/* =========================================================
   Sistem Claim & PV — Tema Reka Bentuk
   ========================================================= */
:root {
    --bg: #0B1030;
    --panel: #141A3F;
    --panel-2: #1C2352;
    --input-bg: #0F1535;
    --border: #252D63;
    --text: #EEF1FF;
    --text-2: #A3AED0;

    --primary: #6A45FF;
    --primary-grad-a: #868CFF;
    --primary-grad-b: #4318FF;
    --success: #05CD99;
    --info: #39B8FF;
    --warning: #FFB547;
    --danger: #FF7A70;

    --radius-panel: 20px;
    --radius-control: 12px;
    --shadow-soft: 0 12px 30px rgba(3, 6, 20, 0.35);
    --font-main: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --sidebar-width: 104px;
    --topbar-height: 76px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

::selection { background: var(--primary); color: #fff; }

/* Scrollbar halus */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 40;
}

.sidebar__logo {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-grad-a), var(--primary-grad-b));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; margin-bottom: 18px;
    overflow: hidden;
}
.sidebar__logo img { width: 100%; height: 100%; object-fit: cover; }

.sidebar__new {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-grad-a), var(--primary-grad-b));
    color: #fff; font-size: 24px; font-weight: 400;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 20px rgba(105, 69, 255, .45);
    margin-bottom: 28px; border: none; cursor: pointer;
    transition: transform .15s ease;
}
.sidebar__new:hover { transform: translateY(-2px); }

.sidebar__nav { display: flex; flex-direction: column; gap: 6px; width: 100%; align-items: center; flex: 1; }

.nav-item {
    width: 80px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 4px; border-radius: 14px;
    color: var(--text-2); font-size: 11px; font-weight: 500;
    transition: background .15s ease, color .15s ease;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.is-active { background: var(--panel-2); color: #fff; }
.nav-item.is-active svg { color: var(--primary-grad-a); }

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

.topbar {
    height: var(--topbar-height);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 30;
    background: rgba(11, 16, 48, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.topbar__greeting h1 { font-size: 18px; margin: 0; font-weight: 700; }
.topbar__greeting p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); }

.user-card { display: flex; align-items: center; gap: 10px; position: relative; }
.user-card__avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-grad-a), var(--primary-grad-b));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; font-size: 14px;
}
.user-card__name { font-size: 13.5px; font-weight: 600; }
.user-card__role { font-size: 11.5px; color: var(--text-2); }
.user-card__btn { background: none; border: none; cursor: pointer; display: flex; align-items: center; gap: 10px; color: var(--text); }

.user-menu {
    position: absolute; top: 54px; right: 0; min-width: 200px;
    background: var(--panel-2); border: 1px solid var(--border);
    border-radius: var(--radius-control); box-shadow: var(--shadow-soft);
    padding: 8px; display: none; z-index: 50;
}
.user-menu.is-open { display: block; }
.user-menu a, .user-menu button {
    display: block; width: 100%; text-align: left; padding: 10px 12px;
    border-radius: 8px; border: none; background: none; color: var(--text);
    font-size: 13.5px; cursor: pointer; font-family: var(--font-main);
}
.user-menu a:hover, .user-menu button:hover { background: var(--input-bg); }

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

