/* ── Print helpers ─────────────────────────────────────────────────────── */
.no-print { }
.print-only { display: none !important; }

@media print {
    /* Dölj navigation, appbar, knappar */
    .mud-appbar,
    .mud-drawer,
    .mud-overlay,
    .no-print { display: none !important; }

    /* Visa print-header */
    .print-only { display: block !important; }

    /* Nollställ marginaler */
    body { background: #fff !important; margin: 0 !important; }
    .mud-main-content { padding: 0 !important; }

    /* Diagram – tillåt sidbrytning */
    .mud-paper { break-inside: avoid; box-shadow: none !important; border: 1px solid #eee !important; }
    .mud-grid { break-inside: avoid; }

    /* KPI-kort mer kompakta */
    .rpt-kpi { padding: 8px 12px !important; }

    /* Tabeller – visa fulla utan scroll */
    .mud-table-container { overflow: visible !important; max-height: none !important; height: auto !important; }
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    font-family: 'Roboto', Arial, 'Segoe UI', sans-serif;
    font-size: 14px;
    background: #f4f4f4;
}

/* ── MudBlazor layout fixes ───────────────────────────────────────────── */
.mud-main-content { overflow-y: auto; }

/* ── AppBar – guldton shadow ─────────────────────────────────────────── */
.mud-appbar {
    box-shadow: 0 2px 8px rgba(0,0,0,.18) !important;
    border-bottom: 2px solid hsl(43,98%,38%) !important;
}
.mud-appbar .mud-button-root:hover {
    background: rgba(0,0,0,.1) !important;
    border-radius: 4px;
}

/* ── Mobile Navigation Toggle ───────────────────────────────────────────── */
/* Desktop - visa bara desktop-nav */
.mobile-menu-btn {
    display: none !important;
}
.desktop-nav {
    display: flex !important;
    align-items: center;
    gap: 2px;
}
.desktop-emoji {
    display: inline-block !important;
    font-size: 2rem;
    line-height: 1;
}
.app-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.title-wrapper {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.title-main {
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #1a1a1a;
}
.title-sub {
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 1.4px;
    color: #3a3a3a;
    text-transform: uppercase;
}
.main-appbar {
    min-height: 64px !important;
}
.nav-btn {
    font-family: 'Roboto', Arial, sans-serif !important;
    font-weight: 700 !important;
    font-size: 0.88rem !important;
    letter-spacing: 0.5px !important;
    color: #1a1a1a !important;
    min-width: 0 !important;
    padding: 6px 14px !important;
}
.nav-divider {
    width: 1px;
    height: 28px;
    background: rgba(0, 0, 0, 0.25);
    margin: 0 6px;
}
.mobile-drawer {
    width: 280px;
}

/* ══════════════════════════════════════════════════════════════════════════
   MACHINE PANEL – omdesignad maskinväljare
══════════════════════════════════════════════════════════════════════════ */

/* Yttre panel-behållare */
.machine-panel {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

/* Status-strip överst i panelen */
.msel-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: 0.84rem;
    border-bottom: 1px solid #f0f4f8;
    min-height: 36px;
}
.msel-idle {
    background: #f8f9fb;
    color: #8a94a6;
}
.msel-idle-icon { font-size: 0.9rem; opacity: 0.6; }
.msel-idle-text { font-size: 0.83rem; color: #8a94a6; letter-spacing: 0.01em; }
.msel-active {
    background: #f0f7ff;
    border-bottom-color: #d0e8ff;
}
.msel-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(34,197,94,.5);
    animation: msel-pulse-anim 2.2s ease-in-out infinite;
}
@keyframes msel-pulse-anim {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
    60%  { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.msel-text { color: #1e3a5f; font-size: 0.85rem; }
.msel-grp {
    padding: 2px 9px;
    border-radius: 20px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.msel-hint {
    margin-left: auto;
    font-size: 0.72rem;
    color: #b0bac8;
    font-style: italic;
    white-space: nowrap;
}

/* Maskinlist */
.machine-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px 12px;
    background: #fff;
    border-bottom: none;
}

/* Maskingrupp-kort – slank vänsterborderlinje */
.machine-cluster {
    display: flex;
    flex-direction: column;
    background: #fafbfc;
    border-radius: 10px;
    border: 1.5px solid color-mix(in srgb, var(--grp, #9e9e9e) 28%, #e0e4ea);
    border-left: 3px solid var(--grp, #9e9e9e);
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    overflow: hidden;
    transition: border-color .18s, box-shadow .18s, transform .18s;
}
.machine-cluster.cluster-active {
    background: color-mix(in srgb, var(--grp, #9e9e9e) 6%, #fff);
    border-color: var(--grp, #9e9e9e);
    border-left-color: var(--grp, #9e9e9e);
    border-left-width: 4px;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--grp, #9e9e9e) 22%, transparent);
    transform: translateY(-1px);
}

/* Grupprubrik – liten textlabel, ingen fylld bakgrund */
.cluster-label {
    background: none !important;
    color: var(--grp, #666) !important;
    font-size: 0.68rem !important;
    font-weight: 800;
    text-align: left;
    padding: 6px 10px 2px 11px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    opacity: 0.85;
    line-height: 1;
}

/* Knapphållare */
.cluster-btns {
    display: flex;
    gap: 5px;
    padding: 6px 8px 8px;
}

/* Maskinknapp */
.mbtn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    width: 136px;
    height: 158px;
    border-radius: 12px;
    border: 1.5px solid color-mix(in srgb, var(--grp, #9e9e9e) 22%, #e0e0e0);
    background: #fff;
    cursor: pointer;
    transition: all .14s ease;
    position: relative;
    padding: 5px 4px 6px;
    box-shadow: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Maskinbild */
.mbtn-img {
    width: 100%;
    flex: 1;
    background: #f2f4f6;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background .14s;
}
.mbtn-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    display: block;
    transition: transform .2s;
}
.mbtn:hover .mbtn-img img { transform: scale(1.05); }

/* Maskinnummer */
.mbtn-num {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--grp, #444);
    line-height: 1;
    padding-bottom: 1px;
}

/* Hover */
.mbtn:hover {
    background: color-mix(in srgb, var(--grp, #9e9e9e) 7%, #fff);
    border-color: color-mix(in srgb, var(--grp, #9e9e9e) 60%, #e0e0e0);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}
.mbtn:hover .mbtn-img {
    background: color-mix(in srgb, var(--grp, #9e9e9e) 14%, #f0f0f0);
}

/* Vald maskin */
.mbtn.mbtn-selected {
    background: var(--grp, #1976d2);
    border-color: var(--grp, #1565c0);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--grp, #1976d2) 45%, transparent);
    transform: translateY(-1px);
}
.mbtn.mbtn-selected .mbtn-num { color: #fff; }
.mbtn.mbtn-selected .mbtn-img {
    background: color-mix(in srgb, var(--grp, #1976d2) 65%, #000);
}
.mbtn.mbtn-selected .mbtn-img img { filter: brightness(0.82) saturate(0.85); }

/* Checkmark-badge */
.mbtn.mbtn-selected::after {
    content: '✓';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #fff;
    color: var(--grp, #1976d2);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--grp, #1976d2);
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    line-height: 1;
}

/* Bakåtkompatibilitet */
.active-machine-bar { display: none; }
.active-57  { background: #4caf50; color: #fff; border-color: #388e3c; }
.active-58  { background: #1976d2; color: #fff; border-color: #0d47a1; }
.inactive   { background: #fff; color: #555; }
.machine-label { margin-left: 8px; color: #444; font-size: .95rem; }

/* ══════════════════════════════════════════════════════════════════════════
   EXCEL FORM TABLE (top entry row)
══════════════════════════════════════════════════════════════════════════ */
.excel-form-wrap {
    padding: 10px 16px 0;
    background: #fff;
}
.excel-form {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #b0b0b0;
    table-layout: fixed;
}
.excel-form th {
    background: #dce6f1;
    border: 1px solid #b0b0b0;
    padding: 5px 6px;
    font-size: .82rem;
    font-weight: 700;
    text-align: left;
    color: #1a1a1a;
}
.excel-form th:nth-child(1) { width: 100px; }
.excel-form th:nth-child(2) { width: 70px; }
.excel-form th:nth-child(3) { width: 120px; }
.excel-form th:nth-child(4) { width: auto; }
.excel-form th:nth-child(5) { width: 90px; }
.excel-form th:nth-child(6) { width: 180px; }
.excel-form th:nth-child(7) { width: 180px; }
.excel-form th:nth-child(8) { width: 180px; }
.excel-form th:nth-child(9) { width: 100px; }

.form-row td {
    border: 1px solid #b0b0b0;
    padding: 4px 5px;
    vertical-align: middle;
}
.cell-auto {
    background: #f2f2f2;
    font-weight: 600;
    color: #333;
    padding-left: 8px !important;
}
.cell-input {
    width: 100%;
    border: none;
    outline: none;
    font: inherit;
    padding: 3px 5px;
    background: transparent;
}
.cell-input:focus { background: #fffde7; }
.cell-select {
    width: 100%;
    border: none;
    outline: none;
    font: inherit;
    padding: 3px 4px;
    background: transparent;
    cursor: pointer;
}
.cell-desc { color: #333; padding-left: 8px !important; font-style: italic; }
.cell-save { text-align: center; padding: 4px !important; }

.save-btn {
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 7px 16px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}
.save-btn:hover:not(:disabled) { background: #388e3c; }
.save-btn:disabled { background: #aaa; cursor: not-allowed; }

/* ── T-nr autocomplete dropdown ──────────────────────────────────────── */
.ac-wrap { position: relative; }
.ac-list {
    position: absolute;
    z-index: 9999;
    top: 100%;
    left: 0;
    min-width: 400px;
    background: #fff;
    border: 2px solid #1976d2;
    border-top: none;
    margin: 0;
    padding: 0;
    list-style: none;
    box-shadow: 0 6px 16px rgba(0,0,0,.22);
    max-height: 280px;
    overflow-y: auto;
    border-radius: 0 0 4px 4px;
}
.ac-list li {
    padding: 8px 12px;
    cursor: pointer;
    font-size: .92rem;
    border-bottom: 1px solid #eee;
    transition: background .1s;
}
.ac-list li:hover {
    background: #e3f2fd;
}
.ac-list li:hover, .ac-active { background: #e3f2fd !important; }

/* ══════════════════════════════════════════════════════════════════════════
   LOG TABLE SECTION
══════════════════════════════════════════════════════════════════════════ */
.log-section {
    margin: 10px 16px 24px;
    border: 1px solid #b0b0b0;
    border-radius: 2px;
    background: #fff;
}
.log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    background: #dce6f1;
    border-bottom: 1px solid #b0b0b0;
}
.log-title { font-weight: 700; font-size: .95rem; color: #1a3a5e; }
.log-btns  { display: flex; gap: 6px; }
.tbtn {
    padding: 4px 14px;
    border: 1px solid #aaa;
    border-radius: 3px;
    background: #fff;
    font-size: .82rem;
    cursor: pointer;
    font-weight: 600;
}
.tbtn.active { background: #1976d2; color: #fff; border-color: #1976d2; }
.tbtn:hover:not(.active) { background: #e3e3e3; }

.table-scroll { overflow-x: auto; }
.excel-log {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 700px;
}
.excel-log th {
    background: #dce6f1;
    border: 1px solid #b0b0b0;
    padding: 5px 7px;
    font-size: .82rem;
    font-weight: 700;
    text-align: left;
    position: sticky;
    top: 0;
}
/* ── Log-tabellen: alla kolumner ── */
/* Kolumn 1: Dag (100px), 2: Tid (60px), 3: T-nr (70px), 4: Beskrivning (auto), 5: Operatör (90px), 
   6: Avvikelse (150px), 7: Kommentar (auto), 8: Maskin (35px!), 9: Actions (110px) */
.excel-log { table-layout: fixed; }
.excel-log th:nth-child(1) { width: 100px; }
.excel-log th:nth-child(2) { width: 60px; }
.excel-log th:nth-child(3) { width: 70px; }
.excel-log th:nth-child(4) { width: auto; }
.excel-log th:nth-child(5) { width: 90px; }
.excel-log th:nth-child(6) { width: 150px; }
.excel-log th:nth-child(7) { width: auto; min-width: 120px; }
.excel-log th:nth-child(8) { width: 35px; text-align: center; }
.excel-log th:nth-child(9) { width: 110px; }

.excel-log td {
    border: 1px solid #d0d0d0;
    padding: 5px 8px;
    font-size: .89rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background .12s;
}

/* Färgkodning per maskingrupp */
.log-57 { background: #e8f5e9; }
.log-58 { background: #e3f2fd; }
.log-grp1 { background: #fff8e1; }   /* 49/50 – gul */
.log-grp2 { background: #fce4ec; }   /* 51/54 – rosa */
.log-grp4 { background: #e8eaf6; }   /* 59/60 – lila */
.log-grp5 { background: #e0f2f1; }   /* 45 – teal */
.log-grp6 { background: #f3e5f5; }   /* 47 – lila */
.log-grp7 { background: #fafafa; }   /* 55 – grå */

/* Hover-effekter */
.excel-log tbody tr:hover td {
    background: rgba(0,0,0,.05) !important;
    cursor: pointer;
}

.tnr-col { font-weight: 700; color: #1a237e; }
.dev-col { color: #c62828; font-weight: 600; }

/* ── Rader med avvikelse = rödaktiga (ljust läge) ── */
.excel-log tr.has-dev td { background: #fdecea; border-color: #f2c5c0; }
.excel-log tr.has-dev td:first-child { box-shadow: inset 4px 0 0 #e53935; }
.excel-log tr.has-dev .dev-col { color: #b71c1c; font-weight: 700; }
.excel-log tbody tr.has-dev:hover td { background: #f9d8d4 !important; }

/* ══════════════════════════════════════════════════════════════════════════
   HISTORIK - KOMPAKT TABELL MED FÖRBÄTTRINGAR
══════════════════════════════════════════════════════════════════════════ */

/* Kompaktare tabell-layout */
.compact-table .mud-table-cell {
    padding: 6px 8px !important;
    font-size: 0.875rem !important;
}

.compact-table .mud-table-head .mud-table-cell {
    font-weight: 700 !important;
    background-color: #f5f5f5 !important;
    border-bottom: 2px solid #e0e0e0 !important;
}

/* Zebra-striping (redan på via Striped="true", men säkerställ) */
.compact-table .mud-table-row:nth-of-type(even) {
    background-color: #fafafa;
}

/* Hover-effekt */
.compact-table .mud-table-row:hover {
    background-color: #e3f2fd !important;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* Sticky header */
.compact-table .mud-table-head {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background-color: #f5f5f5 !important;
}

/* Sort-pilar mer synliga */
.compact-table .mud-table-sort-label {
    font-weight: 700 !important;
}

.compact-table .mud-table-sort-label:hover {
    color: #fdb912 !important;
}

/* Quick filter chips */
.mud-chip.mud-chip-size-small {
    cursor: pointer;
    transition: all 0.2s ease;
}

.mud-chip.mud-chip-size-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ══════════════════════════════════════════════════════════════════════════
   STATISTIK - KPI CARDS & GRAFER
══════════════════════════════════════════════════════════════════════════ */

.kpi-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    border-left: 4px solid transparent;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15) !important;
}

.kpi-card:nth-child(1) { border-left-color: #1976d2; } /* Primary */
.kpi-card:nth-child(2) { border-left-color: #f44336; } /* Error */
.kpi-card:nth-child(3) { border-left-color: #2196f3; } /* Info */
.kpi-card:nth-child(4) { border-left-color: #ff9800; } /* Warning */

.kpi-card .font-weight-bold {
    font-weight: 700 !important;
    line-height: 1.2 !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN - MOBILE/TABLET
══════════════════════════════════════════════════════════════════════════ */

/* Tablets och mindre (≤1024px) */
@media (max-width: 1024px) {
    html, body {
        font-size: 13px;
    }
    
    .excel-form-wrap, .log-section {
        margin: 8px;
        padding: 8px;
    }
    
    .ac-list {
        min-width: 300px;
        max-height: 200px;
    }
}

/* Mobiler och små tablets (≤768px) */
@media (max-width: 768px) {
    html, body {
        font-size: 12px;
    }
    
    /* ── Mobile Navigation ────────────────────────────────────────────── */
    .mobile-menu-btn {
        display: inline-flex !important; /* Visa på mobil */
        visibility: visible !important;
        pointer-events: auto !important; /* Säkerställ att knappen är klickbar */
        z-index: 1300 !important; /* Högre än drawer och overlay */
        position: relative !important;
    }
    .desktop-nav,
    nav.desktop-nav,
    .mud-appbar .desktop-nav {
        display: none !important; /* Dölj desktop-nav på mobil */
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    .desktop-emoji {
        display: none !important; /* Dölj emojin på mobil */
    }
    .mobile-drawer {
        width: 280px !important;
        max-width: 85vw !important;
    }
    
    /* ── Drawer - dölj helt när stängd ────────────────────────── */
    .mud-drawer.mud-drawer--closed {
        transform: translateX(100%) !important;
        visibility: hidden !important;
    }
    .mud-drawer.mud-drawer--open {
        transform: translateX(0) !important;
        visibility: visible !important;
    }
    
    /* ── AppBar - mobilanpassad layout ────────────────────────────────── */
    .main-appbar {
        min-height: 56px !important;
    }
    .mud-appbar {
        min-height: 56px !important;
        padding: 0 8px !important;
    }
    
    /* ── AppBar Title - kompakt layout ────────────────────────────────── */
    .app-title {
        gap: 0 !important;
    }
    .title-main {
        font-size: 0.9rem !important;
        font-weight: 700 !important;
        letter-spacing: 0.3px !important;
    }
    .title-sub {
        font-size: 0.55rem !important;
        letter-spacing: 0.5px !important;
    }
    
    /* Machine panel - mobil */
    .msel-bar { padding: 6px 10px; }
    .msel-hint { display: none; }
    .machine-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        padding: 8px 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .machine-bar::-webkit-scrollbar { display: none; }
    .machine-cluster { flex-shrink: 0; }
    .mbtn { width: 90px; height: 108px; }
    .mbtn-num { font-size: 0.9rem !important; }
    
    /* Excel form - scrollbar horisontellt */
    .excel-form-wrap {
        padding: 8px;
        overflow-x: auto;
    }
    .excel-form {
        min-width: 600px;
        font-size: .85rem;
    }
    .excel-form th {
        padding: 6px 4px;
        font-size: .8rem;
    }
    .excel-form td {
        padding: 4px 3px;
    }
    .cell-input, .cell-select {
        font-size: .85rem;
        padding: 4px;
    }
    .save-btn {
        padding: 10px 12px;
        font-size: 1rem;
    }
    
    /* Autocomplete dropdown - mindre bredd */
    .ac-list {
        min-width: calc(100vw - 40px);
        max-width: calc(100vw - 40px);
        left: 50%;
        transform: translateX(-50%);
        max-height: 180px;
        font-size: .85rem;
    }
    .ac-list li {
        padding: 10px 8px;
        white-space: normal;
        word-wrap: break-word;
    }
    
    /* Log section */
    .log-section {
        margin: 10px 8px 16px;
    }
    .log-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px;
    }
    .log-title {
        font-size: 1rem;
        text-align: center;
    }
    .log-btns {
        justify-content: center;
        flex-wrap: wrap;
    }
    .tbtn {
        padding: 8px 14px;
        font-size: .9rem;
        flex: 1;
        min-width: 80px;
    }
    
    /* Log table - horisontell scroll */
    .table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .excel-log {
        min-width: 600px;
        font-size: .8rem;
    }
    .excel-log th {
        padding: 6px 5px;
        font-size: .75rem;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    .excel-log td {
        padding: 6px 5px;
        font-size: .8rem;
    }
    
    /* MudBlazor components - mobilanpassning */
    .mud-table {
        font-size: .85rem !important;
    }
    .mud-table-cell {
        padding: 8px 6px !important;
    }
    .mud-button-root {
        padding: 8px 12px !important;
        font-size: .9rem !important;
    }
    .mud-input {
        font-size: .9rem !important;
    }
    .mud-card {
        margin: 8px !important;
    }
    .mud-card-content {
        padding: 12px !important;
    }
}

/* Små mobiler (≤480px) */
@media (max-width: 480px) {
    html, body {
        font-size: 11px;
    }
    
    /* Machine buttons - ännu större på små skärmar */
    .mbtn {
        padding: 14px 10px;
        font-size: 1.1rem;
    }
    
    /* Excel tables - extra kompakta */
    .excel-form, .excel-log {
        font-size: .75rem;
    }
    .excel-form th, .excel-log th {
        padding: 4px 3px;
        font-size: .7rem;
    }
    .excel-form td, .excel-log td {
        padding: 4px 3px;
    }
    
    /* Buttons - större touch targets */
    .save-btn, .tbtn {
        padding: 12px 16px;
        font-size: 1rem;
        min-height: 44px; /* Apple rekommendation för touch targets */
    }
    
    /* Autocomplete */
    .ac-list {
        max-height: 150px;
        font-size: .8rem;
    }
    
    /* MudBlazor - extra kompakt */
    .mud-table-cell {
        padding: 6px 4px !important;
        font-size: .75rem !important;
    }
    .mud-button-root {
        min-height: 44px !important;
    }
}
.mnr-cell { text-align: center; font-weight: 800; font-size: .95rem; color: #333; }
.mnr-cell-small { text-align: center; font-weight: 800; font-size: .85rem; color: #333; min-width: 30px; width: 30px; max-width: 30px; overflow: hidden; }
  
/* ── Maskinnummer i tabellens th och td (kolumn 8) ── */
.excel-log td:nth-child(8),
.excel-log td.mnr-cell,
.excel-log td.mnr-cell-small { text-align: center; font-weight: 800; width: 60px !important; min-width: 60px !important; max-width: 60px !important; overflow: hidden; padding: 5px 2px !important; }
.excel-log th:nth-child(8),
.excel-log th.mnr-head { text-align: center; width: 60px !important; min-width: 60px !important; max-width: 60px !important; }
.excel-log td.mnr-cell-small b,
.excel-log td:nth-child(8) b { font-size: .85rem; }
  
/* ── Kommentar-kolumn (kolumn 7) bredare ── */
.excel-log td:nth-child(7) { width: auto; min-width: 120px; white-space: normal; word-wrap: break-word; }
  
/* ── Avvikelse-kolumn (kolumn 6) ── */
.excel-log td:nth-child(6) { width: 150px; min-width: 100px; white-space: normal; word-wrap: break-word; }
.mnr-57 { text-align: center; color: #2e7d32; font-weight: 800; font-size: 1rem; }
.mnr-58 { text-align: center; color: #1565c0; font-weight: 800; font-size: 1rem; }
.no-rows { text-align: center; color: #888; padding: 16px; font-style: italic; }

/* ══════════════════════════════════════════════════════════════════════════
   OPERATÖRER - KORT, LEADERBOARD & PROFIL
══════════════════════════════════════════════════════════════════════════ */
.operator-card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    height: 100%;
}
.operator-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15) !important;
}

.leaderboard-row {
    border-radius: 8px;
    transition: background-color 0.15s ease;
}
.leaderboard-row:hover {
    background-color: #f5f5f5;
}

.avatar-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.avatar-swatch:hover {
    transform: scale(1.15);
}
.avatar-swatch.selected {
    border-color: #333;
    transform: scale(1.15);
}

.kpi-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    height: 100%;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}

/* ── Logga: klickbara rader med edit/delete ── */
.log-clickable { cursor: pointer; }
.log-clickable:hover td { filter: brightness(0.96); }
.log-row-selected td {
    outline: 2px solid #1976d2;
    outline-offset: -2px;
}
.row-actions {
    white-space: nowrap;
    text-align: right;
    padding: 2px 6px !important;
}
.row-btn {
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 4px;
    padding: 2px 8px;
    margin-left: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1.4;
}
.row-btn:hover { background: #f0f0f0; }
.rb-save   { border-color: #2e7d32; }
.rb-cancel { border-color: #999; }
.rb-edit   { border-color: #1976d2; }
.rb-delete { border-color: #c62828; }
.rb-confirm {
    border-color: #c62828;
    background: #c62828;
    color: #fff;
    font-weight: 700;
}
.rb-confirm:hover { background: #a51f1f; }
.log-edit-row td { background: #fff8e1 !important; }
.edit-input {
    border: 1px solid #1976d2 !important;
    border-radius: 3px;
    padding: 2px 6px;
    width: 100%;
    box-sizing: border-box;
}

/* ════════════════════════════════════════════════════════════
   VISNINGSINSTÄLLNINGAR (kugghjulet nere till höger)
   ════════════════════════════════════════════════════════════ */
.app-root { --fs: 1; --pady: 5px; }
.app-root.fs-large  { --fs: 1.18; }
.app-root.fs-xlarge { --fs: 1.38; }
.app-root.density-compact { --pady: 3px; }
.app-root.density-airy    { --pady: 12px; }

/* ── Logga: tabell & formulär skalar ── */
.app-root .excel-log td {
    font-size: calc(.89rem * var(--fs));
    padding: var(--pady) 8px;
}
.app-root .excel-log th {
    font-size: calc(.82rem * var(--fs));
    padding: var(--pady) 7px;
}
.app-root .excel-form th { font-size: calc(.8rem * var(--fs)); }
.app-root .excel-form td { font-size: calc(.9rem * var(--fs)); }
.app-root .cell-input    { font-size: calc(.9rem * var(--fs)); padding: calc(var(--pady) * .8) 8px; }
.app-root .cell-auto     { font-size: calc(.88rem * var(--fs)); }
.app-root .desc-text     { font-size: calc(.9rem * var(--fs)); }
.app-root .save-btn      { font-size: calc(.9rem * var(--fs)); padding: calc(var(--pady) + 3px) 16px; }
.app-root .ac-list li    { font-size: calc(.88rem * var(--fs)); padding: calc(var(--pady) + 2px) 10px; }
.app-root .mbtn          { font-size: calc(1rem * var(--fs)); }
.app-root .log-title     { font-size: calc(.95rem * var(--fs)); }
.app-root .tbtn          { font-size: calc(.82rem * var(--fs)); }
.app-root .row-btn       { font-size: calc(.85rem * var(--fs)); }
.app-root .active-machine-bar { font-size: calc(.9rem * var(--fs)); }

/* Luftig = radbryt långa texter så ALLT syns */
.app-root.density-airy .excel-log td {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.45;
}

/* ── MudBlazor-tabeller & text skalar (Historik, Verktyg, Statistik…) ── */
.app-root .mud-table-cell {
    font-size: calc(.875rem * var(--fs)) !important;
    padding: calc(var(--pady) + 2px) 12px !important;
}
.app-root .mud-table-cell .mud-typography,
.app-root .mud-typography-body1 { font-size: calc(1rem * var(--fs)); }
.app-root .mud-typography-body2 { font-size: calc(.875rem * var(--fs)); }
.app-root .mud-typography-caption { font-size: calc(.75rem * var(--fs)); }
.app-root .mud-chip { font-size: calc(.8125rem * var(--fs)); }

/* ── Hög kontrast ── */
.app-root.high-contrast .excel-log td {
    border-color: #555;
    color: #000;
    font-weight: 600;
}
.app-root.high-contrast .excel-log th {
    background: #1a3a5e;
    color: #fff;
    border-color: #555;
}
.app-root.high-contrast .log-57   { background: #c8e6c9; }
.app-root.high-contrast .log-58   { background: #bbdefb; }
.app-root.high-contrast .log-grp1 { background: #ffecb3; }
.app-root.high-contrast .log-grp2 { background: #f8bbd0; }
.app-root.high-contrast .log-grp4 { background: #c5cae9; }
.app-root.high-contrast .log-grp5 { background: #b2dfdb; }
.app-root.high-contrast .log-grp6 { background: #e1bee7; }
.app-root.high-contrast .tnr-col  { color: #0d1442; }
.app-root.high-contrast .dev-col  { color: #8e0000; font-weight: 800; }
.app-root.high-contrast .mud-table-cell { color: #000 !important; font-weight: 600; }

/* ── Kugghjul (FAB) ── */
.settings-fab {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1450;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1a1a1a;
    font-size: 26px;
    line-height: 1;
    border: 2px solid #fdb912;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
    cursor: pointer;
    transition: transform .25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.settings-fab:hover { transform: rotate(45deg) scale(1.06); }
.settings-fab.fab-open { transform: rotate(90deg); }

.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 1440;
    background: rgba(0,0,0,.18);
}
.settings-panel {
    position: fixed;
    right: 18px;
    bottom: 86px;
    z-index: 1450;
    width: 320px;
    max-width: calc(100vw - 36px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,.32);
    padding: 16px 18px 18px;
    animation: panelUp .18s ease;
}
@keyframes panelUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.sp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 12px;
}
.sp-close {
    border: none;
    background: #eee;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: .9rem;
}
.sp-close:hover { background: #ddd; }
.sp-group { margin-bottom: 14px; }
.sp-label {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #777;
    margin-bottom: 6px;
}
.seg { display: flex; gap: 6px; }
.seg-btn {
    flex: 1;
    padding: 9px 4px;
    border: 1.5px solid #ccc;
    background: #fff;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 600;
    font-size: .85rem;
    transition: all .12s;
}
.seg-btn:hover { border-color: #999; }
.seg-btn.on {
    background: #fdb912;
    border-color: #1a1a1a;
    color: #1a1a1a;
    font-weight: 800;
}
.sp-reset {
    width: 100%;
    padding: 9px;
    border: 1.5px dashed #bbb;
    background: #fafafa;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 600;
    color: #666;
}
.sp-reset:hover { background: #f0f0f0; }

/* Mobil: panelen tar nästan hela bredden, FAB något mindre */
@media (max-width: 600px) {
    .settings-fab { width: 50px; height: 50px; font-size: 23px; right: 14px; bottom: 14px; }
    .settings-panel { right: 14px; left: 14px; width: auto; bottom: 76px; }
}

/* ════════════════════════════════════════════════════════════
   MASKINGRUPPER: grupfärger (49/50, 51/54, 57/58, 59/60, 45, 47, 55)
   ════════════════════════════════════════════════════════════ */
.grp-1 { --grp: #f9a825; }  /* 49/50 gul */
.grp-2 { --grp: #d81b60; }  /* 51/54 rosa */
.grp-3 { --grp: #2e7d32; }  /* 57/58 grön */
.grp-4 { --grp: #5e35b1; }  /* 59/60 lila */
.grp-5 { --grp: #00897b; }  /* 45 teal */
.grp-6 { --grp: #8e24aa; }  /* 47 violett */
.grp-7 { --grp: #546e7a; }  /* 55 blågrå */
.grp-8 { --grp: #0277bd; }  /* P70 blå */
.grp-9 { --grp: #e64a19; }  /* Stora Ventiler orange */

/* Idag / Hela månaden — STÖRRE knappar */
.tbtn {
    padding: 10px 22px !important;
    font-size: 1rem !important;
    border-radius: 8px !important;
    border-width: 2px !important;
}
.log-title { font-size: 1.05rem !important; }

/* ── Sorterbara kolumnhuvuden (Verktyg) ── */
.sort-head { cursor: pointer; user-select: none; font-weight: 700; white-space: nowrap; }
.sort-head:hover { color: #1976d2; text-decoration: underline; }

/* ════════════════════════════════════════════════════════════
   FAB: pill med text "Inställningar"
   ════════════════════════════════════════════════════════════ */
.settings-fab {
    width: auto !important;
    height: auto !important;
    border-radius: 28px !important;
    padding: 12px 20px 12px 16px;
    gap: 8px;
    color: #fdb912;
    font-weight: 800;
    font-size: 1rem !important;
}
.settings-fab .fab-gear { font-size: 22px; line-height: 1; }
.settings-fab .fab-label { color: #fff; font-size: .95rem; letter-spacing: .02em; }
.settings-fab:hover { transform: scale(1.05); }
.settings-fab.fab-open { transform: none; }

/* Innehållet får luft i botten så FAB aldrig täcker sista raden.
   Endast autentiserad shell (MudLayout) — annars blir det en vit/grå gap under landningssidan. */
.mud-layout > .mud-main-content { padding-bottom: 96px !important; }

@media (max-width: 600px) {
    .settings-fab { padding: 10px 16px 10px 13px; }
    .settings-fab .fab-label { font-size: .85rem; }
    .mbtn { width: 90px !important; height: 108px !important; padding: 4px 3px 5px !important; }
}

/* ════════════════════════════════════════════════════════════
   MÖRKT LÄGE (nightmode) — egna tabeller & paneler
   ════════════════════════════════════════════════════════════ */
.app-root.dark-mode { background: #121212; color: #e0e0e0; min-height: calc(100vh - 64px); }

.app-root.dark-mode .machine-panel { background: #1a1a1a; border-bottom-color: #333; }
.app-root.dark-mode .msel-bar { background: #1d1d1d; border-bottom-color: #2a2a2a; }
.app-root.dark-mode .msel-active { background: #162030; border-bottom-color: #1e3a52; }
.app-root.dark-mode .msel-idle { background: #1a1a1a; }
.app-root.dark-mode .msel-idle-text { color: #6a7585; }
.app-root.dark-mode .msel-text { color: #90caf9; }
.app-root.dark-mode .msel-grp { background: #1e3252; color: #64b5f6; }
.app-root.dark-mode .msel-hint { color: #4a5568; }
.app-root.dark-mode .machine-bar { background: #1a1a1a; }
.app-root.dark-mode .machine-cluster { background: #222; border-color: color-mix(in srgb, var(--grp) 30%, #333); border-left-color: var(--grp); }
.app-root.dark-mode .machine-cluster .mbtn { background: #262626; }
.app-root.dark-mode .machine-cluster .mbtn.mbtn-selected { color: #fff; }
.app-root.dark-mode .machine-cluster.cluster-active { background: color-mix(in srgb, var(--grp) 14%, #1d1d1d); }

.app-root.dark-mode .excel-form-wrap,
.app-root.dark-mode .log-section { background: #1d1d1d; border-color: #444; }
.app-root.dark-mode .excel-form th,
.app-root.dark-mode .excel-log th { background: #263238; color: #eceff1; border-color: #444; }
.app-root.dark-mode .excel-form td,
.app-root.dark-mode .excel-log td { border-color: #3a3a3a; color: #e0e0e0; }
.app-root.dark-mode .log-header { background: #263238; border-color: #444; }
.app-root.dark-mode .log-title { color: #90caf9; }
.app-root.dark-mode .tbtn { background: #262626; color: #e0e0e0; border-color: #555; }
.app-root.dark-mode .tbtn.active { background: #1976d2; color: #fff; }
.app-root.dark-mode .cell-input { background: #262626; color: #fff; border-color: #555; }
.app-root.dark-mode .cell-input:focus { background: #30301f; }
.app-root.dark-mode .cell-auto { background: #2a2a2a; color: #b0b0b0; }
.app-root.dark-mode .form-row td { border-color: #444; }
.app-root.dark-mode .excel-form { border-color: #444; }
.app-root.dark-mode .cell-desc { color: #ccc; }
.app-root.dark-mode .cell-measure { background: #3a3520 !important; }
.app-root.dark-mode .save-btn:disabled { background: #3a3a3a; color: #777; }
.app-root.dark-mode .desc-text { color: #e0e0e0; }
.app-root.dark-mode .ac-list { background: #262626; border-color: #555; }
.app-root.dark-mode .ac-list li { color: #e0e0e0; }
.app-root.dark-mode .ac-list li.ac-active,
.app-root.dark-mode .ac-list li:hover { background: #37474f; }

/* Mörka radfärger per grupp */
.app-root.dark-mode .log-57   { background: #1b3320; }
.app-root.dark-mode .log-58   { background: #14283d; }
.app-root.dark-mode .log-grp1 { background: #332b10; }
.app-root.dark-mode .log-grp2 { background: #3a1722; }
.app-root.dark-mode .log-grp4 { background: #221a3a; }
.app-root.dark-mode .log-grp5 { background: #103330; }
.app-root.dark-mode .log-grp6 { background: #2d1633; }
.app-root.dark-mode .log-grp7 { background: #232323; }
.app-root.dark-mode .tnr-col { color: #90caf9; }
.app-root.dark-mode .dev-col { color: #ef9a9a; }

/* ── Rader med avvikelse = rödaktiga (mörkt läge) ── */
.app-root.dark-mode .excel-log tr.has-dev td { background: #3b1512; border-color: #5d2723; }
.app-root.dark-mode .excel-log tr.has-dev td:first-child { box-shadow: inset 4px 0 0 #ef5350; }
.app-root.dark-mode .excel-log tr.has-dev .dev-col { color: #ff8a80; font-weight: 700; }
.app-root.dark-mode .excel-log tbody tr.has-dev:hover td { background: #4a1c18 !important; }

/* Hover i mörkt läge: ljusare istället för mörkare */
.app-root.dark-mode .excel-log tbody tr:hover td { background: rgba(255,255,255,.07) !important; }
.app-root.dark-mode .log-row-selected td { outline-color: #64b5f6; }
.app-root.dark-mode .no-rows { color: #888; }
.app-root.dark-mode .row-btn { background: #262626; color: #e0e0e0; border-color: #555; }
.app-root.dark-mode .log-edit-row td { background: #33301d !important; }

/* MudBlazor-ytor i mörkt läge */
.app-root.dark-mode .mud-paper { background: #1d1d1d; color: #e0e0e0; }
.app-root.dark-mode .mud-table { background: #1d1d1d; color: #e0e0e0; }
.app-root.dark-mode .mud-table-cell { color: #e0e0e0 !important; border-color: #3a3a3a; }
.app-root.dark-mode th.mud-table-cell { background: #263238 !important; color: #eceff1 !important; }
.app-root.dark-mode .mud-typography { color: #e0e0e0; }
.app-root.dark-mode .mud-input,
.app-root.dark-mode .mud-input-slot { color: #fff !important; }
.app-root.dark-mode .mud-alert { background: #263238; color: #e0e0e0; }

/* ════════════════════════════════════════════════════════════
   MOBILFORMULÄR för /logga
   ════════════════════════════════════════════════════════════ */
.mobile-form {
    display: none !important;
}

/* Tvinga desktop-formuläret att visas på skärmar över 768px */
@media (min-width: 769px) {
    .excel-form {
        display: table !important;
    }
    .mobile-form {
        display: none !important;
    }
}

.measure-error {
    color: #c62828;
    font-size: .78rem;
    font-weight: 700;
    margin-top: 4px;
}
.measure-hint {
    color: #666;
    font-size: .75rem;
    margin-top: 3px;
}
.dev-cat-badge {
    display: inline-block;
    background: #ffebee;
    color: #c62828;
    font-weight: 700;
    font-size: .8rem;
    padding: 2px 8px;
    border-radius: 4px;
}


@media (max-width: 600px) {
    .excel-form-wrap {
        padding: 10px;
    }
    .excel-form {
        display: none !important;
    }
    .mobile-form {
        display: block !important;
    }
    .mobile-entry {
        display: flex;
        flex-direction: column;
        gap: 14px;
        background: #fff;
        border: 1px solid #b0b0b0;
        border-radius: 8px;
        padding: 14px;
    }
    .mf-meta {
        display: flex;
        justify-content: space-between;
        font-weight: 700;
        color: #555;
        font-size: 1rem;
        padding-bottom: 8px;
        border-bottom: 1px solid #e0e0e0;
    }
    .mf-field {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    .mf-field label {
        font-size: .9rem;
        font-weight: 700;
        color: #1a3a5e;
    }
    .mf-input {
        width: 100%;
        padding: 12px 14px;
        font-size: 1.05rem;
        border: 2px solid #bbb;
        border-radius: 8px;
        outline: none;
        min-height: 48px;
        background: #fff;
    }
    .mf-input:focus {
        border-color: #1976d2;
        background: #fffde7;
    }
    .mf-select {
        cursor: pointer;
        appearance: auto;
    }
    .mf-desc {
        font-style: italic;
        color: #555;
        font-size: .9rem;
    }
    .mf-measure {
        background: #fffacd;
        padding: 12px;
        border-radius: 8px;
        border: 1px solid #fbc02d;
    }
    .mf-measure-input {
        font-weight: 800;
        color: #d84315;
        border-color: #f57f17;
    }
    .mobile-save-btn {
        width: 100%;
        padding: 16px;
        font-size: 1.25rem;
        font-weight: 800;
        color: #fff;
        background: #4caf50;
        border: none;
        border-radius: 10px;
        margin-top: 8px;
        min-height: 56px;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(76,175,80,.35);
    }
    .mobile-save-btn:disabled {
        background: #aaa;
        box-shadow: none;
        cursor: not-allowed;
    }
    .mobile-save-btn:active:not(:disabled) {
        transform: scale(.98);
    }

    /* Autocomplete på mobil */
    .mobile-ac-list {
        position: fixed;
        top: auto;
        left: 16px;
        right: 16px;
        bottom: 16px;
        min-width: auto;
        max-width: none;
        transform: none;
        max-height: 240px;
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(0,0,0,.3);
        z-index: 2000;
    }
    .mobile-ac-list li {
        padding: 16px 14px;
        font-size: 1.05rem;
        border-bottom: 1px solid #eee;
    }

    /* Maskinväljaren ännu större på mobil */
    .machine-bar {
        gap: 12px;
        padding: 14px 10px;
    }
    .machine-cluster {
        padding: 10px;
        border-radius: 10px;
    }
    .cluster-btns {
        gap: 10px;
    }
    .mbtn {
        padding: 16px 10px !important;
        font-size: 1.25rem !important;
        min-height: 56px;
        border-radius: 10px !important;
    }

    /* Aktivt tillstånd tydligare */
    .mbtn.mbtn-selected {
        transform: scale(1.02);
        box-shadow: 0 4px 12px rgba(21,101,192,.5);
    }

    /* Logglistan mer kompakt */
    .log-section {
        margin: 10px;
    }
    .log-header {
        padding: 10px;
    }
    .tbtn {
        padding: 10px 14px !important;
        font-size: .95rem !important;
    }
}

@media (max-width: 480px) {
    .mobile-form {
        padding: 12px;
        gap: 12px;
    }
    .mf-input {
        padding: 14px;
        font-size: 1.1rem;
        min-height: 52px;
    }
    .mobile-save-btn {
        padding: 18px;
        font-size: 1.3rem;
        min-height: 60px;
    }
    .mbtn {
        padding: 18px 10px !important;
        font-size: 1.35rem !important;
        min-height: 60px;
    }
    .cluster-label {
        font-size: .85rem !important;
    }
}


/* ══════════════════════════════════════════════════════════════════════════
   AI-VARNING OCH ANALYS-POPUP
══════════════════════════════════════════════════════════════════════════ */

.ai-warning-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.ai-warning-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 10px;
    border: 2px solid #ccc;
    border-radius: 20px;
    background: #f5f5f5;
    color: #444;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all .2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    min-width: 40px;
    height: 34px;
}

.ai-warning-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,.15);
}

.ai-warning-btn.warning {
    border-color: #f9a825;
    background: #fff8e1;
    color: #7c4d03;
    animation: ai-pulse-warning 2s infinite;
}

.ai-warning-btn.critical {
    border-color: #d32f2f;
    background: #ffebee;
    color: #b71c1c;
    animation: ai-pulse-critical 1.4s infinite;
}

.ai-warning-btn.ok {
    border-color: #388e3c;
    background: #e8f5e9;
    color: #1b5e20;
}

@keyframes ai-pulse-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(249, 168, 37, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(249, 168, 37, 0); }
}

@keyframes ai-pulse-critical {
    0%, 100% { box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.5); }
    50% { box-shadow: 0 0 0 10px rgba(211, 47, 47, 0); }
}

.ai-lamp { font-size: 1.1rem; }

.ai-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #d32f2f;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
}

.ai-hint {
    font-size: 0.82rem;
    color: #666;
}

/* Modal / popup */
.ai-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    padding: 16px;
}

.ai-modal {
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
    overflow: hidden;
}

.ai-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1a3a5e 0%, #0d1f33 100%);
    color: #fff;
}

.ai-modal-icon { font-size: 1.6rem; }

.ai-modal-title-wrap { flex: 1; }

.ai-modal-title-wrap h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
}

.ai-modal-subtitle {
    font-size: 0.78rem;
    opacity: 0.85;
}

.ai-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background .15s;
}

.ai-modal-close:hover { background: rgba(255,255,255,.3); }

.ai-days-select select {
    padding: 5px 8px;
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 5px;
    background: rgba(0,0,0,.25);
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
}

.ai-days-select select option {
    background: #1a3a5e;
    color: #fff;
}

.ai-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
}

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 30px;
    color: #555;
}

.ai-spinner { font-size: 2rem; animation: ai-spin 1.2s linear infinite; }

@keyframes ai-spin { 100% { transform: rotate(360deg); } }

.ai-empty {
    padding: 24px;
    text-align: center;
    color: #2e7d32;
    background: #e8f5e9;
    border-radius: 8px;
    font-weight: 600;
}

.ai-insight {
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 8px;
    border-left: 5px solid #999;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.ai-insight:last-child { margin-bottom: 0; }

.ai-insight-critical { border-left-color: #d32f2f; }
.ai-insight-warning { border-left-color: #f9a825; }
.ai-insight-info { border-left-color: #1976d2; }

.ai-insight-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.ai-insight-icon { font-size: 1.1rem; }

.ai-insight-title {
    flex: 1;
    font-weight: 800;
    font-size: 1rem;
    color: #1a1a1a;
}

.ai-insight-count {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f0f0f0;
    color: #555;
}

.ai-insight-message {
    margin: 0 0 8px 0;
    color: #333;
    line-height: 1.45;
}

.ai-insight-details {
    margin: 8px 0 0 0;
    padding-left: 18px;
    font-size: 0.88rem;
    color: #444;
}

.ai-insight-details li { margin-bottom: 3px; }

.ai-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.ai-modal-action {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: #1976d2;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}

.ai-modal-action:hover { background: #1565c0; }

.ai-modal-action.secondary {
    background: #e0e0e0;
    color: #333;
}

.ai-modal-action.secondary:hover { background: #d0d0d0; }

@media (max-width: 600px) {
    .ai-modal { max-height: 92vh; border-radius: 10px; }
    .ai-modal-header { padding: 12px 14px; }
    .ai-modal-body { padding: 14px; }
    .ai-warning-bar { flex-wrap: wrap; gap: 6px; }
    .ai-hint { width: 100%; font-size: 0.75rem; }
}


/* ══════════════════════════════════════════════════════════════════════════
   NOTISKLOCKA
══════════════════════════════════════════════════════════════════════════ */

.notification-bell-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.notification-bell-btn {
    color: #1a1a1a !important;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #d32f2f;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

.notification-menu {
    position: absolute;
    top: 46px;
    right: -8px;
    width: 360px;
    max-width: 92vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,.25);
    z-index: 1100;
    overflow: hidden;
}

.notification-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: #1a3a5e;
    color: #fff;
    font-weight: 700;
}

.notification-mark-all {
    border: none;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.notification-mark-all:hover { background: rgba(255,255,255,.3); }

.notification-menu-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.notification-loading,
.notification-empty {
    padding: 20px;
    text-align: center;
    color: #666;
}

.notification-item {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background .15s;
    border-left: 3px solid #999;
}

.notification-item:last-child { margin-bottom: 0; }

.notification-item:hover { background: #f5f5f5; }

.notification-item.unread { background: #f0f7ff; }
.notification-item.unread:hover { background: #e3f2fd; }

.notification-item.severity-critical { border-left-color: #d32f2f; }
.notification-item.severity-warning { border-left-color: #f9a825; }
.notification-item.severity-info { border-left-color: #1976d2; }

.notification-item-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #1a1a1a;
}

.notification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d32f2f;
    flex-shrink: 0;
}

.notification-item.unread .notification-dot { display: inline-block; }
.notification-item:not(.unread) .notification-dot { display: none; }

.notification-item-message {
    font-size: 0.82rem;
    color: #444;
    margin-top: 3px;
    line-height: 1.35;
}

.notification-item-meta {
    font-size: 0.72rem;
    color: #888;
    margin-top: 4px;
}

.notification-menu-footer {
    padding: 10px 14px;
    border-top: 1px solid #e0e0e0;
    text-align: right;
}

.notification-menu-footer a {
    color: #1976d2;
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
}

.notification-menu-footer a:hover { text-decoration: underline; }

@media (max-width: 600px) {
    .notification-menu {
        width: 320px;
        right: -50px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   AI-ASSISTENT SIDAN
══════════════════════════════════════════════════════════════════════════ */

.ai-assistant-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 84px);
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.ai-assistant-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 16px;
}

.ai-assistant-icon { font-size: 2.2rem; }

.ai-assistant-header h3 {
    margin: 0;
    font-size: 1.4rem;
    color: #1a3a5e;
}

.ai-assistant-header p {
    margin: 4px 0 0;
    color: #666;
    font-size: 0.9rem;
}

.ai-assistant-chat {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px;
    background: #fafafa;
    border-radius: 10px;
    margin-bottom: 12px;
}

.ai-chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
}

.ai-chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-chat-message.assistant {
    align-self: flex-start;
}

.ai-chat-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e0e0;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ai-chat-content {
    background: #fff;
    padding: 10px 14px;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    line-height: 1.45;
}

.ai-chat-message.user .ai-chat-content {
    background: #e3f2fd;
}

.ai-chat-text {
    white-space: pre-wrap;
    color: #222;
}

.ai-chat-data {
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 8px;
}

.ai-chat-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
    font-size: 0.88rem;
    border-bottom: 1px dashed #f0f0f0;
}

.ai-chat-row:last-child { border-bottom: none; }

.ai-chat-label { font-weight: 700; color: #444; }
.ai-chat-value { color: #1976d2; font-weight: 600; }
.ai-chat-detail { color: #888; font-size: 0.8rem; }

.ai-chat-followup {
    margin-top: 10px;
    padding: 6px 12px;
    border: 1px solid #1976d2;
    border-radius: 16px;
    background: #fff;
    color: #1976d2;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all .15s;
}

.ai-chat-followup:hover {
    background: #1976d2;
    color: #fff;
}

.ai-chat-error {
    margin-top: 8px;
    padding: 8px;
    border-radius: 6px;
    background: #ffebee;
    color: #c62828;
    font-size: 0.85rem;
}

.ai-chat-typing {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.ai-chat-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #90caf9;
    animation: ai-typing 1.2s infinite ease-in-out;
}

.ai-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ai-typing {
    0%, 100% { transform: translateY(0); opacity: .4; }
    50% { transform: translateY(-6px); opacity: 1; }
}

.ai-assistant-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.ai-assistant-suggestions span {
    font-size: 0.85rem;
    color: #666;
    font-weight: 700;
}

.ai-assistant-suggestions button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 16px;
    background: #f5f5f5;
    color: #444;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all .15s;
}

.ai-assistant-suggestions button:hover {
    background: #e3f2fd;
    border-color: #1976d2;
    color: #1565c0;
}

.ai-assistant-input {
    display: flex;
    gap: 10px;
}

.ai-assistant-input input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 24px;
    font-size: 1rem;
    outline: none;
    transition: border-color .15s;
}

.ai-assistant-input input:focus {
    border-color: #1976d2;
}

.ai-assistant-input button {
    padding: 12px 24px;
    border: none;
    border-radius: 24px;
    background: #1976d2;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}

.ai-assistant-input button:hover:not(:disabled) { background: #1565c0; }
.ai-assistant-input button:disabled { background: #bbb; cursor: not-allowed; }

@media (max-width: 600px) {
    .ai-assistant-page {
        height: calc(100vh - 70px);
        padding: 10px;
        border-radius: 0;
    }
    .ai-chat-message { max-width: 95%; }
    .ai-assistant-suggestions button { font-size: 0.75rem; padding: 5px 10px; }
}

/* ── Rapport-sida ────────────────────────────────────────────────────────── */
.rpt-print-header { margin-bottom: 20px; }

.rpt-period-badge {
    display: inline-block;
    background: #1976d2;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 6px 18px;
    border-radius: 20px;
    margin-bottom: 16px;
    letter-spacing: 0.4px;
}

/* KPI-kort */
.rpt-kpi {
    background: #fff;
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    height: 100%;
}
.rpt-kpi-val {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}
.rpt-kpi-tool {
    font-size: 1.1rem;
    font-weight: 700;
    word-break: break-all;
}
.rpt-kpi-lbl {
    font-size: 0.72rem;
    color: #666;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Donut-legend */
.rpt-donut-legend { border-top: 1px solid #eee; padding-top: 8px; }
.rpt-legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 0.78rem;
}
.rpt-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.rpt-legend-lbl { flex: 1; color: #444; }
.rpt-legend-val { font-weight: 700; color: #222; }

/* Avvikelsekategori-chip */
.rpt-cat-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}
.rpt-cat-critical { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.rpt-cat-warning  { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.rpt-cat-normal   { background: #f3e5f5; color: #6a1b9a; border: 1px solid #ce93d8; }

/* Verktyg-barcharts */
.rpt-tool-grid { display: flex; flex-direction: column; gap: 6px; }
.rpt-tool-row {
    display: grid;
    grid-template-columns: 80px 1fr 120px 48px;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
}
.rpt-tool-tnr  { font-weight: 700; color: #1976d2; }
.rpt-tool-desc { color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rpt-tool-bar-wrap { background: #f0f0f0; border-radius: 4px; height: 8px; overflow: hidden; }
.rpt-tool-bar  { background: #d32f2f; height: 8px; border-radius: 4px; transition: width .3s; min-width: 4px; }
.rpt-tool-count { text-align: right; font-weight: 700; color: #d32f2f; font-size: 0.78rem; }

@media (max-width: 600px) {
    .rpt-tool-row { grid-template-columns: 70px 1fr 60px 40px; }
    .rpt-kpi-val  { font-size: 1.5rem; }
}

/* ══════════════════════════════════════════════════════════════════════════
   MASKIN-FÖRHANDSVISNING (dubbelklick modal i /logga)
══════════════════════════════════════════════════════════════════════════ */
.mpreview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    padding: 16px;
}
.mpreview-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    width: 100%;
    max-width: 420px;
    padding: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.mpreview-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #555;
    line-height: 1;
}
.mpreview-close:hover { color: #000; }
.mpreview-img-wrap {
    width: 100%;
    height: 200px;
    border-radius: 10px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mpreview-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.mpreview-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mpreview-nr {
    font-size: 1.6rem;
    font-weight: 900;
    color: #1a3a5e;
    line-height: 1.1;
}
.mpreview-name {
    font-size: 1rem;
    color: #444;
    font-weight: 500;
}
.mpreview-group {
    font-size: 0.82rem;
    color: #888;
}
.mpreview-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.mpreview-btn-go {
    flex: 1;
    padding: 12px 16px;
    background: #1976d2;
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.mpreview-btn-go:hover { background: #1565c0; }
.mpreview-btn-log {
    flex: 1;
    padding: 12px 16px;
    background: #f0f4ff;
    color: #1a3a5e;
    border: 2px solid #1976d2;
    border-radius: 9px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.mpreview-btn-log:hover { background: #e3ecff; }

/* ══════════════════════════════════════════════════════════════════════════
   MASKIN-SIDA (/maskin/{nr})
══════════════════════════════════════════════════════════════════════════ */
.maskin-page {
    padding: 16px;
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.maskin-loading {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 1.1rem;
}
.maskin-back-btn {
    background: none;
    border: none;
    color: #1976d2;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
}
.maskin-back-btn:hover { text-decoration: underline; }

/* Header */
.maskin-header {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    flex-wrap: wrap;
}
.maskin-img-wrap {
    width: 120px;
    height: 90px;
    border-radius: 10px;
    overflow: hidden;
    background: #f0f0f0;
    flex-shrink: 0;
}
.maskin-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.maskin-title-block {
    flex: 1;
    min-width: 140px;
}
.maskin-title {
    font-size: 2rem;
    font-weight: 900;
    color: #1a3a5e;
    margin: 0 0 4px;
    line-height: 1.1;
}
.maskin-subtitle {
    font-size: 1rem;
    color: #444;
}
.maskin-group-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 10px;
    border-radius: 20px;
    background: #e8f4fd;
    color: #1565c0;
    font-size: 0.78rem;
    font-weight: 700;
}

/* Spindelstatus badge */
.spindle-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.spindle-badge.spindle-on  { background: #e8f5e9; color: #2e7d32; border: 2px solid #a5d6a7; }
.spindle-badge.spindle-off { background: #ffebee; color: #c62828; border: 2px solid #ef9a9a; }
.spindle-badge.spindle-unknown { background: #f5f5f5; color: #757575; border: 2px solid #e0e0e0; }
.spindle-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.spindle-on .spindle-dot    { background: #2e7d32; box-shadow: 0 0 6px #4caf50; }
.spindle-off .spindle-dot   { background: #c62828; }
.spindle-unknown .spindle-dot { background: #bdbdbd; }

/* Sektion */
.maskin-section {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.section-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1a3a5e;
    margin: 0 0 14px;
}

/* Spindel-knappar */
.spindle-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.spindle-btn {
    padding: 10px 22px;
    border-radius: 8px;
    border: 2px solid transparent;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
}
.spindle-btn.spindle-on  { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.spindle-btn.spindle-on:hover  { background: #c8e6c9; }
.spindle-btn.spindle-on.active  { background: #2e7d32; color: #fff; border-color: #1b5e20; }
.spindle-btn.spindle-off { background: #ffebee; color: #c62828; border-color: #ef9a9a; }
.spindle-btn.spindle-off:hover { background: #ffcdd2; }
.spindle-btn.spindle-off.active { background: #c62828; color: #fff; border-color: #b71c1c; }
.spindle-since { font-size: 0.8rem; color: #888; margin-top: 4px; }

/* Händelse/körning-formulär */
.event-form, .run-start-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ef-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ef-row label {
    width: 130px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    flex-shrink: 0;
}
.ef-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color .15s;
}
.ef-input:focus { border-color: #1976d2; box-shadow: 0 0 0 2px rgba(25,118,210,0.12); }
.ef-save-btn, .ef-start-btn {
    align-self: flex-start;
    padding: 10px 22px;
    background: #1976d2;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
    margin-top: 4px;
}
.ef-save-btn:hover, .ef-start-btn:hover { background: #1565c0; }
.ef-save-btn:disabled, .ef-start-btn:disabled { background: #bbb; cursor: not-allowed; }
.ef-stop-btn {
    padding: 10px 22px;
    background: #d32f2f;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.ef-stop-btn:hover { background: #b71c1c; }

/* Aktiv körning */
.run-active-card {
    background: #fff8e1;
    border: 2px solid #ffd54f;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.run-active-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #e65100;
    font-size: 0.95rem;
}
.run-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff6f00;
    animation: run-pulse 1.4s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes run-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.4); opacity: 0.7; }
}
.run-article, .run-op { font-size: 0.85rem; color: #555; }
.run-stop-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 6px;
}
.run-stop-form .ef-input { min-width: 120px; flex: none; }

/* Händelselogg */
.event-log {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.event-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 7px;
    background: #fafafa;
    border: 1px solid #eeee;
    font-size: 0.85rem;
    flex-wrap: wrap;
}
.event-row.etype-stop   { background: #fff8f8; border-color: #ffcdd2; }
.event-row.etype-start  { background: #f0fff4; border-color: #c8e6c9; }
.event-row.etype-spindleon  { background: #f0fff4; border-color: #a5d6a7; }
.event-row.etype-spindleoff { background: #fff8f8; border-color: #ef9a9a; }
.event-icon { font-size: 1rem; flex-shrink: 0; }
.event-time { color: #888; font-size: 0.78rem; white-space: nowrap; }
.event-type { font-weight: 700; color: #333; min-width: 80px; }
.event-op   { background: #e3ecff; color: #1a3a5e; border-radius: 4px; padding: 1px 6px; font-weight: 700; font-size: 0.78rem; }
.event-comment { color: #666; font-style: italic; }

/* Körningshistorik */
.runs-table-wrap { overflow-x: auto; }
.runs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.runs-table th {
    background: #dce6f1;
    padding: 7px 10px;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid #90caf9;
    white-space: nowrap;
}
.runs-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f0f0f0;
}
.runs-table tr:hover td { background: #f8faff; }
.run-row-active td { background: #fff8e1 !important; font-weight: 600; }
.runs-parts { font-weight: 800; color: #1976d2; }
.maskin-empty { color: #aaa; font-style: italic; font-size: 0.9rem; }

@media (max-width: 600px) {
    .maskin-header { gap: 12px; }
    .maskin-img-wrap { width: 80px; height: 60px; }
    .maskin-title { font-size: 1.5rem; }
    .ef-row { flex-direction: column; align-items: flex-start; }
    .ef-row label { width: auto; }
    .spindle-badge { font-size: 0.8rem; padding: 6px 12px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   MASKIN DETALJ-SIDA (/maskin/{MachineNr}) - HERO & LAYOUT
══════════════════════════════════════════════════════════════════════════ */

.mskin-hero {
    position: relative;
    height: 280px;
    background: linear-gradient(135deg, #1a3a5e 0%, #0d1f33 100%);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.mskin-hero-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.5;
}

.mskin-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(26,58,94,0.85) 0%, rgba(13,31,51,0.9) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    z-index: 1;
    color: #fff;
}

.mskin-hero-top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.mskin-group-chip {
    background: rgba(255,255,255,0.15);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
}

.mskin-spindle-chip {
    background: rgba(255,255,255,0.15);
    color: #fff;
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
}

.mskin-spindle-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4caf50;
    box-shadow: 0 0 8px rgba(76,175,80,0.6);
}

.mskin-spindle-on .mskin-spindle-dot { background: #4caf50; box-shadow: 0 0 8px rgba(76,175,80,0.6); }
.mskin-spindle-off .mskin-spindle-dot { background: #ef5350; box-shadow: 0 0 8px rgba(239,83,80,0.4); }

.mskin-spindle-label {
    color: #fff;
}

.mskin-hero-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
}

.mskin-hero-title {
    font-size: 2.8rem;
    font-weight: 900;
    margin: 0;
    line-height: 1;
    letter-spacing: -0.5px;
}

.mskin-hero-sub {
    font-size: 1.05rem;
    margin: 0;
    opacity: 0.95;
    font-weight: 300;
}

.mskin-back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 2;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1.5rem;
    backdrop-filter: blur(8px);
}

.mskin-back-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* KPI-rad under hero */
.mskin-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.mskin-kpi {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #f0f0f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mskin-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.mskin-kpi-val {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1976d2;
    line-height: 1.1;
    margin-bottom: 4px;
}

.mskin-kpi-val.mskin-kpi-dev {
    color: #d32f2f;
}

.mskin-kpi-lbl {
    font-size: 0.72rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════════════
   MASKIN-KORT GRID (Index.razor) - Större bilder & dubbelklick
══════════════════════════════════════════════════════════════════════════ */

.machine-card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s, cursor 0.1s;
    cursor: pointer;
    user-select: none;
}

.machine-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.machine-card:active {
    cursor: grab;
}

.machine-card-image {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
    overflow: hidden;
}

.machine-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.machine-card:hover .machine-card-image img {
    transform: scale(1.05);
}

.machine-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
    opacity: 1;
    transition: opacity 0.2s;
}

.machine-status-badge {
    color: #fff;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    width: fit-content;
}

.machine-card-content {
    padding: 16px;
}

.machine-card-info {
    margin: 8px 0;
    padding: 8px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

/* ── VerktygsDetalj (/verktyg/{tnr}/{nr}) ────────────────────────────── */
.vd-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0 18px;
    border-bottom: 2px solid #e3eaf5;
    margin-bottom: 18px;
}
.vd-back { flex-shrink: 0; }
.vd-hero-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vd-tnr-badge {
    background: #1565c0;
    color: #fff;
    font-weight: 800;
    font-size: 1.2rem;
    border-radius: 8px;
    padding: 4px 14px;
    letter-spacing: 0.03em;
}
.vd-desc { font-size: 1rem; color: #444; }
.vd-machine-chip { font-size: 0.8rem !important; }

.vd-kpi-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.vd-kpi {
    flex: 1 1 100px;
    background: #f5f7fb;
    border-radius: 10px;
    padding: 12px 16px;
    text-align: center;
    border: 1px solid #e0e8f5;
}
.vd-kpi-warn { background: #fff8e1; border-color: #ffe082; }
.vd-kpi-val { display: block; font-size: 1.6rem; font-weight: 800; color: #1565c0; line-height: 1.1; }
.vd-kpi-val small { font-size: 1rem; font-weight: 600; }
.vd-kpi-lbl { display: block; font-size: 0.72rem; color: #888; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.04em; }
.vd-kpi-warn .vd-kpi-val { color: #e65100; }

.vd-table-wrap { overflow-x: auto; }
.vd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.vd-table th {
    padding: 9px 12px;
    text-align: left;
    background: #f0f4fb;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #555;
    border-bottom: 2px solid #dde5f4;
    white-space: nowrap;
}
.vd-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.vd-table tr:hover td { background: #f8faff; }
.vd-row-dev td { background: #fff8f0 !important; }
.vd-row-dev:hover td { background: #fff3e0 !important; }
.vd-time { color: #888; font-size: 0.85rem; }
.vd-comment { color: #555; font-size: 0.85rem; max-width: 240px; }
.vd-interval-col { font-weight: 700; color: #1565c0; white-space: nowrap; }
.vd-short-life { color: #c62828 !important; }
.vd-first { color: #aaa; font-style: italic; font-weight: 400; }

/* Underhålls-lista */
.maintenance-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.maintenance-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 8px;
    border-radius: 8px;
    background: rgba(0,0,0,0.02);
}

.maintenance-item > div {
    flex: 1;
}

/* ============================================================
   Landing page (public marketing) — scoped under .lp-page
   Does not affect authenticated app shell styles.
   ============================================================ */
/* Kill page chrome so landing is full-bleed (no white Mud strip / FAB gap). */
.landing-shell {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: #0b1220;
}
html:has(.lp-page),
body:has(.lp-page) {
    background: #0b1220 !important;
}

.lp-page {
    --lp-bg: #0b1220;
    --lp-bg-elevated: #111827;
    --lp-bg-card: #151d2e;
    --lp-border: rgba(148, 163, 184, 0.14);
    --lp-text: #f1f5f9;
    --lp-muted: #94a3b8;
    --lp-accent: #fdb912;
    --lp-accent-dim: rgba(253, 185, 18, 0.14);
    --lp-accent-strong: #e5a40f;
    --lp-gold: #fdb912;
    --lp-teal: #2dd4bf;
    --lp-light: #f8fafc;
    --lp-light-text: #0f172a;
    --lp-light-muted: #475569;
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
    color: var(--lp-text);
    background: var(--lp-bg);
    overflow-x: hidden;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
}

.lp-page * { box-sizing: border-box; }

.lp-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 28px;
    background: rgba(11, 18, 32, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--lp-border);
}

.lp-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--lp-accent);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
}

.lp-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, rgba(253, 185, 18, 0.22), rgba(45, 212, 191, 0.1));
    border: 1px solid rgba(253, 185, 18, 0.4);
    color: var(--lp-gold);
}

.lp-nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.lp-nav-link {
    color: var(--lp-muted) !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

.lp-nav-link:hover { color: var(--lp-text) !important; }

.lp-btn-primary {
    background: var(--lp-gold) !important;
    color: #1a1a1a !important;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 24px rgba(253, 185, 18, 0.28) !important;
}

.lp-btn-primary:hover {
    background: var(--lp-accent-strong) !important;
}

.lp-btn-ghost {
    color: var(--lp-text) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    background: rgba(255, 255, 255, 0.04) !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    border-radius: 8px !important;
}

.lp-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
}

.lp-btn-dark {
    background: var(--lp-light-text) !important;
    color: #fff !important;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    border-radius: 8px !important;
}

.lp-hero {
    position: relative;
    min-height: min(88vh, 820px);
    display: flex;
    align-items: center;
    padding: 64px 28px 80px;
    overflow: hidden;
}

.lp-hero-media {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.lp-hero-media video,
.lp-hero-media .lp-hero-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.lp-hero-media video { z-index: 1; }
.lp-hero-media .lp-hero-fallback { z-index: 0; }

.lp-hero-fallback {
    background:
        radial-gradient(ellipse 80% 60% at 70% 20%, rgba(253, 185, 18, 0.16), transparent 55%),
        radial-gradient(ellipse 60% 50% at 15% 80%, rgba(45, 212, 191, 0.1), transparent 50%),
        linear-gradient(160deg, #0b1220 0%, #0f1a2e 45%, #0a1624 100%);
}

.lp-hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(105deg, rgba(11, 18, 32, 0.92) 0%, rgba(11, 18, 32, 0.78) 48%, rgba(11, 18, 32, 0.55) 100%),
        linear-gradient(to top, rgba(11, 18, 32, 0.95) 0%, transparent 40%);
    z-index: 1;
}

.lp-hero-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
}

.lp-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--lp-accent-dim);
    border: 1px solid rgba(253, 185, 18, 0.35);
    color: var(--lp-gold);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 22px;
}

.lp-hero h1 {
    margin: 0 0 20px;
    font-size: clamp(2.2rem, 5vw, 3.55rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: #fff;
    max-width: 16ch;
}

.lp-hero-lead {
    margin: 0 0 32px;
    font-size: clamp(1.05rem, 2vw, 1.2rem);
    line-height: 1.65;
    color: rgba(226, 232, 240, 0.88);
    max-width: 540px;
}

.lp-hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 40px;
}

.lp-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 28px;
    padding-top: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    max-width: 560px;
}

.lp-hero-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--lp-muted);
    font-size: 0.88rem;
}

.lp-hero-meta-item strong {
    color: var(--lp-text);
    font-weight: 600;
}

.lp-section {
    padding: 88px 28px;
}

.lp-section-inner {
    max-width: 1120px;
    margin: 0 auto;
}

.lp-section-head {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 52px;
}

.lp-eyebrow {
    display: inline-block;
    color: var(--lp-accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.lp-section-head h2 {
    margin: 0 0 14px;
    font-size: clamp(1.75rem, 3.5vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--lp-text);
    line-height: 1.2;
}

.lp-section-head p {
    margin: 0;
    color: var(--lp-muted);
    font-size: 1.05rem;
    line-height: 1.65;
}

.lp-section--light {
    background: var(--lp-light);
    color: var(--lp-light-text);
}

.lp-section--light .lp-section-head h2 { color: var(--lp-light-text); }
.lp-section--light .lp-section-head p { color: var(--lp-light-muted); }
.lp-section--light .lp-eyebrow { color: #b45309; }

.lp-section--elevated {
    background: var(--lp-bg-elevated);
}

.lp-proof {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: -36px;
    position: relative;
    z-index: 3;
    padding: 0 28px 8px;
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
}

.lp-proof-card {
    background: var(--lp-bg-card);
    border: 1px solid var(--lp-border);
    border-radius: 12px;
    padding: 22px 20px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.lp-proof-card .lp-proof-label {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--lp-muted);
    margin-bottom: 6px;
}

.lp-proof-card .lp-proof-value {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--lp-text);
}

.lp-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.lp-feature {
    background: var(--lp-bg-card);
    border: 1px solid var(--lp-border);
    border-radius: 14px;
    padding: 26px 22px;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.lp-feature:hover {
    border-color: rgba(253, 185, 18, 0.4);
    transform: translateY(-2px);
}

.lp-feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--lp-accent-dim);
    color: var(--lp-accent);
    margin-bottom: 16px;
}

.lp-feature h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--lp-text);
}

.lp-feature p {
    margin: 0;
    color: var(--lp-muted);
    font-size: 0.95rem;
    line-height: 1.55;
}

.lp-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    counter-reset: lp-step;
}

.lp-step {
    position: relative;
    padding: 28px 24px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}

.lp-step::before {
    counter-increment: lp-step;
    content: counter(lp-step);
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0f172a;
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.lp-step h3 {
    margin: 0 0 8px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--lp-light-text);
}

.lp-step p {
    margin: 0;
    color: var(--lp-light-muted);
    font-size: 0.95rem;
    line-height: 1.55;
}

.lp-showcase {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 40px;
    align-items: center;
}

.lp-showcase.reverse {
    grid-template-columns: 0.95fr 1.05fr;
}

.lp-showcase.reverse .lp-showcase-copy { order: 2; }
.lp-showcase.reverse .lp-showcase-visual { order: 1; }

.lp-showcase-copy h3 {
    margin: 0 0 12px;
    font-size: clamp(1.4rem, 2.5vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--lp-text);
}

.lp-showcase-copy p {
    margin: 0 0 18px;
    color: var(--lp-muted);
    font-size: 1.02rem;
    line-height: 1.65;
}

.lp-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.lp-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: rgba(226, 232, 240, 0.9);
    font-size: 0.95rem;
    line-height: 1.45;
}

.lp-checklist li .mud-icon-root {
    color: var(--lp-accent);
    margin-top: 2px;
    flex-shrink: 0;
}

.lp-frame {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--lp-border);
    background: #020617;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(253, 185, 18, 0.1);
}

.lp-frame img {
    display: block;
    width: 100%;
    height: auto;
}

.lp-frame-caption {
    padding: 14px 16px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid var(--lp-border);
    color: var(--lp-muted);
    font-size: 0.85rem;
}

.lp-cta {
    text-align: center;
    padding: 64px 32px;
    border-radius: 18px;
    background:
        radial-gradient(ellipse 70% 80% at 50% 0%, rgba(253, 185, 18, 0.14), transparent 60%),
        var(--lp-bg-card);
    border: 1px solid var(--lp-border);
}

.lp-cta h2 {
    margin: 0 0 12px;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 800;
    color: #fff;
}

.lp-cta p {
    margin: 0 auto 28px;
    max-width: 520px;
    color: var(--lp-muted);
    font-size: 1.05rem;
    line-height: 1.6;
}

.lp-cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.lp-showcase-stack {
    display: grid;
    gap: 72px;
}

.lp-footer {
    padding: 40px 28px 48px;
    border-top: 1px solid var(--lp-border);
    text-align: center;
    color: rgba(148, 163, 184, 0.75);
    font-size: 0.85rem;
    background: #080e18;
}

.lp-footer-inner {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.lp-footer-brand {
    display: inline-flex;
    text-decoration: none;
    margin-bottom: 4px;
}

.lp-footer-tagline {
    margin: 0;
    color: var(--lp-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.lp-footer-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 8px;
    color: rgba(148, 163, 184, 0.65);
    font-size: 0.8rem;
}

.lp-footer-dot { opacity: 0.6; }

@media (max-width: 960px) {
    .lp-proof,
    .lp-features,
    .lp-steps,
    .lp-showcase,
    .lp-showcase.reverse {
        grid-template-columns: 1fr;
    }

    .lp-showcase.reverse .lp-showcase-copy,
    .lp-showcase.reverse .lp-showcase-visual {
        order: unset;
    }

    .lp-hero h1 { max-width: none; }
    .lp-showcase-stack { gap: 48px; }

    .lp-nav { padding: 12px 16px; }
    .lp-section { padding: 64px 16px; }
    .lp-proof { padding: 0 16px; margin-top: -24px; }
}

@media (max-width: 600px) {
    .lp-nav {
        padding: 10px 14px;
        gap: 10px;
    }
    .lp-brand-logo { height: 28px; }
    .lp-nav-links {
        gap: 4px;
        flex-wrap: nowrap;
    }
    .lp-nav-links .lp-nav-desktop { display: none !important; }
    .lp-nav-links .lp-btn-primary {
        padding-left: 12px !important;
        padding-right: 12px !important;
        font-size: 0.82rem !important;
        min-height: 36px;
    }

    .lp-proof { grid-template-columns: 1fr; }
    .lp-hero {
        padding: 36px 16px 56px;
        min-height: auto;
    }
    .lp-hero h1 {
        font-size: clamp(1.75rem, 8vw, 2.35rem);
        line-height: 1.15;
    }
    .lp-hero-lead {
        font-size: 1rem;
        margin-bottom: 24px;
    }
    .lp-hero-cta,
    .lp-cta-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .lp-hero-cta .mud-button-root,
    .lp-cta-actions .mud-button-root {
        width: 100%;
        justify-content: center;
    }
    .lp-hero-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        max-width: none;
    }
    .lp-section { padding: 48px 16px; }
    .lp-section-head { margin-bottom: 32px; }
    .lp-cta { padding: 40px 20px; border-radius: 14px; }
    .lp-showcase-stack { gap: 40px; }
    .lp-footer { padding: 32px 16px 40px; }
}


/* ══════════════════════════════════════════════════════════════════════════
   LOGG A / MASKIN — shop-floor operator UX (industrial, touch-first)
══════════════════════════════════════════════════════════════════════════ */

.logga-page {
    --shop-ink: #0f172a;
    --shop-muted: #64748b;
    --shop-border: #e2e8f0;
    --shop-panel: #ffffff;
    --shop-bg: #f1f5f9;
    --shop-accent: #0f766e;
    --shop-accent-soft: #ccfbf1;
    --shop-gold: #fdb912;
    background: var(--shop-bg);
    min-height: 100%;
    padding-bottom: 32px;
}

.logga-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: stretch;
    justify-content: space-between;
    padding: 18px 16px 8px;
    background: linear-gradient(135deg, #0b1220 0%, #152238 55%, #0f766e 140%);
    color: #f8fafc;
    border-bottom: 3px solid var(--shop-gold);
}

.logga-kicker {
    margin: 0 0 4px;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
}
.logga-title {
    margin: 0;
    font-size: clamp(1.45rem, 3.5vw, 2rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.15;
}
.logga-lead {
    margin: 6px 0 0;
    color: #cbd5e1;
    font-size: 0.95rem;
    max-width: 42rem;
}

.logga-active-card {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 14px;
    padding: 14px 16px;
    min-width: min(100%, 280px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    backdrop-filter: blur(8px);
}
.logga-active-top { display: flex; gap: 12px; align-items: center; }
.logga-active-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: #94a3b8; font-weight: 700; }
.logga-active-name { font-size: 1.25rem; font-weight: 800; }
.logga-active-meta { font-size: 0.8rem; color: #99f6e4; }
.logga-active-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.logga-cta-primary,
.logga-cta-ghost,
.msel-open-btn {
    border: none;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.9rem;
    padding: 12px 16px;
    min-height: 48px;
    cursor: pointer;
    touch-action: manipulation;
}
.logga-cta-primary {
    background: var(--shop-gold);
    color: #0f172a;
    flex: 1;
}
.logga-cta-primary:hover { filter: brightness(1.05); }
.logga-cta-ghost {
    background: transparent;
    color: #e2e8f0;
    border: 1px solid rgba(226,232,240,0.35);
}
.msel-open-btn {
    margin-left: auto;
    background: #0f766e;
    color: #fff;
    padding: 8px 14px;
    min-height: 40px;
    font-size: 0.82rem;
}
.msel-open-btn:hover { background: #0d9488; }

.logga-form-section {
    background: var(--shop-panel);
    border-bottom: 1px solid var(--shop-border);
}
.logga-step-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 0;
}
.logga-step {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.logga-step.current {
    color: #0f766e;
    background: #ccfbf1;
    border-color: #99f6e4;
}
.logga-step.done {
    color: #166534;
    background: #dcfce7;
    border-color: #bbf7d0;
}
.logga-step-sep { color: #cbd5e1; font-weight: 700; }

.mbtn-open {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255,255,255,0.92);
    color: #0f172a;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    touch-action: manipulation;
}
.mbtn-open:hover { background: #0f766e; color: #fff; border-color: #0f766e; }
.mbtn.mbtn-selected .mbtn-open {
    background: rgba(255,255,255,0.95);
    color: #0f172a;
}

/* Larger save button on shop floor */
.logga-page .save-btn,
.logga-page .mobile-save-btn {
    min-height: 52px !important;
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    border-radius: 10px !important;
}
.logga-page .mf-input,
.logga-page .cell-input {
    min-height: 44px;
    font-size: 1rem;
}

/* Maskin detail page */
.mskin-page {
    --shop-ink: #0f172a;
    --shop-muted: #64748b;
    --shop-border: #e2e8f0;
    --shop-accent: #0f766e;
    --shop-gold: #fdb912;
    padding: 12px 12px 40px;
    background: #f1f5f9;
    min-height: 100%;
}
.mskin-page .mskin-hero {
    height: auto;
    min-height: 240px;
    border-radius: 16px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #0b1220 0%, #152238 60%, #0f766e 130%);
    border: 1px solid rgba(15, 23, 42, 0.35);
}
.mskin-hero-cta { margin-top: 10px; }
.mskin-log-cta {
    font-weight: 800 !important;
    min-height: 52px !important;
    background: var(--shop-gold) !important;
    color: #0f172a !important;
}
.mskin-panel {
    background: #fff;
    border: 1px solid var(--shop-border);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.mskin-panel-title {
    font-weight: 800 !important;
    color: #0f172a !important;
    letter-spacing: -0.01em;
}
.mskin-page .mskin-kpi {
    border: 1px solid var(--shop-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: none;
}
.mskin-page .mskin-kpi-val { color: #0f766e; }
.mskin-tnr-link { color: #0f766e; text-decoration: none; font-weight: 800; }
.mskin-tnr-link:hover { text-decoration: underline; }

.mskin-tool-list, .mskin-op-list { display: flex; flex-direction: column; gap: 6px; }
.mskin-tool-row, .mskin-op-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: inherit;
    min-height: 48px;
}
.mskin-tool-row span, .mskin-op-name {
    color: #64748b;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mskin-tool-row:hover, .mskin-op-hot {
    border-color: #99f6e4;
    background: #f0fdfa;
}
.mskin-op-ini {
    font-weight: 900;
    min-width: 2.4rem;
    color: #0f172a;
}

.machine-card-actions { margin-top: 8px; }

@media (max-width: 768px) {
    .logga-hero { padding: 14px 12px 10px; }
    .msel-hint { display: none; }
    .mbtn { width: 112px; height: 136px; }
    .mbtn-open { width: 34px; height: 34px; }
    .logga-active-card { width: 100%; }
    .mskin-page { padding: 8px 8px 32px; }
    .mskin-page .mskin-hero { min-height: 220px; border-radius: 12px; }
    .mskin-hero-title { font-size: 2rem !important; }
}



/* ── EdgeOpsys / tenant branding ─────────────────────────────────────────── */
.app-company-logo {
    height: 36px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    border-radius: 6px;
    background: rgba(255,255,255,0.55);
    padding: 2px 4px;
}
.app-company-logo-sm {
    height: 28px;
    width: auto;
    max-width: 100px;
    object-fit: contain;
    border-radius: 4px;
    background: rgba(255,255,255,0.55);
    padding: 2px;
}
.app-powered-by {
    text-align: center;
    padding: 18px 12px 28px;
    font-size: 0.78rem;
    color: #94a3b8;
    letter-spacing: 0.02em;
}
.app-powered-by a {
    color: #0f766e;
    font-weight: 700;
    text-decoration: none;
}
.app-powered-by a:hover { text-decoration: underline; }
.lp-brand-logo {
    display: block;
    height: 34px;
    width: auto;
}
.app-root.dark-mode .app-powered-by { color: #64748b; }
.app-root.dark-mode .app-powered-by a { color: #5eead4; }
