/* ============================================================
   Bhirama Creator Dashboard
   Tema: off-white + warm beige + charcoal + soft gold (premium, data-focused)
   ============================================================ */
:root {
    --bg: #FAF6F0;
    --bg-2: #F3EBDF;
    --surface: #FFFFFF;
    --surface-soft: #FBF7F1;
    --ink: #2A2422;
    --ink-2: #5F554E;
    --muted: #8B8078;
    --line: rgba(42, 36, 34, .12);
    --line-soft: rgba(42, 36, 34, .07);
    --gold: #B98A3C;
    --gold-2: #D9B25F;
    --gold-soft: rgba(185, 138, 60, .12);
    --green: #2F6B4F;
    --red: #B5544E;
    --plum: #6E4F80;
    --teal: #3E7C7B;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(42, 36, 34, .04), 0 12px 28px rgba(42, 36, 34, .07);
    --shadow-sm: 0 1px 2px rgba(42, 36, 34, .05), 0 6px 14px rgba(42, 36, 34, .05);
    --sans: Inter, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--sans);
    color: var(--ink);
    background:
        radial-gradient(900px 500px at 8% -5%, rgba(217, 178, 95, .18), transparent 60%),
        radial-gradient(700px 420px at 100% 0%, rgba(185, 138, 60, .10), transparent 55%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    background-attachment: fixed;
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; }
a.link { color: var(--gold); border-bottom: 1px solid rgba(185, 138, 60, .35); }
a.link:hover { border-bottom-color: var(--gold); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16.5px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.4px; }
.block { display: block; }
.center { text-align: center; }
.strong { font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; color: var(--gold); margin: 0 0 4px; }
hr.sep { border: 0; border-top: 1px solid var(--line-soft); margin: 18px 0; }

