

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; }

/* --- TILLBAKA TILL APP-LAYOUT --- */
body { 
    background-color: var(--bg-dark); 
    color: var(--text-main); 
    height: 100vh; /* Fyll skärmen */
    overflow: hidden; /* INGEN scroll på body */
}

/* Login */
.login-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-dark); display: flex; justify-content: center; align-items: center; z-index: 1000;
}
.login-box {
    background: var(--bg-panel); padding: 2rem; border-radius: 8px; 
    width: 90%; /* Bättre för mobil */
    max-width: 350px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.login-box input {
    width: 100%; padding: 10px; margin: 10px 0; background: var(--bg-card); border: 1px solid var(--border-color); color: white;
}
/* --- FIX FÖR LOGIN-KNAPP --- */
.login-box button {
    width: 100%;
    background-color: var(--accent-blue);
    color: white;
    font-weight: bold;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}
.login-box button:hover {
    background-color: #2563eb;
}

/* NY LOGO-STIL */
.login-logo {
    display: block;
    max-height: 80px; /* Max höjd för logotypen */
    width: auto;      /* Behåll bildförhållandet */
    max-width: 100%;  /* Se till att den inte svämmar över rutan */
    margin: 0 auto 20px auto; /* Centrera, med 20px marginal under */
    object-fit: contain; /* Förhindra att bilden sträcks */
}


/* Layout */
#app-container { 
    display: flex; 
    flex-direction: column; 
    height: 100vh; /* Fyll skärmen */
}
.hidden { display: none !important; }

/* ---- NY HEADER-LAYOUT ---- */
/* ---- NY HEADER-LAYOUT ---- */
.top-bar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    padding: 10px;
    display: flex;
    flex-direction: row;          /* Logo vänster, knappar höger */
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}

.logo { 
    font-size: 1.2rem; 
    font-weight: bold;
    text-align: left;
}

/* LOGO I HEADER */
.header-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* Rad med "Inloggad som" + knappar */
.top-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;            /* tryck knapparna till höger */
}

.top-actions span {
    margin-right: 8px;
}

.top-actions button { 
    margin-left: 0;
}

/* NYTT: Stil för aktiv knapp */
.top-actions button.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}
/* ---- SLUT PÅ NY HEADER ---- */




/* --- TILLBAKA TILL APP-LAYOUT --- */
.main-layout { 
    display: flex; 
    flex: 1; /* Fyll återstående höjd */
    overflow: hidden; /* Inget scroll här */
    min-height: 0; /* Viktig flexbox-fix */
}

/* Sidebars */
.sidebar-left { 
    width: 450px; /* Ny, bredare startbredd */
    min-width: 200px; /* Minsta bredd */
    max-width: 600px; /* Största bredd */
    flex-shrink: 0; 
    background: var(--bg-panel); 
    border-right: 1px solid var(--border-color); 
    display: flex; 
    flex-direction: column; 
    padding: 10px; 
    overflow: hidden; /* Inget scroll här */
}
.sidebar-right { 
    width: 300px; 
    /* NYTT: Gränser för storlek */
    min-width: 200px;
    max-width: 600px;
    
    flex-shrink: 0;
    background: var(--bg-panel); 
    border-left: 1px solid var(--border-color); 
    padding: 15px; 
    display: flex; 
    flex-direction: column;
    overflow-y: auto; 
}

/* --- STIL FÖR RESIZER --- */
.resizer {
    width: 5px;
    background: var(--border-color);
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    transition: background 0.2s ease;
    /* Borttagen: position: sticky */
}
.resizer:hover {
    background: var(--accent-blue);
}

.year-selector select { width: 100%; padding: 8px; margin-top: 5px; background: var(--bg-card); color: white; border: none; }
.station-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.filter-group {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    margin-bottom: 5px;
}
.filter-btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.8rem;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}
.filter-btn.active {
    background: var(--accent-blue);
    color: var(--text-main);
    border-color: var(--accent-blue);
}
.filter-btn:hover:not(.active) {
    background: #3a404d;
}

/* --- **** NY SÖKRUTA STIL **** --- */
.search-box {
    margin-top: 10px;
    margin-bottom: 5px;
}
.search-box input {
    width: 100%;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 4px;
    font-size: 0.9rem;
}
/* --- **** SLUT SÖKRUTA STIL **** --- */


/* --- **** TILLBAKA TILL INTERN SCROLL **** --- */
.station-list { 
    flex: 1; /* Fyller utrymmet i vänstra menyn */
    overflow-y: auto; /* INTERN SCROLLBAR */
    margin-top: 10px; 
    min-height: 0; /* Viktig flexbox-fix */
} 
/* --- **** SLUT PÅ FIX **** --- */

/* --- NYTT: STILAR FÖR STATIONS-LISTAN --- */
.station-item {
    padding: 10px; 
    cursor: pointer; 
    border-radius: 4px; 
    display: flex; 
    align-items: center;
    justify-content: space-between; /* Flytta bockar till höger */
}
.station-item-name {
    display: flex;
    align-items: center;
    gap: 10px; /* Mellanrum mellan prick och namn */
    /* Förhindra att långa namn pajar layouten */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.station-item-checks {
    display: flex;
    gap: 5px;
    flex-shrink: 0; /* Hindra från att krympa */
    margin-left: 5px; /* Avstånd från namn */
}
.check-icon, .check-icon-empty {
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 18px; /* Säkerställ centrering */
}
.check-icon.servad {
    background-color: var(--accent-blue);
    color: white;
}
.check-icon.tvattad {
    background-color: var(--color-amber);
    color: white;
}
.check-icon-empty {
    color: #555;
    border: 1px solid #444;
}
/* --- SLUT PÅ NYA STILAR --- */


.station-item:hover { background: var(--bg-card); }
.station-item.active { background: var(--accent-blue); }
.dot { height: 8px; width: 8px; border-radius: 50%; flex-shrink: 0; } /* Lagt till flex-shrink */
.dot.vatten { background: #0ea5e9; }
.dot.avlopp { background: var(--accent-red); }

/* Content Area */
.content-area { 
    flex: 1; 
    position: relative; 
    background: var(--bg-dark); 
    overflow-y: auto; /* INNEHÅLLET SKROLLAR HÄR */
    min-width: 0;
}
.view-section { 
    padding: 20px; 
    height: 100%;
}
#empty-state {
    text-align: center;
    padding-top: 100px;
    color: var(--text-muted);
}
#empty-state .icon-placeholder {
    font-size: 3rem;
    margin-bottom: 1rem;
}

#station-details .details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}


/* Map */
/* ---- NY KART-LAYOUT (Flexbox-baserad) ---- */
#map-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}
#map { 
    width: 100%; 
    border-radius: 8px; 
    flex-grow: 1; /* Ta upp återstående plats */
    /* Borttagen: height: 75vh; */
}
.map-controls { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding-top: 10px;
    flex-shrink: 0;
    height: auto;
    padding-bottom: 10px;
}
/* ---- SLUT PÅ NY KART-LAYOUT ---- */
#map-status-text { color: var(--text-muted); }

/* Dashboard Details */
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card { background: var(--bg-panel); padding: 15px; border-radius: 8px; }
.history-card { grid-column: 1 / -1; } 

/* ---- NY LAYOUT FÖR MINI-KARTA (Flex) ---- */
.card-permanent-info {
    display: flex;
    flex-direction: column;
}
.form-group-map-preview {
    flex-grow: 1; /* Ta upp återstående plats */
    display: flex;
    flex-direction: column;
    min-height: 200px; /* Minsta höjd */
}
.map-preview-container {
    flex-grow: 1; /* Ta upp plats i form-group */
    width: 100%; 
    background: var(--bg-card); 
    border-radius: 4px; 
    margin-bottom: 10px; 
    border: 1px solid var(--border-color);
}
.map-preview-container.clickable {
    cursor: pointer;
}
/* ---- SLUT PÅ NY LAYOUT ---- */


.form-group { margin-bottom: 10px; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted) !important; 
    margin-bottom: 4px;
}
input[type="text"], textarea, select {
    width: 100%; 
    padding: 8px; 
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    color: white; 
    border-radius: 4px;
}
input[type="date"] {
    width: 100%;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 4px;
}

textarea {
    min-height: 80px;
}

.checkbox-group {
    display: flex;
    flex-direction: column; 
    gap: 10px; 
    margin-top: 10px;
}
.checkbox-group label {
    display: flex; 
    align-items: center; 
    gap: 8px;
    color: var(--text-main); 
    font-size: 0.9rem;
}

/* Custom checkbox style */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 1.15em;
    height: 1.15em;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}
input[type="checkbox"]:checked {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}
input[type="checkbox"]:checked::before {
    content: '✔';
    position: absolute;
    color: white;
    font-size: 0.9em;
    top: -2px; 
    left: 2px;  
}

/* Photos */
.photo-grid { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.photo-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; cursor: pointer; position: relative; }
.photo-container { position: relative; display: inline-block; }
.del-photo { 
    position: absolute; 
    top: -5px; 
    right: -5px; 
    background: red; 
    color: white; 
    font-size: 10px; 
    cursor: pointer; 
    padding: 0px 4px;
    border-radius: 50%;
    border: 1px solid white;
}






.reminder-date-input{
    flex-basis: 140px;
}

.reminder-date {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 8px;
}

.reminder-item.due {
    outline: 1px solid rgba(255,255,255,0.12);
}

.due-reminder-modal{
    max-width: 520px;
}
/* Confirm modal */
.confirm-modal {
  max-width: 520px;
  width: calc(100% - 24px);
}

.confirm-message {
  margin-top: 10px;
  line-height: 1.4;
  color: var(--text-color, #eaeaea);
  opacity: 0.95;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: var(--text-color, #fff);
  font-size: 24px;
  cursor: pointer;
  opacity: 0.8;
}
.modal-close:hover { opacity: 1; }

/* Om du vill ha "danger" knapp-stil om du inte redan har */
.btn-danger {
  background: #b63b3b;
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
}
.btn-danger:hover {
  filter: brightness(1.05);
}

/* Backdrop-klick (om du vill att klick utanför stänger) */
#confirm-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
}
#confirm-modal.hidden { display: none; }

#confirm-modal .modal-content {
  position: relative;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
}

.due-reminder-list .due-item{
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.due-reminder-list .due-item .meta{
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.due-reminder-list .due-actions{
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}









/* History & Reminders */
#history-list, #reminder-list { list-style: none; margin-top: 10px; }
.history-item, .reminder-item {
    background: var(--bg-card); padding: 10px; margin-bottom: 5px; border-radius: 4px; font-size: 0.9rem;
}
.history-meta { font-size: 0.75rem; color: var(--text-muted); display: block; margin-bottom: 3px; }
.reminder-input .row {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}
.reminder-input select {
    flex-basis: 100px;
}
.reminder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.reminder-item.priority-Hög { border-left: 3px solid var(--accent-red); }
.reminder-item.priority-Normal { border-left: 3px solid var(--accent-blue); }
.reminder-item.priority-Låg { border-left: 3px solid #6b7280; }


.reminder-personal {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.reminder-item.personal {
    border-left-style: dashed; /* bara för att se skillnad på “Endast du” */
}

.reminder-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-right: 8px;
}



/* Buttons */
button { cursor: pointer; padding: 8px 12px; border: none; border-radius: 4px; font-weight: bold; color: white; }
.btn-primary { background: var(--accent-blue); }
.btn-secondary { background: var(--bg-card); color: white; border: 1px solid var(--border-color); }
.btn-danger { background: var(--accent-red); }
.btn-danger-text { background: transparent; color: var(--accent-red); padding: 0; }
.btn-icon { background: var(--accent-blue); width: 24px; height: 24px; padding: 0; display: flex; justify-content: center; align-items: center;}
.btn-small {
    padding: 4px 8px;
    font-size: 0.8rem;
}
.mt-auto { margin-top: auto; }

/* Modal */
.modal { position: fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.7); display:flex; align-items:center; justify-content:center; z-index:2000;}
.modal-content { 
    background: var(--bg-panel); 
    padding: 20px; 
    width: 90%; /* Bättre för mobil */
    max-width: 400px; /* Bredare för användarlistan */
    border-radius: 8px; 
    position: relative;
}
.close { position:absolute; top:10px; right:15px; cursor:pointer; font-size:20px;}
.modal-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 15px 0;
}
.modal-content input {
    margin-bottom: 10px;
}
.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:14px;
}

.confirm-modal{
  max-width: 520px;
}

.station-modal{
  max-width: 520px;
}

/* --- NY STIL FÖR ANVÄNDARLISTA --- */
.user-item-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}
.user-item-setting:last-child {
    border-bottom: none;
}
.user-item-name {
    font-weight: 500;
}
.user-item-actions button {
    margin-left: 5px;
}
/* --- SLUT NY STIL --- */


/* --- Fixar för Leaflet Popup (Karta) --- */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    color: #333 !important; 
    font-size: 14px;
}
.leaflet-popup-content h3, 
.leaflet-popup-content b {
    color: #000 !important; 
    font-size: 1.1em;
}
.leaflet-popup-content div, .leaflet-popup-content {
    color: #555 !important; 
}
.leaflet-popup-content button {
    margin-top: 8px;
    width: 100%;
    color: white !important; 
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
}
.leaflet-popup-content select {
    width: 100%;
    margin-top: 5px;
    color: #333; 
    background: #f4f4f4;
    border: 1px solid #ccc;
}
.btn-popup-open {
    background-color: #3b82f6 !important; 
}
.btn-popup-open:hover {
    background-color: #2563eb !important;
}
.btn-popup-delete {
    background-color: #ef4444 !important;
}
.btn-popup-delete:hover {
    background-color: #dc2626 !important;
}

/* --- NY STIL FÖR KART-BYTARE (MÖRKT LÄGE) --- */
.leaflet-control-layers {
    background: var(--bg-panel) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
}
.leaflet-control-layers-base label {
    color: var(--text-main) !important;
    display: flex;
    align-items: center;
}
.leaflet-control-layers-separator {
    border-top: 1px solid var(--border-color) !important;
}

.photo-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.photo-modal-hidden {
    display: none;
}

.photo-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
}

.photo-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: #111;
    padding: 12px 16px 16px;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.photo-modal-img {
    max-width: 80vw;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 4px;
    background: #000;
}

.photo-modal-close {
    position: absolute;
    top: 6px;
    right: 8px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
}

.photo-modal-close:hover {
    color: #ff6666;
}

.photo-modal-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 14px;
}

.photo-modal-nav-btn {
    border: none;
    background: #333;
    color: #fff;
    font-size: 22px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.photo-modal-nav-btn:hover {
    background: #555;
}

.photo-modal-counter {
    min-width: 80px;
    text-align: center;
    opacity: 0.9;
}

/* Extra anpassning för riktigt små skärmar */
@media (max-width: 600px) {
    .photo-modal-content {
        max-width: 95vw;
        max-height: 90vh;
        padding: 10px 12px 12px;
    }

    .photo-modal-img {
        max-width: 90vw;
        max-height: 65vh;
    }
}

.reminder-personal {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.reminder-item.personal {
    border-left-style: dashed;          /* bara för att se skillnad */
}

.reminder-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-right: 8px;
}

/* ================================================================
--- MOBILANPASSNING (MEDIA QUERIES) ---
================================================================
*/
@media (max-width: 800px) {
    /* --- TILLBAKA TILL "WEBSITE" SCROLL --- */
    body {
        height: auto;
        overflow-y: auto;
    }
    #app-container {
        height: auto;
        min-height: 100vh;
    }
    .main-layout {
        flex-direction: column;
        min-height: 0; 
        overflow: visible;
    }

    /* Göm resizer */
    #resizer {
        display: none;
    }

    /* Gör sidomenyerna 100% breda */
    .sidebar-left {
        width: 100% !important; 
        max-width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        /* Ta bort sticky-layout */
        position: static;
        height: auto;
    }
    .sidebar-right {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
        /* Ta bort sticky-layout */
        position: static;
        height: auto;
    }

    /* Ge stationslistan en fast höjd på mobil */
    .station-list {
        flex: none; /* Ta bort flex för desktop */
        height: 400px; /* Fast höjd */
    }

    /* Mobil: normal-läge */
    #map-view:not(.map-fullscreen) #map {
        height: 400px;
        flex-grow: 0;
    }
    
    /* Mobil: fullscreen-läge */
    #map-view.map-fullscreen {
        height: 100vh;
        height: 100dvh;
    }
    
    #map-view.map-fullscreen #map {
        height: 100% !important;
        flex-grow: 1 !important;
    }
    .map-fullscreen #map {
        height: 100% !important;
    }

    .content-area {
        overflow: visible; /* Låt body sköta scroll */
    }

       /* Stapla toppmenyn */
        .top-bar {
        height: auto;
        padding: 10px;
        position: static;
        flex-direction: column;    /* på mobil: logga överst */
        align-items: flex-start;
    }


    .logo {
        display: none;           /* om du vill gömma texttiteln på mobil */
    }

    .top-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }

    .top-actions span {
        width: auto;
        text-align: left;
    }



    /* Stapla korten i service-vyn */
    .details-grid {
        grid-template-columns: 1fr;
    }

    /* Gör modalen bredare på mobil */
    .modal-content {
        max-width: 90%;
    }
}

/* Fullscreen-knapp på kartan */
.fullscreen-btn {
    position: absolute;
    top: 10px;               /* avstånd från toppen */
    left: 50%;               /* mitt på bredden */
    transform: translateX(-50%); /* flytta tillbaka halva bredden = centrerad */
    z-index: 9999;
    background: #111;
    color: white;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.85;
}
.fullscreen-btn:hover {
    opacity: 1;
}

.fullscreen-btn:hover {
    opacity: 1;
}

/* Klass som gör kartvyn fullscreen */
.map-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9998 !important;
    background: #000;
}
.extra-fields-container{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:10px;
}

.extra-field-row{
  display:grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap:10px;
  align-items:center;
}

.extra-field-row input{
  margin:0;
}

.extra-field-remove{
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: #ff6b6b;
  border-radius: 10px;
  padding: 8px 10px;
  cursor:pointer;
}
/* Popup-form för ritade objekt */
.draw-popup label{
  display:block;
  font-size: 12px;
  opacity: .85;
  margin-top: 8px;
}

