/* ==========================================================================
   PantauKerja — Design System
   Self-contained. No external fonts/CDN (avoids sandbox render timeouts).
   ========================================================================== */

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --sidebar: #0f172a;
    --sidebar-2: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #2563eb;

    --text: #0f172a;
    --text-2: #475569;
    --text-3: #94a3b8;
    --border: #e2e8f0;
    --border-2: #cbd5e1;

    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #0ea5e9;
    --info-light: #f0f9ff;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);

    --sidebar-w: 260px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand-mark {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    display: grid; place-items: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .4);
}
.brand-mark svg { width: 22px; height: 22px; stroke: #fff; }

.brand-text h1 { font-size: 16px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.brand-text p { font-size: 11px; color: var(--sidebar-text); line-height: 1.35; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: .09em;
    color: #64748b; font-weight: 700; padding: 14px 10px 7px;
}

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--sidebar-text); font-size: 14px; font-weight: 500;
    margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; stroke-width: 1.9; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(37, 99, 235, .35); }
.nav-badge {
    margin-left: auto; background: rgba(255,255,255,.14); color: #fff;
    font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,.25); }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
.user-card {
    display: flex; align-items: center; gap: 11px;
    background: var(--sidebar-2); border-radius: var(--radius);
    padding: 11px 12px;
}
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    display: grid; place-items: center;
    font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0;
}
.user-card-info { min-width: 0; flex: 1; }
.user-card-info strong { display: block; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-info span { font-size: 11px; color: var(--sidebar-text); }
.logout-btn { color: var(--sidebar-text); padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.logout-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.logout-btn svg { width: 17px; height: 17px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex; align-items: center; gap: 16px;
    position: sticky; top: 0; z-index: 40;
}
.topbar-title h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.topbar-title p { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.menu-toggle { display: none; padding: 8px; border-radius: 9px; color: var(--text-2); }
.menu-toggle:hover { background: var(--surface-2); }
.menu-toggle svg { width: 21px; height: 21px; display: block; }

.content { padding: 24px 28px 40px; flex: 1; }

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15, 23, 42, .5); z-index: 50;
}

/* ---------- Language pill ---------- */
.lang-switch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.lang-switch a {
    padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
    color: var(--text-2); transition: all .15s;
}
.lang-switch a.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.card-head {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.card-head p { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.card-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }

/* ---------- KPI ---------- */
.kpi-grid {
    display: grid; gap: 16px; margin-bottom: 20px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.kpi {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow);
    transition: transform .18s, box-shadow .18s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-top { display: flex; align-items: center; gap: 11px; margin-bottom: 13px; }
.kpi-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.kpi-icon svg { width: 20px; height: 20px; stroke-width: 2; }
.kpi-label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.kpi-value { font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.kpi-sub { font-size: 11.5px; color: var(--text-3); margin-top: 6px; display: flex; align-items: center; gap: 5px; }
.kpi-sub strong { font-weight: 700; }
.kpi-sub.up strong { color: var(--success); }
.kpi-sub.down strong { color: var(--danger); }

.i-blue { background: var(--primary-light); color: var(--primary); }
.i-green { background: var(--success-light); color: var(--success); }
.i-amber { background: var(--warning-light); color: var(--warning); }
.i-red { background: var(--danger-light); color: var(--danger); }
.i-purple { background: var(--purple-light); color: var(--purple); }
.i-cyan { background: var(--info-light); color: var(--info); }

/* ---------- Grid helpers ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
    text-align: left; padding: 11px 20px; background: var(--surface-2);
    font-size: 11px; font-weight: 700; color: var(--text-2);
    text-transform: uppercase; letter-spacing: .05em;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 13px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.t-name { font-weight: 600; color: var(--text); }
.t-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.t-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-gray { background: #f1f5f9; color: #475569; }
.b-blue { background: var(--primary-light); color: var(--primary-dark); }
.b-green { background: var(--success-light); color: #047857; }
.b-amber { background: var(--warning-light); color: #b45309; }
.b-red { background: var(--danger-light); color: #b91c1c; }
.b-purple { background: var(--purple-light); color: #6d28d9; }
.b-cyan { background: var(--info-light); color: #0369a1; }

.chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 7px;
    font-size: 11px; font-weight: 700; letter-spacing: .02em;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; border-radius: 10px;
    font-size: 13.5px; font-weight: 600;
    border: 1px solid transparent; transition: all .15s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; stroke-width: 2; flex-shrink: 0; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(37,99,235,.28); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(37,99,235,.36); }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-icon { padding: 7px; border-radius: 8px; }
.btn-icon svg { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label, .lbl {
    display: block; font-size: 12.5px; font-weight: 600;
    color: var(--text); margin-bottom: 6px;
}
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.45; }
.req { color: var(--danger); }
.opt { color: var(--text-3); font-weight: 500; }

.input, .select, .textarea {
    width: 100%; padding: 10px 13px;
    border: 1px solid var(--border-2); border-radius: 10px;
    font-size: 14px; font-family: inherit; color: var(--text);
    background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}
.textarea { resize: vertical; min-height: 92px; line-height: 1.55; }
.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    padding-right: 36px;
}
.input.err, .select.err, .textarea.err { border-color: var(--danger); }
.err-msg { color: var(--danger); font-size: 12px; margin-top: 5px; font-weight: 500; }

.form-row { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Radio / option cards */
.opt-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.opt-card {
    position: relative; display: flex; align-items: center; gap: 11px;
    padding: 13px 15px; border: 1.5px solid var(--border-2);
    border-radius: 12px; cursor: pointer; transition: all .15s; background: var(--surface);
}
.opt-card:hover { border-color: var(--primary); background: var(--primary-light); }
.opt-card input { position: absolute; opacity: 0; pointer-events: none; }
.opt-card .oc-mark {
    width: 19px; height: 19px; border-radius: 50%;
    border: 2px solid var(--border-2); flex-shrink: 0;
    display: grid; place-items: center; transition: all .15s;
}
.opt-card .oc-mark::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .15s; }
.opt-card input:checked ~ .oc-mark { border-color: var(--primary); background: var(--primary); }
.opt-card input:checked ~ .oc-mark::after { transform: scale(1); }
.opt-card input:checked ~ .oc-body .oc-title { color: var(--primary-dark); }
.opt-card:has(input:checked) { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.oc-body { min-width: 0; }
.oc-title { font-size: 14px; font-weight: 700; }
.oc-desc { font-size: 11.5px; color: var(--text-2); margin-top: 1px; }

/* Stage stepper (radio list) */
.stage-list { display: flex; flex-direction: column; gap: 8px; }
.stage-opt {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border: 1.5px solid var(--border-2);
    border-radius: 11px; cursor: pointer; transition: all .15s; background: var(--surface);
}
.stage-opt input { position: absolute; opacity: 0; pointer-events: none; }
.stage-opt:hover { border-color: var(--primary); }
.stage-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.stage-num {
    width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center; font-size: 12px; font-weight: 800;
    background: var(--surface-2); color: var(--text-2); border: 1.5px solid var(--border-2);
}
.stage-opt:has(input:checked) .stage-num { background: var(--primary); color: #fff; border-color: var(--primary); }
.stage-txt { font-size: 13.5px; font-weight: 600; }
.stage-bar { margin-left: auto; width: 54px; height: 5px; border-radius: 999px; background: var(--border); overflow: hidden; flex-shrink: 0; }
.stage-bar i { display: block; height: 100%; border-radius: 999px; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track {
    width: 42px; height: 24px; border-radius: 999px; background: var(--border-2);
    position: relative; transition: background .18s; flex-shrink: 0;
}
.switch .track::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: var(--shadow-sm); transition: transform .18s;
}
.switch input:checked ~ .track { background: var(--success); }
.switch input:checked ~ .track::after { transform: translateX(18px); }

/* ---------- Progress ---------- */
.pbar { height: 7px; background: var(--border); border-radius: 999px; overflow: hidden; min-width: 60px; }
.pbar i { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }
.pbar-row { display: flex; align-items: center; gap: 10px; }
.pbar-val { font-size: 12px; font-weight: 700; color: var(--text-2); min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; height: 100%; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar {
    width: 100%; max-width: 46px; border-radius: 7px 7px 0 0;
    position: relative; transition: opacity .15s; min-height: 3px;
}
.bar:hover { opacity: .82; }
.bar-val {
    position: absolute; top: -21px; left: 50%; transform: translateX(-50%);
    font-size: 11.5px; font-weight: 700; color: var(--text-2); white-space: nowrap;
}
.bar-lbl { font-size: 11px; color: var(--text-2); text-align: center; line-height: 1.25; word-break: break-word; }

.donut-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.donut { position: relative; width: 168px; height: 168px; flex-shrink: 0; }
.donut svg { transform: rotate(-90deg); display: block; }
.donut-center {
    position: absolute; inset: 0; display: flex;
    flex-direction: column; align-items: center; justify-content: center; pointer-events: none;
}
.donut-center .dc-val { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.donut-center .dc-lbl { font-size: 11px; color: var(--text-3); margin-top: 3px; text-align: center; }
.legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 11px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-name { color: var(--text-2); flex: 1; min-width: 0; }
.legend-val { font-weight: 700; font-variant-numeric: tabular-nums; }

.spark { display: block; width: 100%; height: 40px; }

/* ---------- Alert / list panels ---------- */
.alert-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 13px 20px; border-bottom: 1px solid var(--border);
}
.alert-item:last-child { border-bottom: none; }
.alert-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.alert-ico svg { width: 17px; height: 17px; stroke-width: 2; }
.alert-body { flex: 1; min-width: 0; }
.alert-body strong { display: block; font-size: 13.5px; font-weight: 600; }
.alert-body span { font-size: 12px; color: var(--text-2); line-height: 1.45; }

.list-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.avatar-sm {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff;
}

/* ---------- Empty / flash ---------- */
.empty { padding: 46px 20px; text-align: center; }
.empty-ico {
    width: 54px; height: 54px; border-radius: 15px; background: var(--surface-2);
    display: grid; place-items: center; margin: 0 auto 14px; color: var(--text-3);
}
.empty-ico svg { width: 26px; height: 26px; stroke-width: 1.7; }
.empty p { color: var(--text-2); font-size: 13.5px; max-width: 380px; margin: 0 auto; }

.flash {
    display: flex; align-items: center; gap: 11px;
    padding: 13px 17px; border-radius: var(--radius);
    margin-bottom: 20px; font-size: 13.5px; font-weight: 500;
    border: 1px solid transparent;
}
.flash svg { width: 19px; height: 19px; flex-shrink: 0; }
.flash-success { background: var(--success-light); color: #047857; border-color: #a7f3d0; }
.flash-error { background: var(--danger-light); color: #b91c1c; border-color: #fecaca; }
.flash-warn { background: var(--warning-light); color: #b45309; border-color: #fde68a; }
.flash-info { background: var(--info-light); color: #0369a1; border-color: #bae6fd; }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
    display: none; align-items: center; justify-content: center;
    padding: 20px; z-index: 100; overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--surface); border-radius: var(--radius-lg);
    width: 100%; max-width: 560px; box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 40px); display: flex; flex-direction: column;
    animation: modal-in .18s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(-12px) scale(.98); } }
.modal-head {
    padding: 17px 22px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-close { margin-left: auto; color: var(--text-3); padding: 5px; border-radius: 7px; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-close svg { width: 19px; height: 19px; display: block; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
    padding: 15px 22px; border-top: 1px solid var(--border);
    display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- Filter bar ---------- */
.filters {
    display: flex; gap: 11px; flex-wrap: wrap; align-items: flex-end;
    padding: 16px 20px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    margin-bottom: 20px; box-shadow: var(--shadow);
}
.filters .field { margin: 0; flex: 1; min-width: 150px; }
.filters .fbtns { display: flex; gap: 8px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 5px; align-items: center; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 34px; height: 34px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px; font-size: 13px; font-weight: 600;
    color: var(--text-2); border: 1px solid var(--border); background: var(--surface);
}
.pagination a:hover { background: var(--surface-2); border-color: var(--border-2); }
.pagination .cur { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .dis { opacity: .45; }

/* ==========================================================================
   Public form (no-login) — standalone page
   ========================================================================== */
.pub-wrap { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.pub-hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
    color: #fff; padding: 30px 20px 74px; position: relative; overflow: hidden;
}
.pub-hero::after {
    content: ''; position: absolute; right: -70px; top: -70px;
    width: 260px; height: 260px; border-radius: 50%;
    background: rgba(255, 255, 255, .07);
}
.pub-hero::before {
    content: ''; position: absolute; left: -50px; bottom: -110px;
    width: 200px; height: 200px; border-radius: 50%;
    background: rgba(255, 255, 255, .05);
}
.pub-hero-inner { max-width: 640px; margin: 0 auto; position: relative; z-index: 1; }
.pub-topline { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.pub-brand { display: flex; align-items: center; gap: 11px; }
.pub-brand .brand-mark { background: rgba(255, 255, 255, .18); box-shadow: none; backdrop-filter: blur(6px); }
.pub-brand h1 { font-size: 15px; font-weight: 700; }
.pub-brand p { font-size: 11px; opacity: .8; }
.pub-hero h2 { font-size: 25px; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; }
.pub-hero > .pub-hero-inner > p { font-size: 13.5px; opacity: .9; margin-top: 7px; line-height: 1.5; }
.pub-note {
    display: inline-flex; align-items: center; gap: 7px; margin-top: 15px;
    background: rgba(255, 255, 255, .16); padding: 6px 13px;
    border-radius: 999px; font-size: 12px; font-weight: 600;
}
.pub-note svg { width: 14px; height: 14px; }

.pub-hero .lang-switch { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.2); margin-left: auto; }
.pub-hero .lang-switch a { color: rgba(255,255,255,.75); }
.pub-hero .lang-switch a.active { background: #fff; color: var(--primary); }

.pub-main { max-width: 640px; width: 100%; margin: -54px auto 0; padding: 0 20px 44px; position: relative; z-index: 2; flex: 1; }
.pub-card {
    background: var(--surface); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden;
}
.pub-card-body { padding: 26px; }
.pub-section { margin-bottom: 26px; }
.pub-section:last-child { margin-bottom: 0; }
.pub-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pub-step {
    width: 25px; height: 25px; border-radius: 50%; background: var(--primary);
    color: #fff; display: grid; place-items: center;
    font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.pub-section-head h3 { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.pub-divider { height: 1px; background: var(--border); margin: 24px 0; }

.pub-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; text-align: center; padding: 0 20px 30px; font-size: 11.5px; color: var(--text-3); }
.pub-foot a { color: var(--text-2); font-weight: 600; }
.pub-foot-login { padding-left: 10px; border-left: 1px solid var(--border); }

.success-card { text-align: center; padding: 44px 26px; }
.success-ico {
    width: 74px; height: 74px; border-radius: 50%;
    background: var(--success-light); color: var(--success);
    display: grid; place-items: center; margin: 0 auto 20px;
    animation: pop .35s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.success-ico svg { width: 38px; height: 38px; stroke-width: 2.4; }
.success-card h2 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 9px; }
.success-card p { color: var(--text-2); font-size: 14px; max-width: 380px; margin: 0 auto 24px; line-height: 1.6; }
.success-recap {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; text-align: left;
    max-width: 400px; margin: 0 auto 24px;
}
.recap-row { display: flex; justify-content: space-between; gap: 14px; padding: 6px 0; font-size: 13px; }
.recap-row + .recap-row { border-top: 1px solid var(--border); }
.recap-row .rk { color: var(--text-2); }
.recap-row .rv { font-weight: 600; text-align: right; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-aside {
    background: linear-gradient(150deg, #0f172a 0%, #1e3a8a 60%, #2563eb 100%);
    color: #fff; padding: 46px; display: flex; flex-direction: column;
    justify-content: space-between; position: relative; overflow: hidden;
}
.login-aside::after {
    content: ''; position: absolute; right: -90px; bottom: -90px;
    width: 320px; height: 320px; border-radius: 50%; background: rgba(255,255,255,.06);
}
.login-aside .brand-mark { background: rgba(255,255,255,.18); box-shadow: none; }
.la-mid { position: relative; z-index: 1; }
.la-mid h2 { font-size: 31px; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; margin-bottom: 13px; }
.la-mid p { font-size: 14.5px; opacity: .82; line-height: 1.65; max-width: 400px; }
.la-feats { margin-top: 30px; display: flex; flex-direction: column; gap: 13px; }
.la-feat { display: flex; align-items: center; gap: 11px; font-size: 13.5px; }
.la-feat svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.la-foot { font-size: 12px; opacity: .6; position: relative; z-index: 1; }

.login-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.login-box { width: 100%; max-width: 380px; }
.login-box > h2 { font-size: 24px; font-weight: 800; letter-spacing: -.025em; margin-bottom: 6px; }
.login-box > .sub { color: var(--text-2); font-size: 13.5px; margin-bottom: 26px; }
.demo-box {
    background: var(--info-light); border: 1px solid #bae6fd;
    border-radius: var(--radius); padding: 13px 15px; margin-top: 22px; font-size: 12.5px;
}
.demo-box strong { display: block; color: #0369a1; margin-bottom: 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.demo-box code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: #0c4a6e; font-weight: 600; }

/* ---------- Report preview (screen) ---------- */
.doc {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 40px; box-shadow: var(--shadow); max-width: 900px; margin: 0 auto;
}
.doc-head { text-align: center; border-bottom: 2.5px solid var(--sidebar); padding-bottom: 22px; margin-bottom: 26px; }
.doc-head .org { font-size: 12px; text-transform: uppercase; letter-spacing: .13em; color: var(--text-2); font-weight: 700; }
.doc-head h1 { font-size: 22px; font-weight: 800; margin: 9px 0 7px; letter-spacing: -.02em; }
.doc-head .period { font-size: 13.5px; color: var(--text-2); font-weight: 600; }
.doc-meta { display: flex; justify-content: space-between; gap: 20px; font-size: 12px; color: var(--text-2); margin-top: 13px; flex-wrap: wrap; }
.doc h2 {
    font-size: 15px; font-weight: 800; margin: 30px 0 14px;
    padding-bottom: 8px; border-bottom: 1.5px solid var(--border);
    text-transform: uppercase; letter-spacing: .04em;
}
.doc h2:first-of-type { margin-top: 0; }
.doc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 8px; }
.doc-stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.doc-stat .ds-val { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.doc-stat .ds-lbl { font-size: 11px; color: var(--text-2); margin-top: 3px; font-weight: 600; }
.doc table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 8px; }
.doc table th {
    background: var(--surface-2); text-align: left; padding: 9px 11px;
    border: 1px solid var(--border); font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: var(--text-2);
}
.doc table td { padding: 9px 11px; border: 1px solid var(--border); vertical-align: top; }
.doc-staff { margin-bottom: 24px; page-break-inside: avoid; }
.doc-staff-head {
    display: flex; align-items: center; gap: 11px; padding: 10px 13px;
    background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border: 1px solid var(--border); border-bottom: none;
}
.doc-staff-head .n { font-weight: 700; font-size: 14px; }
.doc-staff-head .d { font-size: 11.5px; color: var(--text-2); }
.doc-sign { display: flex; justify-content: space-between; gap: 40px; margin-top: 48px; font-size: 12.5px; }
.doc-sign div { flex: 1; }
.doc-sign .line { border-top: 1px solid var(--text); margin-bottom: 6px; padding-top: 40px; }

/* ---------- Utilities ---------- */
.muted { color: var(--text-3); }
.text-sm { font-size: 12.5px; }
.fw-7 { font-weight: 700; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.ml-auto { margin-left: auto; }
.nowrap { white-space: nowrap; }
.tr { text-align: right; }
.tc { text-align: center; }

.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
    .g-2-1, .g-1-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-aside { display: none; }
    .doc-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main { margin-left: 0; }
    .menu-toggle { display: grid; }
    .topbar { padding: 12px 16px; }
    .topbar-title h2 { font-size: 17px; }
    .topbar-title p { display: none; }
    .content { padding: 18px 16px 34px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .doc { padding: 22px; }
}

/* ---------- Indicator builder (panel) ---------- */
.row-muted { opacity: .55; }
.ord-btns { display: inline-flex; flex-direction: column; gap: 2px; }
.ord-btn {
    border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
    border-radius: 5px; width: 22px; height: 17px; font-size: 8px; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s, border-color .15s;
}
.ord-btn:hover:not(:disabled) { background: var(--brand); color: #fff; border-color: var(--brand); }
.ord-btn:disabled { opacity: .3; cursor: not-allowed; }
.switch-row { display: flex; flex-wrap: wrap; gap: 18px 26px; padding-top: 4px; }
.modal.modal-lg { max-width: 620px; }

/* ---------- Share-link panel ---------- */
.share-box {
    border: 1px solid var(--line); border-radius: var(--r-md);
    background: linear-gradient(135deg, rgba(37, 99, 235, .05), rgba(37, 99, 235, .01));
    padding: 16px 18px; margin-bottom: 18px;
}
.share-box h4 { font-size: 13.5px; margin: 0 0 4px; display: flex; align-items: center; gap: 7px; }
.share-box h4 svg { width: 15px; height: 15px; color: var(--brand); }
.share-box p { font-size: 12px; color: var(--text-3); margin: 0 0 12px; line-height: 1.5; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share-input {
    flex: 1; min-width: 220px; font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 11.5px; padding: 9px 11px; border: 1px solid var(--line);
    border-radius: var(--r-sm); background: var(--surface); color: var(--text-1);
}
.share-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 11px; font-size: 11.5px; color: var(--text-3); }
.share-meta strong { color: var(--text-1); }

/* ---------- Public report view ---------- */
.pub-main-wide { max-width: 1080px; }
.rep-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 18px; flex-wrap: wrap; padding-bottom: 18px; margin-bottom: 20px;
    border-bottom: 2px solid var(--line);
}
.rep-org { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--text-3); font-weight: 700; }
.rep-title { font-size: 19px; margin: 6px 0 8px; letter-spacing: -.2px; }
.rep-period { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.rep-period svg { width: 15px; height: 15px; color: var(--brand); }
.rep-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.rep-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.rep-stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 15px 14px; text-align: center; }
.rs-val { font-size: 23px; font-weight: 700; letter-spacing: -.6px; color: var(--text-1); }
.rs-of { font-size: 14px; font-weight: 600; color: var(--text-3); }
.rs-lbl { font-size: 11px; color: var(--text-3); margin-top: 4px; line-height: 1.35; }

.rep-h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .7px; color: var(--text-2);
    margin: 26px 0 13px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.rep-h3.first { margin-top: 0; }
.rep-bars { display: flex; flex-direction: column; gap: 9px; }
.rep-bar-row { display: grid; grid-template-columns: 190px 1fr 92px; gap: 12px; align-items: center; }
.rb-label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.rb-track { height: 9px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.rb-fill { height: 100%; border-radius: 99px; transition: width .5s ease; }
.rb-val { font-size: 12.5px; font-weight: 700; text-align: right; }
.rep-note { font-size: 13px; line-height: 1.65; color: var(--text-2); margin: 0; white-space: pre-line; }

.rep-staff { margin-bottom: 22px; }
.rep-staff-head {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    flex-wrap: wrap; padding: 11px 14px; background: var(--surface-2);
    border: 1px solid var(--line); border-radius: var(--r-md) var(--r-md) 0 0; border-bottom: none;
}
.rep-staff .table-wrap { border: 1px solid var(--line); border-radius: 0 0 var(--r-md) var(--r-md); }
table.data.compact th, table.data.compact td { padding: 9px 13px; font-size: 12.5px; }
.rep-sub { padding: 3px 0; font-size: 12.5px; line-height: 1.55; }
.rep-sub + .rep-sub { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 6px; }
.rs-date { color: var(--text-3); font-weight: 600; margin-right: 5px; }
.rep-inds { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.ind-pill {
    display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2);
    border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px;
    font-size: 11px; color: var(--text-2);
}
.ind-pill strong { color: var(--text-1); font-weight: 700; }
.mini-track { height: 4px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; width: 100%; }
.mini-fill { height: 100%; border-radius: 99px; }
.rep-foot {
    display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line);
    font-size: 12px; color: var(--text-2);
}

@media (max-width: 860px) {
    .rep-stats { grid-template-columns: repeat(2, 1fr); }
    .rep-bar-row { grid-template-columns: 130px 1fr 78px; gap: 9px; }
    .rb-label { font-size: 11.5px; }
}

@media (max-width: 560px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .rep-title { font-size: 16.5px; }
    .rep-bar-row { grid-template-columns: 1fr; gap: 3px; }
    .rb-val { text-align: left; }
    .rep-actions { width: 100%; }
    .rep-actions .btn { flex: 1; }
    .share-input { min-width: 100%; }
    .share-row .btn { flex: 1; }
    .switch-row { gap: 12px 18px; }
    .kpi { padding: 14px; }
    .kpi-value { font-size: 21px; }
    .kpi-icon { width: 34px; height: 34px; }
    .kpi-icon svg { width: 17px; height: 17px; }
    .kpi-label { font-size: 11.5px; }
    .opt-grid { grid-template-columns: 1fr; }
    .pub-hero { padding: 22px 16px 66px; }
    .pub-hero h2 { font-size: 20px; }
    .pub-main { padding: 0 14px 34px; }
    .pub-card-body { padding: 19px; }
    .donut-wrap { justify-content: center; }
    .card-head { padding: 14px 16px; }
    .card-body { padding: 16px; }
    table.data th, table.data td { padding: 10px 14px; }
    .doc-stats { grid-template-columns: repeat(2, 1fr); }
    .doc { padding: 16px; }
    .doc-sign { flex-direction: column; gap: 22px; }
    .modal-foot { flex-direction: column-reverse; }
    .modal-foot .btn { width: 100%; }
    .filters .field { min-width: 100%; }
    .filters .fbtns { width: 100%; }
    .filters .fbtns .btn { flex: 1; }
}

/* ---------- Print ---------- */
@media print {
    .sidebar, .topbar, .sidebar-overlay, .no-print { display: none !important; }
    .main { margin-left: 0; }
    .content { padding: 0; }
    body { background: #fff; }
    .doc { border: none; box-shadow: none; padding: 0; max-width: none; }
    .doc-staff { page-break-inside: avoid; }
}