/* ---------------- layout ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 248px; flex: 0 0 248px;
    background: linear-gradient(180deg, #241E1B 0%, #2C2521 60%, #332A24 100%);
    color: #F4EDE3;
    display: flex; flex-direction: column;
    padding: 20px 14px;
    position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.side-brand strong { display: block; font-family: var(--serif); font-size: 16.5px; line-height: 1.15; letter-spacing: .02em; }
.side-brand small { display: block; font-size: 11px; color: rgba(244, 237, 227, .6); text-transform: uppercase; letter-spacing: .1em; }
.brand-dot {
    width: 30px; height: 30px; border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, var(--gold-2), var(--gold) 70%);
    box-shadow: 0 0 0 4px rgba(217, 178, 95, .14);
}
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.side-nav a, .side-foot a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius-sm);
    color: rgba(244, 237, 227, .82); font-size: 13.4px;
    transition: background .15s ease, color .15s ease;
}
.side-nav a:hover, .side-foot a:hover { background: rgba(244, 237, 227, .07); color: #fff; }
.side-nav a.active {
    background: linear-gradient(90deg, rgba(217, 178, 95, .22), rgba(217, 178, 95, .06));
    color: #fff; box-shadow: inset 2px 0 0 var(--gold-2);
}
.side-foot { border-top: 1px solid rgba(244, 237, 227, .12); padding-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.side-foot small { display: block; font-size: 11px; color: rgba(244, 237, 227, .55); }
.side-foot span { line-height: 1.25; }
.ic { width: 18px; height: 18px; flex: 0 0 18px; }
.btn .ic, .btn-icon .ic { width: 16px; height: 16px; flex-basis: 16px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 26px 14px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(250, 246, 240, .8);
    backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 20;
}
.topbar-title h1 { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.topbar-title p { margin: 2px 0 0; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 22px 26px 60px; display: flex; flex-direction: column; gap: 20px; }
.nav-toggle { display: none; }

/* ---------------- kartu & grid ---------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px 22px;
}
.card.soft { background: var(--surface-soft); box-shadow: none; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin-bottom: 2px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 16px; }
.kpi-grid.compact { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; }
.kpi-grid.tight { gap: 12px; }
.kpi {
    background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow-sm);
    display: flex; gap: 12px; align-items: flex-start;
}
.kpi-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; flex: 0 0 34px; }
.kpi-label { margin: 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.kpi-value { margin: 2px 0 0; font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-sub { margin: 0; font-size: 11.8px; }

.insight-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 0 16px; }
.mini-stat {
    background: var(--surface-soft); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
    padding: 10px 14px; min-width: 132px;
}
.mini-stat span { display: block; font-size: 11.4px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.mini-stat strong { font-size: 16px; }

/* ---------------- tombol ---------------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 15px; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-size: 13.4px; font-weight: 500; cursor: pointer;
    background: var(--surface); color: var(--ink); white-space: nowrap;
    transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: linear-gradient(135deg, var(--gold-2) 0%, var(--gold) 100%);
    color: #2A241D; box-shadow: 0 6px 16px rgba(185, 138, 60, .28);
}
.btn-primary:hover { box-shadow: 0 8px 20px rgba(185, 138, 60, .34); }
.btn-ghost { border-color: var(--line); background: rgba(255, 255, 255, .7); color: var(--ink-2); }
.btn-ghost:hover { border-color: rgba(185, 138, 60, .5); color: var(--ink); }
.btn-danger { border-color: rgba(181, 84, 78, .35); color: var(--red); background: rgba(181, 84, 78, .06); }
.btn-mini { padding: 5px 10px; font-size: 12.2px; border-radius: 8px; border-color: var(--line); background: rgba(255, 255, 255, .8); }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { border: 1px solid var(--line); background: rgba(255, 255, 255, .8); border-radius: 10px; padding: 8px; cursor: pointer; display: inline-flex; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-actions form { display: inline-flex; gap: 6px; }

/* ---------------- form ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.form-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.form-wide { max-width: 1080px; }
.span-2 { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld > span { font-size: 12.2px; color: var(--ink-2); font-weight: 500; }
input, select, textarea {
    font: inherit; font-size: 13.6px; color: var(--ink);
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(217, 178, 95, .35); border-color: var(--gold-2); }
input[disabled] { background: var(--surface-soft); color: var(--muted); }
textarea { resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.2px; color: var(--ink-2); }
.check input { width: auto; margin-top: 3px; }
.form-foot { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form select, .inline-form input { width: auto; min-width: 130px; }
.add-row { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.search { min-width: 190px; }
.weight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.code-block { display: block; background: var(--surface-soft); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; overflow-x: auto; margin: 6px 0 12px; }

.metric-preview {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px;
    background: var(--surface-soft); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
    padding: 14px; margin-top: 18px;
}
.metric-preview span { display: block; font-size: 11.4px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.metric-preview strong { font-size: 17px; font-variant-numeric: tabular-nums; }

/* ---------------- filter bar ---------------- */
.filterbar {
    display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
    background: rgba(255, 255, 255, .78); border: 1px solid var(--line-soft);
    border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.filterbar .fld { min-width: 138px; }
.filterbar .fld > span { font-size: 11.4px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------------- tabel ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.2px; background: #fff; }
table.tbl th, table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl thead th {
    background: var(--surface-soft); text-align: left; font-size: 11.6px; text-transform: uppercase;
    letter-spacing: .05em; color: var(--ink-2); font-weight: 600; white-space: nowrap;
    position: sticky; top: 0; z-index: 1;
}
table.tbl thead th.num { text-align: right; }
table.tbl tbody tr:hover { background: rgba(217, 178, 95, .06); }
table.tbl tfoot th { background: var(--surface-soft); font-size: 12.6px; }
table.tbl tfoot th.num { text-align: right; }
table.tbl.sortable thead th[data-sort] { cursor: pointer; user-select: none; }
table.tbl.sortable thead th[data-sort]::after { content: ''; }
table.tbl th.sorted-asc::after { content: ' ▲'; color: var(--gold); font-size: 9px; }
table.tbl th.sorted-desc::after { content: ' ▼'; color: var(--gold); font-size: 9px; }
table.tbl td small.block { display: block; font-size: 11.4px; }
table.compare td.hl { background: rgba(217, 178, 95, .18); font-weight: 600; }
table.tbl td .score-badge { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; }

.score-badge { font-variant-numeric: tabular-nums; font-weight: 600; }
.score-badge small { font-size: 10.6px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; opacity: .85; }
.g-up { color: var(--green); }
.g-mid { color: var(--teal); }
.g-neutral { color: var(--gold); }
.g-down { color: var(--red); }
.g-none { color: var(--muted); }

.tag {
    display: inline-block; padding: 3px 9px; border-radius: 999px;
    background: var(--surface-soft); border: 1px solid var(--line);
    font-size: 11.4px; color: var(--ink-2); white-space: nowrap;
}
.tag-active { background: rgba(47, 107, 79, .10); border-color: rgba(47, 107, 79, .25); color: var(--green); }
.tag-completed { background: rgba(62, 124, 123, .10); border-color: rgba(62, 124, 123, .25); color: var(--teal); }
.tag-draft, .tag-prospect { background: rgba(139, 128, 120, .12); border-color: rgba(139, 128, 120, .25); color: var(--ink-2); }
.tag-inactive { background: rgba(181, 84, 78, .10); border-color: rgba(181, 84, 78, .22); color: var(--red); }

/* ---------------- chart ---------------- */
.chart-box { width: 100%; min-height: 120px; }
.chart-box svg { display: block; }
.chart-box .axis { font-size: 10.5px; fill: var(--muted); font-family: var(--sans); }
.chart-box .strongaxis { font-weight: 600; fill: var(--ink-2); }
.chart-box .chart-title { font-size: 12.5px; font-weight: 600; fill: var(--ink-2); }
.chart-box .legend { display: flex; gap: 14px; justify-content: center; margin-top: 6px; font-size: 12px; color: var(--ink-2); }
.chart-box .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.seg { display: inline-flex; background: var(--surface-soft); border: 1px solid var(--line-soft); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
    border: 0; background: transparent; font: inherit; font-size: 12.4px; padding: 6px 12px;
    border-radius: 999px; cursor: pointer; color: var(--ink-2);
}
.seg button.active { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #2A241D; font-weight: 600; }

/* ---------------- daftar & insight ---------------- */
.top-list { background: var(--surface-soft); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 14px 16px; }
.top-list h3 { margin-bottom: 10px; }
.top-list ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.top-list li span.num { float: right; font-weight: 600; }
.insight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.insight-col h3 { margin-bottom: 8px; color: var(--gold); }
.insight-col ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13.2px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13.4px; }
.kv { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.kv li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); }
.kv li:last-child { border-bottom: 0; }
.error-list { background: rgba(181, 84, 78, .05); border: 1px solid rgba(181, 84, 78, .2); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; }
.error-list ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 5px; }