.draw-popup input,
.draw-popup select{
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.18);
  outline: none;
}

.draw-popup .row{
  display:flex;
  gap:8px;
  margin-top:10px;
}

.draw-popup .row button{
  flex:1;
}
.leaflet-tooltip.pump-f-label{
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #000 !important;
  font-weight: 900;
  font-size: 14px;        /* gör F större/mindre */
  padding: 0 !important;
  margin: 0 !important;
}

.leaflet-tooltip.pump-f-label:before{
  display: none !important; /* tar bort “pilen” */
}
.pump-f-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #000 !important;
  font-weight: 900;
  line-height: 1;
  padding: 0 !important;
  margin: 0 !important;
  text-align: center;
}
.pump-f-label::before {
  display: none !important;
}
/* NYTT: GPS-knapp */
.gps-btn{
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 9999;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  font-weight: 800;
  cursor: pointer;
  opacity: 0.9;
}
.gps-btn:hover{ opacity: 1; }
.gps-btn.active{
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

/* VIKTIGT: Fullscreen ska alltid ge kartan full höjd (även på mobil där du annars har #map { height: 400px }) */
.map-fullscreen #map{
  height: 100vh !important;
  flex-grow: 1 !important;
}

/* Förhindra att sidan scrollar när fullscreen är aktiv */
body.no-scroll{
  height: 100vh !important;
  overflow: hidden !important;
}
/* GPS-ikon: "arbetare" */
.gps-worker-icon{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #111;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  user-select: none;
}

.gps-worker-icon span{
  font-size: 18px;  /* ändra storlek på figuren */
  line-height: 1;
}
/* GPS-knapp som overlay i fullscreen */
#map-view.map-fullscreen #btn-gps {
  position: fixed !important;
  right: 12px !important;
  bottom: 12px !important;
  z-index: 10050 !important; /* över Leaflet-kontroller */
}

/* iPhone safe-area (så den inte hamnar bakom “home bar”) */
@supports (padding: max(0px)) {
  #map-view.map-fullscreen #btn-gps {
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
  }
}
:root {
    --bg-dark: #15171e;
    --bg-panel: #1e2129;
    --bg-card: #2b303b;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --accent-blue: #3b82f6;
    --accent-red: #ef4444;
    --accent-brown: #78350f;
    --border-color: #374151;
    --color-amber: #f59e0b;

    /* NYTT: samma röd överallt i dejourn */
    --dejour-red: rgba(220, 38, 38, 0.92);      /* starkare röd (header) */
    --dejour-red-col: rgba(220, 38, 38, 0.28);  /* tydligare röd (tomma rutor i kolumn) */
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; }

/* --- TILLBAKA TILL APP-LAYOUT --- */
body { 
    background-color: var(--bg-dark); 
    color: var(--text-main); 
    height: 100vh; /* Fyll skärmen */
    overflow: hidden; /* INGEN scroll på body */
}

/* Login */
.login-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-dark); display: flex; justify-content: center; align-items: center; z-index: 1000;
}
.login-box {
    background: var(--bg-panel); padding: 2rem; border-radius: 8px; 
    width: 90%; /* Bättre för mobil */
    max-width: 350px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.login-box input {
    width: 100%; padding: 10px; margin: 10px 0; background: var(--bg-card); border: 1px solid var(--border-color); color: white;
}
/* --- FIX FÖR LOGIN-KNAPP --- */
.login-box button {
    width: 100%;
    background-color: var(--accent-blue);
    color: white;
    font-weight: bold;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}
.login-box button:hover {
    background-color: #2563eb;
}

/* NY LOGO-STIL */
.login-logo {
    display: block;
    max-height: 80px; /* Max höjd för logotypen */
    width: auto;      /* Behåll bildförhållandet */
    max-width: 100%;  /* Se till att den inte svämmar över rutan */
    margin: 0 auto 20px auto; /* Centrera, med 20px marginal under */
    object-fit: contain; /* Förhindra att bilden sträcks */
}


/* Layout */
#app-container { 
    display: flex; 
    flex-direction: column; 
    height: 100vh; /* Fyll skärmen */
}
.hidden { display: none !important; }

/* ---- NY HEADER-LAYOUT ---- */
/* ---- NY HEADER-LAYOUT ---- */
.top-bar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    padding: 10px;
    display: flex;
    flex-direction: row;          /* Logo vänster, knappar höger */
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}

.logo { 
    font-size: 1.2rem; 
    font-weight: bold;
    text-align: left;
}

/* LOGO I HEADER */
.header-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* Rad med "Inloggad som" + knappar */
.top-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;            /* tryck knapparna till höger */
}

.top-actions span {
    margin-right: 8px;
}

.top-actions button { 
    margin-left: 0;
}

/* NYTT: Stil för aktiv knapp */
.top-actions button.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}
/* ---- SLUT PÅ NY HEADER ---- */




/* --- TILLBAKA TILL APP-LAYOUT --- */
.main-layout { 
    display: flex; 
    flex: 1; /* Fyll återstående höjd */
    overflow: hidden; /* Inget scroll här */
    min-height: 0; /* Viktig flexbox-fix */
}

/* Sidebars */
.sidebar-left { 
    width: 450px; /* Ny, bredare startbredd */
    min-width: 200px; /* Minsta bredd */
    max-width: 600px; /* Största bredd */
    flex-shrink: 0; 
    background: var(--bg-panel); 
    border-right: 1px solid var(--border-color); 
    display: flex; 
    flex-direction: column; 
    padding: 10px; 
    overflow: hidden; /* Inget scroll här */
}
.sidebar-right { 
    width: 300px; 
    flex-shrink: 0;
    background: var(--bg-panel); 
    border-left: 1px solid var(--border-color); 
    padding: 15px; 
    display: flex; 
    flex-direction: column;
    overflow-y: auto; /* PÅMINNELSER SKROLLAR HÄR */
}

/* --- STIL FÖR RESIZER --- */
.resizer {
    width: 5px;
    background: var(--border-color);
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    transition: background 0.2s ease;
    /* Borttagen: position: sticky */
}
.resizer:hover {
    background: var(--accent-blue);
}

.year-selector select { width: 100%; padding: 8px; margin-top: 5px; background: var(--bg-card); color: white; border: none; }
.station-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.filter-group {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    margin-bottom: 5px;
}
.filter-btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.8rem;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}
.filter-btn.active {
    background: var(--accent-blue);
    color: var(--text-main);
    border-color: var(--accent-blue);
}
.filter-btn:hover:not(.active) {
    background: #3a404d;
}

/* --- **** NY SÖKRUTA STIL **** --- */
.search-box {
    margin-top: 10px;
    margin-bottom: 5px;
}
.search-box input {
    width: 100%;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 4px;
    font-size: 0.9rem;
}
/* --- **** SLUT SÖKRUTA STIL **** --- */


/* --- **** TILLBAKA TILL INTERN SCROLL **** --- */
.station-list { 
    flex: 1; /* Fyller utrymmet i vänstra menyn */
    overflow-y: auto; /* INTERN SCROLLBAR */
    margin-top: 10px; 
    min-height: 0; /* Viktig flexbox-fix */
} 
/* --- **** SLUT PÅ FIX **** --- */

/* --- NYTT: STILAR FÖR STATIONS-LISTAN --- */
.station-item {
    padding: 10px; 
    cursor: pointer; 
    border-radius: 4px; 
    display: flex; 
    align-items: center;
    justify-content: space-between; /* Flytta bockar till höger */
}
.station-item-name {
    display: flex;
    align-items: center;
    gap: 10px; /* Mellanrum mellan prick och namn */
    /* Förhindra att långa namn pajar layouten */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.station-item-checks {
    display: flex;
    gap: 5px;
    flex-shrink: 0; /* Hindra från att krympa */
    margin-left: 5px; /* Avstånd från namn */
}
.check-icon, .check-icon-empty {
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 18px; /* Säkerställ centrering */
}
.check-icon.servad {
    background-color: var(--accent-blue);
    color: white;
}
.check-icon.tvattad {
    background-color: var(--color-amber);
    color: white;
}
.check-icon-empty {
    color: #555;
    border: 1px solid #444;
}
/* --- SLUT PÅ NYA STILAR --- */


.station-item:hover { background: var(--bg-card); }
.station-item.active { background: var(--accent-blue); }
.dot { height: 8px; width: 8px; border-radius: 50%; flex-shrink: 0; } /* Lagt till flex-shrink */
.dot.vatten { background: #0ea5e9; }
.dot.avlopp { background: var(--accent-red); }

/* Content Area */
.content-area { 
    flex: 1; 
    position: relative; 
    background: var(--bg-dark); 
    overflow-y: auto; /* INNEHÅLLET SKROLLAR HÄR */
    min-width: 0;
}
.view-section { 
    padding: 20px; 
    height: 100%;
}
#empty-state {
    text-align: center;
    padding-top: 100px;
    color: var(--text-muted);
}
#empty-state .icon-placeholder {
    font-size: 3rem;
    margin-bottom: 1rem;
}

#station-details .details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}


/* Map */
/* ---- NY KART-LAYOUT (Flexbox-baserad) ---- */
#map-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}
#map { 
    width: 100%; 
    border-radius: 8px; 
    flex-grow: 1; /* Ta upp återstående plats */
    /* Borttagen: height: 75vh; */
}
.map-controls { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding-top: 10px;
    flex-shrink: 0;
    height: auto;
    padding-bottom: 10px;
}
/* ---- SLUT PÅ NY KART-LAYOUT ---- */
#map-status-text { color: var(--text-muted); }

/* Dashboard Details */
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card { background: var(--bg-panel); padding: 15px; border-radius: 8px; }
.history-card { grid-column: 1 / -1; } 

/* ---- NY LAYOUT FÖR MINI-KARTA (Flex) ---- */
.card-permanent-info {
    display: flex;
    flex-direction: column;
}
.form-group-map-preview {
    flex-grow: 1; /* Ta upp återstående plats */
    display: flex;
    flex-direction: column;
    min-height: 200px; /* Minsta höjd */
}
.map-preview-container {
    flex-grow: 1; /* Ta upp plats i form-group */
    width: 100%; 
    background: var(--bg-card); 
    border-radius: 4px; 
    margin-bottom: 10px; 
    border: 1px solid var(--border-color);
}
.map-preview-container.clickable {
    cursor: pointer;
}
/* ---- SLUT PÅ NY LAYOUT ---- */


.form-group { margin-bottom: 10px; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted) !important; 
    margin-bottom: 4px;
}
input[type="text"], textarea, select {
    width: 100%; 
    padding: 8px; 
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    color: white; 
    border-radius: 4px;
}
input[type="date"] {
    width: 100%;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 4px;
}

textarea {
    min-height: 80px;
}

.checkbox-group {
    display: flex;
    flex-direction: column; 
    gap: 10px; 
    margin-top: 10px;
}
.checkbox-group label {
    display: flex; 
    align-items: center; 
    gap: 8px;
    color: var(--text-main); 
    font-size: 0.9rem;
}

/* Custom checkbox style */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 1.15em;
    height: 1.15em;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}
input[type="checkbox"]:checked {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}
input[type="checkbox"]:checked::before {
    content: '✔';
    position: absolute;
    color: white;
    font-size: 0.9em;
    top: -2px; 
    left: 2px;  
}

/* Photos */
.photo-grid { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.photo-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; cursor: pointer; position: relative; }
.photo-container { position: relative; display: inline-block; }
.del-photo { 
    position: absolute; 
    top: -5px; 
    right: -5px; 
    background: red; 
    color: white; 
    font-size: 10px; 
    cursor: pointer; 
    padding: 0px 4px;
    border-radius: 50%;
    border: 1px solid white;
}






.reminder-date-input{
    flex-basis: 140px;
}

.reminder-date {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 8px;
}

.reminder-item.due {
    outline: 1px solid rgba(255,255,255,0.12);
}

.due-reminder-modal{
    max-width: 520px;
}
/* Confirm modal */
.confirm-modal {
  max-width: 520px;
  width: calc(100% - 24px);
}

.confirm-message {
  margin-top: 10px;
  line-height: 1.4;
  color: var(--text-color, #eaeaea);
  opacity: 0.95;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: var(--text-color, #fff);
  font-size: 24px;
  cursor: pointer;
  opacity: 0.8;
}
.modal-close:hover { opacity: 1; }

/* Om du vill ha "danger" knapp-stil om du inte redan har */
.btn-danger {
  background: #b63b3b;
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
}
.btn-danger:hover {
  filter: brightness(1.05);
}

/* Backdrop-klick (om du vill att klick utanför stänger) */
#confirm-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
}
#confirm-modal.hidden { display: none; }

#confirm-modal .modal-content {
  position: relative;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
}

.due-reminder-list .due-item{
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.due-reminder-list .due-item .meta{
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.due-reminder-list .due-actions{
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}









/* History & Reminders */
#history-list, #reminder-list { list-style: none; margin-top: 10px; }
.history-item, .reminder-item {
    background: var(--bg-card); padding: 10px; margin-bottom: 5px; border-radius: 4px; font-size: 0.9rem;
}
.history-meta { font-size: 0.75rem; color: var(--text-muted); display: block; margin-bottom: 3px; }
.reminder-input .row {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}
.reminder-input select {
    flex-basis: 100px;
}
.reminder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.reminder-item.priority-Hög { border-left: 3px solid var(--accent-red); }
.reminder-item.priority-Normal { border-left: 3px solid var(--accent-blue); }
.reminder-item.priority-Låg { border-left: 3px solid #6b7280; }


.reminder-personal {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.reminder-item.personal {
    border-left-style: dashed; /* bara för att se skillnad på “Endast du” */
}

.reminder-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-right: 8px;
}



/* Buttons */
button { cursor: pointer; padding: 8px 12px; border: none; border-radius: 4px; font-weight: bold; color: white; }
.btn-primary { background: var(--accent-blue); }
.btn-secondary { background: var(--bg-card); color: white; border: 1px solid var(--border-color); }
.btn-danger { background: var(--accent-red); }
.btn-danger-text { background: transparent; color: var(--accent-red); padding: 0; }
.btn-icon { background: var(--accent-blue); width: 24px; height: 24px; padding: 0; display: flex; justify-content: center; align-items: center;}
.btn-small {
    padding: 4px 8px;
    font-size: 0.8rem;
}
.mt-auto { margin-top: auto; }

/* Modal */
.modal { position: fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.7); display:flex; align-items:center; justify-content:center; z-index:2000;}
.modal-content { 
    background: var(--bg-panel); 
    padding: 20px; 
    width: 90%; /* Bättre för mobil */
    max-width: 400px; /* Bredare för användarlistan */
    border-radius: 8px; 
    position: relative;
}
.close { position:absolute; top:10px; right:15px; cursor:pointer; font-size:20px;}
.modal-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 15px 0;
}
.modal-content input {
    margin-bottom: 10px;
}
.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:14px;
}

.confirm-modal{
  max-width: 520px;
}

.station-modal{
  max-width: 520px;
}

/* --- NY STIL FÖR ANVÄNDARLISTA --- */
.user-item-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}
.user-item-setting:last-child {
    border-bottom: none;
}
.user-item-name {
    font-weight: 500;
}
.user-item-actions button {
    margin-left: 5px;
}
/* --- SLUT NY STIL --- */


/* --- Fixar för Leaflet Popup (Karta) --- */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    color: #333 !important; 
    font-size: 14px;
}
.leaflet-popup-content h3, 
.leaflet-popup-content b {
    color: #000 !important; 
    font-size: 1.1em;
}
.leaflet-popup-content div, .leaflet-popup-content {
    color: #555 !important; 
}
.leaflet-popup-content button {
    margin-top: 8px;
    width: 100%;
    color: white !important; 
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
}
.leaflet-popup-content select {
    width: 100%;
    margin-top: 5px;
    color: #333; 
    background: #f4f4f4;
    border: 1px solid #ccc;
}
.btn-popup-open {
    background-color: #3b82f6 !important; 
}
.btn-popup-open:hover {
    background-color: #2563eb !important;
}
.btn-popup-delete {
    background-color: #ef4444 !important;
}
.btn-popup-delete:hover {
    background-color: #dc2626 !important;
}

/* --- NY STIL FÖR KART-BYTARE (MÖRKT LÄGE) --- */
.leaflet-control-layers {
    background: var(--bg-panel) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
}
.leaflet-control-layers-base label {
    color: var(--text-main) !important;
    display: flex;
    align-items: center;
}
.leaflet-control-layers-separator {
    border-top: 1px solid var(--border-color) !important;
}

.photo-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.photo-modal-hidden {
    display: none;
}

.photo-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
}

.photo-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: #111;
    padding: 12px 16px 16px;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.photo-modal-img {
    max-width: 80vw;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 4px;
    background: #000;
}

.photo-modal-close {
    position: absolute;
    top: 6px;
    right: 8px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
}

.photo-modal-close:hover {
    color: #ff6666;
}

.photo-modal-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 14px;
}

