/* ============================================================
   VELOCE DEALER PORTAL
   ============================================================ */
:root {
    --primary: #1a8fc4;
    --primary-dark: #14729e;
    --primary-light: #e8f4fa;
    --accent: #f9445a;
    --accent-hover: #e03248;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --success: #22c55e;
    --danger: #ef4444;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 16px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.10);
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --speed: 0.2s ease;
}
/* DARK THEME */
[data-theme="dark"] {
    --bg:           #0f172a;
    --surface:      #1e293b;
    --text:         #e2e8f0;
    --muted:        #94a3b8;
    --border:       #334155;
    --primary:      #38bdf8;
    --primary-dark: #0ea5e9;
    --primary-light:#0c2d3f;
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.4);
    --shadow:       0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg:    0 10px 40px rgba(0,0,0,0.6);
}
tr.row-outdated td                  { background:#fef2f2; }
tr.row-current td                   { background:#fefce8; }
tr.row-pilot td                     { background:#f5f3ff; }
[data-theme="dark"] tr.row-outdated td { background: rgba(239,68,68,.09); }
[data-theme="dark"] tr.row-current td  { background: rgba(234,179,8,.09); }
[data-theme="dark"] tr.row-pilot td    { background: rgba(139,92,246,.09); }
[data-theme="dark"] .alert-success { background:#052e16; color:#86efac; border-color:#166534; }
[data-theme="dark"] .alert-error   { background:#450a0a; color:#fca5a5; border-color:#991b1b; }
[data-theme="dark"] .alert-info    { background:#0c2d3f; color:#38bdf8; border-color:#0369a1; }
[data-theme="dark"] .badge-dealer         { background:#451a03; color:#fcd34d; }
[data-theme="dark"] .badge-dealer-plus    { background:#022c22; color:#6ee7b7; }
[data-theme="dark"] .badge-internal       { background:#431407; color:#fed7aa; }
[data-theme="dark"] .badge-support-admin  { background:#1e1b4b; color:#a5b4fc; }
[data-theme="dark"] .login-wrapper { background: #38bdf8; }
[data-portal-theme="maitred"] .login-wrapper { background: #F26522; }
[data-portal-theme="maitred"][data-theme="dark"] .login-wrapper { background: #FB923C; }
[data-theme="dark"] tr:hover td    { background: rgba(56,189,248,.05); }
[data-theme="dark"] .upload-zone:hover,
[data-theme="dark"] .upload-zone.dragover { background: var(--primary-light); }
/* PORTAL THEME: MAITRE'D */
[data-portal-theme="maitred"] {
    --primary:       #F26522;
    --primary-dark:  #D4521A;
    --primary-light: #FEF0E7;
}
[data-portal-theme="maitred"][data-theme="dark"] {
    --primary:       #FB923C;
    --primary-dark:  #F97316;
    --primary-light: #431407;
}
/* MAITRED LOGO SWITCHING */
.maitred-logo-light,
.theme-logo-light { display: block; }
.maitred-logo-dark,
.theme-logo-dark  { display: none; }
[data-theme="dark"] .maitred-logo-light,
[data-theme="dark"] .theme-logo-light { display: none; }
[data-theme="dark"] .maitred-logo-dark,
[data-theme="dark"] .theme-logo-dark  { display: block; }
.nav-brand-maitred   { height: 36px; width: auto; max-width: 160px; object-fit: contain; }
.login-brand-maitred { height: 60px; width: auto; max-width: 240px; object-fit: contain; margin: 0 auto .5rem; }
/* THEME PICKER (config page) */
.theme-picker { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .75rem; }
.theme-option { position: relative; cursor: pointer; }
.theme-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.theme-option-card { border: 2px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; display: flex; align-items: center; gap: .75rem; transition: all var(--speed); min-width: 180px; }
.theme-option:hover .theme-option-card { border-color: var(--primary); }
.theme-option input:checked ~ .theme-option-card { border-color: var(--primary); background: var(--primary-light); }
.theme-swatch { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.theme-swatch-veloce  { background: #1a8fc4; }
.theme-swatch-maitred { background: #F26522; }
.theme-logo-thumb { height: 32px; width: auto; max-width: 80px; object-fit: contain; flex-shrink: 0; }
.theme-option-name { font-weight: 700; font-size: .95rem; }
.theme-picker-save { margin-top: 1rem; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; overflow-x: hidden; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; transition: background .2s, color .2s; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* NAV */
.main-nav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm); }
.nav-inner { width: 100%; padding: 0 2.5rem; height: 60px; display: flex; align-items: center; gap: 2rem; }
.nav-brand { display: flex; align-items: center; gap: .5rem; color: var(--primary); font-weight: 800; font-size: 1.1rem; letter-spacing: 3px; }
.nav-links { display: flex; gap: .25rem; flex: 1; }
.nav-link { padding: .45rem 1rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem; color: var(--muted); transition: all var(--speed); white-space: nowrap; }
.nav-link:hover { color: var(--text); background: var(--bg); }
.nav-link.active { color: var(--primary); background: var(--primary-light); }
.nav-user { display: flex; align-items: center; gap: .75rem; white-space: nowrap; }
.nav-user-name { font-weight: 600; font-size: .85rem; }
.nav-badge { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .5px; }
.badge-admin         { background: var(--primary-light); color: var(--primary); }
.badge-dealer        { background: #fef3c7; color: #92400e; }
.badge-dealer-plus   { background: #d1fae5; color: #065f46; }
.badge-internal      { background: #fff7ed; color: #c2410c; }
.badge-support-admin { background: #ede9fe; color: #5b21b6; }
.badge-warning       { background: #fef9c3; color: #854d0e; }
.badge-success       { background: #dcfce7; color: #166534; }
.badge-danger        { background: #fee2e2; color: #991b1b; }
.badge-pending       { background: #f1f5f9; color: #475569; }
.badge-sent          { background: #dbeafe; color: #1e40af; }
.badge-scheduled     { background: #fef3c7; color: #92400e; }
.badge-installed     { background: #ccfbf1; color: #0f766e; }
[data-theme="dark"] .badge-success   { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-danger    { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge-pending   { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] .badge-sent      { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-scheduled { background: #2d1a00; color: #fcd34d; }
[data-theme="dark"] .badge-installed { background: #032320; color: #5eead4; }

/* LAYOUT */
.container { width: 100%; padding: 2rem 2.5rem; flex: 1; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 800; }

/* CARD */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); overflow: hidden; }
.card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.card-header h2 { font-size: 1.1rem; font-weight: 700; }
.card-body { padding: 1.5rem; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem 1.25rem; border: none; border-radius: var(--radius-sm); font-family: var(--font); font-weight: 600; font-size: .85rem; cursor: pointer; transition: all var(--speed); text-decoration: none; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--muted); }
.btn-outline:hover { border-color: var(--muted); color: var(--text); }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }
.btn-lg { padding: .75rem 2rem; font-size: 1rem; }
.btn-pilot { background: #7c3aed; color: #fff; }
.btn-pilot:hover { background: #6d28d9; color: #fff; }

/* FORMS */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .4rem; }
.form-control { width: 100%; padding: .65rem .9rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font); font-size: .9rem; transition: border-color var(--speed); background: var(--surface); color: var(--text); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,143,196,.1); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* FILE LIST */
.file-list { list-style: none; }
.file-item { display: flex; align-items: center; gap: 1.25rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); transition: background var(--speed); }
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--bg); }
.file-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-weight: 800; font-size: .65rem; letter-spacing: .5px; text-transform: uppercase; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 700; font-size: 1rem; color: var(--primary); margin-bottom: .15rem; }
.file-meta { font-size: .8rem; color: var(--muted); display: flex; gap: 1rem; flex-wrap: wrap; }
.file-desc { margin-top: .4rem; font-size: .85rem; color: var(--muted); }
.file-actions { flex-shrink: 0; display: flex; flex-direction: column; gap: .35rem; align-items: flex-end; }

/* TABLE */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.users-table { table-layout: fixed; }
.users-table td { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-table td:last-child { overflow: visible; white-space: normal; }
th, td { text-align: left; padding: .75rem 1rem; border-bottom: 1px solid var(--border); font-size: .88rem; }
th { font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: var(--bg); }
tr:hover td { background: rgba(26,143,196,.03); }

/* ALERTS */
.alert { padding: .9rem 1.25rem; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 500; margin-bottom: 1.25rem; border: 1px solid transparent; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); border-color: #bae6fd; }

/* LOGIN */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #1a8fc4; padding: 1rem; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 2.5rem; }
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-brand h1 { font-size: 1rem; letter-spacing: 5px; color: var(--primary); font-weight: 800; }
.login-brand p { color: var(--muted); font-size: .85rem; margin-top: .25rem; }

/* LICENSE DETAIL */
.license-detail-wrap   { width: 100%; max-width: 1600px; margin: 0 auto; }
.license-detail-layout { display: grid; gap: 1rem; align-items: start; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.license-grid { display: grid; grid-template-columns: repeat(2, 200px 1fr); }
.license-grid dt { padding: .6rem 1rem; font-weight: 600; font-size: .82rem; background: var(--bg); border-bottom: 1px solid var(--border); }
.license-grid dd { padding: .6rem 1rem; font-size: .85rem; border-bottom: 1px solid var(--border); }
.license-flag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.license-flag-item { display: flex; justify-content: space-between; align-items: center; padding: .4rem 1rem; border-bottom: 1px solid var(--border); gap: .5rem; }
.license-flag-item span:first-child { font-size: .82rem; font-weight: 600; }
.feature-on  { color: var(--success); font-weight: 700; }
.feature-off { color: var(--danger);  font-weight: 700; }

/* MODAL */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:500; display:flex; align-items:center; justify-content:center; padding:1rem; }
.modal-box { background:var(--surface); border-radius:var(--radius); box-shadow:var(--shadow-lg); max-width:540px; width:100%; padding:2rem; position:relative; max-height:90vh; overflow-y:auto; }
.modal-box h2 { font-size:1.1rem; font-weight:800; margin-bottom:1.25rem; color:var(--text); }
.modal-close { position:absolute; top:.9rem; right:1rem; background:none; border:none; cursor:pointer; font-size:1.4rem; line-height:1; color:var(--muted); padding:0; }
.modal-close:hover { color:var(--text); }

/* NOTICE ROWS */
.notice-row { border-radius:8px; padding:.85rem 1.1rem; border:1.5px solid; font-size:.9rem; line-height:1.5; }
.notice-row[data-level="high"]   { background:#fef2f2; border-color:#fca5a5; color:#991b1b; }
.notice-row[data-level="medium"] { background:#fffbeb; border-color:#fcd34d; color:#92400e; }
.notice-row[data-level="low"]    { background:#f0fdf4; border-color:#86efac; color:#166534; }
.notice-row textarea.form-control { background:var(--surface); min-height: 160px; }
[data-theme="dark"] .notice-row[data-level="high"]   { background: rgba(239,68,68,.1);  border-color:#7f1d1d; color:#fca5a5; }
[data-theme="dark"] .notice-row[data-level="medium"] { background: rgba(234,179,8,.1);  border-color:#92400e; color:#fcd34d; }
[data-theme="dark"] .notice-row[data-level="low"]    { background: rgba(34,197,94,.08); border-color:#14532d; color:#86efac; }

/* 2FA BANNER */
.banner-2fa { background:#fef2f2; color:#991b1b; border:1px solid #fecaca; border-radius:var(--radius-sm); padding:.75rem 1.25rem; font-size:.88rem; font-weight:500; margin-bottom:1.25rem; text-align:center; }
.banner-2fa a { color:#991b1b; font-weight:700; text-decoration:underline; }
.banner-2fa a:hover { color:#7f1d1d; }
[data-theme="dark"] .banner-2fa { background:#450a0a; color:#fca5a5; border-color:#991b1b; }
[data-theme="dark"] .banner-2fa a { color:#fca5a5; }
[data-theme="dark"] .banner-2fa a:hover { color:#fecaca; }

/* UPLOAD ZONE */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 3rem 2rem; text-align: center; cursor: pointer; transition: all var(--speed); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-zone p { color: var(--muted); font-size: .9rem; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm); }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* EMPTY / MISC */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.site-footer { text-align: center; padding: 1.5rem; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--border); margin-top: auto; }
.text-muted { color: var(--muted); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }

/* HAMBURGER BUTTON (hidden on desktop) */
.nav-hamburger {
    display: none;
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .35rem .65rem;
    cursor: pointer;
    color: var(--text);
    font-size: 1.25rem;
    line-height: 1;
    transition: all var(--speed);
    flex-shrink: 0;
}
.nav-hamburger:hover { background: var(--bg); }

/* RESPONSIVE */
@media (max-width: 992px) {
    .col-hide-md { display: none; }
}
/* ── Full desktop nav — ≥1700px: pills inline, maximum breathing room */
@media (min-width: 1700px) {
    .nav-inner       { gap: 1rem; padding: 0 1.5rem; }
    .nav-link        { padding: .45rem .6rem; }
    .view-toggle-btn { padding: 3px 8px; font-size: .68rem; }
}

/* ── Medium desktop — 992-1699px: nav links always visible, pills in hamburger dropdown */
@media (min-width: 992px) and (max-width: 1699px) {
    .nav-inner { gap: .5rem; padding: 0 1rem; }
    .nav-links .nav-link { padding: .45rem .5rem; font-size: .85rem; }
    .nav-user { gap: .4rem; }
    .nav-user-name { display: none; }
    .nav-badge { display: none; }
    .nav-view-toggle { display: none !important; }
    .nav-dealer-badge { display: none !important; }
    .lang-switcher .lang-btn { padding: 3px 6px; }
    .theme-toggle-btn { padding: 3px 6px; }
    /* Hamburger only for admins (has view-toggle extras) */
    .nav-hamburger.nav-hamburger-has-extras { display: flex; align-items: center; justify-content: center; }
    /* Extras: hidden inline; shown as overlay when hamburger is open */
    .nav-links .nav-mobile-extras { display: none; }
    .nav-links.mobile-open .nav-mobile-extras {
        display: flex;
        flex-direction: column;
        gap: .6rem;
        position: absolute;
        top: 60px;
        right: 0;
        min-width: 220px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-top: none;
        box-shadow: var(--shadow);
        padding: .75rem 1rem;
        z-index: 99;
    }
    .nav-mobile-user { display: flex; align-items: center; gap: .5rem; }
    .nav-mobile-user .nav-badge { display: inline-flex; }
    .nav-mobile-view-toggle { display: flex; flex-wrap: wrap; gap: .35rem; }
    .nav-mobile-view-toggle .nav-inline-form { display: inline; }
}

/* ── Mobile hamburger — below 992px: full dropdown */
@media (max-width: 991px) {
    .nav-inner { gap: .4rem; padding: 0 1rem; }
    .nav-hamburger { display: flex; align-items: center; justify-content: center; }
    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0; right: 0;
        flex-direction: column;
        gap: .1rem;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        padding: .75rem 1rem 1rem;
        z-index: 99;
    }
    .nav-links.mobile-open { display: flex; }
    .nav-links .nav-link { padding: .7rem .75rem; font-size: .95rem; }
    .nav-user { gap: .35rem; }
    .nav-user-name { display: none; }
    .nav-badge { display: none; }
    .nav-view-toggle { display: none !important; }
    .nav-dealer-badge { display: none !important; }
    .lang-switcher .lang-btn { padding: 3px 6px; }
    .theme-toggle-btn { padding: 3px 6px; }
    .nav-mobile-extras {
        display: flex;
        flex-direction: column;
        gap: .6rem;
        margin-top: .5rem;
        padding-top: .75rem;
        border-top: 1px solid var(--border);
    }
    .nav-mobile-user { display: flex; align-items: center; gap: .5rem; padding: 0 .75rem; }
    .nav-mobile-user .nav-badge { display: inline-flex; }
    .nav-mobile-view-toggle { display: flex; flex-wrap: wrap; gap: .35rem; padding: 0 .75rem; }
    .nav-mobile-view-toggle .nav-inline-form { display: inline; }
}

@media (max-width: 768px) {
    .col-hide-sm { display: none; }

    /* Prevents iOS Safari from zooming in when tapping inputs */
    .form-control { font-size: 16px; }

    /* Login */
    .login-wrapper { align-items: flex-start; padding: 2rem 1rem; }
    .login-brand img { height: 56px; }
    .login-brand { margin-bottom: 1.5rem; }

    /* Layout */
    .container { padding: 1rem; }
    .card-header { padding: 1rem; }
    .card-body { padding: 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header h1 { font-size: 1.3rem; }

    /* File list */
    .file-item { flex-wrap: wrap; gap: .75rem; padding: 1rem; }
    .file-actions {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: .4rem;
    }

    /* License */
    .license-grid { grid-template-columns: 140px 1fr; }
    .license-flag-grid { grid-template-columns: 1fr; }
    .license-detail-wrap   { width: 100%; }
    .license-detail-layout { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

    /* Forms */
    .form-row { grid-template-columns: 1fr; }

    /* Upload */
    .upload-zone { padding: 2rem 1rem; }

    /* Stats */
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

@media (max-width: 480px) {
    html { font-size: 14px; }
    .nav-inner { padding: 0 .75rem; }
    .container { padding: .75rem; }
    .card-header { padding: .75rem 1rem; }
    .card-body { padding: .75rem 1rem; }
    .file-item { padding: .75rem; }
    .login-card { padding: 1.5rem 1.25rem; }
    .login-brand { margin-bottom: 1rem; }
    .login-brand img { height: 48px; }
}

/* ============================================================
   UTILITY — replaces all inline style="" attributes
   ============================================================ */

/* Display */
.d-none   { display: none; }
.d-inline { display: inline; }
.d-flex   { display: flex; }
.d-grid   { display: grid; }

/* Flex helpers */
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.flex-shrink0 { flex-shrink: 0; }
.align-start  { align-items: flex-start; }
.align-center { align-items: center; }
.align-end    { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-1  { gap: .25rem; }
.gap-2  { gap: .3rem; }
.gap-3  { gap: .4rem; }
.gap-4  { gap: .5rem; }
.gap-5  { gap: .6rem; }
.gap-6  { gap: .75rem; }
.gap-7  { gap: 1rem; }
.gap-8  { gap: 1.25rem; }
.gap-9  { gap: 1.5rem; }
.gap-px { gap: 1px; }

/* Overflow */
.overflow-visible { overflow: visible; }
.overflow-y-auto  { overflow-y: auto; }

/* Position */
.position-relative { position: relative; }
.position-absolute { position: absolute; inset: 0; }

/* Max-width card variants */
.card-narrow  { max-width: 480px; }
.card-medium  { max-width: 600px; }
.card-wide    { max-width: 700px; }
.card-config  { max-width: 760px; width: 100%; }

/* Spacing extras */
.mb-05  { margin-bottom: .35rem; }
.mb-06  { margin-bottom: .6rem; }
.mb-7   { margin-bottom: .75rem; }
.mt-05  { margin-top: .25rem; }
.mt-8   { margin-top: 1.25rem; }
.mt-15  { margin-top: 1.5rem; }
.mt-10  { margin-top: 10px; }
.p-card { padding: 1.5rem; }

/* Pointer */
.cursor-pointer   { cursor: pointer; }
.user-select-none { user-select: none; }
.pointer-none     { pointer-events: none; }
.w-full           { width: 100%; }

/* ── Typography helpers ───────────────────────────────── */
.text-xs    { font-size: .75rem; }
.text-sm    { font-size: .85rem; }
.text-base  { font-size: 1rem; }
.text-lg    { font-size: 1.1rem; }
.fw-500     { font-weight: 500; }
.fw-600     { font-weight: 600; }
.fw-700     { font-weight: 700; }
.fw-800     { font-weight: 800; }
.fw-400     { font-weight: 400; }
.text-primary  { color: var(--primary); }
.text-muted-xs { font-size: .65rem; color: var(--muted); font-weight: 600; letter-spacing: .03em; }
.text-mono     { font-family: monospace; }
.white-space-nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.line-height-1 { line-height: 1; }
.letter-spacing-wide { letter-spacing: .12em; }
.opacity-3 { opacity: .3; }

/* ── Page header count ────────────────────────────────── */
.page-count { font-weight: 400; color: var(--muted); font-size: 1rem; }

/* ── Login page ───────────────────────────────────────── */
.login-brand-img { height: 72px; width: auto; object-fit: contain; margin-bottom: .5rem; }
.login-2fa-title { text-align: center; font-weight: 700; font-size: 1rem; margin-bottom: .25rem; }
.login-2fa-desc  { text-align: center; font-size: .85rem; color: var(--muted); margin-bottom: 1.25rem; }
.login-cancel-link { font-size: .82rem; color: var(--muted); }

/* ── Form check (checkbox row) ────────────────────────── */
.form-check       { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.form-check-input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.form-check-label { margin: 0; font-family: var(--font); font-weight: 500; font-size: .88rem; cursor: pointer; }

/* ── Roles checklist (inline checkboxes for file role picker) ── */
.roles-checklist                   { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; margin-top: .35rem; }
.roles-checklist .form-check       { margin-bottom: 0; }

/* ── TOTP / 2FA ───────────────────────────────────────── */
.totp-input   { font-size: 1.4rem; letter-spacing: .3em; text-align: center; }
.totp-input-sm { font-size: 1.3rem; letter-spacing: .25em; text-align: center; }
.setup-qr-wrap  { text-align: center; margin-bottom: .75rem; }
.setup-qr-box   { display: inline-block; background: #fff; padding: 10px; border-radius: 8px; border: 1px solid var(--border); }
.setup-secret-block { background: var(--bg); border-radius: var(--radius-sm); padding: .65rem 1rem; text-align: center; margin-bottom: 1.5rem; }
.setup-secret-label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: .3rem; }
.setup-secret-code  { font-family: monospace; font-size: .95rem; letter-spacing: .12em; font-weight: 700; word-break: break-all; }
.setup-intro-text   { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.setup-step-title   { font-weight: 700; font-size: .88rem; margin-bottom: .35rem; }
.setup-step-apps    { font-size: .85rem; color: var(--muted); margin-bottom: 1.5rem; }
.setup-form-group   { max-width: 220px; }
.disable-intro-text { color: var(--muted); font-size: .9rem; margin-bottom: 1.25rem; }
.disable-pwd-input  { max-width: 280px; }

/* ── 2FA status badges ────────────────────────────────── */
.badge-2fa { flex-shrink: 0; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.badge-2fa-on  { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }
.badge-2fa-off { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
[data-theme="dark"] .badge-2fa-on  { background: #052e16; color: #86efac; border-color: #166534; }
[data-theme="dark"] .badge-2fa-off { background: #450a0a; color: #fca5a5; border-color: #991b1b; }

/* ── Active/inactive status badges in tables ──────────── */
.badge-active   { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: #f0fdf4; color: #166534; }
.badge-inactive { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: #f9fafb; color: var(--muted); }
[data-theme="dark"] .badge-active   { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-inactive { background: #1e293b; color: var(--muted); }

/* ── Language switcher ────────────────────────────────── */
.lang-bar      { display: flex; justify-content: center; align-items: center; gap: .6rem; margin-top: 1.5rem; flex-wrap: wrap; }
.lang-switcher { display: flex; gap: 2px; border: 1.5px solid var(--border); border-radius: 20px; overflow: hidden; }
.lang-btn      { padding: 3px 9px; font-size: .72rem; font-weight: 700; text-decoration: none; transition: all var(--speed); color: var(--muted); }
.lang-btn-lg   { padding: 4px 14px; font-size: .75rem; font-weight: 700; text-decoration: none; color: var(--muted); }
.lang-btn-active     { background: var(--primary); color: #fff; }
.lang-btn-active:hover { color: #fff; }

/* ── Theme toggle button ──────────────────────────────── */
.theme-toggle-btn { background: none; border: 1.5px solid var(--border); border-radius: 20px; padding: 3px 8px; cursor: pointer; font-size: 1rem; line-height: 1; color: var(--muted); transition: all var(--speed); }
.theme-toggle-btn-lg { background: none; border: 1.5px solid var(--border); border-radius: 20px; padding: 4px 10px; cursor: pointer; font-size: 1rem; line-height: 1; color: var(--muted); }

/* ── Nav extras ───────────────────────────────────────── */
.nav-brand-img   { height: 32px; width: auto; object-fit: contain; }
.nav-brand-stack { display: flex; flex-direction: column; line-height: 1; }
.nav-brand-sub   { font-size: .55em; font-weight: 600; letter-spacing: .12em; color: var(--muted); }
.nav-brand-maitred-wrap { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; gap: 3px; }
.nav-inline-form { display: inline; margin: 0; }
.nav-view-toggle { display: flex; gap: .35rem; align-items: center; flex-wrap: nowrap; flex-shrink: 0; }
.nav-mobile-extras { display: none; }
.nav-mobile-username { font-weight: 600; font-size: .9rem; color: var(--text); text-decoration: none; }
.nav-mobile-username:hover { color: var(--primary); }
.view-toggle-btn { font-size: .75rem; font-weight: 700; padding: 4px 12px; border-radius: 20px; white-space: nowrap; cursor: pointer; font-family: var(--font); background: none; border: 1.5px solid; }
.view-toggle-dealer        { background: #fef9c3; color: #854d0e; border-color: #fcd34d; }
.view-toggle-internal      { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.view-toggle-support-admin { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.view-toggle-admin         { background: #f0fdf4; color: #166534; border-color: #86efac; }
[data-theme="dark"] .view-toggle-dealer        { background: #422006; color: #fcd34d; border-color: #78350f; }
[data-theme="dark"] .view-toggle-internal      { background: #431407; color: #fed7aa; border-color: #9a3412; }
[data-theme="dark"] .view-toggle-support-admin { background: #1e1b4b; color: #a5b4fc; border-color: #4338ca; }
[data-theme="dark"] .view-toggle-admin         { background: #052e16; color: #86efac; border-color: #166534; }
.nav-dealer-badge { font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 20px; background: #e0f2fe; color: #0369a1; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.nav-username-link { text-decoration: none; font-weight: 600; font-size: .85rem; }
[data-theme="dark"] .nav-dealer-badge { background: #0c2d3f; color: #38bdf8; }

/* ── Btn full-width ───────────────────────────────────── */
.btn-block { width: 100%; justify-content: center; }

/* ── Card header flex row ─────────────────────────────── */
.card-header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card-header-flex { display: flex; align-items: center; gap: .75rem; }
.card-body-muted  { color: var(--muted); font-size: .9rem; }
.card-header-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }


/* ── Table toolbar ────────────────────────────────────── */
.table-toolbar { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1rem; border-bottom: 1px solid var(--border); gap: 1rem; flex-wrap: wrap; }
.table-count   { font-size: .85rem; color: var(--muted); }
.table-perpage { display: flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 600; color: var(--muted); }
.table-sort-link { text-decoration: none; color: inherit; }
.th-narrow     { width: 100px; }
.th-type       { width: 110px; }
.th-version    { width: 90px; white-space: nowrap; }
.th-lcdate     { width: 105px; white-space: nowrap; }
.th-active     { width: 70px; }
.th-order      { width: 80px; }
.td-text-sm    { font-size: .875rem; color: var(--muted); }
.td-text-xs    { font-size: .8rem; color: var(--muted); }
.td-version    { font-size: .875rem; }

/* ── Golden version legend bar ────────────────────────── */
.golden-legend { display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem; font-size: .78rem; color: var(--muted); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.golden-legend-item { display: flex; align-items: center; gap: .4rem; }
.golden-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.golden-swatch-current  { background: #fefce8; border: 1px solid #fde047; }
.golden-swatch-outdated { background: #fef2f2; border: 1px solid #fca5a5; }
.golden-swatch-pilot    { background: #f5f3ff; border: 1px solid #c4b5fd; }

/* ── Pagination ───────────────────────────────────────── */
.pager { display: flex; justify-content: center; align-items: center; gap: .3rem; padding: .75rem 1rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager-ellipsis { padding: 0 .25rem; color: var(--muted); }
.btn-disabled   { pointer-events: none; opacity: .4; }

/* ── Search/filter toolbar ────────────────────────────── */
.search-form      { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.search-input     { flex: 2; min-width: 220px; max-width: 480px; }
.filter-col       { display: flex; flex-direction: column; gap: 1px; }
.filter-label     { font-size: .65rem; color: var(--muted); font-weight: 600; letter-spacing: .03em; white-space: nowrap; }
.filter-select-sm { width: auto; font-size: .82rem; }
.filter-checkbox  { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--text); cursor: pointer; user-select: none; padding-bottom: .35rem; white-space: nowrap; }
.filter-checkbox input[type="checkbox"] { margin: 0; cursor: pointer; }
.h1-sub           { font-weight: 400; color: var(--muted); font-size: 1rem; }

/* ── Dashboard ────────────────────────────────────────── */
.dash-notice-mb  { margin-bottom: .6rem; }
.dash-chart-pad  { padding: 1.5rem; }
.dash-bars-pad   { display: none; padding: 1.5rem; }
.dash-ver-note   { font-size: .72rem; color: var(--muted); padding: .5rem 1.5rem 1rem; margin: 0; }
.dash-hdr-btns   { display: flex; gap: .3rem; }
.cat-toggle-header { cursor: pointer; user-select: none; transition: background .15s; }
.cat-toggle-header:hover { background: var(--bg); }
.cat-header-name { color: var(--primary); }
.cat-header-count { font-size: .85rem; font-weight: 600; color: var(--muted); }
.cat-chevron {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; flex-shrink: 0;
    border-radius: 50%; border: 1.5px solid var(--border);
    color: var(--muted); background: var(--surface);
    transition: transform .25s ease, color .15s, border-color .15s, background .15s;
}
.cat-toggle-header:hover .cat-chevron { color: var(--primary); border-color: var(--primary); background: var(--bg); }
.file-icon-img   { height: 40px; width: 40px; object-fit: contain; }
.file-version    { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.file-release-links { display: flex; gap: 1rem; margin-top: .25rem; }
.file-release-link  { font-size: .8rem; font-weight: 600; }
.file-inline-form   { display: inline; }

/* ── Static color swatches ─────────────────────────────── */
.swatch-amber { background: #f59e0b; }
.swatch-red   { background: var(--accent); }

/* ── Chart widgets ────────────────────────────────────── */
.chart-section-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.chart-donut-row { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.chart-donut-wrap    { position: relative; width: 180px; height: 180px; flex-shrink: 0; }
.chart-donut-wrap-lg { position: relative; width: 220px; height: 220px; flex-shrink: 0; }
.chart-center-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.chart-center-count  { font-size: 1.4rem; font-weight: 800; color: var(--primary); line-height: 1; }
.chart-center-label  { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.chart-center-label-sm { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.chart-legend-col    { display: flex; flex-direction: column; gap: .6rem; }
.chart-legend-col-sm { display: flex; flex-direction: column; gap: .5rem; }
.chart-legend-row    { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.chart-legend-list   { min-width: 180px; max-width: 260px; display: flex; flex-direction: column; gap: .35rem; align-content: start; }
.chart-legend-list-sm { display: flex; flex-wrap: wrap; gap: .35rem .75rem; align-content: start; }
.chart-legend-item   { display: flex; align-items: center; gap: .5rem; font-size: .8rem; cursor: pointer; user-select: none; }
.chart-legend-item-sm { display: flex; align-items: center; gap: .4rem; font-size: .8rem; cursor: pointer; user-select: none; }
.chart-swatch        { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.chart-swatch-md     { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.chart-ver-label     { font-weight: 700; color: var(--text); }
.chart-ver-pct       { color: var(--muted); margin-left: auto; }
.chart-ver-pct-xs    { font-size: .72rem; }
.chart-count-block   { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .25rem; min-width: 90px; }
.chart-count-block-sm { display: flex; flex-direction: column; align-items: center; gap: .2rem; min-width: 80px; }
.chart-big-count     { font-size: 2.5rem; font-weight: 800; color: var(--primary); line-height: 1; }
.chart-big-label     { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.chart-legend-val    { font-weight: 800; margin-left: .4rem; }
.chart-legend-pct    { color: var(--muted); font-size: .75rem; }
.chart-versions-wrap { display: flex; align-items: center; gap: 2.5rem; flex-wrap: wrap; flex: 1; min-width: 0; }
.chart-versions-bar  { flex: 1; min-width: 0; }
.chart-bars-hdr      { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.chart-bars-canvas   { max-width: 700px; }
.chart-golden-bars-canvas { width: 100%; max-width: 280px; }
.chart-split-pilot  { display: flex; flex-direction: column; gap: .3rem; padding-left: 1.5rem; border-left: 1px solid var(--border); align-self: center; }
.chart-pilot-num    { font-size: 2.75rem; font-weight: 700; color: #0d9488; line-height: 1; text-decoration: none; }
a.chart-pilot-num:hover { text-decoration: underline; }
.chart-pilot-label  { font-size: .8rem; color: var(--text-muted); }
.chart-overflow { overflow: visible; }

/* ── Profile page ─────────────────────────────────────── */
.profile-card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* ── Users/edit-user: dealer modal ────────────────────── */
.dealer-modal        { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.45); align-items: center; justify-content: center; }
.dealer-modal-inner  { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 80vh; display: flex; flex-direction: column; margin: 1rem; }
.dealer-modal-head   { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.dealer-modal-title  { font-size: 1rem; }
.dealer-modal-close  { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); }
.dealer-modal-search { padding: .75rem 1.25rem; border-bottom: 1px solid var(--border); }
.dealer-modal-list   { overflow-y: auto; flex: 1; }
.dealer-row          { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1.25rem; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.dealer-row:hover    { background: var(--bg); }
.dealer-row-name     { font-weight: 600; }
.dealer-row-id       { font-size: .8rem; color: var(--muted); font-weight: 700; }
.dealer-label-all    { font-style: italic; color: var(--muted); }
.dealer-id-sub       { font-size: .75rem; color: var(--muted); }
.dealer-labels-wrap  { display: flex; flex-wrap: wrap; gap: .25rem; }
.dealer-label-multi  { display: inline-flex; align-items: baseline; gap: .15rem; font-size: .8rem; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: .1rem .45rem; white-space: nowrap; }
.dealer-chips-wrap   { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; min-height: 1.5rem; }
.dealer-chip         { display: inline-flex; align-items: center; gap: .2rem; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: .2rem .3rem .2rem .6rem; font-size: .8rem; font-weight: 600; }
.dealer-chip-id      { color: var(--muted); font-weight: 400; }
.dealer-chip-remove  { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 1.1rem; line-height: 1; padding: 0 .15rem; border-radius: 3px; }
.dealer-chip-remove:hover { color: #ef4444; background: #fef2f2; }
.user-row-inactive   { opacity: .5; }
.user-pwd-form       { margin-top: .5rem; }
.user-pwd-input      { max-width: 220px; }
.user-actions-muted  { font-size: .8rem; color: var(--muted); }
.user-inline-form    { display: flex; gap: .5rem; align-items: center; }

/* ── admin/users.php: dealer id row ──────────────────── */
.dealer-field-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.dealer-id-input  { min-width: 80px; }
.user-hint        { color: var(--muted); font-size: .78rem; margin-top: .3rem; display: block; }
.pwd-icon-btn     { padding: .35rem .5rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ── edit-user: active checkbox row ──────────────────── */
.active-check-row { display: flex; align-items: center; gap: .75rem; padding-top: 1.5rem; }
.active-check-label { margin: 0; font-weight: 600; }

/* ── admin/config.php ─────────────────────────────────── */
.config-settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.config-settings-grid > .card { display: flex; flex-direction: column; }
.config-settings-grid > .card > .card-body { flex: 1; display: flex; flex-direction: column; }
.config-checkbox-label  { display: flex; align-items: center; gap: .6rem; cursor: pointer; font-family: var(--font); font-size: .9rem; font-weight: 500; color: var(--text); }
.config-checkbox-action { margin-top: auto; padding-top: 1.5rem; }
.notice-list    { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(700px, 100%), 1fr)); gap: 1rem; }
.notice-inner   { display: flex; gap: .75rem; align-items: flex-start; }
.notice-texts   { flex: 1; display: flex; flex-direction: row; gap: .75rem; min-width: 0; }
.notice-texts > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.notice-side    { display: flex; flex-direction: column; gap: .3rem; width: 175px; flex-shrink: 0; }
@media (max-width: 768px) {
    .notice-inner { flex-direction: column; }
    .notice-texts { flex-direction: column; }
    .notice-side  { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .notice-side .notice-select-sm { flex: 1; min-width: 120px; }
}
.notice-lang-label { font-size: .72rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.notice-select-sm  { font-size: .78rem; padding: .25rem .4rem; }
.notice-remove-btn { color: #ef4444; border-color: #ef4444; font-size: .75rem; padding: .2rem .5rem; }
.notice-action-bar { display: flex; gap: .75rem; margin-top: 1.25rem; flex-wrap: wrap; align-items: center; }
.notice-clear-btn  { color: #ef4444; border-color: #ef4444; margin-left: auto; }
.notice-count-hint { font-size: .8rem; color: var(--muted); font-weight: 600; }
.config-text-hint  { font-size: .875rem; color: var(--muted); margin-bottom: 1.25rem; }
.config-golden-form { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.config-golden-input { max-width: 200px; }
.config-golden-hint { font-size: .8rem; color: var(--muted); }
.config-save-bar    { display: flex; justify-content: flex-end; margin: 1.25rem 0 2rem; }

/* ── Pilot respond page ─────────────────────────────────────────────────── */
.pilot-respond-layout         { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 860px)     { .pilot-respond-layout { grid-template-columns: 1fr; } }
.pilot-respond-email          { color: var(--muted); font-size: .82rem; margin-left: .25rem; }
.pilot-respond-notes          { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.pilot-respond-notes-label    { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .4rem; }
.pilot-respond-notes p        { margin: 0; font-size: .9rem; color: var(--text); line-height: 1.65; }
.pilot-respond-actions        { display: flex; gap: 1rem; margin-top: .5rem; flex-wrap: wrap; }
.pilot-action-opt             { display: flex; align-items: center; gap: .6rem; padding: .75rem 1.25rem; border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; font-family: var(--font); font-size: .9rem; transition: all var(--speed); flex: 1; min-width: 130px; justify-content: center; }
.pilot-action-opt input       { display: none; }
.pilot-action-icon            { font-size: 1.1rem; }
.pilot-action-approve:hover,
.pilot-action-approve.pilot-action-selected { border-color: #16a34a; background: #f0fdf4; color: #166534; }
.pilot-action-deny:hover,
.pilot-action-deny.pilot-action-selected    { border-color: #dc2626; background: #fff1f2; color: #991b1b; }
[data-theme="dark"] .pilot-action-approve.pilot-action-selected { background: #052e16; color: #86efac; }
[data-theme="dark"] .pilot-action-deny.pilot-action-selected    { background: #450a0a; color: #fca5a5; }

/* ── Pilot active-submission badge (license detail) ─────────────────────── */
.pilot-active-badge  { display:inline-flex;align-items:center;gap:.4rem;padding:.35rem .8rem;border-radius:var(--radius-sm);background:var(--bg-alt);border:1px solid var(--border);font-size:.82rem;color:var(--muted); }
.pilot-active-link   { color:var(--primary);text-decoration:none;font-weight:600; }
.pilot-active-link:hover { text-decoration:underline; }

/* ── Pilot submissions list ─────────────────────────────────────────────── */
.pilot-sub-has-msg            { font-size: 1.1rem; cursor: help; }
.pilot-sub-msg-row td         { background: var(--bg) !important; }
.pilot-search-form            { display: flex; gap: .5rem; align-items: center; flex: 1; max-width: 560px; }
.clickable-row                { cursor: pointer; transition: background var(--speed); }
.clickable-row:hover td       { background: var(--table-hover, rgba(0,0,0,.04)); }
[data-theme="dark"] .clickable-row:hover td { background: rgba(255,255,255,.04); }

/* ── Pilot submission detail ─────────────────────────────────────────────── */
.pilot-detail-field           { display: flex; gap: .75rem; align-items: baseline; margin-bottom: .85rem; flex-wrap: wrap; }
.pilot-detail-label           { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); min-width: 110px; flex-shrink: 0; }
.pilot-manage-row             { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
@media (max-width: 640px)     { .pilot-manage-row { flex-direction: column; } .pilot-manage-row > .form-group { flex: 1 1 100% !important; } }

/* ── edit-file / upload: image picker ─────────────────── */
.img-picker      { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.img-opt         { display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; padding: 6px; overflow: hidden; transition: border-color .15s, background .15s; font-size: .72rem; color: var(--muted); text-align: center; }
.img-opt-selected { border-color: var(--primary); background: var(--surface-hover, #f0f4ff); }
.img-opt img     { max-width: 100%; max-height: 58px; object-fit: contain; pointer-events: none; }
.file-info-box   { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1.5rem; font-size: .875rem; }
.file-info-row   { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.file-info-img   { height: 36px; width: 36px; object-fit: contain; flex-shrink: 0; }
.file-info-meta  { color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.file-info-ver   { color: var(--muted); }
.replace-section { border-top: 1px solid var(--border); margin-top: 1.25rem; padding-top: 1.25rem; }
.replace-label   { font-weight: 600; display: block; margin-bottom: .4rem; }
.replace-hint    { font-size: .8rem; color: var(--muted); font-weight: 400; }
.replace-note    { font-size: .8rem; color: var(--muted); margin-top: .35rem; }
.form-actions    { display: flex; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* ── Upload page: progress bar ─────────────────────────── */
.progress-wrap   { margin-top: 1rem; }
.progress-header { display: flex; justify-content: space-between; margin-bottom: .35rem; font-size: .85rem; font-weight: 600; }
.progress-track  { background: #e5e7eb; border-radius: 99px; height: 10px; overflow: hidden; }
.progress-bar    { height: 100%; width: 0; background: var(--primary); border-radius: 99px; transition: width .15s; }
.progress-status { font-size: .8rem; color: var(--muted); margin-top: .4rem; }
[data-theme="dark"] .progress-track { background: #334155; }

/* ── License detail ────────────────────────────────────── */
.lic-detail-cols { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.lic-section-hd  { padding: .4rem 1rem; background: var(--bg); border-top: 2px solid var(--border); border-bottom: 1px solid var(--border); }
.lic-section-title { font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lic-section-hd.lic-card-toggle { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; transition: background .15s; }
.lic-section-hd.lic-card-toggle:hover { background: var(--card-bg, var(--bg)); }
.lic-section-hd.lic-card-toggle:hover .lic-card-chevron { color: var(--primary); border-color: var(--primary); }
.lic-card-chevron {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; flex-shrink: 0;
    border-radius: 50%; border: 1.5px solid var(--border);
    color: var(--muted); margin-left: .5rem;
    transition: transform .15s ease, color .15s, border-color .15s;
}
.lic-section-hd.lic-card-collapsed .lic-card-chevron { transform: rotate(-90deg); }
.lic-section-hd.lic-card-collapsed + .lic-card-body  { display: none; }
.lic-info-row    { display: flex; justify-content: space-between; align-items: center; padding: 0 1rem; min-height: 28px; border-bottom: 1px solid var(--border); gap: 1rem; }
.lic-info-label  { font-size: .8rem; font-weight: 600; color: var(--muted); white-space: nowrap; line-height: 28px; }
.lic-info-val    { font-size: .8rem; white-space: nowrap; line-height: 28px; }
.lic-addr-block  { padding: .6rem 1rem; font-size: .85rem; line-height: 1.6; border-bottom: 2px solid var(--border); }
.lic-addr-block-last { padding: .6rem 1rem; font-size: .85rem; line-height: 1.6; }
.lic-bar-device-row { display: flex; align-items: center; padding: .4rem 1rem; font-size: .85rem; border-bottom: 1px solid var(--border); }
.lic-detail-grid-wrap { display: grid; gap: 1rem; align-items: start; }
.lic-flag-check  { flex-shrink: 0; width: 20px; text-align: right; font-size: .9rem; font-weight: 700; color: #22c55e; }
.lic-flag-cross  { flex-shrink: 0; width: 20px; text-align: right; font-size: .9rem; font-weight: 700; color: #ef4444; }
.lic-flag-row    { display: flex; align-items: center; padding: .3rem 1rem; border-bottom: 1px solid var(--border); gap: .5rem; }
.lic-flag-label  { font-size: .8rem; font-weight: 600; flex: 1; }
.lic-detail-hdr  { display: flex; gap: .5rem; align-items: center; }

/* ── helpers.php auto_link ─────────────────────────────── */
.auto-link { color: inherit; font-weight: 700; text-decoration: underline; }

/* ── Categories ────────────────────────────────────────── */
.cat-order-td  { width: 80px; }
.cat-order-inp { width: 70px; }
.cat-actions-td { white-space: nowrap; }

/* ── Audit log badges (logs.php) ───────────────────────────── */
.log-badge          { display:inline-block; padding:.2rem .55rem; border-radius:9999px; font-size:.72rem; font-weight:700; white-space:nowrap; }
.log-badge-blue     { background:#dbeafe; color:#1d4ed8; }
.log-badge-green    { background:#dcfce7; color:#15803d; }
.log-badge-orange   { background:#ffedd5; color:#c2410c; }
.log-badge-red      { background:#fee2e2; color:#b91c1c; }
.log-badge-purple   { background:#ede9fe; color:#6d28d9; }
.log-filters        { display:flex; flex-wrap:wrap; gap:.6rem; align-items:flex-end; margin-bottom:1.25rem; }
.log-filters .form-group { margin:0; }
.log-filters label  { font-size:.75rem; font-weight:600; display:block; margin-bottom:.25rem; }
.log-table th, .log-table td { vertical-align:top; }
.log-row            { cursor:pointer; }
.log-row:hover      { background:var(--bg); }
.log-detail-grid    { display:grid; grid-template-columns:max-content 1fr; gap:.6rem 1rem; align-items:start; }
.log-detail-grid dt { font-weight:600; color:var(--muted,#6b7280); font-size:.85rem; }
.log-detail-grid dd { margin:0; word-break:break-word; }
.log-desc           { max-width:280px; word-break:break-word; }
.log-meta           { font-size:.8rem; color:var(--muted, #6b7280); }
[data-theme="dark"] .log-badge-blue   { background:#1e3a5f; color:#93c5fd; }
[data-theme="dark"] .log-badge-green  { background:#14532d; color:#86efac; }
[data-theme="dark"] .log-badge-orange { background:#431407; color:#fdba74; }
[data-theme="dark"] .log-badge-red    { background:#450a0a; color:#fca5a5; }
[data-theme="dark"] .log-badge-purple { background:#2e1065; color:#c4b5fd; }

/* ── Changelog (changelog.php) ─────────────────────────────── */
.cl-form-grid            { display:grid; grid-template-columns:1fr 1fr; gap:.75rem; }
.cl-form-grid .cl-full   { grid-column:1/-1; }
.cl-date-group           { display:flex; flex-direction:column; gap:.35rem; margin-bottom:1.25rem; }
.cl-date-group:last-child{ margin-bottom:0; }
.cl-date-label           { font-size:.78rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted,#6b7280); padding-bottom:.4rem; border-bottom:1px solid var(--border,#e5e7eb); margin-bottom:.15rem; }
.cl-entry                { display:flex; align-items:center; gap:.85rem; padding:.6rem .85rem .6rem 1rem; border-left:4px solid transparent; border-radius:.35rem; }
.cl-entry[data-cat="feature"]     { border-left-color:#16a34a; background:#f0fdf4; }
.cl-entry[data-cat="fix"]         { border-left-color:#dc2626; background:#fff5f5; }
.cl-entry[data-cat="improvement"] { border-left-color:#d97706; background:#fffbeb; }
.cl-entry[data-cat="security"]    { border-left-color:#9333ea; background:#faf5ff; }
.cl-entry[data-cat="other"]       { border-left-color:#6b7280; background:#f9fafb; }
.cl-badge                { display:inline-flex; align-items:center; padding:.22rem .65rem; border-radius:9999px; font-size:.72rem; font-weight:700; white-space:nowrap; flex-shrink:0; align-self:flex-start; margin-top:.1rem; min-width:90px; justify-content:center; }
.cl-badge-feature        { background:#dcfce7; color:#15803d; }
.cl-badge-fix            { background:#fee2e2; color:#b91c1c; }
.cl-badge-improvement    { background:#fef3c7; color:#b45309; }
.cl-badge-security       { background:#ede9fe; color:#6d28d9; }
.cl-badge-other          { background:#f3f4f6; color:#4b5563; }
.cl-entry-body           { flex:1; min-width:0; }
.cl-entry-title          { font-weight:600; font-size:.9rem; color:var(--text); }
.cl-entry-desc           { font-size:.82rem; color:var(--muted); margin-top:.2rem; white-space:pre-wrap; word-break:break-word; }
.cl-entry-meta           { font-size:.75rem; color:var(--muted); margin-top:.2rem; }
.cl-entry-actions        { display:flex; gap:.4rem; flex-shrink:0; align-self:center; }
.cl-entry-actions form   { display:contents; }
.cl-btn-delete           { color:#b91c1c !important; border-color:#fca5a5 !important; }
.cl-btn-delete:hover     { background:#fee2e2 !important; }
[data-theme="dark"] .cl-entry[data-cat="feature"]     { background:#052e16; }
[data-theme="dark"] .cl-entry[data-cat="fix"]         { background:#300; }
[data-theme="dark"] .cl-entry[data-cat="improvement"] { background:#2c1700; }
[data-theme="dark"] .cl-entry[data-cat="security"]    { background:#1e0a3c; }
[data-theme="dark"] .cl-entry[data-cat="other"]       { background:#1f2937; }
[data-theme="dark"] .cl-badge-feature                 { background:#14532d; color:#86efac; }
[data-theme="dark"] .cl-badge-fix                     { background:#450a0a; color:#fca5a5; }
[data-theme="dark"] .cl-badge-improvement             { background:#451a03; color:#fcd34d; }
[data-theme="dark"] .cl-badge-security                { background:#2e1065; color:#c4b5fd; }
[data-theme="dark"] .cl-badge-other                   { background:#374151; color:#d1d5db; }
[data-theme="dark"] .cl-btn-delete                    { border-color:#7f1d1d !important; }
[data-theme="dark"] .cl-btn-delete:hover              { background:#450a0a !important; }

/* Dashboard chart split layout */
.chart-split { display: flex; align-items: flex-start; gap: 0; flex-wrap: wrap; }
.chart-split-golden {
    display: flex; flex-direction: column; gap: .75rem;
    padding-right: 2rem; margin-right: 2rem;
    border-right: 1px solid var(--border);
}
@media (max-width: 768px) {
    .chart-split { flex-direction: column; }
    .chart-split-golden {
        padding-right: 0; margin-right: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-bottom: 1.25rem; margin-bottom: 1.25rem;
    }
}

/* ── NinjaOne-sourced field values ─────────────────────────────────────────
   Violet/purple — distinct from primary sky-blue, success green, and danger
   red already in the palette. Darker tone for light theme readability,
   lighter tone for dark theme.                                            */
:root              { --ninja-val-fg: #2563eb; }   /* blue-600 */
[data-theme="dark"] { --ninja-val-fg: #60a5fa; }  /* blue-400 */
.lic-ninja-val,
.lic-smartcard-sub .lic-info-val,
.lic-eft-sub .lic-info-val,
.lic-hotel-sub .lic-info-val,
.lic-ext-orders-sub .lic-info-val,
.lic-schedule-sub .lic-info-val,
.lic-ninja-card .lic-info-val { color: var(--ninja-val-fg); }
.lic-ninja-card { margin-top: 1.25rem; }
.lic-ver-chip { display: inline-block; font-size: .58rem; font-weight: 700; padding: 1px 5px; border-radius: 6px; text-transform: uppercase; letter-spacing: .4px; vertical-align: middle; margin-left: .3rem; line-height: 1.5; }
.lic-ver-chip-outdated { background: var(--danger); color: #fff; }
.lic-ver-chip-golden { background: #d97706; color: #fff; }
.lic-ver-chip-pilot  { background: #7c3aed; color: #fff; }
[data-theme="dark"] .lic-ver-chip-golden { background: #f59e0b; color: #1a1a1a; }
[data-theme="dark"] .lic-ver-chip-pilot  { background: #a78bfa; color: #1a1a1a; }
/* Fallback for unparseable OS strings */
.lic-os-list { padding: .6rem 1rem; font-size: .85rem; line-height: 1.55; word-break: break-word; }

/* Workstations / Kitchen Display OS cards (pagination) */
.os-list[data-mode="paged"] .os-entry { display: none; }
.os-list[data-mode="paged"] .os-entry.os-current-page { display: flex; }
.os-pagination { display: flex; gap: .5rem; align-items: center; padding: .6rem 1rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.os-page-info { font-size: .8rem; color: var(--muted); min-width: 3.5rem; text-align: center; }
.os-toggle-all { margin-left: auto; }

/* Expandable module rows (only used in the Modules card so far) */
.lic-flag-row-expandable { cursor: pointer; user-select: none; }
.lic-expand-chevron {
    display: inline-block;
    margin-left: .4rem;
    color: var(--muted);
    font-weight: bold;
    transition: transform .15s ease;
}
.lic-flag-row-expandable.lic-expanded .lic-expand-chevron { transform: rotate(90deg); }

/* Sub-rows under expandable module / interface flags — hidden until parent is expanded. */
.lic-eft-sub-wrap,
.lic-schedule-sub,
.lic-delivery-sub,
.lic-smartcard-protocols,
.lic-hotel-sub-wrap,
.lic-bar-sub-wrap,
.lic-ext-orders-sub,
.lic-modern-ws-sub,
.lic-modern-kds-sub,
.lic-appareil-sub { display: none; }
.lic-flag-row-expandable.lic-expanded + .lic-eft-sub-wrap,
.lic-flag-row-expandable.lic-expanded + .lic-schedule-sub,
.lic-flag-row-expandable.lic-expanded + .lic-delivery-sub,
.lic-flag-row-expandable.lic-expanded + .lic-smartcard-protocols,
.lic-flag-row-expandable.lic-expanded + .lic-hotel-sub-wrap,
.lic-flag-row-expandable.lic-expanded + .lic-bar-sub-wrap,
.lic-flag-row-expandable.lic-expanded + .lic-ext-orders-sub,
.lic-flag-row-expandable.lic-expanded + .lic-modern-ws-sub,
.lic-flag-row-expandable.lic-expanded + .lic-modern-kds-sub,
.lic-flag-row-expandable.lic-expanded + .lic-appareil-sub { display: block; }
.lic-appareil-id { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 1rem; min-height: 28px; border-bottom: 1px solid var(--border); }
.lic-appareil-id .lic-info-val { font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace; }

/* POS Backups card — one row per S3 object */
.lic-pos-backup-row { display: flex; align-items: center; gap: .75rem; padding: .55rem 1rem; border-bottom: 1px solid var(--border); }
.lic-pos-backup-row:last-of-type { border-bottom: 0; }
.lic-pos-backup-meta { flex: 1; min-width: 0; }
.lic-pos-backup-name { font-size: .9rem; word-break: break-all; }
.lic-pos-backup-sub  { font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.lic-pos-backups-note { padding: .5rem 1rem; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); }

/* ── feedback.php ─────────────────────────────────────── */
.feedback-wrap { max-width: 640px; margin: 2.5rem auto; }
.feedback-hero { text-align: center; margin-bottom: 2rem; }
.feedback-hero-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; font-size: 1.5rem; }
.feedback-hero h1 { font-size: 1.6rem; font-weight: 800; margin: 0 0 .4rem; }
.feedback-hero p { color: var(--muted); font-size: .95rem; margin: 0; }
.feedback-sender-box { display: flex; align-items: center; gap: .85rem; background: var(--primary-light); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .85rem 1rem; margin-bottom: 1.5rem; }
.feedback-sender-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.feedback-sender-info { flex: 1; min-width: 0; }
.feedback-sender-name { font-weight: 700; font-size: .9rem; color: var(--text); }
.feedback-sender-meta { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.feedback-textarea { width: 100%; min-height: 200px; resize: vertical; padding: .85rem 1rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font); font-size: .95rem; line-height: 1.6; background: var(--surface); color: var(--text); transition: border-color var(--speed), box-shadow var(--speed); box-sizing: border-box; }
.feedback-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,143,196,.1); }
.feedback-char-note { text-align: right; font-size: .78rem; color: var(--muted); margin-top: .35rem; }
.feedback-actions { display: flex; align-items: center; gap: .75rem; margin-top: 1.25rem; flex-wrap: wrap; }
.feedback-actions-note { font-size: .8rem; color: var(--muted); }

/* ── Users table — creator sub-label under the Created date ─────────────── */
.user-created-by { font-size: .72rem; color: var(--muted); margin-top: 2px; }

/* ── Admin dealer-preview selector in the nav ───────────────────────────── */
.nav-preview-dealer-sel {
    font-size: .74rem;
    font-weight: 600;
    font-family: var(--font);
    height: 28px;
    padding: 0 8px;
    border-radius: 20px;
    border: 1.5px solid #fcd34d;
    background: #fef9c3;
    color: #854d0e;
    cursor: pointer;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-preview-dealer-sel:focus { outline: none; box-shadow: 0 0 0 2px #fcd34d55; }
[data-theme="dark"] .nav-preview-dealer-sel {
    background: #422006;
    color: #fcd34d;
    border-color: #78350f;
}

/* ── Version chart — external HTML tooltip ─────────────────────────────── */
.ver-tooltip-html {
    position: fixed;
    z-index: 9999;
    display: none;
    pointer-events: none;
    background: rgba(17,17,17,.93);
    color: #fff;
    border-radius: 8px;
    padding: 10px 13px;
    min-width: 155px;
    max-width: 230px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 4px 18px rgba(0,0,0,.28);
    font-size: 12px;
    line-height: 1.55;
}
/* Wider variants activated when sub-version list needs 2 or 3 columns */
.ver-tooltip-html.vtt-wide-2 { max-width: 370px; }
.ver-tooltip-html.vtt-wide-3 { max-width: 520px; }
.ver-tooltip-html .vtt-title {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,.18);
    display: flex;
    align-items: center;
    gap: 7px;
}
.ver-tooltip-html .vtt-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}
.ver-tooltip-html .vtt-total {
    font-weight: 600;
    margin-bottom: 1px;
}
.ver-tooltip-html .vtt-sep {
    border: none;
    border-top: 1px solid rgba(255,255,255,.15);
    margin: 6px 0 4px;
}
/* Sub-version grid — switches to 2 or 3 columns for large lists */
.ver-tooltip-html .vtt-subs { }
.ver-tooltip-html .vtt-subs-2col { columns: 2; column-gap: 14px; }
.ver-tooltip-html .vtt-subs-3col { columns: 3; column-gap: 14px; }
.ver-tooltip-html .vtt-sub-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 1px 0;
    font-size: 11.5px;
    color: rgba(255,255,255,.82);
    break-inside: avoid; /* keep each row in one column */
}
.ver-tooltip-html .vtt-sub-pct { color: rgba(255,255,255,.48); }