/* ---------------- tabs & profil ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 10px 14px; font-size: 13.4px; color: var(--ink-2); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--gold); }
.creator-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.creator-id { display: flex; gap: 14px; align-items: center; }
.avatar {
    width: 52px; height: 52px; border-radius: 50%; flex: 0 0 52px;
    background: linear-gradient(135deg, var(--gold-2), var(--gold));
    color: #2A241D; display: grid; place-items: center; font-family: var(--serif); font-size: 24px; font-weight: 600;
}
.creator-id h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--serif); font-size: 22px; }

/* ---------------- picker ---------------- */
.picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.pick {
    display: flex; gap: 10px; align-items: center; padding: 10px 12px;
    border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: #fff; cursor: pointer;
}
.pick:hover { border-color: rgba(185, 138, 60, .45); }
.pick input { width: auto; }
.pick span { display: flex; flex-direction: column; }
.pick strong { font-size: 13.6px; }
.pick small { font-size: 11.8px; }

/* ---------------- flash / auth ---------------- */
.flash { padding: 11px 15px; border-radius: var(--radius-sm); font-size: 13.4px; border: 1px solid; }
.flash-ok { background: rgba(47, 107, 79, .08); border-color: rgba(47, 107, 79, .25); color: var(--green); }
.flash-warn { background: rgba(185, 138, 60, .10); border-color: rgba(185, 138, 60, .35); color: #7C5B18; }
.bare-body { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 30px 18px; }
.auth-brand { display: flex; align-items: center; gap: 12px; text-align: left; }
.auth-brand strong { display: block; font-family: var(--serif); font-size: 22px; }
.auth-brand small { color: var(--muted); font-size: 12px; }
.auth-card {
    width: 100%; max-width: 480px; background: var(--surface);
    border: 1px solid var(--line-soft); border-radius: 18px; box-shadow: var(--shadow);
    padding: 26px 26px 24px;
}
.auth-card h1 { font-family: var(--serif); font-size: 24px; margin-bottom: 4px; }
.auth-card .form-grid { margin-top: 16px; }
.auth-foot { font-size: 12px; color: var(--muted); }

/* ---------------- details popover inline ---------------- */
.inline-details { position: relative; display: inline-block; }
.inline-details summary { list-style: none; display: inline-flex; }
.inline-details summary::-webkit-details-marker { display: none; }
.pop-form {
    position: absolute; right: 0; top: 34px; z-index: 30; width: 270px;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px;
}

/* ---------------- responsif ---------------- */
@media (max-width: 1000px) {
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; z-index: 50;
        transform: translateX(-100%); transition: transform .2s ease;
    }
    body.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, .35); }
    .nav-toggle { display: inline-flex; }
    .content { padding: 16px 14px 50px; }
    .topbar { padding: 14px 14px 12px; }
}
@media (max-width: 620px) {
    .kpi-value { font-size: 18px; }
    .filter-actions { margin-left: 0; width: 100%; }
    .filterbar .fld { min-width: 120px; flex: 1; }
    table.tbl { font-size: 12.6px; }
}

/* ---------------- cetak / PDF ---------------- */
@media print {
    body { background: #fff; }
    .sidebar, .topbar-actions, .filterbar, .no-print, .row-actions, .seg { display: none !important; }
    .app { display: block; }
    .content { padding: 0; gap: 14px; }
    .card { box-shadow: none; border-color: rgba(0, 0, 0, .15); break-inside: avoid; }
    .table-wrap { overflow: visible; }
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
    table.tbl thead th { position: static; }
}