.photo-modal-nav-btn {
    border: none;
    background: #333;
    color: #fff;
    font-size: 22px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.photo-modal-nav-btn:hover {
    background: #555;
}

.photo-modal-counter {
    min-width: 80px;
    text-align: center;
    opacity: 0.9;
}

/* Extra anpassning för riktigt små skärmar */
@media (max-width: 600px) {
    .photo-modal-content {
        max-width: 95vw;
        max-height: 90vh;
        padding: 10px 12px 12px;
    }

    .photo-modal-img {
        max-width: 90vw;
        max-height: 65vh;
    }
}

.reminder-personal {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.reminder-item.personal {
    border-left-style: dashed;          /* bara för att se skillnad */
}

.reminder-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-right: 8px;
}

/* ================================================================
--- MOBILANPASSNING (MEDIA QUERIES) ---
================================================================
*/
@media (max-width: 800px) {
    /* --- TILLBAKA TILL "WEBSITE" SCROLL --- */
    body {
        height: auto;
        overflow-y: auto;
    }
    #app-container {
        height: auto;
        min-height: 100vh;
    }
    .main-layout {
        flex-direction: column;
        min-height: 0; 
        overflow: visible;
    }

    /* Göm resizer */
    #resizer {
        display: none;
    }

    /* Gör sidomenyerna 100% breda */
    .sidebar-left {
        width: 100% !important; 
        max-width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        /* Ta bort sticky-layout */
        position: static;
        height: auto;
    }
    .sidebar-right {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
        /* Ta bort sticky-layout */
        position: static;
        height: auto;
    }

    /* Ge stationslistan en fast höjd på mobil */
    .station-list {
        flex: none; /* Ta bort flex för desktop */
        height: 400px; /* Fast höjd */
    }

    /* Mobil: normal-läge */
    #map-view:not(.map-fullscreen) #map {
        height: 400px;
        flex-grow: 0;
    }
    
    /* Mobil: fullscreen-läge */
    #map-view.map-fullscreen {
        height: 100vh;
        height: 100dvh;
    }
    
    #map-view.map-fullscreen #map {
        height: 100% !important;
        flex-grow: 1 !important;
    }
    .map-fullscreen #map {
        height: 100% !important;
    }

    .content-area {
        overflow: visible; /* Låt body sköta scroll */
    }

       /* Stapla toppmenyn */
        .top-bar {
        height: auto;
        padding: 10px;
        position: static;
        flex-direction: column;    /* på mobil: logga överst */
        align-items: flex-start;
    }


    .logo {
        display: none;           /* om du vill gömma texttiteln på mobil */
    }

    .top-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }

    .top-actions span {
        width: auto;
        text-align: left;
    }



    /* Stapla korten i service-vyn */
    .details-grid {
        grid-template-columns: 1fr;
    }

    /* Gör modalen bredare på mobil */
    .modal-content {
        max-width: 90%;
    }
}

/* Fullscreen-knapp på kartan */
.fullscreen-btn {
    position: absolute;
    top: 10px;               /* avstånd från toppen */
    left: 50%;               /* mitt på bredden */
    transform: translateX(-50%); /* flytta tillbaka halva bredden = centrerad */
    z-index: 9999;
    background: #111;
    color: white;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.85;
}
.fullscreen-btn:hover {
    opacity: 1;
}

.fullscreen-btn:hover {
    opacity: 1;
}

/* Klass som gör kartvyn fullscreen */
.map-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9998 !important;
    background: #000;
}
.extra-fields-container{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:10px;
}

.extra-field-row{
  display:grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap:10px;
  align-items:center;
}

.extra-field-row input{
  margin:0;
}

.extra-field-remove{
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: #ff6b6b;
  border-radius: 10px;
  padding: 8px 10px;
  cursor:pointer;
}
/* Popup-form för ritade objekt */
.draw-popup label{
  display:block;
  font-size: 12px;
  opacity: .85;
  margin-top: 8px;
}

.draw-popup input,
.draw-popup select{
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.18);
  outline: none;
}

.draw-popup .row{
  display:flex;
  gap:8px;
  margin-top:10px;
}

.draw-popup .row button{
  flex:1;
}
.leaflet-tooltip.pump-f-label{
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #000 !important;
  font-weight: 900;
  font-size: 14px;        /* gör F större/mindre */
  padding: 0 !important;
  margin: 0 !important;
}

.leaflet-tooltip.pump-f-label:before{
  display: none !important; /* tar bort “pilen” */
}
.pump-f-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #000 !important;
  font-weight: 900;
  line-height: 1;
  padding: 0 !important;
  margin: 0 !important;
  text-align: center;
}
.pump-f-label::before {
  display: none !important;
}
/* NYTT: GPS-knapp */
.gps-btn{
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 9999;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  font-weight: 800;
  cursor: pointer;
  opacity: 0.9;
}
.gps-btn:hover{ opacity: 1; }
.gps-btn.active{
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

/* VIKTIGT: Fullscreen ska alltid ge kartan full höjd (även på mobil där du annars har #map { height: 400px }) */
.map-fullscreen #map{
  height: 100vh !important;
  flex-grow: 1 !important;
}

/* Förhindra att sidan scrollar när fullscreen är aktiv */
body.no-scroll{
  height: 100vh !important;
  overflow: hidden !important;
}
/* GPS-ikon: "arbetare" */
.gps-worker-icon{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #111;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  user-select: none;
}

.gps-worker-icon span{
  font-size: 18px;  /* ändra storlek på figuren */
  line-height: 1;
}
/* GPS-knapp som overlay i fullscreen */
#map-view.map-fullscreen #btn-gps {
  position: fixed !important;
  right: 12px !important;
  bottom: 12px !important;
  z-index: 10050 !important; /* över Leaflet-kontroller */
}

/* iPhone safe-area (så den inte hamnar bakom “home bar”) */
@supports (padding: max(0px)) {
  #map-view.map-fullscreen #btn-gps {
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
  }
}
/* Göm GPS-knappen på desktop/laptop */
@media (min-width: 801px) {
  #btn-gps,
  .gps-btn {
    display: none !important;
  }
}
/* FULLSCREEN: tvinga kartvyn att verkligen bli 100% av viewport */
#map-view.map-fullscreen{
  position: fixed !important;
  inset: 0 !important;          /* ersätter top/left/width/height */
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;    /* bättre på mobil */
  padding: 0 !important;        /* tar bort ev. padding från .view-section */
  margin: 0 !important;
  border-radius: 0 !important;
  z-index: 99999 !important;
  background: #000;
}

/* Själva Leaflet-diven ska fylla allt */
#map-view.map-fullscreen #map{
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
}

/* Om du har map-controls under kartan: göm dem i fullscreen (annars stjäl de höjd) */
#map-view.map-fullscreen .map-controls{
  display: none !important;
}

/* Stoppa scroll när fullscreen är aktiv (du har redan no-scroll, men här är den hård) */
body.no-scroll{
  height: 100vh !important;
  overflow: hidden !important;
}
/* Fullscreen: gör lagerpanelen scrollbar och säker ovanpå */
#map-view.map-fullscreen .leaflet-control-layers{
  z-index: 10060 !important;
}

#map-view.map-fullscreen .leaflet-control-layers-expanded{
  max-height: 60vh !important;
  overflow-y: auto !important;
}
/* --- DEJOUR / KALENDER STYLING --- */
.hidden { display: none !important; }

/* Hela vyn */
#dejour-view {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #1a1a1a; /* Mörk bakgrund */
    color: #e5e5e5;
    z-index: 2000; /* Ovanpå kartan */
    display: flex; flex-direction: column;
}

/* Verktygsfältet */
.dejour-toolbar {
    height: 55px;
    background-color: #262626;
    border-bottom: 1px solid #404040;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 15px;
}

