/* IT Help Desk — shared styles for public pages, admin pages and login. */

:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;

    --brand: #1d4ed8;
    --brand-hover: #1e40af;
    --brand-soft: #eff4ff;
    --brand-ring: rgba(29, 78, 216, 0.18);

    --success: #15803d;
    --success-soft: #dcfce7;
    --danger: #b91c1c;
    --danger-hover: #991b1b;
    --danger-soft: #fee2e2;
    --warn: #a16207;
    --warn-soft: #fef3c7;
    --info: #0369a1;
    --info-soft: #e0f2fe;
    --violet: #6d28d9;
    --violet-soft: #ede9fe;

    --sidebar: #0b1730;
    --sidebar-ink: #c7d2e6;
    --sidebar-muted: #7d8bab;
    --sidebar-active: #1a2a4d;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
    --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- Admin shell ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
    background: var(--sidebar);
    color: var(--sidebar-ink);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; color: #fff; }
.brand-mark svg.icon { width: 18px; height: 18px; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--sidebar-muted); letter-spacing: 0.02em; }
.nav-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sidebar-muted); padding: 14px 12px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--sidebar-ink); font-weight: 500; }
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 #60a5fa; }
.nav-link .count { margin-left: auto; font-size: 11px; font-weight: 600; background: #f59e0b; color: #1f1300; border-radius: 999px; padding: 1px 8px; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #23365f; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.user-chip .who { font-size: 13px; color: #fff; font-weight: 500; line-height: 1.2; }
.user-chip .who small { display: block; color: var(--sidebar-muted); font-weight: 400; }
.nav-link.logout { width: 100%; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.nav-link.logout:hover { color: #fecaca; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar, .scrim { display: none; }
.content { padding: 28px 32px 48px; max-width: 1320px; width: 100%; margin: 0 auto; }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.page-header p { color: var(--muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.breadcrumb svg.icon { width: 14px; height: 14px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-header h2, .card-header h3 { font-size: 15px; font-weight: 600; }
.card-header p { color: var(--muted); font-size: 13px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; color: inherit; text-align: left; font: inherit; }
button.stat, a.stat { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
button.stat:hover, a.stat:hover { border-color: var(--brand); box-shadow: var(--shadow-lg); transform: translateY(-1px); text-decoration: none; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.stat-icon svg.icon { width: 20px; height: 20px; }
.stat-value { display: block; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat-label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.tone-blue { background: var(--brand-soft); color: var(--brand); }
.tone-green { background: var(--success-soft); color: var(--success); }
.tone-amber { background: var(--warn-soft); color: var(--warn); }
.tone-red { background: var(--danger-soft); color: var(--danger); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-sky { background: var(--info-soft); color: var(--info); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--surface-2); padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfd; }
.table .ref { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * { margin-left: 4px; }
.table .actions form { display: inline; }
.cell-sub { display: block; color: var(--muted); font-size: 12.5px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg.icon { width: 36px; height: 36px; color: var(--line-strong); margin-bottom: 8px; }
.empty strong { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 2px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-approved, .badge-returned, .badge-active { background: var(--success-soft); color: var(--success); }
.badge-rejected, .badge-not-returned { background: var(--danger-soft); color: var(--danger); }
.badge-received { background: var(--info-soft); color: var(--info); }
.badge-inactive { background: #f1f5f9; color: var(--muted); }
.badge-site { background: var(--brand-soft); color: var(--brand); }
.badge-printer { background: #f1f5f9; color: var(--ink-2); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.2; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
.btn svg.icon { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink-2); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); border-color: #94a3b8; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #166534; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #fecaca; }
.btn-danger-ghost:hover { background: var(--danger-soft); color: var(--danger-hover); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #eef2f7; color: var(--ink); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-sm svg.icon { width: 14px; height: 14px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500; border: 1px solid; }
.alert svg.icon { margin-top: 1px; }
.alert-success { background: #f0fdf4; color: #14532d; border-color: #bbf7d0; }
.alert-error { background: #fef2f2; color: #7f1d1d; border-color: #fecaca; }
.alert ul { margin: 4px 0 0; padding-left: 18px; font-weight: 400; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field label, .field .label { display: block; font-weight: 600; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field .req { color: var(--danger); margin-left: 2px; }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=date], .field input[type=time], .field input[type=search], .field select, .field textarea {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 92px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.field .error { color: var(--danger); font-size: 12.5px; margin-top: 5px; font-weight: 500; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: #f87171; }
.form-section { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); padding-top: 6px; border-top: 1px dashed var(--line); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--brand); }
.search-bar { display: flex; gap: 8px; }
.search-bar .input { max-width: 320px; }

/* Site picker (KB / BSB) */
.site-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.site-option { position: relative; }
.site-option input { position: absolute; opacity: 0; pointer-events: none; }
.site-option label { display: flex !important; align-items: center; gap: 12px; padding: 14px 16px; margin: 0 !important; border: 1.5px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s, box-shadow .15s; }
.site-option label:hover { border-color: #93c5fd; }
.site-code { font-size: 18px; font-weight: 800; letter-spacing: 0.02em; color: var(--ink); min-width: 52px; padding: 0 10px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); }
.site-name { font-weight: 600; color: var(--ink); }
.site-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.site-option .tick { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; color: transparent; }
.site-option .tick svg.icon { width: 12px; height: 12px; stroke-width: 3; }
.site-option input:checked + label { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-ring); }
.site-option input:checked + label .site-code { background: var(--brand); border-color: var(--brand); color: #fff; }
.site-option input:checked + label .tick { background: var(--brand); border-color: var(--brand); color: #fff; }
.site-option input:focus-visible + label { box-shadow: 0 0 0 3px var(--brand-ring); }
.location-reveal[hidden] { display: none; }
.location-reveal { margin-top: 14px; animation: reveal .2s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Printer checklist */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.check-item { display: flex !important; align-items: center; gap: 10px; padding: 9px 12px; margin: 0 !important; border: 1px solid var(--line); border-radius: var(--radius-sm); font-weight: 500 !important; color: var(--ink-2) !important; cursor: pointer; background: var(--surface); }
.check-item:hover { border-color: #93c5fd; }
.check-item input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.check-item:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--ink) !important; }
.check-item small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }

/* ---------- Detail list ---------- */
.dl { display: grid; grid-template-columns: 170px 1fr; }
.dl dt, .dl dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--line); }
.dl dt { color: var(--muted); font-weight: 500; font-size: 13px; }
.dl dd { color: var(--ink); font-weight: 500; }
.dl > :nth-last-child(-n+2) { border-bottom: 0; }
.prose { white-space: pre-line; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Bar charts ---------- */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 5px; }
.bar-row-top span:first-child { color: var(--ink-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row-top span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--brand); }
.bar-fill.amber { background: #f59e0b; }
.bar-fill.green { background: #16a34a; }

/* ---------- Reports: filters ---------- */
.filter-bar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 18px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-item { padding: 6px 12px; border-radius: 6px; color: var(--ink-2); font-weight: 600; font-size: 13px; white-space: nowrap; }
.seg-item:hover { background: #eef2f7; text-decoration: none; color: var(--ink); }
.seg-item.on { background: var(--brand); color: #fff; }
.custom-range { display: inline-flex; align-items: center; gap: 6px; }
.custom-range .input { width: auto; padding: 6px 8px; font-size: 13px; }
.filter-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13px; }

/* ---------- Reports: ranked bars (one series, one hue) ---------- */
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; align-items: center; gap: 12px; padding: 7px 8px; margin: 0 -8px; border-radius: 8px; color: inherit; }
.hbar:hover, .hbar:focus-visible { background: #f1f5fb; text-decoration: none; outline: none; }
.hbar-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar-rank { width: 20px; flex: none; color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.hbar-name { min-width: 0; font-size: 13px; font-weight: 500; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-name small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar-fill { display: block; height: 14px; width: max(3px, calc((100% - 36px) * var(--p))); background: var(--brand); border-radius: 0 4px 4px 0; transition: background .15s; }
.hbar:hover .hbar-fill, .hbar:focus-visible .hbar-fill { background: var(--brand-hover); }
.hbar-value { font-size: 13px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Reports: monthly columns ---------- */
.cols { position: relative; display: grid; grid-template-columns: 32px 1fr; grid-template-rows: 220px auto; }
.cols-grid { grid-column: 1 / -1; grid-row: 1; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.cols-tick { position: relative; height: 0; border-top: 1px solid var(--line); margin-left: 32px; }
.cols-tick:last-child { border-top-color: var(--line-strong); }
.cols-tick span { position: absolute; right: calc(100% + 8px); top: -8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cols-plot { grid-column: 2; grid-row: 1; position: relative; z-index: 1; display: grid; grid-template-columns: repeat(var(--cols), 1fr); align-items: end; }
.col { height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 6px 6px 0 0; }
.col:hover, .col:focus-visible { background: rgba(29, 78, 216, 0.06); outline: none; }
.col-bar { display: block; width: min(24px, 62%); height: calc(100% * var(--p)); min-height: 0; background: var(--brand); border-radius: 4px 4px 0 0; transition: background .15s; }
.col:hover .col-bar, .col:focus-visible .col-bar { background: var(--brand-hover); }
.cols-x { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(var(--cols), 1fr); padding-top: 8px; }
.cols-x span { text-align: center; font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.cols-x small { display: block; font-size: 10.5px; color: var(--ink-2); font-weight: 600; }

.chart-table { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.chart-table summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 13px; }
.chart-table .table { margin-top: 10px; }
.chart-tip { position: fixed; z-index: 60; pointer-events: none; background: #0b1730; color: #fff; padding: 8px 11px; border-radius: 8px; box-shadow: var(--shadow-lg); max-width: 260px; display: flex; flex-direction: column; gap: 1px; }
.chart-tip[hidden] { display: none; }
.chart-tip strong { font-size: 14px; }
.chart-tip span { font-size: 12.5px; color: #dbe4f3; }
.chart-tip small { font-size: 11.5px; color: #9fb0cf; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal.open { display: flex; }
.modal-panel { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 820px; max-height: 85vh; display: flex; flex-direction: column; }
.modal-panel .card-header { position: sticky; top: 0; background: var(--surface); border-radius: 14px 14px 0 0; }
.modal-body { overflow-y: auto; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pagination .summary { color: var(--muted); font-size: 13px; }
.pagination .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination .page { min-width: 34px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 7px; border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: 13px; background: var(--surface); }
.pagination a.page:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pagination .page.current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .page.disabled { color: var(--line-strong); }

/* ---------- Select2 to match ---------- */
.select2-container--default .select2-selection--single { height: 42px !important; border: 1px solid var(--line-strong) !important; border-radius: var(--radius-sm) !important; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 40px !important; padding-left: 12px !important; color: var(--ink) !important; }
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: #94a3b8 !important; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 40px !important; right: 6px !important; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single { border-color: var(--brand) !important; box-shadow: 0 0 0 3px var(--brand-ring); }
.select2-dropdown { border: 1px solid var(--line-strong) !important; border-radius: var(--radius-sm) !important; box-shadow: var(--shadow-lg); overflow: hidden; }
.select2-search--dropdown .select2-search__field { border-radius: 6px; border: 1px solid var(--line-strong) !important; padding: 7px 10px !important; }
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--brand) !important; }
.select2-results__option { padding: 8px 12px !important; }
.select2-results__option small { color: inherit; opacity: .7; }

/* ---------- Public pages ---------- */
.public { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(1200px 500px at 50% -120px, #dbe6ff 0%, rgba(219, 230, 255, 0) 70%), var(--bg); }
.public-header { display: flex; align-items: center; justify-content: space-between; max-width: 960px; width: 100%; margin: 0 auto; padding: 22px 20px; }
.public-header .brand { padding: 0; color: var(--ink); }
.public-header .brand small { color: var(--muted); }
.public-main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 8px 20px 48px; }
.public-main.narrow { max-width: 780px; }
.public-footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 20px; }
.hero { text-align: center; padding: 28px 0 30px; }
.hero h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
.hero p { color: var(--muted); font-size: 16px; margin-top: 6px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 12px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; }
.tile:hover { text-decoration: none; border-color: var(--brand); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.tile .stat-icon { width: 46px; height: 46px; border-radius: 12px; }
.tile h2 { font-size: 17px; font-weight: 700; }
.tile p { color: var(--muted); font-size: 13.5px; }
.tile .go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 600; font-size: 13.5px; }
.tile .go svg.icon { width: 16px; height: 16px; transition: transform .15s; }
.tile:hover .go svg.icon { transform: translateX(3px); }
.form-card .card-header { padding: 20px 24px; }
.form-card .card-header h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.form-card .card-body { padding: 24px; }
.title-with-icon { display: flex; align-items: center; gap: 14px; }
.success-panel { text-align: center; padding: 44px 24px; }
.success-panel .check { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; background: var(--success-soft); color: var(--success); }
.success-panel .check svg.icon { width: 30px; height: 30px; stroke-width: 2.5; }
.success-panel h1 { font-size: 22px; font-weight: 700; }
.success-panel p { color: var(--muted); margin: 6px 0 22px; }
.success-panel .form-actions { justify-content: center; }

/* Login */
.auth-card { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-card .card-body { padding: 28px; }
.auth-card h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.auth-card .field + .field { margin-top: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-main-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; }
    .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    .app.nav-open .scrim { display: block; }
    .scrim { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 30; }
    .topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
    .topbar .brand { padding: 0; color: var(--ink); font-size: 15px; }
    .content { padding: 20px 16px 40px; }
    .tiles, .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .form-grid { grid-template-columns: 1fr; }
    .dl { grid-template-columns: 1fr; }
    .dl dt { border-bottom: 0; padding-bottom: 0; }
    .dl dd { padding-top: 2px; }
    .site-picker { grid-template-columns: 1fr 1fr; }
    .site-option label { flex-direction: column; text-align: center; gap: 8px; padding: 14px 10px; }
    .site-option .tick { display: none; }
    .hero h1 { font-size: 26px; }
    .page-header { align-items: flex-start; }
    .table th, .table td { padding: 10px 12px; }
    .stats { grid-template-columns: 1fr 1fr; }
    /* Reports: names above bars, and every other month label when crowded */
    .hbar { grid-template-columns: 1fr; gap: 5px; }
    .cols.dense .cols-x span:nth-child(even) { visibility: hidden; }
    .cols { grid-template-rows: 180px auto; }
}