/* ---------- Kad umum ---------- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-panel);
    padding: 22px;
}

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }

.kpi-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-panel);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}
.kpi-card::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--stripe, var(--primary));
}
.kpi-card__icon {
    position: absolute; top: 16px; right: 16px;
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--panel-2); display: flex; align-items: center; justify-content: center;
    color: var(--stripe, var(--primary));
}
.kpi-card__label { color: var(--text-2); font-size: 12.5px; margin: 0 0 8px; }
.kpi-card__value { font-size: 22px; font-weight: 700; margin: 0; }
.kpi-card__sub { font-size: 11.5px; color: var(--text-2); margin-top: 4px; }

/* ---------- Butang ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: var(--radius-control);
    font-size: 13.5px; font-weight: 600; font-family: var(--font-main);
    border: 1px solid transparent; cursor: pointer; transition: all .15s ease;
    white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--primary-grad-a), var(--primary-grad-b)); color: #fff; box-shadow: 0 8px 18px rgba(105,69,255,.35); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--input-bg); }
.btn-success { background: var(--success); color: #06281f; }
.btn-danger { background: var(--danger); color: #2b0906; }
.btn-warning { background: var(--warning); color: #2b1a00; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Borang ---------- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--text); }
.form-label .req { color: var(--danger); }
.form-hint { font-size: 12px; color: var(--text-2); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; }

.form-control, select.form-control, textarea.form-control {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    padding: 11px 14px;
    color: var(--text);
    font-family: var(--font-main);
    font-size: 13.5px;
    transition: border-color .15s ease;
}
.form-control:focus, select.form-control:focus, textarea.form-control:focus {
    outline: none; border-color: var(--primary-grad-a);
    box-shadow: 0 0 0 3px rgba(134, 140, 255, .18);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-filled-auto { border-left: 3px solid var(--info); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.input-group { position: relative; }
.input-group .form-control { padding-right: 40px; }

/* ---------- Pil status ---------- */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-info { background: rgba(57,184,255,.15); color: var(--info); }
.pill-warning { background: rgba(255,181,71,.15); color: var(--warning); }
.pill-primary { background: rgba(105,69,255,.18); color: var(--primary-grad-a); }
.pill-success { background: rgba(5,205,153,.15); color: var(--success); }
.pill-danger { background: rgba(255,122,112,.15); color: var(--danger); }

/* ---------- Jadual ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
table.table th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-2); padding: 10px 14px; border-bottom: 1px solid var(--border);
    font-weight: 700;
}
table.table td { padding: 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
table.table tbody tr:hover { background: var(--panel-2); }
table.table tbody tr:last-child td { border-bottom: none; }

/* ---------- Tab status ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab-link {
    padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--text-2);
    border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 6px;
}
.tab-link.is-active { color: #fff; border-color: var(--primary-grad-a); }
.tab-link .count { background: var(--panel-2); padding: 1px 8px; border-radius: 999px; font-size: 11px; }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(3,6,20,.6);
    display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.is-open { display: flex; }
.modal-box {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-panel);
    max-width: 520px; width: 100%; padding: 26px; box-shadow: var(--shadow-soft);
    max-height: 90vh; overflow-y: auto;
}
.modal-box h3 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- Auth ---------- */
.auth-shell {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 20% 20%, rgba(105,69,255,.25), transparent 45%),
                radial-gradient(circle at 80% 80%, rgba(255,122,215,.15), transparent 45%),
                var(--bg);
    padding: 20px;
}
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--border); border-radius: 24px; padding: 36px 32px; box-shadow: var(--shadow-soft); }
.auth-card__logo { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, var(--primary-grad-a), var(--primary-grad-b)); margin: 0 auto 18px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 20px; }
.auth-card h1 { text-align: center; font-size: 20px; margin: 0 0 6px; }
.auth-card p.sub { text-align: center; color: var(--text-2); font-size: 13px; margin: 0 0 26px; }
.auth-footer-link { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-2); }

/* ---------- Flash / alert ---------- */
.alert { padding: 13px 16px; border-radius: var(--radius-control); font-size: 13.5px; margin-bottom: 18px; border: 1px solid transparent; }
.alert-success { background: rgba(5,205,153,.12); border-color: rgba(5,205,153,.35); color: var(--success); }
.alert-danger { background: rgba(255,122,112,.12); border-color: rgba(255,122,112,.35); color: var(--danger); }
.alert-warning { background: rgba(255,181,71,.12); border-color: rgba(255,181,71,.35); color: var(--warning); }
.alert-info { background: rgba(57,184,255,.12); border-color: rgba(57,184,255,.35); color: var(--info); }