/* Snygga Knappar (Grå/Svarta, inte konstiga färger) */
.dj-btn {
    background-color: #333; color: #fff;
    border: 1px solid #555;
    padding: 6px 12px;
    border-radius: 4px; cursor: pointer;
    font-size: 14px; font-weight: 500;
    transition: background 0.2s;
}
.dj-btn:hover { background-color: #444; }

/* Stäng-knappen (Rödaktig men diskret) */
.dj-btn-close { background-color: #7f1d1d; border-color: #991b1b; }
.dj-btn-close:hover { background-color: #991b1b; }

/* Layouten (Sidebar + Kalender) */
.dejour-container {
    flex: 1; display: flex; overflow: hidden; position: relative;
}

/* Vänster spalt: Namn */
.dejour-sidebar {
    width: 200px; flex-shrink: 0;
    background-color: #262626;
    border-right: 1px solid #404040;
    margin-top: 50px; /* Plats för datum-headern */
    overflow: hidden; /* Scrollas via JS */
}
.emp-name {
    height: 40px; line-height: 40px;
    padding-left: 15px; border-bottom: 1px solid #333;
    font-size: 14px; white-space: nowrap; overflow: hidden;
}

/* Höger del: Tidslinje */
.dejour-timeline {
    flex: 1; overflow: auto; position: relative;
    background-color: #1a1a1a;
}

/* Datum Header */
.dejour-header {
    height: 50px; display: flex; position: sticky; top: 0; left: 0;
    background-color: #262626; z-index: 10;
    border-bottom: 1px solid #404040;
    width: max-content;
}
.d-cell {
    height: 100%; border-right: 1px solid #333;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    font-size: 12px; color: #aaa; box-sizing: border-box;
}
.d-cell.weekend { background: rgba(255, 255, 255, 0.03); color: #f87171; }
.d-cell.today { background: #2563eb; color: #fff; }

/* Grid (Rutorna) */
.dejour-grid { width: max-content; }
.d-row { height: 40px; display: flex; border-bottom: 1px solid #333; }
.g-cell {
    height: 100%; border-right: 1px solid #333;
    cursor: pointer;
}
.g-cell:hover { background: rgba(255,255,255,0.1); }
.g-cell.weekend { background: rgba(255,255,255,0.02); }

/* Färger för markerad dag */
.g-cell.active { background-color: #10b981 !important; } /* GRÖN */
.g-cell.drag-add { background-color: #34d399; }
.g-cell.drag-remove { background-color: #ef4444; }

/* --- TVINGANDE CSS FÖR ATT DET SKA SYNAS --- */
#dejour-view {
    position: fixed; /* Tvingar den att ligga överst */
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #1a1a1a;
    z-index: 99999;
    display: flex; flex-direction: column;
    color: #fff;
}
.hidden { display: none !important; }

/* Toolbar */
.dejour-toolbar {
    height: 60px; background: #2d2d2d; border-bottom: 1px solid #555;
    display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
}
.dj-btn { padding: 10px 20px; background: #444; color: white; border: 1px solid #666; cursor: pointer; font-weight: bold; }
.dj-btn:hover { background: #666; }
.dj-close { background: #a00; border-color: #c00; }

/* Huvudcontainer */
.dejour-container {
    flex: 1; display: flex; overflow: hidden; /* Viktigt för scroll */
}

/* VÄNSTER SPALT (NAMN) */
.dejour-sidebar {
    width: 200px; flex-shrink: 0;
    background: #222; border-right: 2px solid #555;
    margin-top: 50px; /* Plats för datum-raden */
    overflow: hidden; 
}
.emp-name {
    height: 40px; line-height: 40px;
    border-bottom: 1px solid #444;
    padding-left: 15px; font-size: 14px; white-space: nowrap;
    background: #2a2a2a; color: #ddd;
}

/* HÖGER SPALT (RUTNÄT) */
.dejour-timeline {
    flex: 1; overflow: auto; position: relative; background: #111;
}
.dejour-header {
    height: 50px; display: flex; position: sticky; top: 0; left: 0; z-index: 10;
    background: #333; border-bottom: 1px solid #555; width: max-content;
}
.date-cell {
    width: 40px; height: 50px; border-right: 1px solid #444;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 11px; color: #aaa;
}
.date-cell.weekend { background: rgba(255,100,100,0.1); color: #ff8888; }

/* RUTORNA */
.dejour-grid { width: max-content; }
.d-row { height: 40px; display: flex; border-bottom: 1px solid #333; }
.g-cell {
    width: 40px; height: 100%; border-right: 1px solid #333;
    cursor: pointer;
}
.g-cell:hover { background: #333; }
.g-cell.weekend { background: rgba(255,255,255,0.03); }

/* FÄRGER */
.g-cell.active { background-color: #00cc66 !important; } /* GRÖN */
.g-cell.drag-add { background-color: #66ff99; }
.g-cell.drag-remove { background-color: #ff6666; }

/* Lägg till detta sist i style.css */

/* När man INTE redigerar: Ingen pekare, gråare rutor */
.dejour-container:not(.editing) .g-cell {
    cursor: default !important;
}
.dejour-container:not(.editing) .g-cell:hover {
    background-color: transparent !important; /* Ingen hover-effekt när låst */
}

/* När man REDIGERAR: Tydlig ram runt hela kalendern så man ser att det är skarpt läge */
.dejour-container.editing {
    outline: 2px solid #d97706;
}
/* Markerar dagens kolumn med svaga linjer alltid */
/* =========================================================
   DEJOUR – DAGENS DATUM / DAGENS KOLUMN
   ========================================================= */

/* Viktigt: låt glow synas utanför själva datumrutan */
.dejour-header,
#dj-header {
    overflow: visible !important;
}

.date-cell,
.d-cell {
    position: relative;
    overflow: visible !important;
}

/* Själva dagens datum i headern */
#dj-today,
.date-cell.today,
.d-cell.today {
    position: relative;
    z-index: 60;
    background: #facc15 !important;
    color: #111827 !important;
    font-weight: 900;
    border: 2px solid #fff7ae !important;
    border-radius: 8px;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.45),
        0 0 8px rgba(250, 204, 21, 0.95),
        0 0 18px rgba(250, 204, 21, 0.65);
    animation: todayPulse 1.8s ease-in-out infinite;
}

/* Extra glow-ring runt dagens datum */
#dj-today::before,
.date-cell.today::before,
.d-cell.today::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 10px;
    pointer-events: none;
    box-shadow:
        0 0 0 2px rgba(250, 204, 21, 0.85),
        0 0 14px rgba(250, 204, 21, 0.65),
        0 0 28px rgba(250, 204, 21, 0.35);
    animation: todayRingPulse 1.8s ease-in-out infinite;
}

/* Hela dagens kolumn i schemat */
.today-col {
    position: relative;
    background: rgba(250, 204, 21, 0.16) !important;
    border-left: 2px solid rgba(250, 204, 21, 0.55) !important;
    border-right: 2px solid rgba(250, 204, 21, 0.55) !important;
    box-shadow:
        inset 0 0 10px rgba(250, 204, 21, 0.10),
        inset 0 0 20px rgba(250, 204, 21, 0.06);
}

.today-col::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow:
        inset 0 0 12px rgba(250, 204, 21, 0.14),
        inset 0 0 24px rgba(250, 204, 21, 0.08);
}

/* Om idag också råkar vara helg/röd dag ska dagens markering ändå vinna */
.date-cell.today.weekend,
.date-cell.today.holiday,
.d-cell.today.weekend,
.d-cell.today.holiday {
    background: #facc15 !important;
    color: #111827 !important;
}

/* Extra klass som läggs på när man scrollar till idag */
.glow-effect,
.flash-effect {
    animation: todayFlash 1.2s ease-out 1;
}

/* Animationer */
@keyframes todayPulse {
    0% {
        transform: scale(1);
        box-shadow:
            inset 0 0 0 1px rgba(255,255,255,0.35),
            0 0 8px rgba(250, 204, 21, 0.80),
            0 0 18px rgba(250, 204, 21, 0.45);
    }
    50% {
        transform: scale(1.04);
        box-shadow:
            inset 0 0 0 1px rgba(255,255,255,0.55),
            0 0 14px rgba(250, 204, 21, 1),
            0 0 28px rgba(250, 204, 21, 0.75);
    }
    100% {
        transform: scale(1);
        box-shadow:
            inset 0 0 0 1px rgba(255,255,255,0.35),
            0 0 8px rgba(250, 204, 21, 0.80),
            0 0 18px rgba(250, 204, 21, 0.45);
    }
}

@keyframes todayRingPulse {
    0% {
        opacity: 0.75;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.06);
    }
    100% {
        opacity: 0.75;
        transform: scale(1);
    }
}

@keyframes todayFlash {
    0% {
        box-shadow:
            0 0 0 rgba(250, 204, 21, 0),
            0 0 0 rgba(250, 204, 21, 0);
    }
    35% {
        box-shadow:
            0 0 16px rgba(250, 204, 21, 1),
            0 0 34px rgba(250, 204, 21, 0.85);
    }
    100% {
        box-shadow:
            0 0 8px rgba(250, 204, 21, 0.85),
            0 0 18px rgba(250, 204, 21, 0.55);
    }
}

/* Mobil – starkare markering så den verkligen syns */
@media (max-width: 800px) {
    #dj-today,
    .date-cell.today,
    .d-cell.today {
        border: 2px solid #fff7ae !important;
        box-shadow:
            inset 0 0 0 1px rgba(255,255,255,0.55),
            0 0 12px rgba(250, 204, 21, 1),
            0 0 24px rgba(250, 204, 21, 0.85);
    }

    #dj-today::before,
    .date-cell.today::before,
    .d-cell.today::before {
        inset: -5px;
        box-shadow:
            0 0 0 2px rgba(250, 204, 21, 1),
            0 0 18px rgba(250, 204, 21, 0.75),
            0 0 30px rgba(250, 204, 21, 0.45);
    }

    .today-col {
        background: rgba(250, 204, 21, 0.22) !important;
        border-left: 2px solid rgba(250, 204, 21, 0.75) !important;
        border-right: 2px solid rgba(250, 204, 21, 0.75) !important;
    }
}
/* --- Snygga Gradients för perioder (Både start och slut fade) --- */

/* Basen för en aktiv ruta (mitten) - Helt grön */
.g-cell.active {
    background: #10b981; 
}

/* Viktigt: så padding inte ändrar kolumnbredd */
.g-cell { box-sizing: border-box; }

/* STARTEN: Fade IN (Genomskinlig -> Grön) */
.g-cell.p-start {
    background: linear-gradient(to right, rgba(16, 185, 129, 0.2) 0%, #10b981 100%) !important;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;

    /* INGEN margin (det var den som flyttade stapeln) */
    margin-left: 0 !important;

    /* “Glipa” inuti cellen istället */
    padding-left: 2px;
    background-clip: content-box;
}

/* MITTEN: Helt grön */
.g-cell.p-mid {
    background: #10b981 !important;
    border-radius: 0 !important;

    /* Ingen padding/margin i mitten */
    margin: 0 !important;
    padding: 0 !important;
    background-clip: border-box;
}

/* SLUTET: Fade UT (Grön -> Genomskinlig) */
.g-cell.p-end {
    background: linear-gradient(to right, #10b981 0%, rgba(16, 185, 129, 0.2) 100%) !important;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;

    /* INGEN margin */
    margin-right: 0 !important;

    /* “Glipa” inuti cellen istället */
    padding-right: 2px;
    background-clip: content-box;
}

/* SPECIAL: Om det bara är EN dag (både start och slut) */
.g-cell.p-start.p-end {
    background: linear-gradient(to right, rgba(16, 185, 129, 0.2) 0%, #10b981 50%, rgba(16, 185, 129, 0.2) 100%) !important;
    border-radius: 6px;

    /* INGEN margin */
    margin: 0 !important;

    /* Glipa inuti cellen */
    padding: 0 2px;
    background-clip: content-box;
}
/* Röda dagar (Dejour) - stark röd */
.date-cell.holiday,
.d-cell.holiday {
    background: rgba(220, 38, 38, 0.85) !important; /* stark röd */
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Röd dag-kolumn: syns bara på "tomma" rutor.
   Prioritet: active/period/drag ska alltid vinna. */
.g-cell.holiday-col:not(.active):not(.drag-add):not(.drag-remove):not(.p-start):not(.p-mid):not(.p-end) {
    background: rgba(220, 38, 38, 0.25) !important;
}


/* Om både weekend och holiday: ännu tydligare */
.date-cell.weekend.holiday,
.d-cell.weekend.holiday {
    background: rgba(185, 28, 28, 0.90) !important;
}
/* Weekend (lör/sön) - mycket rödare (header) */
.date-cell.weekend,
.d-cell.weekend {
    background: rgba(220, 38, 38, 0.45) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Weekend-kolumn: syns bara på tomma rutor */
.g-cell.weekend:not(.active):not(.drag-add):not(.drag-remove):not(.p-start):not(.p-mid):not(.p-end) {
    background: rgba(220, 38, 38, 0.12) !important;
}

/* Weekend (lör/sön) i rutnätet – syns bara på tomma rutor.
   Prioritet: active/period/drag ska alltid vinna. */
.g-cell.weekend:not(.active):not(.drag-add):not(.drag-remove):not(.p-start):not(.p-mid):not(.p-end) {
    background: rgba(220, 38, 38, 0.12) !important;
}
/* ===============================
   DEJOUR – ENHETLIG RÖD (SIST)
   Samma röd för: lör/sön, helgdagar, och egna röda dagar.
   Grönt (active/period) vinner alltid.
   =============================== */

/* HEADER: weekend + holiday + egna röda (manual) */
.dejour-header .date-cell.weekend,
.dejour-header .date-cell.holiday,
.dejour-header .date-cell.manual-red,
.dejour-header .d-cell.weekend,
.dejour-header .d-cell.holiday,
.dejour-header .d-cell.manual-red {
  background: var(--dejour-red) !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,0.22);
}

/* KOLUMN: röd ton bara på TOMMA rutor */
.dejour-grid .g-cell.weekend:not(.active):not(.drag-add):not(.drag-remove):not(.p-start):not(.p-mid):not(.p-end),
.dejour-grid .g-cell.holiday-col:not(.active):not(.drag-add):not(.drag-remove):not(.p-start):not(.p-mid):not(.p-end),
.dejour-grid .g-cell.manual-red-col:not(.active):not(.drag-add):not(.drag-remove):not(.p-start):not(.p-mid):not(.p-end) {
  background: var(--dejour-red-col) !important;
}

/* GRÖNT VINNER ALLTID */
.dejour-grid .g-cell.active,
.dejour-grid .g-cell.p-mid,
.dejour-grid .g-cell.weekend.active,
.dejour-grid .g-cell.weekend.p-mid,
.dejour-grid .g-cell.holiday-col.active,
.dejour-grid .g-cell.holiday-col.p-mid,
.dejour-grid .g-cell.manual-red-col.active,
.dejour-grid .g-cell.manual-red-col.p-mid {
  background: #10b981 !important;
}

.dejour-grid .g-cell.p-start,
.dejour-grid .g-cell.weekend.p-start,
.dejour-grid .g-cell.holiday-col.p-start,
.dejour-grid .g-cell.manual-red-col.p-start {
  background: linear-gradient(to right, rgba(16, 185, 129, 0.2) 0%, #10b981 100%) !important;
}

.dejour-grid .g-cell.p-end,
.dejour-grid .g-cell.weekend.p-end,
.dejour-grid .g-cell.holiday-col.p-end,
.dejour-grid .g-cell.manual-red-col.p-end {
  background: linear-gradient(to right, #10b981 0%, rgba(16, 185, 129, 0.2) 100%) !important;
}

.dejour-grid .g-cell.p-start.p-end,
.dejour-grid .g-cell.weekend.p-start.p-end,
.dejour-grid .g-cell.holiday-col.p-start.p-end,
.dejour-grid .g-cell.manual-red-col.p-start.p-end {
  background: linear-gradient(to right, rgba(16, 185, 129, 0.2) 0%, #10b981 50%, rgba(16, 185, 129, 0.2) 100%) !important;
}
/* --- Dejour Events (Julfest etc) --- */
.dejour-event-label {
    display: block;
    font-size: 9px;
    font-weight: bold;
    background-color: #f59e0b; /* Amber/Gul färg */
    color: #000;
    padding: 1px 3px;
    border-radius: 3px;
    margin-top: 2px;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 95%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    z-index: 5;
    cursor: pointer;
}

/* Gör datumrutan lite högre för att rymma texten */
.dejour-header .date-cell {
    height: 55px; 
    justify-content: flex-start; /* Börja uppifrån */
    padding-top: 4px;
    position: relative;
    user-select: none;
    transition: background-color 0.2s, transform 0.1s;
}

/* Visuell effekt när man håller inne (Long press) */
.date-cell.long-press-active {
    background-color: #444 !important;
    transform: scale(0.95);
    border: 1px solid #f59e0b;
}

.dejour-header .date-cell b {
    display: block;
    line-height: 1;
    margin-bottom: 2px;
}
/* --- Dejour Events --- */

/* Text-etiketten i headern */
.dejour-event-label {
    display: block;
    font-size: 9px;
    font-weight: bold;
    background-color: #f59e0b; /* Amber */
    color: #000;
    padding: 1px 3px;
    border-radius: 3px;
    margin-top: 2px;
    line-height: 1.1;
    
    /* Klipp texten snyggt om den är lång */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 95%;
    
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    pointer-events: none; /* Klick går igenom till datumcellen */
}

/* Hela kolumnen blir gulaktig */
.g-cell.event-col:not(.active):not(.drag-add):not(.drag-remove):not(.p-start):not(.p-mid):not(.p-end) {
    background: rgba(245, 158, 11, 0.15) !important; /* Svag bärnsten */
    border-right: 1px solid rgba(245, 158, 11, 0.1);
}

/* Om det BÅDE är helg och event, blanda färgerna lite */
.g-cell.weekend.event-col:not(.active) {
    background: rgba(245, 158, 11, 0.2) !important;
}

/* Datum-rutan får en liten gul ram i botten */
.date-cell.has-event {
    border-bottom: 3px solid #f59e0b !important;
}
/* --- MODERN EVENT POPUP --- */

/* Själva bakgrunden som täcker skärmen (backdrop) */
#event-popup.modal {
    backdrop-filter: blur(5px); /* "Frosted glass" effekt */
    background-color: rgba(0, 0, 0, 0.7); /* Lite mörkare bakgrund */
    transition: opacity 0.2s ease;
}

/* Den inre moderna rutan */
.modern-modal-content {
    background: linear-gradient(to bottom right, #252b38, #1a1f2b); /* Subtil mörk gradient */
    border: 1px solid rgba(255, 255, 255, 0.08); /* Tunn ljus ram */
    border-radius: 16px; /* Mjuka, runda hörn */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); /* Djup skugga */
    padding: 0; /* Padding hanteras av inre element */
    max-width: 450px; /* Lite bredare för bättre läsbarhet */
    width: 92%;
    text-align: left;
    position: relative;
    overflow: hidden; /* Viktigt för accent-linjen */
}

/* En snygg accent-linje högst upp */
.modern-modal-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(to right, #f59e0b, #d97706); /* Amber/Orange gradient */
}

/* Header-delen med datum och stäng-knapp */
.event-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 16px 24px;
}

/* Datumet */
#event-popup-date {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #f59e0b; /* Amber färg */
    margin: 0;
    text-transform: capitalize;
}

/* Modern "X" stäng-knapp */
.modern-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.8rem;
    line-height: 1;
    width: 40px; height: 40px;
    border-radius: 50%; /* Cirkelformad */
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding-bottom: 4px; /* Finjustering av kryssets position */
}
.modern-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: rotate(90deg); /* Snurrar lite vid hover */
}

/* Själva textinnehållet */
.event-popup-body {
    padding: 0 24px 24px 24px;
}

#event-popup-text {
    font-size: 1.15rem;
    line-height: 1.6;
    color: #e5e7eb; /* Ljusgrå text, lättläst mot mörk bakgrund */
    background: transparent; /* Ingen ful grå ruta längre! */
    padding: 0;
    margin: 0;
    white-space: pre-wrap; /* Bevara radbrytningar */
    word-break: break-word;
}

/* Footern med den stora stängknappen */
.event-popup-footer {
    padding: 16px 24px 24px 24px;
    background: rgba(0,0,0,0.1); /* Något mörkare botten */
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* Styla om sekundärknappen i footern att bli mer modern */
.event-popup-footer .btn-secondary {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}
.event-popup-footer .btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}
/* --- Dejour Typer --- */

/* Semester (T.ex. Blå/Turkos) */
.g-cell.type-vacation {
    background-color: #06b6d4 !important; /* Cyan */
    border-color: #0891b2 !important;
}

/* Annat (Lila) */
.g-cell.type-other {
    background-color: #9333ea !important; /* Lila */
    border-color: #7e22ce !important;
}

/* Ikonen/markeringen inuti cellen om den har text */
.g-cell.has-comment::after {
    content: '...';
    position: absolute;
    bottom: 0;
    right: 2px;
    font-size: 8px;
    color: rgba(255,255,255,0.8);
    line-height: 8px;
}
/* ========================================== */
/* FÄRG-ÖVERSKRIVNINGAR (Måste ligga sist)    */
/* ========================================== */

/* SEMESTER (Blå/Cyan) - Överskriv grönt */
.dejour-grid .g-cell.active.type-vacation,
.dejour-grid .g-cell.drag-add.type-vacation,
.dejour-grid .g-cell.p-mid.type-vacation,
.dejour-grid .g-cell.p-start.type-vacation,
.dejour-grid .g-cell.p-end.type-vacation {
    background-color: #06b6d4 !important; /* Cyan */
    border-color: #0891b2 !important;
    z-index: 2; /* Se till att den ligger över */
}

/* ANNAT (Lila) - Överskriv grönt */
.dejour-grid .g-cell.active.type-other,
.dejour-grid .g-cell.drag-add.type-other,
.dejour-grid .g-cell.p-mid.type-other,
.dejour-grid .g-cell.p-start.type-other,
.dejour-grid .g-cell.p-end.type-other {
    background-color: #9333ea !important; /* Lila */
    border-color: #7e22ce !important;
    z-index: 2;
}

/* Fix för helger så de inte blir mörkgröna om de är semester/annat */
.dejour-grid .g-cell.weekend.active.type-vacation { background-color: #0891b2 !important; }
.dejour-grid .g-cell.weekend.active.type-other    { background-color: #7e22ce !important; }

/* Indikator för kommentar (...) */
.g-cell.has-comment::after {
    content: '...';
    position: absolute;
    bottom: 0px;
    right: 3px;
    font-size: 10px;
    font-weight: bold;
    color: rgba(255,255,255,0.9);
    line-height: 8px;
}
/* ========================================================= */
/* TA BORT ALL FADE/GRADIENT PÅ SEMESTER & ANNAT             */
/* ========================================================= */

/* 1. SEMESTER (Blå) - Tvinga solid färg, ta bort gradient */
.dejour-grid .g-cell.type-vacation.p-start,
.dejour-grid .g-cell.type-vacation.p-end,
.dejour-grid .g-cell.type-vacation.p-mid,
.dejour-grid .g-cell.type-vacation.active,
.dejour-grid .g-cell.type-vacation.drag-add {
    background-color: #06b6d4 !important; /* Solid färg */
    background-image: none !important;    /* VIKTIGT: Tar bort faden/gradienten */
    border-color: #0891b2 !important;
    opacity: 1 !important;
}

/* 2. ANNAT (Lila) - Tvinga solid färg, ta bort gradient */
.dejour-grid .g-cell.type-other.p-start,
.dejour-grid .g-cell.type-other.p-end,
.dejour-grid .g-cell.type-other.p-mid,
.dejour-grid .g-cell.type-other.active,
.dejour-grid .g-cell.type-other.drag-add {
    background-color: #9333ea !important; /* Solid färg */
    background-image: none !important;    /* VIKTIGT: Tar bort faden/gradienten */
    border-color: #7e22ce !important;
    opacity: 1 !important;
}

/* Fix för helger så de inte blir mörkgröna i bakgrunden */
.dejour-grid .g-cell.weekend.type-vacation { background-color: #06b6d4 !important; }
.dejour-grid .g-cell.weekend.type-other    { background-color: #9333ea !important; }

/* Behåll indikator (...) */
.g-cell.has-comment::after {
    content: '...';
    position: absolute;
    bottom: 0px;
    right: 3px;
    font-size: 10px;
    font-weight: bold;
    color: rgba(255,255,255,0.9);
    line-height: 8px;
}
/* 2. ANNAT (Nu RÖD för att matcha lediga dagar) */
.dejour-grid .g-cell.type-other.p-start,
.dejour-grid .g-cell.type-other.p-end,
.dejour-grid .g-cell.type-other.p-mid,
.dejour-grid .g-cell.type-other.active,
.dejour-grid .g-cell.type-other.drag-add {
    background-color: #ef4444 !important; /* Röd färg */
    background-image: none !important;
    border-color: #dc2626 !important;     /* Mörkare röd kant */
    opacity: 1 !important;
    z-index: 2;
}

/* Startrutan måste ligga överst för att texten ska synas */
.dejour-grid .g-cell.type-other.p-start {
    overflow: visible !important; 
    z-index: 100 !important; 
    position: relative;
}

/* Fix för helger */
.dejour-grid .g-cell.weekend.type-other { background-color: #ef4444 !important; }

/* ================================================================
   MOBILANPASSNING FÖR DEJOUR (Läggs sist i style.css)
   ================================================================ */
/* ================================================================
   MOBILANPASSNING - KORRIGERAD VERSION
   ================================================================ */
@media (max-width: 800px) {

    /* 1. HUVUDVYN: Fixad layout och synlighet */
    #dejour-view {
        position: fixed !important;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100vw !important;
        height: 100dvh !important;       /* Anpassar sig till mobila webbläsare */
        z-index: 2000 !important;        /* Högt, men UNDER popup-modaler (som har 10000) */
        background-color: #1a1a1a !important;
        display: flex;                   /* Flexbox, men utan !important så .hidden fungerar */
        flex-direction: column;
        overflow: hidden !important;
    }
    
    /* Garantera att den döljs när klassen .hidden finns */
    #dejour-view.hidden {
        display: none !important;
    }

    /* 2. CONTAINER: Måste fylla utrymmet */
    .dejour-container {
        flex: 1 1 auto !important;       /* Ta all plats som blir över */
        display: flex !important;
        flex-direction: row !important;  /* Sida vid sida */
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
        position: relative !important;
    }

    /* 3. VÄNSTERSPALTEN (Namn): Garanterad bredd och färg */
    /* 3. VÄNSTERSPALTEN (Namn): Nu med scroll! */
    .dejour-sidebar {
        width: 110px !important;
        min-width: 110px !important;
        margin-top: 40px !important;
        
        /* ÄNDRING HÄR: Tillåt scroll */
        overflow-y: auto !important;     
        -webkit-overflow-scrolling: touch; /* Mjuk scroll på iPhone */
        overscroll-behavior: contain;
        
        background-color: #262626;
        border-right: 1px solid #444;
        z-index: 10;

        /* Dölj scrollbaren för Chrome/Safari/Opera */
        scrollbar-width: none;  /* Firefox */
        -ms-overflow-style: none;  /* IE/Edge */
    }
    
    /* Dölj scrollbaren specifikt för Webkit (Chrome/Safari) */
    .dejour-sidebar::-webkit-scrollbar {
        display: none;
    }
    .emp-name {
        height: 35px !important;
        line-height: 35px !important;
        font-size: 11px !important;
        padding-left: 5px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #e5e5e5;
        border-bottom: 1px solid #333;
    }

    /* 4. HÖGERSPALTEN (Tidslinje): Scrollbar */
    .dejour-timeline {
        flex: 1 !important;              /* Fyll resten av bredden */
        overflow: auto !important;       /* Scrollbar */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;    /* Förhindra att bakgrunden scrollar */
    }

    /* Höjder för att allt ska linjera perfekt */
    .dejour-header, .date-cell, .d-cell {
        height: 40px !important;
    }
    
    .d-row, .g-cell {
        height: 35px !important;
    }

    /* 5. VERKTYGSFÄLT (Toolbar) */
    .dejour-toolbar {
        flex-shrink: 0;
        min-height: 50px;
        height: auto;
        padding: 5px;
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        background-color: #2d2d2d;
        z-index: 20;
    }
    
    .dejour-toolbar h2 { display: none; } /* Dölj rubrik på mobil */
    
    .dj-btn {
        padding: 6px 10px;
        font-size: 11px;
        flex-grow: 1;
        height: 36px;
        white-space: nowrap;
    }
}
/* ================================================================
   TYDLIGARE HÄNDELSER (JUL, EVENT ETC.)
   ================================================================ */

/* 1. Gör hela kolumnen mycket starkare gul (från 15% till 40% synlighet) */
.g-cell.event-col:not(.active):not(.drag-add):not(.drag-remove):not(.p-start):not(.p-mid):not(.p-end) {
    background: rgba(245, 158, 11, 0.40) !important; /* Mycket tydligare gul */
    border-right: 1px solid rgba(245, 158, 11, 0.4) !important;
}

/* Om det är helg + event -> gör den ännu lite starkare/mörkare gul */
.g-cell.weekend.event-col:not(.active) {
    background: rgba(245, 158, 11, 0.50) !important;
}

/* 2. Gör den lilla etiketten i toppen ("Julfest") poppigare */
.dejour-event-label {
    background-color: #fbbf24 !important; /* Ljusare/starkare gul */
    color: #000 !important;
    font-weight: 900 !important; /* Extra fet text */
    border: 1px solid #b45309;   /* Mörk kant för kontrast */
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.6); /* Gul "glow" runt texten */
    z-index: 20;
}

/* 3. Tydligare markering på själva datum-rutan */
.dejour-header .date-cell.has-event {
    background: rgba(245, 158, 11, 0.25); /* Lätt gul bakgrund i headern */
    border-bottom: 4px solid #fbbf24 !important; /* Tjockare och ljusare linje */
    color: #fbbf24; /* Gör datumtexten gul också */
}
/* ================================================================
   KOMPAKT LAPTOP-VY (Skärmar större än 800px)
   ================================================================ */
@media (min-width: 801px) {
    
    /* 1. Krymp sidomenyn */
    .dejour-sidebar {
        width: 150px !important; /* Smalare än förut (var 200px) */
        margin-top: 35px !important; /* Matcha nya header-höjden */
    }

    /* 2. Krymp höjden på ALLT (Rader + Header) */
    .dejour-header, 
    .date-cell, 
    .d-cell,
    .d-row, 
    .g-cell,
    .emp-name {
        height: 32px !important; /* Minskat från ca 40-50px */
        line-height: 32px !important;
        font-size: 12px !important; /* Lite mindre text */
    }
    
    /* Justera textposition i datum-headern */
    .date-cell, .d-cell {
        padding-top: 2px !important;
        line-height: 1.2 !important; /* För datum + veckodag på två rader */
        justify-content: center !important;
    }

    /* 3. Krymp verktygsfältet */
    .dejour-toolbar {
        height: 45px !important;
        padding: 0 10px !important;
    }
    
    .dj-btn {
        padding: 4px 12px !important;
        font-size: 12px !important;
        height: 30px !important;
    }

    /* 4. Krymp event-labels (De gula "Julfest"-lapparna) */
    .dejour-event-label {
        font-size: 9px !important;
        margin-top: 0 !important;
        padding: 0 2px !important;
        line-height: 10px !important;
    }
    
    /* Gör datumrutan lite högre om det finns en händelse, så texten ryms */
    .dejour-header .date-cell.has-event {
        height: 45px !important; /* Låt den sticka ner lite */
        z-index: 20;
        border-bottom-width: 3px !important;
    }
    
    .upload-progress-wrap {
    margin-top: 10px;
    width: 100%;
}

.upload-progress-wrap.hidden {
    display: none;
}

.upload-progress-bar {
    width: 100%;
    height: 14px;
    background: #2a3140;
    border: 1px solid #3c465c;
    border-radius: 999px;
    overflow: hidden;
}

.upload-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width 0.15s linear;
}

.upload-progress-text {
    margin-top: 6px;
    font-size: 12px;
    color: #cbd5e1;
}
}
.photo-modal-content {
    max-width: 96vw;
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    overflow: hidden;
}

.photo-modal-image-wrap {
    width: 92vw;
    height: 68vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 1;
}

.photo-modal-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.2s ease;
    z-index: 1;
}

/* När bilden är vriden 90/270 grader */
.photo-modal-img.rotated-sideways {
    max-width: 68vh;
    max-height: 92vw;
}

.photo-modal-rotate-tools,
.photo-modal-counter,
.photo-modal-nav,
#photo-modal-counter {
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.photo-modal-rotate-tools {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin: 6px 0;
}
.emp-name.dragging-employee {
    opacity: 0.4;
}

.emp-name.drag-over-employee {
    background: rgba(59, 130, 246, 0.35);
    outline: 1px solid rgba(147, 197, 253, 0.8);
}

.dejour-container.editing .emp-name {
    user-select: none;
}
/* Tydligare semesterblock i dejourlistan */
.g-cell.type-vacation.active {
    background: #06b6d4 !important;
    border-top: 2px solid rgba(255, 255, 255, 0.85) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.85) !important;
    box-shadow: inset 0 0 0 1px rgba(8, 47, 73, 0.9);
}

/* Start på semesterperiod */
.g-cell.type-vacation.active.p-start {
    border-left: 3px solid rgba(255, 255, 255, 0.95) !important;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

/* Slut på semesterperiod */
.g-cell.type-vacation.active.p-end {
    border-right: 3px solid rgba(255, 255, 255, 0.95) !important;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Gör semester lite lägre så den inte visuellt blöder över rader */
.g-cell.type-vacation.active::before,
.g-cell.type-vacation.active::after {
    pointer-events: none;
}

/* Om din gamla CSS använder stark box-shadow/gradient på semester,
   neutralisera den här */
.g-cell.type-vacation.active {
    overflow: hidden;
    position: relative;
}
.d-row {
    overflow: hidden;
}

.g-cell {
    box-sizing: border-box;
}
.equipment-fields-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.equipment-field-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    gap: 10px;
    align-items: center;
}

.equipment-field-row input {
    margin: 0;
}

.equipment-field-remove {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: #ff6b6b;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
}

.equipment-field-remove:hover {
    background: rgba(239, 68, 68, 0.12);
}

@media (max-width: 700px) {
    .equipment-field-row {
        grid-template-columns: 1fr;
    }

    .equipment-field-remove {
        width: 100%;
    }
}
.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: inherit;
    font-size: 0.72rem;
    font-weight: 800;
}

.filter-btn.active .filter-count {
    background: rgba(255,255,255,0.25);
    color: #fff;
}
.password-modal-content {
    max-width: 460px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 24px 80px rgba(0,0,0,0.65);
}

.password-modal-user {
    margin-top: 6px;
    margin-bottom: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.password-modal-error {
    min-height: 20px;
    color: #ff6b6b;
    font-size: 0.88rem;
    margin-top: 6px;
    font-weight: 600;
}

#password-modal input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 8px;
    outline: none;
}

#password-modal input[type="password"]:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.22);
}

#password-modal .modal-actions {
    margin-top: 16px;
}

#password-modal .btn-primary,
#password-modal .btn-secondary {
    border-radius: 10px;
    padding: 9px 14px;
}
/* === DEJOUR HJÄLP / INFO === */

.dj-help-btn {
    width: auto;
    min-width: 78px;
    height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(250, 204, 21, 0.45);
    background: rgba(250, 204, 21, 0.12);
    color: #fde68a;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
}

.dj-help-btn:hover {
    background: rgba(250, 204, 21, 0.22);
    color: #fff7cc;
}

.dejour-help-modal {
    z-index: 10050 !important;
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(4px);
    padding: 16px;
}

.dejour-help-content {
    width: 760px;
    max-width: 96vw;
    max-height: 90vh;
    overflow: hidden;
    background: linear-gradient(to bottom right, #172033, #111827);
    border: 1px solid rgba(250, 204, 21, 0.28);
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0,0,0,0.72);
    color: #fff;
    display: flex;
    flex-direction: column;
}

.dejour-help-topbar {
    height: 5px;
    background: linear-gradient(to right, #facc15, #f59e0b, #3b82f6);
    flex-shrink: 0;
}

.dejour-help-header {
    padding: 18px 20px 14px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.dejour-help-header h3 {
    margin: 0;
    color: #fde68a;
    font-size: 1.35rem;
}

.dejour-help-header p {
    margin: 4px 0 0;
    color: #cbd5e1;
    font-size: 0.95rem;
}

.dejour-help-close {
    background: transparent;
    border: 0;
    color: white;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
    padding: 0 4px;
}

.dejour-help-close:hover {
    opacity: 1;
    color: #fde68a;
}

.dejour-help-body {
    padding: 16px 20px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.dejour-help-card {
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 13px 14px;
}

.dejour-help-card h4 {
    margin: 0 0 7px;
    color: #93c5fd;
    font-size: 0.98rem;
}

.dejour-help-card p,
.dejour-help-card li {
    color: #e5e7eb;
    font-size: 0.88rem;
    line-height: 1.45;
}

.dejour-help-card ul {
    margin: 8px 0 0 18px;
    padding: 0;
}

.dejour-help-card strong {
    color: #fde68a;
}

.dejour-help-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.22);
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 700px) {
    .dejour-help-body {
        grid-template-columns: 1fr;
    }

    .dejour-help-content {
        max-height: 92vh;
    }

    .dj-help-btn {
        min-width: auto;
        padding: 6px 10px;
    }
}
/* === HUVUDHJÄLP / SERVICEPORTAL GUIDE === */

.main-help-btn {
    width: auto;
    min-width: 78px;
    height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.55);
    background: rgba(59, 130, 246, 0.16);
    color: #bfdbfe;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
}

.main-help-btn:hover {
    background: rgba(59, 130, 246, 0.28);
    color: #ffffff;
}

.main-help-modal {
    z-index: 10060 !important;
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.74);
    backdrop-filter: blur(4px);
    padding: 16px;
}

.main-help-content {
    width: 920px;
    max-width: 96vw;
    max-height: 92vh;
    overflow: hidden;
    background: linear-gradient(to bottom right, #172033, #111827);
    border: 1px solid rgba(59, 130, 246, 0.34);
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0,0,0,0.72);
    color: #fff;
    display: flex;
    flex-direction: column;
}

.main-help-topbar {
    height: 5px;
    background: linear-gradient(to right, #3b82f6, #0ea5e9, #facc15);
    flex-shrink: 0;
}

.main-help-header {
    padding: 18px 20px 14px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.main-help-header h3 {
    margin: 0;
    color: #bfdbfe;
    font-size: 1.4rem;
}

.main-help-header p {
    margin: 4px 0 0;
    color: #cbd5e1;
    font-size: 0.95rem;
}

.main-help-close {
    background: transparent;
    border: 0;
    color: white;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
    padding: 0 4px;
}

.main-help-close:hover {
    opacity: 1;
    color: #bfdbfe;
}

.main-help-body {
    padding: 16px 20px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.main-help-section {
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 13px 14px;
}

.main-help-section h4 {
    margin: 0 0 7px;
    color: #93c5fd;
    font-size: 0.98rem;
}

.main-help-section p,
.main-help-section li {
    color: #e5e7eb;
    font-size: 0.88rem;
    line-height: 1.45;
}

.main-help-section ul {
    margin: 8px 0 0 18px;
    padding: 0;
}

.main-help-section strong {
    color: #fde68a;
}

.main-help-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.22);
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 800px) {
    .main-help-body {
        grid-template-columns: 1fr;
    }

    .main-help-content {
        max-height: 94vh;
    }

    .main-help-btn {
        min-width: auto;
        padding: 6px 10px;
    }
}
.service-note-modal-content {
    max-width: 520px;
    border-radius: 16px;
    border: 1px solid rgba(59,130,246,0.28);
    box-shadow: 0 24px 70px rgba(0,0,0,0.65);
}

.service-note-subtitle {
    margin-top: 6px;
    margin-bottom: 14px;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.35;
}

#service-note-text {
    min-height: 120px;
    resize: vertical;
    line-height: 1.4;
}

#service-note-text:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.22);
}
/* === LJUST / MÖRKT TEMA === */

body.light-theme {
    --bg-dark: #f3f4f6;
    --bg-panel: #ffffff;
    --bg-card: #e5e7eb;
    --text-main: #111827;
    --text-muted: #4b5563;
    --border-color: #cbd5e1;
    --accent-blue: #2563eb;
    --accent-red: #dc2626;
    --color-amber: #d97706;

    background-color: var(--bg-dark);
    color: var(--text-main);
}

/* Inputs i ljust tema */
body.light-theme input[type="text"],
body.light-theme input[type="password"],
body.light-theme input[type="date"],
body.light-theme textarea,
body.light-theme select {
    background: #ffffff;
    color: #111827;
    border-color: #cbd5e1;
}

/* Placeholder */
body.light-theme input::placeholder,
body.light-theme textarea::placeholder {
    color: #6b7280;
}

/* Knappar */
body.light-theme .btn-secondary {
    background: #e5e7eb;
    color: #111827;
    border-color: #cbd5e1;
}

body.light-theme .btn-secondary:hover {
    background: #d1d5db;
}

/* Station-lista */
body.light-theme .station-item:hover {
    background: #e5e7eb;
}

body.light-theme .station-item.active {
    background: var(--accent-blue);
    color: #ffffff;
}

/* Kort */
body.light-theme .card,
body.light-theme .history-item,
body.light-theme .reminder-item {
    background: #ffffff;
    border: 1px solid #d1d5db;
}

/* Header */
body.light-theme .top-bar,
body.light-theme .sidebar-left,
body.light-theme .sidebar-right {
    background: #ffffff;
    border-color: #d1d5db;
}

/* Content */
body.light-theme .content-area {
    background: #f3f4f6;
}

/* Modaler */
body.light-theme .modal-content {
    background: #ffffff;
    color: #111827;
    border: 1px solid #d1d5db;
}

body.light-theme .modal-content h3,
body.light-theme .modal-content h4 {
    color: #111827;
}

/* Historik */
body.light-theme .history-meta {
    color: #6b7280;
}

/* Tomma S/T cirklar */
body.light-theme .check-icon-empty {
    color: #6b7280;
    border-color: #9ca3af;
}

/* Filterknappar */
body.light-theme .filter-btn {
    background: #e5e7eb;
    color: #111827;
    border-color: #cbd5e1;
}

body.light-theme .filter-btn.active {
    background: var(--accent-blue);
    color: #ffffff;
}

/* Leaflet popup i ljust tema behöver inte vara mörk */
body.light-theme .leaflet-popup-content-wrapper,
body.light-theme .leaflet-popup-tip {
    background: #ffffff !important;
    color: #111827 !important;
}

/* Dejour-vyn ljusare bakgrund */
body.light-theme #dejour-view,
body.light-theme .dejour-container,
body.light-theme .dejour-timeline,
body.light-theme .dejour-sidebar {
    background: #f3f4f6;
    color: #111827;
}

/* Dejour namnkolumn */
body.light-theme .dejour-sidebar div {
    color: #111827;
}

/* Scrollbars lite ljusare */
body.light-theme ::-webkit-scrollbar-track {
    background: #e5e7eb;
}

body.light-theme ::-webkit-scrollbar-thumb {
    background: #9ca3af;
}
.top-actions .btn-secondary,
.top-actions .btn-danger,
.top-actions a.btn-secondary {
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.top-actions button,
.top-actions .btn-secondary,
.top-actions .btn-danger {
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    line-height: 1;
}
/* Fix: ram runt Välj år i ljust tema */
body.light-theme .year-selector select {
    background: #ffffff;
    color: #111827;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
}

/* Valfritt: lite bättre fokusmarkering */
body.light-theme .year-selector select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
/* === FIX: DEJOUR I LJUST TEMA === */

body.light-theme #dejour-view {
    background: #f3f4f6;
    color: #111827;
}

body.light-theme .dejour-toolbar {
    background: #ffffff;
    border-bottom: 1px solid #cbd5e1;
}

body.light-theme .dejour-container {
    background: #f3f4f6;
}

body.light-theme .dejour-sidebar {
    background: #ffffff !important;
    color: #111827 !important;
    border-right: 1px solid #cbd5e1;
}

body.light-theme .dejour-sidebar div,
body.light-theme #dj-sidebar div,
body.light-theme #dj-sidebar .dj-name,
body.light-theme #dj-sidebar * {
    color: #111827 !important;
}

body.light-theme .dejour-sidebar-row,
body.light-theme .dejour-employee-row {
    background: #ffffff !important;
    color: #111827 !important;
    border-bottom: 1px solid #d1d5db;
}

body.light-theme .dejour-timeline {
    background: #f9fafb;
}

body.light-theme .dejour-header {
    background: #e5e7eb;
    color: #111827;
}

body.light-theme .dejour-grid {
    background: #f9fafb;
}

body.light-theme .dj-cell {
    background: #f9fafb;
    border-color: #cbd5e1;
}

body.light-theme .dj-cell.weekend,
body.light-theme .dj-cell.red-day {
    background: #f3c4c8;
}

body.light-theme .dj-day-header {
    background: #e5e7eb;
    color: #111827;
    border-color: #cbd5e1;
}

body.light-theme .dj-day-header.red-day,
body.light-theme .dj-day-header.weekend {
    background: #dc2626;
    color: #ffffff;
}

/* Dagens datum i ljust tema */
body.light-theme .today-column,
body.light-theme .dj-today {
    background: rgba(250, 204, 21, 0.35) !important;
}

/* Dejour-knappar i toolbar */
body.light-theme #dejour-view .dj-btn,
body.light-theme #dejour-view .btn-secondary {
    background: #e5e7eb;
    color: #111827;
    border: 1px solid #cbd5e1;
}

body.light-theme #dejour-view .dj-close {
    background: #dc2626 !important;
    color: white !important;
}
body.light-theme #dj-sidebar {
    background: #ffffff !important;
}

body.light-theme #dj-sidebar > div {
    color: #111827 !important;
    background: #ffffff !important;
    font-weight: 600;
}
/* === FIX: Dejour hjälpknapp i ljust tema === */

body.light-theme #dejour-view .dj-help-btn {
    background: #facc15 !important;
    color: #111827 !important;
    border: 1px solid #ca8a04 !important;
    font-weight: 900 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25) !important;
}

