/* SJ Books theme, after the owner's reference mockup (docs/design/reference-mockup-20261020.webp).
   Loaded after app.css: it re-skins the same class names, so every screen inherits it. */
:root {
    --accent: #5B45C8; --accent-dark: #4A36A8; --accent-soft: #F1EDFF; --accent-ring: #BBA7FC; --brand: #BBA7FC;
    --navy: #0B1F3A; --navy-2: #12294A; --navy-3: #1B3A63; --navy-text: #C7D2E1;
    --text: #0F172A; --muted: #5B6577; --border: #E3E7EE; --bg: #F4F6FA; --surface: #FFFFFF;
    --green-bg: #DCFCE7; --green-fg: #15803D; --red-bg: #FEE2E2; --red-fg: #B91C1C; --grey-bg: #EEF1F5; --grey-fg: #334155;
    --amber-bg: #FEF3C7; --amber-fg: #A16207; --blue-bg: #DBEAFE; --blue-fg: #1D4ED8;
    --radius: 10px; --radius-lg: 14px; --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body { font-size: 14.5px; letter-spacing: -0.003em; }
h1 { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.02em; }
a { color: var(--accent); }
:focus-visible { outline-color: var(--accent-ring); }

/* Sidebar: navy, icon + label rows */
.sidebar { background: var(--navy); border-right: 0; color: var(--navy-text); scrollbar-color: var(--navy-3) transparent; }
.sidebar-head { border-bottom: 1px solid rgba(255, 255, 255, .06); height: 64px; }
.brand { color: #fff; display: inline-flex; align-items: center; gap: 10px; font-size: 1.1rem; letter-spacing: -0.01em; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; font-size: 14px; }
.sidebar .icon-btn { color: #fff; }
.sidebar-company { color: var(--navy-text); border-bottom: 1px solid rgba(255, 255, 255, .06); font-size: 12.5px; }
.nav-title { color: #7F92AE; font-size: 11px; font-weight: 700; margin: 6px 10px 6px; }
.nav-item { color: var(--navy-text); border-radius: 8px; min-height: 38px; padding: 7px 12px; gap: 10px; font-weight: 500; }
.nav-item .ico { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item .nav-label { flex: 1; }
a.nav-item:hover { background: var(--navy-2); color: #fff; }
a.nav-item.is-active { background: var(--navy-3); color: #fff; font-weight: 650; box-shadow: inset 3px 0 0 var(--accent-ring); }
.nav-item.is-disabled { color: #6E819D; }
.sidebar .tag { background: rgba(255, 255, 255, .08); color: #9FB0C8; }
.nav-sub { padding-left: 28px !important; font-size: 13.5px; min-height: 32px; }

/* Top bar: white, search pill, bell, user chip */
.topbar { height: 64px; border-bottom: 1px solid var(--border); box-shadow: none; }
.topbar-company { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 13.5px; background: #fff; }
.topbar-search { flex: 1; max-width: 460px; margin: 0 16px; position: relative; }
.topbar-search input { width: 100%; min-height: 40px; padding-left: 38px; border-radius: 10px; border-color: var(--border); background: #F8FAFC; }
.topbar-search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: #8A94A6; }
.avatar { background: #DCE7F7; color: #1E3A8A; font-size: 13px; }
.user-btn { font-weight: 600; font-size: 13.5px; }

/* Buttons */
.btn { border-radius: 10px; font-weight: 650; min-height: 40px; }
.btn-primary { background: var(--accent); box-shadow: 0 1px 2px rgba(91, 69, 200, .25); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { border-color: var(--border); box-shadow: var(--shadow); }
.btn .ico { width: 17px; height: 17px; }

/* Surfaces */
.dt-wrap, .form, .card-tile, .panel { border-color: var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.panel { background: var(--surface); border: 1px solid var(--border); padding: 18px 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { font-size: 1rem; font-weight: 700; }
.panel-head a { font-size: 13px; font-weight: 600; text-decoration: none; }

/* Tables */
.dt thead th { background: #F8FAFC; color: #475569; font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.dt th, .dt td { padding: 12px 16px; border-bottom-color: #EEF1F5; }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt tbody tr.is-link:hover { background: #F7F5FF; }
.dt td a { color: var(--accent); text-decoration: none; font-weight: 600; }
.dt td a:hover { text-decoration: underline; }
.dt tfoot td { background: #F1F5F9; }

/* Status pills */
.badge { font-size: 11.5px; font-weight: 650; letter-spacing: 0; padding: 3px 10px; text-transform: none; }
.badge-green { background: var(--green-bg); color: var(--green-fg); }
.badge-red { background: var(--red-bg); color: var(--red-fg); }
.badge-grey { background: var(--grey-bg); color: var(--grey-fg); }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); }
.badge-blue { background: var(--blue-bg); color: var(--blue-fg); }

/* Forms */
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=password], select, textarea {
    border-color: #CBD3DF; border-radius: 10px; }
input[type=date] { width: 100%; min-height: 40px; padding: 8px 12px; font: inherit; border: 1px solid #CBD3DF; background: #fff; }
.field label, .field .label { font-size: 13px; color: #334155; }

/* Dashboard */
.dash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.period-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none; color: var(--text); display: block; }
.kpi:hover { border-color: #C9D4E3; }
.kpi-label { display: flex; align-items: center; gap: 8px; color: #475569; font-weight: 600; font-size: 13px; }
.kpi-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: #EEF2F7; color: #334155; }
.kpi-icon .ico { width: 16px; height: 16px; }
.kpi-value { margin-top: 10px; font-size: 1.55rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-value small { font-size: .7em; font-weight: 650; color: #475569; margin-right: 4px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.delta { font-weight: 700; }
.delta.up { color: var(--green-fg); }
.delta.down { color: var(--red-fg); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 14px; margin-bottom: 16px; }
.chart { width: 100%; height: 220px; display: block; }
.chart .grid { stroke: #EEF1F5; }
.chart .axis { fill: #8A94A6; font-size: 10px; }
.chart .bar-in { fill: #7C66E0; }
.chart .bar-out { fill: #93C5FD; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.attention { list-style: none; margin: 0; padding: 0; }
.attention li a, .attention li > span { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid #EEF1F5; color: var(--text); text-decoration: none; font-weight: 550; }
.attention li:last-child a, .attention li:last-child > span { border-bottom: 0; }
.attention .count { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; border-radius: 50%; font-size: 12.5px; font-weight: 750; }
.attention .count.red { background: #FDE8E8; color: var(--red-fg); }
.attention .count.amber { background: var(--amber-bg); color: var(--amber-fg); }
.attention .count.blue { background: var(--blue-bg); color: var(--blue-fg); }
.attention .count.grey { background: var(--grey-bg); color: var(--grey-fg); }
.attention .chev { margin-left: auto; color: #94A3B8; }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid { grid-template-columns: 1fr; } }
@media (min-width: 1024px) { .sidebar { box-shadow: none; } }
@media (max-width: 599px) {
    .topbar-search { display: none; }
    .kpis { gap: 10px; }
    .kpi { padding: 12px 14px; }
    .kpi-value { font-size: 1.2rem; }
    .bottombar { background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(15, 23, 42, .06); }
    .bottombar .ico { width: 20px; height: 20px; }
    .bottombar a.is-active { color: var(--accent); }
}

/* Navigation sections */
.nav { padding: 10px 10px 16px; }
.nav-section { margin-bottom: 2px; }
.nav-section ul { list-style: none; margin: 2px 0 6px; padding: 0; }
button.nav-item { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.nav-toggle.has-active { color: #fff; }
.nav-item .chev { display: inline-flex; margin-left: auto; transition: transform .15s ease; }
.nav-item .chev .ico { width: 15px; height: 15px; }
.nav-item .chev.is-open { transform: rotate(180deg); }
.nav-sub { padding-left: 40px !important; font-size: 13.5px; min-height: 34px; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; margin: 8px 16px 0; padding: 12px 0 0; border-top: 1px solid rgba(255, 255, 255, .06); color: #7F92AE; font-size: 12px; }
.sidebar-foot .ico { width: 15px; height: 15px; }
.topbar .icon-btn .ico { width: 22px; height: 22px; }
.topbar-company .ico { width: 16px; height: 16px; color: var(--muted); }
@media (max-width: 599px) {
    .bottombar { grid-template-columns: repeat(5, 1fr); }
    .bottombar > a, .bottombar > button { border: 0; background: none; font: inherit; font-size: 11.5px; font-weight: 600; color: #475569; cursor: pointer; }
    .bottombar a.is-active { color: var(--accent); }
}
.period-pill { white-space: nowrap; }
.period-pill .ico, .btn .ico { width: 16px; height: 16px; flex: none; }
.kpi-value { font-size: clamp(1.15rem, 2.2vw, 1.6rem); }
.dt td { white-space: nowrap; }
.dt td:nth-child(4) { white-space: normal; min-width: 160px; }
.kpi-foot { flex-wrap: wrap; }
.panel-head { flex-wrap: wrap; }
@media (max-width: 1279px) { .hide-md { display: none; } }
@media (max-width: 599px) {
    .kpi-foot span:not(.delta) { display: none; }
    .kpi-label { font-size: 12.5px; }
    .dash-head h1 { display: none; }
    .dash-head { margin-bottom: 12px; }
    .dash-head .page-header-actions { width: 100%; }
    .dash-head .btn { flex: 1; }
}
.sql-code { margin-left: auto; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: #8EA3C0; background: rgba(255, 255, 255, .06); padding: 1px 6px; border-radius: 5px; }
a.nav-item.is-active .sql-code { color: #CFE6E2; }

/* Sign-in */
body.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px;
    background: radial-gradient(1200px 600px at 50% -10%, #ECE6FF 0%, var(--bg) 60%); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 32px 28px; text-align: center; box-shadow: 0 10px 30px rgba(15, 23, 42, .08); }
.auth-mark { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 800; font-size: 20px; }
.auth-card h1 { margin: 14px 0 4px; font-size: 1.6rem; }
.auth-lead { margin: 0 0 4px; font-weight: 650; font-size: 1.05rem; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 48px; margin-top: 20px; border: 1px solid #CBD3DF; border-radius: 12px; background: #fff; color: var(--text); font-weight: 650; text-decoration: none; box-shadow: var(--shadow); }
.btn-google:hover { background: #F8FAFC; }
.auth-note { margin: 16px 0 0; color: var(--muted); font-size: 13px; }
.auth-foot { color: var(--muted); font-size: 12.5px; }
.key-once { border-color: #99D6CC; background: #F2FBF9; }
.key-value { display: block; margin: 10px 0; padding: 12px; border-radius: 10px; background: #0B1F3A; color: #E6F4F1; font-size: 14px; word-break: break-all; user-select: all; }
.abilities { border: 0; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.dt td.wrap { white-space: normal; }
.kpi-value.ok { color: var(--green-fg); }
.kpi-value.bad { color: var(--red-fg); }
.inline-form { display: flex; align-items: flex-end; gap: 8px; margin-top: 12px; max-width: 520px; }
.inline-form .field { flex: 1; }

/* Seri Jadi brand */
.brand-logo { display: block; height: 34px; width: auto; }
.brand-sub { display: block; margin-top: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; color: #8EA3C0; text-transform: uppercase; }
.sidebar-head .brand { flex-direction: column; align-items: flex-start; gap: 0; }
.auth-logo { display: block; height: 46px; width: auto; margin: 0 auto 6px; }
.topbar-logo { height: 22px; width: auto; display: none; }
@media (max-width: 599px) { .topbar-logo { display: block; } .topbar-title { font-size: .98rem; } }