/* ---------- Utiliti ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--text-2); }
.text-right { text-align: right; }
.section-title { font-size: 16px; font-weight: 700; margin: 0 0 16px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.badge-count { background: var(--panel-2); border-radius: 999px; padding: 2px 10px; font-size: 11px; color: var(--text-2); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-2); }

/* ---------- PV Dokumen (kertas sentiasa putih) ---------- */
.pv-page {
    background: #ffffff; color: #111827; width: 210mm; min-height: 297mm;
    margin: 0 auto; padding: 16mm; position: relative; font-family: 'DM Sans', Arial, sans-serif;
}
.pv-stamp {
    position: absolute; top: 60mm; right: 30mm; transform: rotate(-18deg);
    font-size: 34px; font-weight: 800; border: 5px solid; padding: 6px 18px;
    border-radius: 8px; opacity: .85; letter-spacing: 2px;
}
.pv-stamp.approved { color: #2563eb; border-color: #2563eb; }
.pv-stamp.paid { color: #059669; border-color: #059669; }
.pv-stamp.rejected { color: #dc2626; border-color: #dc2626; }
.pv-header { display: flex; justify-content: space-between; border-bottom: 2px solid #111827; padding-bottom: 14px; margin-bottom: 18px; }
.pv-header img.pv-logo { max-height: 60px; max-width: 140px; }
.pv-header .company-name { font-weight: 800; text-transform: uppercase; font-size: 15px; }
.pv-header .company-meta { font-size: 11px; color: #4b5563; margin-top: 3px; line-height: 1.5; }
.pv-title { text-align: center; margin: 10px 0 18px; }
.pv-title h2 { margin: 0; font-size: 17px; letter-spacing: .04em; }
.pv-title .en { font-size: 11px; color: #6b7280; }
.pv-meta-row { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 14px; }
table.pv-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 18px; }
table.pv-table th, table.pv-table td { border: 1px solid #d1d5db; padding: 8px 10px; text-align: left; }
table.pv-table th { background: #f3f4f6; width: 34%; }
.pv-amount-box { border: 2px solid #111827; border-radius: 8px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.pv-amount-box .rm { font-size: 22px; font-weight: 800; }
.pv-amount-box .words { font-size: 12px; font-style: italic; max-width: 60%; text-align: right; }
.pv-signatures { display: flex; justify-content: space-between; gap: 16px; margin-top: 50px; }
.pv-sign-box { flex: 1; text-align: center; font-size: 11.5px; }
.pv-sign-line { border-top: 1px solid #111827; margin: 46px 10px 8px; }
.pv-sign-box strong { display: block; font-size: 12px; margin-top: 2px; }
.pv-actions { max-width: 210mm; margin: 16px auto; display: flex; gap: 10px; justify-content: flex-end; }

@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .pv-page { box-shadow: none; margin: 0; width: auto; min-height: auto; }
}

/* ---------- Responsif ---------- */
@media (max-width: 980px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
}

body.view-mobile .sidebar,
body[data-viewmode="mobile"] .sidebar { display: none; }
body.view-mobile .main-area,
body[data-viewmode="mobile"] .main-area { margin-left: 0; }
body.view-mobile .topbar-mobile-nav,
body[data-viewmode="mobile"] .topbar-mobile-nav { display: flex; }

.topbar-mobile-nav { display: none; gap: 4px; overflow-x: auto; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel); }
.topbar-mobile-nav a { padding: 8px 12px; border-radius: 10px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.topbar-mobile-nav a.is-active { background: var(--panel-2); color: #fff; }

@media (max-width: 700px) {
    .sidebar { display: none; }
    .main-area { margin-left: 0; }
    .topbar-mobile-nav { display: flex; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .content { padding: 16px; }
    table.table .col-optional { display: none; }
    .pv-signatures { flex-direction: column; }
    .auth-card { padding: 28px 22px; }
}

body[data-viewmode="desktop"] .sidebar { display: flex !important; }
body[data-viewmode="desktop"] .main-area { margin-left: var(--sidebar-width) !important; }
body[data-viewmode="desktop"] .topbar-mobile-nav { display: none !important; }

/* =========================================================
   Komponen tambahan (Fasa 8)
   ========================================================= */

/* ---------- Kebolehcapaian ---------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 200; background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; }
.skip-link:focus { left: 12px; }
:focus-visible { outline: 2px solid #A9AEFF; outline-offset: 2px; }
.btn:focus-visible, .nav-item:focus-visible, .tab-link:focus-visible, .page-link:focus-visible, .segmented__item:focus-visible { outline: 2px solid #A9AEFF; outline-offset: 2px; }
.form-control:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.link { color: #A9AEFF; }
.link:hover { text-decoration: underline; }
.link-button { background: none; border: none; color: #A9AEFF; cursor: pointer; font: inherit; font-weight: 600; padding: 0; text-decoration: underline; }
.mono { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; letter-spacing: .03em; }
.truncate { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }

.form-control-sm { padding: 7px 10px; font-size: 12.5px; width: auto; }
input[type="date"].form-control { color-scheme: dark; }
.form-group.mb-0 { margin-bottom: 0; }
.form-label.mb-0 { margin-bottom: 0; }

/* ---------- Borang permohonan ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.sticky-side { position: sticky; top: calc(var(--topbar-height) + 16px); }
.amount-input { font-size: 20px; font-weight: 700; letter-spacing: .02em; }
.amount-words { margin: 8px 0 0; font-size: 13px; font-style: italic; color: var(--text-2); min-height: 20px; }
.amount-words.is-error { color: var(--danger); font-style: normal; }
.ai-box { margin-top: 14px; padding: 14px; border-radius: var(--radius-control); background: var(--panel-2); border: 1px dashed var(--border); }
.ai-summary { margin-top: 12px; font-size: 12.5px; }
.ai-summary p { margin: 4px 0; }
.ai-summary .is-warning { color: var(--warning); }
.suggest-box { margin-top: 6px; font-size: 12.5px; padding: 8px 10px; border-radius: 10px; background: rgba(57,184,255,.1); border: 1px solid rgba(57,184,255,.3); color: var(--text); }
.attachment-current { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 14px; border-radius: 10px; background: var(--panel-2); font-size: 13px; }

/* ---------- Butiran permohonan ---------- */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.detail-list dt { color: var(--text-2); font-size: 12.5px; }
.detail-list dd { margin: 0; font-size: 13.5px; word-break: break-word; }

.attachment-thumb { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #fff; aspect-ratio: 4 / 3; }
.attachment-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.attachment-thumb__pdf { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: var(--panel-2); color: var(--text-2); font-weight: 700; font-size: 12px; }
.modal-box--wide { max-width: 960px; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline__item { display: flex; gap: 14px; padding: 0 0 16px; position: relative; }
.timeline__dot { width: 14px; height: 14px; border-radius: 50%; background: var(--panel-2); border: 2px solid var(--text-2); flex-shrink: 0; margin-top: 3px; z-index: 1; }
.timeline__item--pv_dijana .timeline__dot { border-color: var(--warning); }
.timeline__item--diluluskan .timeline__dot { border-color: var(--primary-grad-a); }
.timeline__item--dibayar .timeline__dot { border-color: var(--success); background: var(--success); }
.timeline__item--ditolak .timeline__dot { border-color: var(--danger); background: var(--danger); }
.timeline__item--permohonan_dihantar .timeline__dot { border-color: var(--info); }

/* ---------- Jadual permohonan: status bawah no. PV pada mudah alih ---------- */
.status-mobile { display: none; margin-top: 6px; }
table.table tfoot td { border-top: 1px solid var(--border); border-bottom: none; padding-top: 16px; }

/* ---------- Paginasi ---------- */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; justify-content: center; }
.page-link { min-width: 36px; padding: 7px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); font-size: 12.5px; text-align: center; }
.page-link:hover { background: var(--input-bg); }
.page-link.is-current { background: linear-gradient(135deg, var(--primary-grad-a), var(--primary-grad-b)); border-color: transparent; color: #fff; font-weight: 700; }
.page-link.is-disabled { opacity: .45; pointer-events: none; }

/* ---------- Papan pemuka ---------- */
.filter-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; }
.segmented { display: inline-flex; background: var(--input-bg); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.segmented__item { padding: 7px 13px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--text-2); border: none; background: none; cursor: pointer; font-family: inherit; }
.segmented__item.is-active { background: var(--panel-2); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.period-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period-nav__label { font-size: 14px; min-width: 150px; text-align: center; }
.export-actions { margin-left: auto; }
.custom-range { width: 100%; padding-top: 12px; border-top: 1px solid var(--border); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 22px; }
.chart-wrap { position: relative; margin-top: 14px; }
.chart-svg { width: 100%; height: auto; display: block; font-family: var(--font-main); }
.chart-svg text { font-family: var(--font-main); }
.chart-hit { cursor: crosshair; }
.chart-tooltip { position: absolute; pointer-events: none; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); font-size: 12px; padding: 8px 10px; border-radius: 10px; box-shadow: var(--shadow-soft); max-width: 280px; z-index: 5; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 12px; height: 4px; border-radius: 2px; display: inline-block; }

.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-list li:last-child { border-bottom: none; }
.activity-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-2); flex-shrink: 0; margin-top: 5px; }
.activity-dot--dibayar { background: var(--success); }
.activity-dot--ditolak { background: var(--danger); }
.activity-dot--pv_dijana { background: var(--warning); }
.activity-dot--diluluskan { background: var(--primary-grad-a); }
.activity-dot--permohonan_dihantar { background: var(--info); }

/* ---------- Tetapan ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.sign-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sig-fieldset { border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px 16px; margin: 0 0 14px; min-width: 0; }
.sig-fieldset legend { padding: 0 6px; font-weight: 700; font-size: 13px; color: var(--text); }
.logo-preview { height: 120px; border-radius: 14px; border: 1px dashed var(--border); background: #ffffff; display: flex; align-items: center; justify-content: center; padding: 10px; }
.logo-preview img { max-height: 100px; max-width: 100%; object-fit: contain; }
.logo-preview .text-muted { color: #6b7280; }

/* ---------- Dokumen PV pada skrin ---------- */
.pv-sheet-wrap { overflow-x: auto; padding-bottom: 20px; }
.pv-sheet { background: #ffffff; color: #111827; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 14mm; box-shadow: 0 16px 40px rgba(0,0,0,.45); border-radius: 4px; }

@media print {
    @page { size: A4 portrait; margin: 12mm; }
    body, html { background: #ffffff !important; color: #111827 !important; }
    .sidebar, .topbar, .topbar-mobile-nav, .no-print, .alert, .skip-link, .modal-backdrop { display: none !important; }
    .main-area { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    .pv-sheet-wrap { overflow: visible; padding: 0; }
    .pv-sheet { width: auto; min-height: auto; padding: 0; box-shadow: none; margin: 0; }
}

/* ---------- Responsif lanjutan ---------- */
@media (max-width: 1100px) {
    .form-layout, .detail-layout, .dash-grid, .settings-grid { grid-template-columns: 1fr; }
    .sticky-side { position: static; }
    .sign-grid { grid-template-columns: 1fr; }
    .export-actions { margin-left: 0; }
}

@media (max-width: 700px) {
    .topbar { padding: 0 16px; height: 64px; }
    .topbar__greeting h1 { font-size: 15px; }
    .user-card__text { display: none !important; }
    .status-mobile { display: block; }
    table.table .col-status { display: none; }
    .detail-list > div { grid-template-columns: 1fr; gap: 2px; }
    .page-header { align-items: flex-start; }
    .kpi-card__value { font-size: 17px; }
    .modal-box { padding: 20px; }
    .period-nav__label { min-width: 0; }
    .filter-bar { padding: 12px; }
}

/* Mod "Mudah Alih" dipaksa oleh butang Paparan (walaupun skrin besar) */
body[data-viewmode="mobile"] .content { max-width: 480px; margin: 0 auto; padding: 16px; width: 100%; }
body[data-viewmode="mobile"] .kpi-grid { grid-template-columns: repeat(2, 1fr); }
body[data-viewmode="mobile"] .form-layout,
body[data-viewmode="mobile"] .detail-layout,
body[data-viewmode="mobile"] .dash-grid,
body[data-viewmode="mobile"] .settings-grid,
body[data-viewmode="mobile"] .form-row,
body[data-viewmode="mobile"] .sign-grid { grid-template-columns: 1fr; }
body[data-viewmode="mobile"] table.table .col-optional,
body[data-viewmode="mobile"] table.table .col-status { display: none; }
body[data-viewmode="mobile"] .status-mobile { display: block; }
body[data-viewmode="mobile"] .user-card__text { display: none !important; }
body[data-viewmode="mobile"] .detail-list > div { grid-template-columns: 1fr; gap: 2px; }
body[data-viewmode="mobile"] .sticky-side { position: static; }

/* Mod "Desktop" dipaksa pada skrin kecil */
body[data-viewmode="desktop"] { min-width: 1100px; }
body[data-viewmode="desktop"] table.table .col-optional { display: table-cell !important; }
body[data-viewmode="desktop"] table.table .col-status { display: table-cell !important; }
body[data-viewmode="desktop"] .status-mobile { display: none !important; }