body.light-theme #dejour-view .dj-help-btn:hover {
    background: #eab308 !important;
    color: #111827 !important;
}


/* === KORREKT FIX: DEJOUR LJUST TEMA DESKTOP === */
/* Behåller originalstorlek: header 50px, rader 40px */

@media (min-width: 801px) {

    body.light-theme #dejour-view {
        background: #f3f4f6 !important;
        color: #111827 !important;
    }

    body.light-theme .dejour-toolbar {
        background: #ffffff !important;
        border-bottom: 1px solid #cbd5e1 !important;
    }

    body.light-theme #dejour-view h2 {
        color: #111827 !important;
    }

    /* Hjälpknappen ska synas tydligt i ljust tema */
    body.light-theme #dejour-view .dj-help-btn {
        background: #facc15 !important;
        color: #111827 !important;
        border: 1px solid #ca8a04 !important;
        font-weight: 900 !important;
        height: 34px !important;
        padding: 6px 14px !important;
        border-radius: 999px !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.25) !important;
        opacity: 1 !important;
    }

    body.light-theme #dejour-view .dj-help-btn:hover {
        background: #eab308 !important;
        color: #111827 !important;
    }

    /* Vänstra namnkolumnen */
    body.light-theme #dj-sidebar,
    body.light-theme .dejour-sidebar {
        width: 200px !important;
        min-width: 200px !important;
        margin-top: 50px !important;
        background: #ffffff !important;
        color: #111827 !important;
        border-right: 1px solid #9ca3af !important;
        overflow: hidden !important;
    }

    /* Namnrader – samma höjd som kalender-raderna */
    body.light-theme #dj-sidebar .emp-name,
    body.light-theme .dejour-sidebar .emp-name {
        height: 40px !important;
        min-height: 40px !important;
        line-height: 40px !important;
        padding: 0 12px !important;
        box-sizing: border-box !important;

        background: #ffffff !important;
        color: #111827 !important;
        border-bottom: 1px solid #9ca3af !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Kalender-header – originalhöjd */
    body.light-theme #dj-header,
    body.light-theme .dejour-header {
        height: 50px !important;
        min-height: 50px !important;
        background: #e5e7eb !important;
        color: #111827 !important;
        border-bottom: 1px solid #9ca3af !important;
    }

    body.light-theme #dj-header .date-cell,
    body.light-theme #dj-header .d-cell,
    body.light-theme .dejour-header .date-cell,
    body.light-theme .dejour-header .d-cell {
        height: 50px !important;
        min-height: 50px !important;
        color: #111827 !important;
        border-right: 1px solid #9ca3af !important;
        background: #e5e7eb !important;
        font-size: 11px !important;
    }

    /* Kalender-rader – samma höjd som namn */
    body.light-theme #dj-grid .d-row,
    body.light-theme .dejour-grid .d-row {
        height: 40px !important;
        min-height: 40px !important;
        border-bottom: 1px solid #9ca3af !important;
    }

    body.light-theme #dj-grid .g-cell,
    body.light-theme .dejour-grid .g-cell {
        height: 40px !important;
        min-height: 40px !important;
        box-sizing: border-box !important;
        border-right: 1px solid #cbd5e1 !important;
        background: #f9fafb;
    }

    body.light-theme #dj-grid .g-cell.weekend,
    body.light-theme .dejour-grid .g-cell.weekend,
    body.light-theme #dj-grid .g-cell.holiday-col,
    body.light-theme .dejour-grid .g-cell.holiday-col {
        background: #f3c4c8 !important;
    }

    /* Behåll färger för planering */
    body.light-theme #dj-grid .g-cell.type-vacation,
    body.light-theme .dejour-grid .g-cell.type-vacation {
        background-color: #06b6d4 !important;
    }

    body.light-theme #dj-grid .g-cell.type-other,
    body.light-theme .dejour-grid .g-cell.type-other {
        background-color: #ef4444 !important;
    }

    body.light-theme #dj-grid .g-cell.active:not(.type-vacation):not(.type-other),
    body.light-theme .dejour-grid .g-cell.active:not(.type-vacation):not(.type-other) {
        background-color: #10b981 !important;
    }
}
/* === FIX: DEJOUR RADHÖJD – MÖRKT + LJUST TEMA === */
/* Gör namnkolumn och kalender-rader exakt lika höga */

