/* =========================================================
   Void Tools — Design System
   Karakter: presisi, tenang, data-first.
   Palette: netral hangat + aksen teal (brand) + semantic red/amber/green.
   ========================================================= */

:root {
    /* Core neutral (hangat) */
    --bg: #f5f4f1;
    --surface: #ffffff;
    --surface-2: #faf9f7;
    --ink: #1c1917;
    --ink-2: #44403c;
    --muted: #78716c;
    --line: #e7e5e0;
    --line-strong: #d6d3d1;

    /* Brand accent (satu aksen) */
    --brand: #0d766e;
    --brand-strong: #0a5f58;
    --brand-soft: #e6f2f0;
    --brand-ink: #ffffff;

    /* Semantic */
    --ok: #15803d;
    --ok-soft: #e8f5ec;
    --bad: #b91c1c;
    --bad-soft: #fdeaea;
    --warn: #b45309;
    --warn-soft: #fdf1e3;
    --info: #1d4ed8;
    --info-soft: #e8eefc;

    /* Shape */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;

    /* Elevation (dosis kecil: hanya card utama & floating) */
    --shadow-card: 0 1px 2px rgba(28, 25, 23, .04), 0 1px 3px rgba(28, 25, 23, .06);
    --shadow-pop: 0 10px 30px rgba(28, 25, 23, .12);

    /* Type */
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

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

.sidebar {
    width: 240px;
    background: #1b1f24;
    color: #a8b3be;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    transition: transform .22s ease;
}
.brand {
    display: flex; align-items: center; gap: 11px;
    padding: 18px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--brand); color: #fff;
    display: grid; place-items: center;
    font-weight: 800; font-size: 16px; letter-spacing: -.02em;
}
.brand-name { color: #f5f7f8; font-weight: 650; font-size: 14.5px; line-height: 1.2; }
.brand-sub { color: #6b7680; font-size: 11px; }

.sidebar nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-group-label {
    font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: #5c6670;
    padding: 14px 12px 6px;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    color: #a8b3be; font-weight: 500; font-size: 13.5px;
    margin-bottom: 1px;
}
.nav-item .nav-ico { width: 18px; height: 18px; opacity: .75; flex: none; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item.active .nav-ico { opacity: 1; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); }

.main { flex: 1; margin-left: 240px; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 13px 24px; position: sticky; top: 0; z-index: 40;
}
.topbar-title { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.topbar-crumb { font-size: 12px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.user-chip .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--brand-soft); color: var(--brand-strong);
    display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.user-chip .role-tag { font-size: 11px; color: var(--muted); }

.menu-toggle {
    display: none; background: var(--surface); border: 1px solid var(--line);
    border-radius: 8px; padding: 7px 11px; font-size: 17px; cursor: pointer; color: var(--ink-2);
}
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(28,25,23,.4);
    z-index: 45;
}

.content { padding: 24px; width: 100%; max-width: 1360px; margin: 0 auto; flex: 1; }
.content-narrow { max-width: 980px; }

/* ============ Typography ============ */
h1.page-title { font-size: 19px; font-weight: 750; letter-spacing: -.02em; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.page-head .page-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ============ Cards ============ */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 16px; }
.card-head {
    padding: 15px 20px; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
.card-head .card-title { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; }
.card-head .card-sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.card-body { padding: 20px; }

/* ============ Stat cards ============ */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .stat-grid { grid-template-columns: 1fr; } }

.stat {
    padding: 18px 20px;
    display: flex; flex-direction: column; gap: 3px;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-ico {
    width: 30px; height: 30px; border-radius: 8px;
    display: grid; place-items: center; flex: none;
}
.stat-value { font-size: 27px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin-top: 6px; }
.stat-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .tone-brand { color: var(--brand); }
.stat .tone-ok { color: var(--ok); }
.stat .tone-warn { color: var(--warn); }
.stat .tone-bad { color: var(--bad); }

/* ============ Grid helpers ============ */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1000px) { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
    padding: 10px 14px; text-align: left;
    background: var(--surface-2);
    color: var(--muted); font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: .05em;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:hover td { background: #fbfaf8; }
table.data tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; }
.cell-muted { color: var(--muted); }
.cell-mono { font-family: var(--mono); font-size: 12.5px; }

/* ============ Badges ============ */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: var(--radius-sm);
    font-size: 11.5px; font-weight: 600; line-height: 1.4;
    white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge-brand { background: var(--brand-soft); color: var(--brand-strong); }

/* ============ Buttons ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    background: var(--brand); color: #fff; border: 1px solid transparent;
    border-radius: var(--radius); padding: 9px 16px;
    font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer;
    transition: background .15s ease, opacity .15s ease;
    white-space: nowrap;
}
.btn:hover { background: var(--brand-strong); color: #fff; }
.btn:active { opacity: .85; }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--muted); }
.btn-danger { background: var(--bad); }
.btn-danger:hover { background: #991b1b; }
.btn-outline { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.btn-outline:hover { background: #d8ebe8; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ============ Forms ============ */
label.f { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 6px; color: var(--ink-2); }
input[type=text], input[type=password], input[type=number],
input[type=date], input[type=month], input[type=search], select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong);
    border-radius: var(--radius); font: inherit; font-size: 13.5px;
    background: var(--surface); color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(13, 118, 110, .12);
}
input[readonly] { background: var(--surface-2); color: var(--muted); }
textarea { min-height: 150px; font-family: var(--mono); font-size: 12px; line-height: 1.5; }
.form-row { margin-bottom: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.form-section-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); margin: 20px 0 12px; padding-top: 16px; border-top: 1px solid var(--line);
}