#dejour-view {
    --dj-header-height: 50px;
    --dj-row-height: 40px;
}

/* Vänstra namnkolumnen ska börja exakt under datum-headern */
#dj-sidebar,
.dejour-sidebar {
    margin-top: var(--dj-header-height) !important;
}

/* Datumheadern */
#dj-header,
.dejour-header {
    height: var(--dj-header-height) !important;
    min-height: var(--dj-header-height) !important;
}

/* Datumceller */
#dj-header .d-cell,
#dj-header .date-cell,
.dejour-header .d-cell,
.dejour-header .date-cell {
    height: var(--dj-header-height) !important;
    min-height: var(--dj-header-height) !important;
    box-sizing: border-box !important;
}

/* Namnrader */
#dj-sidebar .emp-name,
.dejour-sidebar .emp-name {
    height: var(--dj-row-height) !important;
    min-height: var(--dj-row-height) !important;
    line-height: var(--dj-row-height) !important;
    box-sizing: border-box !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Kalender-rader */
#dj-grid .d-row,
.dejour-grid .d-row {
    height: var(--dj-row-height) !important;
    min-height: var(--dj-row-height) !important;
    box-sizing: border-box !important;
}

/* Kalenderceller */
#dj-grid .g-cell,
.dejour-grid .g-cell {
    height: var(--dj-row-height) !important;
    min-height: var(--dj-row-height) !important;
    box-sizing: border-box !important;
}

/* Text i namnlistan ska centreras utan att ändra höjd */
#dj-sidebar .emp-name,
.dejour-sidebar .emp-name {
    display: flex !important;
    align-items: center !important;
}
/* === FIX: DEJOUR-KNAPPAR PÅ MOBIL === */
@media (max-width: 800px) {

    #dejour-view .dejour-toolbar {
        height: auto !important;
        min-height: 42px !important;
        padding: 4px 6px !important;
        gap: 4px !important;
        flex-wrap: wrap !important;
        align-items: center !important;
    }

    #dejour-view .dejour-toolbar > div {
        gap: 4px !important;
        flex-wrap: wrap !important;
    }

    #dejour-view .dj-btn,
    #dejour-view .btn-secondary,
    #btn-edit-mode,
    #btn-add-dejour-employee,
    #btn-dejour-help {
        width: auto !important;
        min-width: auto !important;
        height: 30px !important;
        padding: 4px 8px !important;
        font-size: 12px !important;
        line-height: 1 !important;
        border-radius: 5px !important;
        white-space: nowrap !important;
    }

    /* Specifikt zoom-knapparna */
    #dejour-view button[onclick="app.dejour.zoom(-10)"],
    #dejour-view button[onclick="app.dejour.zoom(10)"] {
        width: 34px !important;
        min-width: 34px !important;
        height: 30px !important;
        padding: 0 !important;
        font-size: 12px !important;
        text-align: center !important;
    }

    /* IDAG och STÄNG lite kompaktare */
    #dejour-view button[onclick="app.dejour.scrollToToday()"],
    #dejour-view .dj-close {
        height: 30px !important;
        padding: 4px 8px !important;
        font-size: 12px !important;
    }

    #dejour-view h2 {
        font-size: 18px !important;
        margin-right: 4px !important;
    }
}
/* === MOBIL: Flytta STÄNG-knappen längst ner i Dejour === */
@media (max-width: 800px) {

    #dejour-view .dj-close {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        bottom: 12px !important;
        z-index: 10080 !important;

        width: calc(100% - 24px) !important;
        height: 42px !important;

        background: #dc2626 !important;
        color: #ffffff !important;
        border: 1px solid #991b1b !important;
        border-radius: 10px !important;

        font-size: 14px !important;
        font-weight: 900 !important;
        padding: 10px 12px !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.35) !important;
    }

    #dejour-view .dj-close:hover {
        background: #b91c1c !important;
    }

    /* Ge kalendern lite extra bottenutrymme så knappen inte täcker sista raden */
    #dejour-view .dejour-container {
        padding-bottom: 58px !important;
    }
}
/* === MOBIL: Kompakt toppmeny === */

.mobile-menu-btn {
    display: none;
}

@media (max-width: 800px) {

    .top-bar {
        padding: 8px 10px !important;
        gap: 8px !important;
    }

    .header-logo {
        height: 58px !important;
        max-width: 100% !important;
        object-fit: contain !important;
    }

    .top-actions {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 8px !important;
    }

    .top-actions #logged-in-user {
        grid-column: 1 / 2;
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--text-main);
    }

    .mobile-menu-btn {
        display: inline-flex !important;
        grid-column: 2 / 3;
        height: 34px !important;
        align-items: center;
        justify-content: center;
        padding: 7px 12px !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
    }

    /* Dölj alla menyknappar på mobil som standard */
    .top-actions > button:not(#btn-mobile-menu),
    .top-actions > a {
        display: none !important;
    }

    /* När menyn är öppen visas knapparna kompakt */
    .top-actions.mobile-menu-open {
        grid-template-columns: 1fr auto;
    }

    .top-actions.mobile-menu-open > button:not(#btn-mobile-menu),
    .top-actions.mobile-menu-open > a {
        display: inline-flex !important;
        width: 100% !important;
        height: 36px !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 7px 10px !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
        line-height: 1 !important;
    }

    .top-actions.mobile-menu-open > button:not(#btn-mobile-menu),
    .top-actions.mobile-menu-open > a {
        grid-column: 1 / -1;
    }

    .top-actions.mobile-menu-open #logged-in-user {
        grid-column: 1 / 2;
    }

    .top-actions.mobile-menu-open #btn-mobile-menu {
        grid-column: 2 / 3;
    }

    /* Gör hjälpknappen tydligare även i mobil */
    .top-actions.mobile-menu-open #btn-main-help {
        background: #facc15 !important;
        color: #111827 !important;
        border: 1px solid #ca8a04 !important;
    }

    /* Installera app ska fortfarande kunna vara hidden */
    .top-actions.mobile-menu-open #btn-install-app.hidden {
        display: none !important;
    }
}
/* === Versionsnummer i toppmenyn === */
.top-version {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    white-space: nowrap;
}

body.light-theme .top-version {
    color: #4b5563;
    background: #f3f4f6;
    border-color: #cbd5e1;
}
/* === Version i toppmeny desktop, inne i hamburgermeny på mobil === */

.top-version {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    white-space: nowrap;
}

body.light-theme .top-version {
    color: #4b5563;
    background: #f3f4f6;
    border-color: #cbd5e1;
}

/* Mobil: dölj versionen tills hamburgermenyn öppnas */
@media (max-width: 800px) {
    .top-actions .top-version {
        display: none !important;
    }

    .top-actions.mobile-menu-open .top-version {
        display: flex !important;
        grid-column: 1 / -1;
        width: 100%;
        height: 32px;
        align-items: center;
        justify-content: center;
        font-size: 0.78rem;
        opacity: 0.85;
        margin-top: 4px;
    }
}
/* === Mobilmeny-knapp: bara på mobil === */
.mobile-menu-btn {
    display: none !important;
}

@media (max-width: 800px) {
    .mobile-menu-btn {
        display: inline-flex !important;
    }
}
/* === Dejour: senast uppdaterad === */

.dejour-last-updated {
    position: absolute;
    left: 12px;
    bottom: 8px;
    z-index: 10020;

    font-size: 12px;
    color: #cbd5e1;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 5px 10px;
    border-radius: 999px;
    pointer-events: none;
    white-space: nowrap;
}

body.light-theme .dejour-last-updated {
    color: #111827;
    background: rgba(255,255,255,0.88);
    border: 1px solid #cbd5e1;
}

@media (max-width: 800px) {
    .dejour-last-updated {
        left: 8px;
        bottom: 60px; /* lämnar plats om STÄNG-knappen ligger längst ner */
        font-size: 11px;
        padding: 4px 8px;
    }
}
/* === Dejour: senast uppdaterad i toolbar === */

.dejour-last-updated {
    position: static !important;
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 2px 8px;
    margin-left: 4px;

    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: #cbd5e1;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    white-space: nowrap;
    pointer-events: none;
}

body.light-theme .dejour-last-updated {
    color: #374151;
    background: rgba(255,255,255,0.75);
    border: 1px solid #cbd5e1;
}

@media (max-width: 800px) {
    .dejour-last-updated {
        width: 100%;
        justify-content: center;
        height: 22px;
        margin-left: 0;
        margin-top: 2px;
        font-size: 10px;
        padding: 2px 6px;
    }
}
/* === Admin: inloggningshistorik === */

.admin-login-history-section {
    margin-top: 10px;
}

.admin-login-history-list {
    max-height: 230px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    padding: 6px;
}

.login-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;

    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 0.9rem;
}

.login-history-item:last-child {
    border-bottom: none;
}

.login-history-item div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.login-history-item strong {
    color: var(--text-main);
}

.login-history-item span {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.login-history-ip {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

body.light-theme .admin-login-history-list {
    background: #ffffff;
    border-color: #d1d5db;
}

body.light-theme .login-history-item {
    border-bottom: 1px solid #e5e7eb;
}
/* === Arbetsordrar === */

.workorder-badge {
    display: inline-flex;
    min-width: 18px;
    height: 18px;
    margin-left: 5px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: white;
    font-size: 0.72rem;
    font-weight: 900;
    align-items: center;
    justify-content: center;
}

.workorders-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.workorders-header h2 {
    margin: 0;
}

.workorders-header p {
    margin-top: 4px;
    color: var(--text-muted);
}

.workorders-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.workorders-tab {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
}

.workorders-tab.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.workorders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.workorder-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-left: 5px solid #6b7280;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.workorder-card.unread {
    border-left-color: #ef4444;
    box-shadow: 0 0 0 1px rgba(239,68,68,0.25), 0 8px 24px rgba(0,0,0,0.18);
}

.workorder-card.priority-låg {
    border-left-color: #6b7280;
}

.workorder-card.priority-normal {
    border-left-color: #3b82f6;
}

.workorder-card.priority-hög {
    border-left-color: #f59e0b;
}

.workorder-card.priority-akut {
    border-left-color: #ef4444;
}

.workorder-card-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.workorder-card h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
}

.workorder-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.workorder-pill {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap;
}

.workorder-description {
    margin: 12px 0;
    white-space: pre-wrap;
    color: var(--text-main);
    line-height: 1.45;
}

.workorder-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.workorder-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.workorder-status-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.workorder-modal-content {
    max-width: 560px;
}

#wo-description {
    min-height: 120px;
}

body.light-theme .workorder-card {
    background: #ffffff;
    border-color: #d1d5db;
}

body.light-theme .workorder-pill,
body.light-theme .workorders-tab {
    background: #f3f4f6;
    color: #111827;
    border-color: #d1d5db;
}

body.light-theme .workorders-tab.active {
    background: var(--accent-blue);
    color: white;
}

@media (max-width: 800px) {
    .workorders-header {
        flex-direction: column;
    }

    .workorders-header .btn-primary {
        width: 100%;
    }

    .workorders-tabs {
        flex-direction: column;
    }

    .workorder-card-top,
    .workorder-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .workorder-actions,
    .workorder-status-actions {
        flex-wrap: wrap;
    }

    .workorder-actions button,
    .workorder-status-actions button {
        flex: 1;
    }
}
/* === Stationsbild / processbild med klickpunkter === */

.station-schematic-section {
    margin-top: 16px;
}

.schematic-upload-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.station-schematic-wrap {
    width: 100%;
    min-height: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.schematic-empty {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    padding: 16px;
}

.schematic-image-stage {
    position: relative;
    width: 100%;
    background: #0f172a;
    cursor: crosshair;
    overflow: hidden;
}

.schematic-image {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

.schematic-points-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.schematic-point {
    position: absolute;
    transform: translate(-50%, -50%);
    min-width: 24px;
    height: 24px;
    padding: 0 7px;

    border-radius: 999px;
    border: 2px solid #ffffff;
    background: #ef4444;
    color: #ffffff;

    font-size: 11px;
    font-weight: 900;
    line-height: 1;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 4px 14px rgba(0,0,0,0.5);
    cursor: pointer;
    pointer-events: auto;
    z-index: 5;
}

.schematic-point span {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schematic-point:hover {
    background: #f59e0b;
    transform: translate(-50%, -50%) scale(1.08);
}

.schematic-point-modal-content {
    max-width: 520px;
}

#schematic-point-info {
    min-height: 130px;
}

body.light-theme .station-schematic-wrap {
    background: #ffffff;
    border-color: #d1d5db;
}

@media (max-width: 800px) {
    .schematic-upload-row {
        flex-direction: column;
        align-items: stretch;
    }

    .schematic-upload-row button {
        width: 100%;
    }

    .schematic-point {
        min-width: 28px;
        height: 28px;
        font-size: 10px;
    }

    .schematic-point span {
        max-width: 90px;
    }
}
/* === Processbild: titelrad + fullscreen === */

.schematic-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.schematic-title-row label {
    margin-bottom: 0 !important;
}

.schematic-fullscreen-modal {
    z-index: 10090 !important;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.86);
    padding: 12px;
}

.schematic-fullscreen-content {
    width: 100%;
    height: 100%;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 80px rgba(0,0,0,0.65);
}

.schematic-fullscreen-toolbar {
    flex-shrink: 0;
    padding: 10px 14px;
    background: #1f2937;
    border-bottom: 1px solid #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.schematic-fullscreen-toolbar h3 {
    margin: 0;
    color: white;
}

.schematic-fullscreen-toolbar p {
    margin: 3px 0 0;
    color: #9ca3af;
    font-size: 0.82rem;
}

.schematic-fullscreen-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.schematic-fullscreen-scroll {
    flex: 1;
    overflow: auto;
    background: #0f172a;
    padding: 14px;
}

.schematic-fullscreen-stage {
    width: 100%;
    min-width: 100%;
}

.schematic-fullscreen-image-stage {
    position: relative;
    width: 100%;
    background: #0f172a;
    cursor: crosshair;
    transform-origin: top left;
}

.schematic-fullscreen-image {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

.schematic-point-fullscreen {
    min-width: 34px;
    height: 34px;
    font-size: 12px;
    border-width: 3px;
}

.schematic-point-fullscreen span {
    max-width: 170px;
}

body.light-theme .schematic-fullscreen-content {
    background: #ffffff;
    border-color: #cbd5e1;
}

body.light-theme .schematic-fullscreen-toolbar {
    background: #f3f4f6;
    border-bottom: 1px solid #cbd5e1;
}

body.light-theme .schematic-fullscreen-toolbar h3 {
    color: #111827;
}

body.light-theme .schematic-fullscreen-toolbar p {
    color: #4b5563;
}

body.light-theme .schematic-fullscreen-scroll,
body.light-theme .schematic-fullscreen-image-stage {
    background: #e5e7eb;
}

@media (max-width: 800px) {
    .schematic-title-row {
        flex-direction: column;
        align-items: stretch;
    }

    .schematic-title-row button {
        width: 100%;
    }

    .schematic-fullscreen-modal {
        padding: 4px;
    }

    .schematic-fullscreen-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 8px;
    }

    .schematic-fullscreen-actions {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 6px;
    }

    .schematic-fullscreen-actions button {
        padding: 8px 6px;
        font-size: 12px;
    }

    .schematic-fullscreen-scroll {
        padding: 8px;
    }

    .schematic-point-fullscreen {
        min-width: 30px;
        height: 30px;
        font-size: 10px;
    }

    .schematic-point-fullscreen span {
        max-width: 110px;
    }
}
/* === FIX: Punkt-popup ska ligga över processbild fullscreen === */

#schematic-point-modal {
    z-index: 10200 !important;
}

#schematic-point-modal .modal-content {
    z-index: 10201 !important;
    position: relative;
}

/* Om du tar bort punkt från fullscreen måste även bekräftelserutan ligga över */
#confirm-modal {
    z-index: 10300 !important;
}

#confirm-modal .modal-content {
    z-index: 10301 !important;
    position: relative;
}

/* Säkerställ att punkterna i fullscreen verkligen går att klicka */
#schematic-fullscreen-points-layer {
    pointer-events: none !important;
}

#schematic-fullscreen-points-layer .schematic-point {
    pointer-events: auto !important;
}

/* Säkerställ att själva fullscreen-bildytan tar emot klick */
.schematic-fullscreen-image-stage {
    position: relative !important;
    cursor: crosshair !important;
}

.schematic-fullscreen-image {
    pointer-events: none !important;
}
/* === Filter för servad / tvättad i stationslistan === */

.service-filter-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    margin: 8px 0 6px;
    padding: 8px;
    background: rgba(255,255,255,0.035);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.service-filter-box label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-main);
    font-size: 0.82rem;
    cursor: pointer;
    white-space: nowrap;
}

.service-filter-box input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

body.light-theme .service-filter-box {
    background: #f9fafb;
    border-color: #d1d5db;
}

body.light-theme .service-filter-box label {
    color: #111827;
}
.service-filter-clear {
    grid-column: 1 / -1;
    width: 100%;
    padding: 6px 8px;
    margin-top: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
}

.service-filter-clear:hover {
    color: white;
    border-color: var(--accent-blue);
}
/* === Räknare + rensa-knapp för servicefilter === */

.service-filter-result-count {
    margin: 4px 0 8px;
    padding: 5px 8px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    background: rgba(255,255,255,0.035);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.service-filter-clear {
    grid-column: 1 / -1;
    width: 100%;
    padding: 6px 8px;
    margin-top: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
}

.service-filter-clear:hover {
    color: white;
    border-color: var(--accent-blue);
}

body.light-theme .service-filter-result-count {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #4b5563;
}
/* === Service & Utrustning: håll X-knappen på sidan även på mobil === */

.equipment-field-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.equipment-field-row input {
    min-width: 0;
}

.equipment-field-remove {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: rgba(239, 68, 68, 0.14);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 8px;
    font-weight: 900;
    flex-shrink: 0;
}

.equipment-field-remove:hover {
    background: #ef4444;
    color: white;
}

/* Mobil: namn + status får plats, X ligger kvar till höger */
@media (max-width: 800px) {
    .equipment-field-row {
        grid-template-columns: minmax(0, 1fr) 34px;
        grid-template-areas:
            "name remove"
            "status remove";
    }

    .equipment-field-name {
        grid-area: name;
    }

    .equipment-field-status {
        grid-area: status;
    }

    .equipment-field-remove {
        grid-area: remove;
        align-self: stretch;
        height: auto;
        min-height: 72px;
    }
}
/* === Fastighetspumpstationer === */

.dot.fastighet {
    background: #a855f7;
}

#filter-fastighet.active {
    background-color: #a855f7;
    border-color: #a855f7;
    color: white;
}

@media (max-width: 800px) {
    #station-filter-group {
        grid-template-columns: 1fr 1fr;
    }

    #filter-fastighet {
        grid-column: 1 / -1;
    }
}
.filter-group {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

@media (max-width: 800px) {
    .filter-group {
        grid-template-columns: 1fr 1fr;
    }
}
/* === Filterknappar: bättre text på mobil === */

.filter-btn {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-count {
    margin-left: 6px;
    flex-shrink: 0;
}

#station-filter-group {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

@media (max-width: 800px) {
    #station-filter-group {
        grid-template-columns: 1fr 1fr;
    }

    #filter-fastighet {
        grid-column: 1 / -1;
    }
}
/* === Karta: klickbart stationsnamn i popup === */

.map-station-popup {
    min-width: 180px;
    font-family: inherit;
}

.map-station-name-btn {
    display: block;
    width: 100%;
    padding: 8px 10px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 800;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.map-station-name-btn:hover {
    background: #1d4ed8;
}

.map-station-popup-type {
    margin-top: 6px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
}
/* === Google Maps-länk under stationskartan === */

.station-google-maps-link-wrap {
    margin-top: 12px;
    margin-bottom: 14px;
}

.station-google-maps-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 10px 16px;
    border-radius: 10px;

    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff !important;

    font-weight: 800;
    font-size: 15px;
    text-decoration: none;

    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28);
}

.station-google-maps-link:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
}

@media (max-width: 800px) {
    .station-google-maps-link {
        width: 100%;
        padding: 12px 14px;
        font-size: 16px;
    }
}
/* === Mobil: dölj sök/filter för stationer bakom knapp === */

.mobile-station-filter-toggle {
    display: none;
}

.mobile-station-filter-content {
    display: block;
}

@media (max-width: 800px) {
    .mobile-station-filter-toggle {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;

        margin: 12px 0;
        padding: 12px 14px;

        border-radius: 12px;
        border: 1px solid var(--border-color, #374151);
        background: var(--card-bg, #1f2937);
        color: var(--text-main, #ffffff);

        font-size: 16px;
        font-weight: 800;
        cursor: pointer;
    }

    .mobile-station-filter-toggle.open {
        background: #2563eb;
        color: white;
        border-color: #2563eb;
    }

    .mobile-filter-arrow {
        font-size: 18px;
        font-weight: 900;
    }

    .mobile-station-filter-content {
        display: none;
    }

    .mobile-station-filter-content.open {
        display: block;
        animation: mobileFilterSlideDown 0.18s ease-out;
    }

    @keyframes mobileFilterSlideDown {
        from {
            opacity: 0;
            transform: translateY(-6px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}
/* === Mobil: modernare Servad / Tvättad i stationsbilden === */

@media (max-width: 800px) {

    /* Själva checkbox-raderna i servicekortet */
    .service-card label,
    #station-details label {
        font-size: 18px;
        font-weight: 800;
        color: var(--text-main);
    }

    /* Gör vanliga checkboxar större */
    #d-servad,
    #d-tvattad {
        width: 26px;
        height: 26px;
        min-width: 26px;
        accent-color: #3b82f6;
        cursor: pointer;
        transform: translateY(3px);
    }

    /* Om labeln ligger nära checkboxen */
    #d-servad + span,
    #d-tvattad + span {
        font-size: 18px;
        font-weight: 800;
    }

    /* Gör området runt servad/tvättad luftigare */
    .service-checks,
    .service-checkboxes,
    .checkbox-row {
        gap: 14px;
        margin-top: 18px;
        margin-bottom: 14px;
    }

    /* Fallback: om checkboxarna ligger direkt i servicekortet */
    #d-servad,
    #d-tvattad {
        margin-right: 10px;
        margin-bottom: 12px;
    }

    /* Datumfältet under blir också snyggare */
    #d-service-date {
        min-height: 48px;
        font-size: 16px;
        border-radius: 10px;
        padding: 10px 12px;
    }
}
/* === Mobil: gör Servad / Tvättad som stora touch-rader === */

@media (max-width: 800px) {

    #d-servad,
    #d-tvattad {
        appearance: none;
        -webkit-appearance: none;

        width: 30px;
        height: 30px;
        border-radius: 9px;

        border: 2px solid #475569;
        background: #1f2937;

        display: inline-grid;
        place-content: center;

        margin-right: 12px;
        vertical-align: middle;
    }

    #d-servad:checked,
    #d-tvattad:checked {
        background: #3b82f6;
        border-color: #60a5fa;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.22);
    }

    #d-servad:checked::after,
    #d-tvattad:checked::after {
        content: "✓";
        color: white;
        font-size: 22px;
        font-weight: 900;
        line-height: 1;
    }
}
/* === Snyggare filuppladdning: Välj fil / Välj filer === */

input[type="file"] {
    width: 100%;
    max-width: 100%;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-muted, #cbd5e1);
    font-size: 14px;
    cursor: pointer;
}

/* Chrome / Edge / Safari */
input[type="file"]::file-selector-button {
    margin-right: 14px;
    padding: 10px 16px;

    border: none;
    border-radius: 10px;

    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;

    font-weight: 800;
    font-size: 14px;

    cursor: pointer;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
    transition: 0.15s ease;
}

input[type="file"]::file-selector-button:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
}

/* Äldre WebKit fallback */
input[type="file"]::-webkit-file-upload-button {
    margin-right: 14px;
    padding: 10px 16px;

    border: none;
    border-radius: 10px;

    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;

    font-weight: 800;
    font-size: 14px;

    cursor: pointer;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

/* Mobil */
@media (max-width: 800px) {
    input[type="file"] {
        padding: 12px;
        font-size: 15px;
        border-radius: 14px;
    }

    input[type="file"]::file-selector-button {
        display: block;
        width: 100%;
        margin: 0 0 10px 0;
        padding: 13px 16px;
        font-size: 16px;
        border-radius: 12px;
        text-align: center;
    }

    input[type="file"]::-webkit-file-upload-button {
        display: block;
        width: 100%;
        margin: 0 0 10px 0;
        padding: 13px 16px;
        font-size: 16px;
        border-radius: 12px;
        text-align: center;
    }
}
/* === Processbild-knappar: Öppna stor bild / Ladda upp processbild === */

.process-image-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 42px;
    padding: 10px 16px;

    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.25);

    font-size: 14px;
    font-weight: 900;
    line-height: 1.1;
    cursor: pointer;

    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.process-image-btn:hover {
    transform: translateY(-1px);
}

.process-image-btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.process-image-btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.process-image-btn-secondary {
    background: rgba(30, 41, 59, 0.95);
    color: #ffffff;
    border-color: rgba(148, 163, 184, 0.32);
}

.process-image-btn-secondary:hover {
    background: rgba(51, 65, 85, 0.95);
}

/* Om knapparna ligger bredvid filväljaren */
.schematic-actions,
.process-image-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 12px;
}

/* Mobil */
@media (max-width: 800px) {
    .process-image-btn {
        width: 100%;
        min-height: 48px;
        padding: 13px 16px;
        font-size: 16px;
        border-radius: 14px;
    }

    .schematic-actions,
    .process-image-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }
}
/* === Röd processbild-knapp: Ta bort processbild === */

.process-image-btn-danger {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: #ffffff;
    border-color: rgba(248, 113, 113, 0.45);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.25);
}

.process-image-btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c, #7f1d1d);
}
/* === Modern Ladda upp-knapp === */

.upload-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 42px;
    padding: 10px 18px;

    border: none;
    border-radius: 12px;

    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;

    font-size: 14px;
    font-weight: 900;
    line-height: 1.1;

    cursor: pointer;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.upload-action-btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
}

.upload-action-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Mobil */
@media (max-width: 800px) {
    .upload-action-btn {
        width: 100%;
        min-height: 50px;
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 14px;
    }
}
/* === Permanent info / bilder / processbild: snyggare knapp-layout === */

/* Gör området runt bilder och processbild mer kompakt på PC */
@media (min-width: 801px) {

    /* Vanliga uppladdningsknappen för bilder */
    .upload-action-btn {
        width: auto !important;
        min-height: 38px;
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 10px;
    }

    /* Processbild-knappar */
    .process-image-btn {
        width: auto !important;
        min-height: 38px;
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 10px;
    }

    /* Lägg processbild-knapparna snyggt i rad */
    .process-image-actions,
    .schematic-actions {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        margin-top: 8px;
        margin-bottom: 14px;
    }

    /* Gör inte filväljaren för bred på PC */
    input[type="file"] {
        max-width: 520px;
    }

    /* Bild-uppladdning: knapp under filväljare men inte enorm */
    #photo-upload-btn {
        margin-top: 10px;
        max-width: 240px;
    }

    /* Processbildens uppladdningsknapp */
    button[onclick="app.uploadStationSchematic()"] {
        max-width: 240px;
    }

    /* Öppna stor bild-knappen */
    button[onclick="app.openSchematicFullscreen()"] {
        max-width: 220px;
    }

    /* Ta bort processbild */
    button[onclick="app.deleteStationSchematic()"] {
        max-width: 230px;
    }
}
@media (min-width: 801px) {
    .process-image-actions {
        justify-content: flex-start;
        max-width: 560px;
    }

    .process-image-actions .process-image-btn {
        flex: 0 0 auto;
    }
}
/* === Kompaktare knappar i Permanent Info / Bilder / Processbild === */

/* Filväljaren */
#photo-upload,
#schematic-upload,
input[type="file"] {
    padding: 8px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
}

/* Själva "Välj filer"-knappen */
#photo-upload::file-selector-button,
#schematic-upload::file-selector-button,
input[type="file"]::file-selector-button {
    width: auto !important;
    min-width: 120px !important;
    max-width: 180px !important;

    min-height: 34px !important;
    padding: 7px 12px !important;

    font-size: 13px !important;
    font-weight: 800 !important;
    border-radius: 9px !important;

    margin-right: 10px !important;
}

/* Safari/äldre Chrome fallback */
#photo-upload::-webkit-file-upload-button,
#schematic-upload::-webkit-file-upload-button,
input[type="file"]::-webkit-file-upload-button {
    width: auto !important;
    min-width: 120px !important;
    max-width: 180px !important;

    min-height: 34px !important;
    padding: 7px 12px !important;

    font-size: 13px !important;
    font-weight: 800 !important;
    border-radius: 9px !important;

    margin-right: 10px !important;
}

/* Alla blå/röda/mörka uppladdnings- och processbildsknappar */
.upload-action-btn,
.process-image-btn,
.station-google-maps-link,
button[onclick="app.uploadPhotos()"],
button[onclick="app.openSchematicFullscreen()"],
button[onclick="app.uploadStationSchematic()"],
button[onclick="app.deleteStationSchematic()"] {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;

    min-height: 34px !important;
    padding: 7px 12px !important;

    font-size: 13px !important;
    font-weight: 800 !important;
    border-radius: 9px !important;
    gap: 6px !important;

    line-height: 1.1 !important;
}

/* Specifikt: Ladda upp bilder */
#photo-upload-btn {
    width: auto !important;
    max-width: 210px !important;
}

/* Processbild-knapparna i snygg rad */
.process-image-actions,
.schematic-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;

    margin-top: 8px !important;
    margin-bottom: 10px !important;
}

/* Mobil: fortfarande tryckbara men mindre än nu */
@media (max-width: 800px) {
    #photo-upload,
    #schematic-upload,
    input[type="file"] {
        padding: 9px !important;
        font-size: 13px !important;
    }

    #photo-upload::file-selector-button,
    #schematic-upload::file-selector-button,
    input[type="file"]::file-selector-button,
    #photo-upload::-webkit-file-upload-button,
    #schematic-upload::-webkit-file-upload-button,
    input[type="file"]::-webkit-file-upload-button {
        width: auto !important;
        min-width: 130px !important;
        max-width: 190px !important;

        min-height: 36px !important;
        padding: 8px 13px !important;

        font-size: 14px !important;
        border-radius: 10px !important;
        margin-right: 8px !important;
        margin-bottom: 0 !important;
    }

    .upload-action-btn,
    .process-image-btn,
    .station-google-maps-link,
    button[onclick="app.uploadPhotos()"],
    button[onclick="app.openSchematicFullscreen()"],
    button[onclick="app.uploadStationSchematic()"],
    button[onclick="app.deleteStationSchematic()"] {
        width: auto !important;
        min-height: 38px !important;
        padding: 8px 13px !important;
        font-size: 14px !important;
        border-radius: 10px !important;
    }

    .process-image-actions,
    .schematic-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
}
/* === Status/anteckning som textarea, stoppar lösenordsförslag bättre === */

.equipment-field-status {
    width: 100%;
    min-height: 42px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.35;
}

@media (max-width: 800px) {
    .equipment-field-status {
        min-height: 58px;
        font-size: 16px;
    }
}
/* ==========================================================
   FIX: Service och annan information - tydlig prioritet i ljust läge
   Dina klasser är: priority-Hög / priority-Normal / priority-Låg
   ========================================================== */

/* Grund: alla service-info-rader */
body.light-theme .reminder-item {
    color: #111827 !important;
    border: 1px solid #d1d5db !important;
    border-left-width: 6px !important;
    border-left-style: solid !important;
}

/* HÖG prioritet */
body.light-theme .reminder-item.priority-Hög {
    background: #fff1f2 !important;
    border-left-color: #dc2626 !important;
}

/* NORMAL prioritet */
body.light-theme .reminder-item.priority-Normal {
    background: #eff6ff !important;
    border-left-color: #2563eb !important;
}

/* LÅG prioritet */
body.light-theme .reminder-item.priority-Låg {
    background: #f0fdf4 !important;
    border-left-color: #16a34a !important;
}

/* Text inne i raderna */
body.light-theme .reminder-item span {
    color: #111827 !important;
}

/* Datum/taggar */
body.light-theme .reminder-item .reminder-date,
body.light-theme .reminder-item .reminder-tag {
    color: #374151 !important;
}

/* Kryssknappen */
body.light-theme .reminder-item button {
    color: #dc2626 !important;
}
/* ==========================================================
   Mörkt läge - tydligare färger på prioritet
   ========================================================== */

body:not(.light-theme) .reminder-item.priority-Hög {
    border-left: 6px solid #ef4444 !important;
}

body:not(.light-theme) .reminder-item.priority-Normal {
    border-left: 6px solid #3b82f6 !important;
}

body:not(.light-theme) .reminder-item.priority-Låg {
    border-left: 6px solid #22c55e !important;
}
.station-map-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

@media (max-width: 800px) {
    .station-map-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .station-map-actions button {
        width: 100%;
    }
}
/* === Knappar för stationsposition/karta === */

.station-map-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