/* ============ Filter bar ============ */
.filter-bar { display: flex; flex-wrap: wrap; gap: 11px; align-items: flex-end; }
.filter-bar .field { min-width: 150px; }
.filter-bar .field.grow { flex: 1; min-width: 180px; }
.filter-bar .field label { font-size: 11px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 5px; }

/* ============ Alerts ============ */
.alert { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; border: 1px solid transparent; }
.alert-success { background: var(--ok-soft); border-color: #cde9d6; color: var(--ok); }
.alert-error { background: var(--bad-soft); border-color: #f5cccc; color: var(--bad); }
.alert-info { background: var(--info-soft); border-color: #ccdaf7; color: var(--info); }

/* ============ Login ============ */
.login-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: var(--bg);
}
.login-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 16px; box-shadow: var(--shadow-pop);
    padding: 36px; width: 100%; max-width: 400px;
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; }
.login-brand .brand-mark { width: 40px; height: 40px; border-radius: 11px; font-size: 19px; }
.login-brand .t1 { font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
.login-brand .t2 { font-size: 12px; color: var(--muted); }
.login-card h1 { font-size: 19px; font-weight: 750; letter-spacing: -.02em; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-foot { margin-top: 20px; font-size: 12px; color: var(--muted); text-align: center; }

/* ============ Empty states ============ */
.empty {
    text-align: center; color: var(--muted); padding: 44px 16px;
}
.empty .empty-title { font-weight: 650; color: var(--ink-2); font-size: 14px; margin-bottom: 4px; }
.empty .empty-action { margin-top: 12px; }

/* ============ Pagination ============ */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pagination a, .pagination span {
    padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 8px;
    font-size: 13px; color: var(--ink-2); background: var(--surface);
}
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .cur { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ============ Charts ============ */
canvas.chart { max-width: 100%; display: block; }

/* ============ Misc ============ */
.muted { color: var(--muted); }
.text-ok { color: var(--ok); }
.text-bad { color: var(--bad); }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.divider { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.mini-num { font-variant-numeric: tabular-nums; }

/* ============ Modal ============ */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(28, 25, 23, .45);
    display: grid; place-items: center; padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
    background: var(--surface); border-radius: 16px;
    box-shadow: var(--shadow-pop); width: 100%; max-width: 420px;
    animation: modalIn .16s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
    padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.modal-close {
    background: none; border: none; font-size: 24px; line-height: 1;
    color: var(--muted); cursor: pointer; padding: 2px 8px; border-radius: 8px;
}
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-body { padding: 20px; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 14px 20px; border-top: 1px solid var(--line);
}

/* ============ Mobile ============ */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .content { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .modal { animation: none; }
}