/* Alla knappar i kart-position-raden */
.station-map-actions button,
button[onclick="app.enableStationPinPlacement()"],
button[onclick="app.setStationCoordinatesManual()"],
#btn-remove-pin {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    min-height: 34px !important;
    padding: 7px 12px !important;

    border-radius: 8px !important;
    border: 1px solid #334155 !important;

    background: #e5e7eb !important;
    color: #111827 !important;

    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;

    cursor: pointer !important;
    box-shadow: none !important;
}

/* Hover */
.station-map-actions button:hover,
button[onclick="app.enableStationPinPlacement()"]:hover,
button[onclick="app.setStationCoordinatesManual()"]:hover,
#btn-remove-pin:hover {
    background: #d1d5db !important;
}

/* Ta bort-position ska fortfarande vara röd text om du vill */
#btn-remove-pin {
    color: #dc2626 !important;
}

/* Mörkt läge */
body:not(.light-theme) .station-map-actions button,
body:not(.light-theme) button[onclick="app.enableStationPinPlacement()"],
body:not(.light-theme) button[onclick="app.setStationCoordinatesManual()"],
body:not(.light-theme) #btn-remove-pin {
    background: #1f2937 !important;
    color: #ffffff !important;
    border-color: #475569 !important;
}

body:not(.light-theme) .station-map-actions button:hover,
body:not(.light-theme) button[onclick="app.enableStationPinPlacement()"]:hover,
body:not(.light-theme) button[onclick="app.setStationCoordinatesManual()"]:hover,
body:not(.light-theme) #btn-remove-pin:hover {
    background: #334155 !important;
}

body:not(.light-theme) #btn-remove-pin {
    color: #f87171 !important;
}

/* Mobil */
@media (max-width: 800px) {
    .station-map-actions {
        gap: 7px;
    }

    .station-map-actions button,
    button[onclick="app.enableStationPinPlacement()"],
    button[onclick="app.setStationCoordinatesManual()"],
    #btn-remove-pin {
        min-height: 36px !important;
        padding: 8px 11px !important;
        font-size: 13px !important;
        border-radius: 8px !important;
    }
}
/* ==========================================================
   FIX: Mobilknapp "Sök och filtrera stationer" i ljust läge
   ========================================================== */

body.light-theme .mobile-station-filter-toggle {
    background: #ffffff !important;
    color: #111827 !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08) !important;
}

body.light-theme .mobile-station-filter-toggle span {
    color: #111827 !important;
}

/* När den är öppen ska den fortfarande vara blå */
body.light-theme .mobile-station-filter-toggle.open {
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #2563eb !important;
}

body.light-theme .mobile-station-filter-toggle.open span {
    color: #ffffff !important;
}

/* Pilen */
body.light-theme .mobile-station-filter-toggle .mobile-filter-arrow {
    color: #111827 !important;
}

body.light-theme .mobile-station-filter-toggle.open .mobile-filter-arrow {
    color: #ffffff !important;
}
/* ==========================================================
   Kalender: årval, veckonummer och tydligare veckogrupper
   ========================================================== */

.dj-year-select {
    height: 32px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #475569;
    background: #111827;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

body.light-theme .dj-year-select {
    background: #ffffff;
    color: #111827;
    border-color: #94a3b8;
}

/* Veckonummer i datumraden */
#dj-header .date-cell .week-number,
.dejour-header .date-cell .week-number {
    display: block;
    min-height: 11px;
    font-size: 9px;
    line-height: 10px;
    font-weight: 900;
    color: #facc15;
    margin-bottom: 1px;
}

body.light-theme #dj-header .date-cell .week-number,
body.light-theme .dejour-header .date-cell .week-number {
    color: #b45309;
}

#dj-header .date-cell .week-number.empty,
.dejour-header .date-cell .week-number.empty {
    opacity: 0;
}

/* Tydlig start på varje vecka: måndag */
#dj-header .date-cell.week-start,
#dj-grid .g-cell.week-start {
    border-left: 3px solid #facc15 !important;
}

/* Tydlig slutkant på varje vecka: söndag */
#dj-header .date-cell.week-end,
#dj-grid .g-cell.week-end {
    border-right: 3px solid #facc15 !important;
}

/* Lite skugga/ram runt veckorna */
#dj-header .date-cell.week-start,
#dj-grid .g-cell.week-start {
    box-shadow: inset 2px 0 0 rgba(250, 204, 21, 0.35);
}

body.light-theme #dj-header .date-cell.week-start,
body.light-theme #dj-grid .g-cell.week-start {
    border-left-color: #f59e0b !important;
    box-shadow: inset 2px 0 0 rgba(245, 158, 11, 0.28);
}

body.light-theme #dj-header .date-cell.week-end,
body.light-theme #dj-grid .g-cell.week-end {
    border-right-color: #f59e0b !important;
}

/* Dagar utanför valt år, t.ex. sista dagarna från föregående år */
#dj-header .date-cell.outside-year,
#dj-grid .g-cell.outside-year {
    opacity: 0.45;
}

body.light-theme #dj-header .date-cell.outside-year,
body.light-theme #dj-grid .g-cell.outside-year {
    background: #e5e7eb !important;
    opacity: 0.55;
}

/* Mobil */
@media (max-width: 800px) {
    .dj-year-select {
        height: 30px;
        padding: 4px 7px;
        font-size: 12px;
        border-radius: 5px;
    }

    #dj-header .date-cell .week-number,
    .dejour-header .date-cell .week-number {
        font-size: 8px;
        line-height: 9px;
    }

    #dj-header .date-cell.week-start,
    #dj-grid .g-cell.week-start {
        border-left-width: 2px !important;
    }

    #dj-header .date-cell.week-end,
    #dj-grid .g-cell.week-end {
        border-right-width: 2px !important;
    }
}
/* ==========================================================
   FIX: Dejour kalender - visa toolbar-knappar + år dropdown rätt
   ========================================================== */

.dejour-toolbar,
.dj-toolbar,
#dejour-toolbar {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
}

/* År-dropdown ska inte ta hela raden */
#dejour-year-select,
.dj-year-select {
    width: auto !important;
    min-width: 90px !important;
    max-width: 120px !important;
    height: 32px !important;
    flex: 0 0 auto !important;

    padding: 4px 10px !important;
    border-radius: 6px !important;
    border: 1px solid #94a3b8 !important;

    background: #ffffff !important;
    color: #111827 !important;

    font-size: 13px !important;
    font-weight: 800 !important;
}

/* Alla kalenderknappar ska ligga kvar i samma rad */
.dejour-toolbar button,
.dj-toolbar button,
#dejour-toolbar button {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
}

/* Om kalendern ligger i en topbar */
.dejour-topbar,
.dj-topbar,
.calendar-toolbar {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
}

/* Mörkt läge */
body:not(.light-theme) #dejour-year-select,
body:not(.light-theme) .dj-year-select {
    background: #111827 !important;
    color: #ffffff !important;
    border-color: #475569 !important;
}
/* ==========================================================
   Kalender: visa veckor tydligt UTAN att förstöra blå/gröna rutor
   ========================================================== */

/* 1. Nollställ veckolinjer i själva rutnätet */
#dj-grid .g-cell.week-start,
#dj-grid .g-cell.week-end,
#dj-grid .g-cell {
    border-left: 1px solid #cbd5e1 !important;
    border-right: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Mörkt läge för rutnätet */
body:not(.light-theme) #dj-grid .g-cell.week-start,
body:not(.light-theme) #dj-grid .g-cell.week-end,
body:not(.light-theme) #dj-grid .g-cell {
    border-left: 1px solid #475569 !important;
    border-right: 1px solid #475569 !important;
    box-shadow: none !important;
    outline: none !important;
}

/* 2. Veckorna syns i datumraden/headern */
#dj-header .date-cell {
    position: relative !important;
}

/* Måndag = början på vecka */
#dj-header .date-cell.week-start {
    border-left: 3px solid #f59e0b !important;
    background: #fff7ed !important;
}

/* Söndag = slut på vecka */
#dj-header .date-cell.week-end {
    border-right: 3px solid #f59e0b !important;
    background: #fff7ed !important;
}

/* Alla dagar i headern får lite mjuk vecka-känsla */
#dj-header .date-cell {
    border-top: 2px solid rgba(245, 158, 11, 0.35) !important;
    border-bottom: 2px solid rgba(245, 158, 11, 0.35) !important;
}

/* Veckonummer tydligare */
#dj-header .date-cell .week-number {
    display: block !important;
    font-size: 9px !important;
    font-weight: 900 !important;
    color: #c2410c !important;
}

/* Mörkt läge */
body:not(.light-theme) #dj-header .date-cell.week-start,
body:not(.light-theme) #dj-header .date-cell.week-end {
    background: rgba(245, 158, 11, 0.14) !important;
}

body:not(.light-theme) #dj-header .date-cell {
    border-top: 2px solid rgba(245, 158, 11, 0.45) !important;
    border-bottom: 2px solid rgba(245, 158, 11, 0.45) !important;
}

body:not(.light-theme) #dj-header .date-cell .week-number {
    color: #facc15 !important;
}
/* ==========================================================
   Dejour grön period: mjuk transparent -> grön övergång
   ========================================================== */

/* Vanlig helgrön dejour */
#dj-grid .g-cell.active:not(.type-vacation):not(.type-other) {
    background: #35b779 !important;
}

/* Första gröna dejourdagen:
   börjar svagt och går mjukt till helt grönt */
#dj-grid .g-cell.active:not(.type-vacation):not(.type-other):not(.active + .active) {
    background: linear-gradient(
        to right,
        rgba(53, 183, 121, 0.18) 0%,
        rgba(53, 183, 121, 0.35) 20%,
        rgba(53, 183, 121, 0.65) 45%,
        rgba(53, 183, 121, 0.88) 70%,
        #35b779 100%
    ) !important;
}

/* Sista gröna dejourdagen:
   börjar helt grön och tonar ut mjukt */
#dj-grid .g-cell.active:not(.type-vacation):not(.type-other):not(:has(+ .g-cell.active:not(.type-vacation):not(.type-other))) {
    background: linear-gradient(
        to right,
        #35b779 0%,
        rgba(53, 183, 121, 0.88) 30%,
        rgba(53, 183, 121, 0.65) 55%,
        rgba(53, 183, 121, 0.35) 80%,
        rgba(53, 183, 121, 0.18) 100%
    ) !important;
}

/* Om dejour bara är en enda dag */
#dj-grid .g-cell.active:not(.type-vacation):not(.type-other):not(.active + .active):not(:has(+ .g-cell.active:not(.type-vacation):not(.type-other))) {
    background: linear-gradient(
        to right,
        rgba(53, 183, 121, 0.18) 0%,
        rgba(53, 183, 121, 0.55) 25%,
        #35b779 50%,
        rgba(53, 183, 121, 0.55) 75%,
        rgba(53, 183, 121, 0.18) 100%
    ) !important;
}
/* ==========================================================
   Print / PDF för dejourkalender
   ========================================================== */

@media print {
    @page {
        size: A4 landscape;
        margin: 8mm;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
    }

    body.printing-dejour * {
        visibility: hidden !important;
    }

    body.printing-dejour #dejour-modal,
    body.printing-dejour #dejour-modal *,
    body.printing-dejour .dejour-modal,
    body.printing-dejour .dejour-modal *,
    body.printing-dejour #dejour-view,
    body.printing-dejour #dejour-view *,
    body.printing-dejour .dejour-calendar,
    body.printing-dejour .dejour-calendar *,
    body.printing-dejour .dejour-timeline,
    body.printing-dejour .dejour-timeline * {
        visibility: visible !important;
    }

    body.printing-dejour #dejour-modal,
    body.printing-dejour .dejour-modal,
    body.printing-dejour #dejour-view {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        background: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    /* Dölj knappar vid utskrift */
    body.printing-dejour .dejour-toolbar,
    body.printing-dejour .dj-toolbar,
    body.printing-dejour #dejour-toolbar,
    body.printing-dejour .modal-close,
    body.printing-dejour .dj-btn,
    body.printing-dejour button {
        display: none !important;
    }

    /* Kalendern ska få använda hela sidan */
    body.printing-dejour .dejour-timeline {
        overflow: visible !important;
        width: 100% !important;
        max-width: none !important;
    }

    body.printing-dejour #dj-header,
    body.printing-dejour #dj-grid {
        overflow: visible !important;
    }

    /* Gör celler lite mindre så mer får plats */
    body.printing-dejour .date-cell,
    body.printing-dejour .g-cell {
        min-width: 22px !important;
        width: 22px !important;
        max-width: 22px !important;
        height: 24px !important;
        font-size: 8px !important;
        padding: 1px !important;
        box-sizing: border-box !important;
    }

    body.printing-dejour .name-cell,
    body.printing-dejour .employee-name,
    body.printing-dejour .dj-name-cell {
        min-width: 120px !important;
        width: 120px !important;
        max-width: 120px !important;
        font-size: 10px !important;
        font-weight: 700 !important;
    }

    body.printing-dejour .week-number {
        font-size: 7px !important;
    }

    /* Bevara färger i PDF/print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
/* ==========================================================
   SLUTGILTIG FIX: Dejour i mobil-landscape
   Toolbar får egen fast rad, kalendern börjar under den
   ========================================================== */

@media (orientation: landscape) and (max-height: 650px) {

    #dejour-view {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        overflow: hidden !important;
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Toolbar högst upp som egen rad */
    #dejour-view .dejour-toolbar {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;

        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;

        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;

        gap: 6px !important;
        padding: 5px 8px !important;

        overflow-x: auto !important;
        overflow-y: hidden !important;
        white-space: nowrap !important;

        background: #262626 !important;
        border-bottom: 1px solid #404040 !important;

        z-index: 5000 !important;
    }

    /* Alla element i toolbaren ska ligga i en horisontell rad */
    #dejour-view .dejour-toolbar > * {
        flex: 0 0 auto !important;
    }

    #dejour-view .dejour-toolbar h1,
    #dejour-view .dejour-toolbar h2 {
        font-size: 18px !important;
        line-height: 1 !important;
        margin: 0 4px 0 0 !important;
        white-space: nowrap !important;
    }

    #dejour-view .dejour-toolbar button,
    #dejour-view .dejour-toolbar select,
    #dejour-view .dj-btn,
    #dejour-year-select {
        width: auto !important;
        min-width: auto !important;
        max-width: none !important;

        height: 34px !important;
        min-height: 34px !important;
        max-height: 34px !important;

        padding: 5px 8px !important;
        font-size: 12px !important;
        line-height: 1 !important;

        white-space: nowrap !important;
        flex: 0 0 auto !important;
    }

    /* Kalenderområdet börjar alltid under toolbaren */
    #dejour-view .dejour-container {
        position: absolute !important;
        top: 48px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;

        height: auto !important;
        min-height: 0 !important;

        display: flex !important;
        overflow: hidden !important;

        padding: 0 !important;
        margin: 0 !important;
    }

    /* Namnspalten ska börja under datumraden, inte under toolbaren */
    #dejour-view .dejour-sidebar {
        width: 170px !important;
        min-width: 170px !important;
        max-width: 170px !important;
        flex: 0 0 170px !important;

        margin-top: 50px !important;
        height: auto !important;
        overflow: hidden !important;
    }

    /* Själva kalendern */
    #dejour-view .dejour-timeline {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        min-height: 0 !important;
        height: auto !important;

        overflow: auto !important;
        position: relative !important;
    }

    /* Datumraden ligger bara inne i kalendern */
    #dejour-view .dejour-header,
    #dejour-view #dj-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;

        height: 50px !important;
        min-height: 50px !important;

        background: #262626 !important;
    }

    body.light-theme #dejour-view .dejour-toolbar,
    body.light-theme #dejour-view .dejour-header,
    body.light-theme #dejour-view #dj-header {
        background: #ffffff !important;
        color: #111827 !important;
    }

    /* Stäng-knappen ska inte ligga över kalendern */
    #dejour-view .dj-close,
    #dejour-view .dj-btn-close {
        position: static !important;
        margin-left: auto !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        width: auto !important;
    }
}
/* ==========================================================
   FIX: Stäng-knappen fungerar i dejour landscape
   ========================================================== */

/* Alltid: om dejour-view har hidden ska den vara helt borta */
#dejour-view.hidden,
body #dejour-view.hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Extra hårt för telefon i landscape */
@media (orientation: landscape) and (max-height: 650px) {
    #dejour-view.hidden,
    body #dejour-view.hidden {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}
/* ==========================================================
   FIX: Huvudsidan ska kunna scrolla i telefon-landscape
   Gäller INTE dejour-kalendern och INTE kart-fullscreen
   ========================================================== */

@media (orientation: landscape) and (max-height: 650px) {

    /* Huvudsidan får scrolla i landscape */
    body:not(.no-scroll):not(.dejour-open) {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    #app-container {
        height: auto !important;
        min-height: 100vh !important;
        overflow: visible !important;
    }

    .main-layout {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .content-area {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .view-section {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding-bottom: 80px !important;
    }

    .sidebar-left,
    .sidebar-right {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        position: static !important;
    }

    .station-list {
        height: 300px !important;
        max-height: 300px !important;
        overflow-y: auto !important;
    }

    .details-grid {
        grid-template-columns: 1fr !important;
    }

    /* Toppen ska inte låsa sidan */
    .top-bar {
        position: static !important;
        height: auto !important;
        flex-shrink: 0 !important;
    }

    .top-actions {
        flex-wrap: wrap !important;
    }
}
/* ==========================================================
   Comsel-länk i topbaren
   ========================================================== */

.top-comsel-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 8px 12px;
    border-radius: 4px;

    background: var(--bg-card);
    color: #ffffff !important;
    border: 1px solid var(--border-color);

    font-weight: 800;
    font-size: 14px;
    text-decoration: none;

    white-space: nowrap;
    cursor: pointer;
}

.top-comsel-link:hover {
    background: #3a404d;
}

/* Ljust läge */
body.light-theme .top-comsel-link {
    background: #ffffff;
    color: #111827 !important;
    border-color: #cbd5e1;
}

body.light-theme .top-comsel-link:hover {
    background: #e5e7eb;
}

/* Mobil: göm den från topbaren så den inte gör menyn för trång */
@media (max-width: 800px) {
    .top-comsel-link {
        display: none !important;
    }
}