/* ============================================================================
   BINSANIA ONE — One Integrated School Ecosystem
   Tema: navy #0C2239 / #163A63 + emas #C9A227 + teal #159895
   Satu keluarga visual dengan aplikasi Binsania lainnya (kartu lembut, tipografi Inter).
   ========================================================================== */

:root {
  --navy-900: #08182b;
  --navy-850: #0a1d33;
  --navy-800: #0c2239;
  --navy-700: #123a5a;
  --navy-600: #17496f;
  --navy: #16324f;
  --gold: #c9a227;
  --gold-600: #b08d1c;
  --gold-light: #e8c766;
  --gold-soft: #fbf4df;
  --teal: #159895;
  --teal-600: #0f7d7b;
  --teal-soft: #e6f6f4;
  --ink: #14263b;
  --ink-soft: #334861;
  --muted: #6b7c91;
  --muted-2: #8b9aab;
  --bg: #f1f5f9;
  --card: #ffffff;
  --line: #e2e9f1;
  --line-strong: #cfdae7;
  --pos: #0f7b5a;
  --pos-soft: #e6f4ef;
  --neg: #ad3542;
  --neg-soft: #fbeaec;
  --warn: #a9761a;
  --warn-soft: #fdf3dc;
  --info: #1d5f9e;
  --info-soft: #e8f1fa;
  --violet: #6d4bb5;
  --violet-soft: #efeafb;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(12, 34, 57, .04), 0 10px 28px -12px rgba(12, 34, 57, .18);
  --shadow-lg: 0 24px 60px -20px rgba(8, 24, 43, .35);
  --base-rgb: 12, 34, 57;
  --accent-rgb: 201, 162, 39;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 262px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 300px;
  background:
    radial-gradient(900px 240px at 12% -40px, rgba(var(--base-rgb), .14), transparent 70%),
    radial-gradient(700px 200px at 88% -60px, rgba(var(--accent-rgb), .16), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4, h5, p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 650; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.spacer { flex: 1; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c6d3e0; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ================================================================== LOGIN */
.login-wrap {
  position: relative; z-index: 1; min-height: 100vh;
  display: grid; grid-template-columns: 1.02fr .98fr;
}
.login-brand {
  background:
    radial-gradient(700px 420px at 85% 8%, rgba(var(--accent-rgb), .22), transparent 62%),
    radial-gradient(600px 400px at 10% 92%, rgba(var(--base-rgb), .85), transparent 68%),
    linear-gradient(155deg, var(--navy-900) 0%, var(--navy-800) 45%, #0e2c48 100%);
  color: #fff; padding: 46px 52px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-brand::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(70% 60% at 60% 40%, #000 20%, transparent 85%);
  pointer-events: none;
}
.brand-mark { display: flex; align-items: center; gap: 14px; position: relative; z-index: 2; }
.brand-seal {
  width: 54px; height: 54px; border-radius: 15px; flex: none;
  background: linear-gradient(145deg, rgba(255,255,255,.14), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.2); display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 12px 26px -14px rgba(0,0,0,.6);
}
.brand-seal img { width: 100%; height: 100%; object-fit: contain; }
.brand-seal span { font-weight: 800; letter-spacing: .04em; color: var(--gold-light); }
.brand-name { font-size: 14px; font-weight: 750; letter-spacing: .1em; }
.brand-sub { font-size: 11px; color: rgba(255,255,255,.62); letter-spacing: .06em; margin-top: 3px; }
.login-hero { position: relative; z-index: 2; max-width: 520px; }
.login-hero h1 { font-size: 33px; line-height: 1.2; letter-spacing: -.02em; }
.login-hero h1 em { font-style: normal; color: var(--gold-light); }
.login-hero p { margin-top: 14px; color: rgba(255,255,255,.72); font-size: 13.5px; line-height: 1.65; }
.login-points { display: grid; gap: 12px; margin-top: 26px; }
.login-point { display: flex; gap: 11px; align-items: flex-start; font-size: 12.5px; color: rgba(255,255,255,.82); }
.login-point i {
  width: 22px; height: 22px; border-radius: 7px; background: rgba(201,162,39,.16); color: var(--gold-light);
  display: grid; place-items: center; font-size: 12px; font-style: normal; flex: none; border: 1px solid rgba(201,162,39,.3);
}
.login-foot { position: relative; z-index: 2; font-size: 11px; color: rgba(255,255,255,.45); display: flex; gap: 14px; flex-wrap: wrap; }
.login-panel {
  display: flex; align-items: center; justify-content: center; padding: 40px 40px; position: relative; z-index: 1;
}
.login-card { width: 100%; max-width: 402px; }
.login-card h2 { font-size: 23px; letter-spacing: -.015em; }
.login-card .lead { color: var(--muted); font-size: 13px; margin-top: 7px; margin-bottom: 24px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-strong); background: #fff; border-radius: 11px;
  padding: 10px 12px; font-size: 13.5px; color: var(--ink); font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(23,73,111,.12); }
.textarea { min-height: 82px; resize: vertical; }
.input.sm, .select.sm { padding: 7px 9px; font-size: 12.5px; border-radius: 9px; }
.input:disabled, .select:disabled { background: #f6f8fb; color: var(--muted); }
.hint { font-size: 11.5px; color: var(--muted); }
.err { font-size: 12px; color: var(--neg); }
.login-actions { margin-top: 20px; display: grid; gap: 12px; }
.login-aside { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 16px; }
.demo-list { display: grid; gap: 6px; margin-top: 10px; max-height: 220px; overflow: auto; }
.demo-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 6px 9px; border-radius: 8px; background: #f7fafd; }
.demo-row b { font-weight: 600; }
.demo-row button { border: 0; background: transparent; color: var(--navy-600); cursor: pointer; font-size: 11.5px; font-weight: 600; }
.login-note { font-size: 11.5px; color: var(--muted); margin-top: 16px; line-height: 1.6; }

/* ================================================================== SHELL */
.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; position: sticky; top: 0; height: 100vh;
  background: linear-gradient(178deg, var(--navy-900) 0%, var(--navy-800) 58%, #0d2a45 100%);
  color: #fff; display: flex; flex-direction: column; overflow: hidden; z-index: 40;
}
.sidebar::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(420px 240px at 90% 0%, rgba(201,162,39,.16), transparent 70%);
  pointer-events: none;
}
.sidebar-top { padding: 20px 18px 16px; position: relative; z-index: 2; }
.sidebar-brand { display: flex; gap: 11px; align-items: center; }
.sidebar-brand .brand-seal { width: 42px; height: 42px; border-radius: 12px; }
.sidebar-brand .brand-name { font-size: 12.5px; letter-spacing: .07em; line-height: 1.25; }
.sidebar-brand .brand-sub { font-size: 10px; letter-spacing: .03em; margin-top: 2px; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 4px 10px 20px; position: relative; z-index: 2; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 2px; }
.nav-label { font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.36); padding: 0 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8.5px 10px; border-radius: 10px;
  color: rgba(255,255,255,.74); font-size: 12.8px; cursor: pointer; border: 0; background: transparent;
  width: 100%; text-align: left; margin-bottom: 2px; position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(201,162,39,.2), rgba(201,162,39,.06)); color: #fff; font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--gold-light);
}
.nav-item .ico { width: 17px; text-align: center; font-size: 13px; opacity: .92; flex: none; }
.nav-item .tag { margin-left: auto; font-size: 9.5px; padding: 1px 6px; border-radius: 99px; background: rgba(201,162,39,.2); color: var(--gold-light); }
.sidebar-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.09); position: relative; z-index: 2; display: flex; gap: 10px; align-items: center; }
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who .n { font-size: 12.3px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who .r { font-size: 10.5px; color: rgba(255,255,255,.48); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot button { border: 0; background: rgba(255,255,255,.08); color: rgba(255,255,255,.8); width: 30px; height: 30px; border-radius: 9px; cursor: pointer; }
.sidebar-foot button:hover { background: rgba(255,255,255,.16); color: #fff; }
.avatar-sm { width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff; overflow: hidden; flex: none; }
.avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; background: rgba(241,245,249,.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(207,218,231,.7);
}
.crumb { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; min-width: 0; }
.crumb b { color: var(--ink); font-weight: 650; }
.topbar-spacer { flex: 1; }
.searchbox { position: relative; width: 230px; }
.searchbox input { width: 100%; border: 1px solid var(--line-strong); background: #fff; border-radius: 10px; padding: 8px 10px 8px 32px; font-size: 12.5px; }
.searchbox .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-2); font-size: 12px; }
.iconbtn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff;
  display: grid; place-items: center; cursor: pointer; color: var(--ink-soft); font-size: 14px; position: relative;
}
.iconbtn:hover { border-color: var(--navy-600); color: var(--navy-700); }
.iconbtn .dot { position: absolute; top: 6px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.avatar-btn { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line-strong); background: #fff; border-radius: 11px; padding: 4px 9px 4px 4px; cursor: pointer; }
.avatar-btn .avatar-sm { background: var(--navy-700); }
.avatar-btn .nm { font-size: 12px; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line);
  border-radius: 13px; box-shadow: var(--shadow-lg); padding: 7px; min-width: 210px; z-index: 60;
}
.menu-pop button { display: flex; width: 100%; align-items: center; gap: 9px; border: 0; background: transparent; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 12.5px; text-align: left; color: var(--ink); }
.menu-pop button:hover { background: #f2f6fa; }
.menu-pop .sep { height: 1px; background: var(--line); margin: 5px 2px; }
.content { padding: 22px 24px 56px; display: grid; gap: 18px; max-width: 1560px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; letter-spacing: -.02em; }
.page-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; max-width: 780px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ================================================================ COMPONENTS */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card.pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h3 { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.card-head .sub { font-size: 11.5px; color: var(--muted); }
.card-head .badge { margin-left: auto; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 6px 0 -2px; }
.section-title h2 { font-size: 15px; letter-spacing: -.01em; }
.section-title .count { font-size: 11px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font-size: 12.5px; font-weight: 600;
  padding: 8px 13px; cursor: pointer; white-space: nowrap; transition: transform .06s, box-shadow .15s, background .15s;
}
.btn:hover { border-color: var(--navy-600); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--navy-700), var(--navy-800)); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -12px rgba(12,34,57,.7); }
.btn.primary:hover { background: linear-gradient(135deg, var(--navy-600), var(--navy-700)); }
.btn.gold { background: linear-gradient(135deg, var(--gold), var(--gold-600)); border-color: transparent; color: #2a2005; }
.btn.teal { background: linear-gradient(135deg, var(--teal), var(--teal-600)); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--neg-soft); border-color: #f0c8cd; color: var(--neg); }
.btn.danger:hover { background: #f9dde0; }
.btn.sm { padding: 6px 10px; font-size: 11.5px; border-radius: 9px; }
.btn.xs { padding: 4px 8px; font-size: 11px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { border: 1px solid var(--line); background: #fff; width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-soft); font-size: 12px; }
.icon-btn:hover { border-color: var(--navy-600); color: var(--navy-700); }
.icon-btn.xxs { width: 25px; height: 25px; font-size: 10.5px; }
.icon-btn.danger { color: var(--neg); border-color: #f0c8cd; }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.link-btn { border: 0; background: transparent; color: var(--navy-600); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 2px 8px; font-size: 10.8px; font-weight: 650; letter-spacing: .01em; border: 1px solid transparent; white-space: nowrap; }
.badge.pos { background: var(--pos-soft); color: var(--pos); border-color: #c9e8dd; }
.badge.neg { background: var(--neg-soft); color: var(--neg); border-color: #f0c8cd; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #f0e0b8; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: #cfe1f3; }
.badge.gold { background: var(--gold-soft); color: var(--gold-600); border-color: #ecdcae; }
.badge.teal { background: var(--teal-soft); color: var(--teal-600); border-color: #bfe6e3; }
.badge.violet { background: var(--violet-soft); color: var(--violet); border-color: #ddd2f4; }
.badge.grey { background: #eef2f7; color: var(--muted); border-color: #dfe6ef; }

.kpi-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; right: -18px; top: -22px; width: 78px; height: 78px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--accent-rgb), .14), transparent 70%); }
.kpi .k-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.kpi .k-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-600); font-size: 12px; }
.kpi .k-val { font-size: 25px; font-weight: 750; letter-spacing: -.03em; margin-top: 8px; line-height: 1.15; }
.kpi .k-sub { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.kpi .k-bar { height: 5px; border-radius: 99px; background: #eef3f8; margin-top: 10px; overflow: hidden; }
.kpi .k-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--teal), var(--teal-600)); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { width: auto; min-width: 130px; }
.toolbar .search { min-width: 190px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: #fff; border-radius: 99px; padding: 4px 10px; font-size: 11.5px; cursor: pointer; color: var(--ink-soft); }
.chip.active { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.chip:hover { border-color: var(--navy-600); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 0; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  font-weight: 700; padding: 10px 12px; background: #f7fafd; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid #eef3f8; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafcfe; }
table.data td.acts { white-space: nowrap; text-align: right; }
table.data td.acts .icon-btn { margin-left: 3px; }
table.data .cell-main { font-weight: 600; color: var(--ink); }
table.data .sub { font-size: 11px; color: var(--muted); }
table.data.compact td, table.data.compact th { padding: 7px 10px; }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 12.5px; }
.empty .ico { font-size: 26px; opacity: .5; display: block; margin-bottom: 8px; }
.empty h4 { font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); flex-wrap: wrap; }

.note { border-radius: 12px; padding: 11px 13px; font-size: 12.2px; line-height: 1.6; border: 1px solid; display: flex; gap: 9px; align-items: flex-start; }
.note.info { background: var(--info-soft); border-color: #cfe1f3; color: #17466f; }
.note.warn { background: var(--warn-soft); border-color: #f0e0b8; color: #6d4c0d; }
.note.pos { background: var(--pos-soft); border-color: #c9e8dd; color: #0d5c45; }
.note.neg { background: var(--neg-soft); border-color: #f0c8cd; color: #7b2630; }
.note.gold { background: var(--gold-soft); border-color: #ecdcae; color: #6b5312; }
.note .ico { flex: none; font-weight: 700; }

.list { display: grid; gap: 0; }
.list-row { display: flex; align-items: center; gap: 11px; padding: 10px 16px; border-bottom: 1px solid #eef3f8; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #fafcfe; }
.list-row .n { font-size: 12.5px; font-weight: 600; }
.list-row .s { font-size: 11px; color: var(--muted); }
.list-row .when { margin-left: auto; font-size: 11px; color: var(--muted-2); white-space: nowrap; }

.progress { height: 6px; border-radius: 99px; background: #eef3f8; overflow: hidden; min-width: 60px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--teal-600)); border-radius: 99px; }
.progress.gold span { background: linear-gradient(90deg, var(--gold-light), var(--gold-600)); }
.progress.warn span { background: linear-gradient(90deg, #e7b96a, var(--warn)); }
.progress.neg span { background: linear-gradient(90deg, #e79aa2, var(--neg)); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; padding: 0 4px; }
.tab { border: 0; background: transparent; padding: 10px 13px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--navy-700); border-bottom-color: var(--gold); }
.tab:hover { color: var(--navy-700); }
.tab-body { padding-top: 16px; }

.seg { display: inline-flex; background: #eef3f8; border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(12,34,57,.12); }

.chart-box { padding: 10px 6px 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 12px 14px; font-size: 11.5px; color: var(--muted); }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.chart-tip { position: fixed; z-index: 200; pointer-events: none; background: var(--navy-900); color: #fff; font-size: 11px; padding: 5px 8px; border-radius: 7px; opacity: 0; transition: opacity .12s; white-space: nowrap; }
.chart-tip.on { opacity: 1; }
svg .hit { fill: transparent; cursor: pointer; }
svg .hit:hover { fill: rgba(23,73,111,.06); }

.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 12px; }
.hbar { display: grid; gap: 9px; padding: 4px 2px; }
.hbar-row { display: grid; grid-template-columns: 92px 1fr 52px; align-items: center; gap: 10px; font-size: 11.5px; }
.hbar-row .lbl { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-row .trk { background: #eef3f8; border-radius: 99px; height: 9px; overflow: hidden; }
.hbar-row .trk span { display: block; height: 100%; border-radius: 99px; }
.hbar-row .val { text-align: right; font-weight: 650; }

.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar-xl { width: 74px; height: 74px; border-radius: 20px; background: var(--navy-800); color: #fff; display: grid; place-items: center; font-size: 24px; font-weight: 700; overflow: hidden; flex: none; }
.avatar-xl img { width: 100%; height: 100%; object-fit: cover; }
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 20px; }
.dl .item { min-width: 0; }
.dl .k { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.dl .v { font-size: 13px; margin-top: 2px; word-break: break-word; }

.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline .tl { position: relative; padding: 0 0 14px 4px; }
.timeline .tl::before { content: ""; position: absolute; left: -17px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--gold-soft); }
.timeline .tl .t { font-size: 12.5px; font-weight: 600; }
.timeline .tl .d { font-size: 11.5px; color: var(--muted); }

.matrix { overflow-x: auto; }
.matrix table { border-collapse: collapse; width: 100%; font-size: 11.5px; }
.matrix th, .matrix td { border: 1px solid var(--line); padding: 5px 6px; text-align: center; }
.matrix th.mod { text-align: left; background: #f7fafd; font-weight: 650; white-space: nowrap; }
.matrix thead th { background: #f7fafd; font-size: 10px; letter-spacing: .03em; }
.matrix td label { display: grid; place-items: center; cursor: pointer; }
.matrix input { accent-color: var(--navy-700); width: 15px; height: 15px; }
.matrix tr.role td { background: #fcfdff; }
.matrix td.on { background: rgba(201,162,39,.09); }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.perm-mod { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; }
.perm-mod h5 { font-size: 12px; margin-bottom: 3px; }
.perm-mod .d { font-size: 10.5px; color: var(--muted); margin-bottom: 8px; }
.perm-mod label { display: flex; gap: 6px; align-items: center; font-size: 11.5px; padding: 2px 0; cursor: pointer; }
.perm-mod input { accent-color: var(--navy-700); }

/* ================================================================== MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(8, 24, 43, .45); backdrop-filter: blur(3px);
  z-index: 120; display: flex; align-items: flex-start; justify-content: center; padding: 34px 18px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 620px;
  display: flex; flex-direction: column; max-height: calc(100vh - 68px); animation: pop .16s ease-out;
}
.modal.wide { max-width: 900px; }
.modal.narrow { max-width: 440px; }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15px; font-weight: 700; }
.modal-head .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.modal-head .x { margin-left: auto; border: 0; background: #f2f6fa; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-body.flush { padding: 0; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .field { margin-bottom: 0; }
.check-line { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; padding: 4px 0; }
.check-line input { margin-top: 2px; accent-color: var(--navy-700); }
.upload-box { border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 13px; text-align: center; background: #fbfdff; }
.upload-box.drag { border-color: var(--navy-600); background: #f2f8fd; }
.upload-box .preview { max-width: 100%; max-height: 150px; border-radius: 8px; margin-top: 8px; }

/* ================================================================== TOAST */
#toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: grid; gap: 8px; max-width: 380px; }
.toast {
  background: var(--navy-900); color: #fff; border-radius: 11px; padding: 11px 14px; font-size: 12.5px;
  box-shadow: var(--shadow-lg); display: flex; gap: 9px; align-items: flex-start; animation: slide .18s ease-out;
}
.toast.pos { background: #0d5c45; }
.toast.neg { background: #7b2630; }
.toast.warn { background: #6d4c0d; }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============================================================ RESPONSIVE */
@media (max-width: 1220px) {
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
  .searchbox { display: none; }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-102%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg); width: 268px;
  }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(8,24,43,.4); z-index: 35; }
  .topbar { padding: 10px 14px; }
  .content { padding: 16px 14px 72px; gap: 14px; }
  .page-head h1 { font-size: 19px; }
  .grid.two, .grid.three, .grid.four { grid-template-columns: minmax(0, 1fr); }
  .login-wrap { grid-template-columns: minmax(0, 1fr); }
  .login-brand { display: none; }
  .login-panel { padding: 30px 18px 40px; min-height: 100vh; align-items: flex-start; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  /* bottom navigation sesuai peran */
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; background: #fff;
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 2px;
    box-shadow: 0 -8px 24px -18px rgba(12,34,57,.5);
  }
  .bottom-nav button {
    flex: 1; border: 0; background: transparent; display: grid; place-items: center; gap: 2px;
    font-size: 9.5px; color: var(--muted); padding: 4px 2px; border-radius: 9px; cursor: pointer;
  }
  .bottom-nav button .ico { font-size: 16px; }
  .bottom-nav button.active { color: var(--navy-700); background: var(--gold-soft); font-weight: 650; }
}
@media (min-width: 901px) { .bottom-nav, .scrim { display: none; } }
@media (max-width: 640px) {
  .modal-overlay { padding: 0; }
  .modal { max-width: none; border-radius: 0; min-height: 100vh; max-height: none; }
  .modal-body { max-height: calc(100vh - 132px); }
  .modal-foot { position: sticky; bottom: 0; background: #fff; }
  .modal-foot .btn { flex: 1; }
  .input, .select, .textarea { font-size: 16px; }
  .toolbar .input, .toolbar .select, .toolbar .search { width: 100%; min-width: 0; }
  .toolbar { gap: 7px; }
  .toolbar .btn { flex: 1; }
  .page-actions { width: 100%; margin-left: 0; }
  .page-actions .btn { flex: 1; }
  .kpi .k-val { font-size: 22px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 13px 14px; }
  .matrix th, .matrix td { padding: 4px; }
  .matrix thead th { font-size: 9px; }
  .matrix th.mod { font-size: 10.5px; }
  .avatar-btn .nm { display: none; }
  .crumb .hide-sm { display: none; }

  /* Tabel data menjadi kartu bertumpuk di HP */
  .table-cards thead { display: none; }
  .table-cards table.data, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin: 8px 10px; background: #fff; }
  .table-cards td { border: 0; padding: 4px 0; display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; }
  .table-cards td::before { content: attr(data-l); flex: 0 0 96px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding-top: 1px; }
  .table-cards td.cell-main { font-size: 13.5px; border-bottom: 1px dashed #eef3f8; padding-bottom: 7px; margin-bottom: 3px; }
  .table-cards td.cell-main::before { content: none; }
  .table-cards td.acts { justify-content: flex-end; padding-top: 7px; }
  .table-cards td.acts::before { content: none; }
  .table-cards td.empty-cell { display: block; text-align: center; }
  .table-cards td.empty-cell::before { content: none; }
  .table-cards .pager { border-top: 1px solid var(--line); }
}

/* ================================================================== PRINT */
@media print {
  body::before, .sidebar, .topbar, .page-actions, .no-print, #toast-root, .toolbar, .pager, .bottom-nav { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; gap: 14px; max-width: none; }
  .card { box-shadow: none; border-color: #c9d5e2; break-inside: avoid; }
  .print-only { display: block !important; }
  a { text-decoration: none; }
  body { font-size: 11.5px; background: #fff; }
  body.modal-open #app { display: none !important; }
  body.modal-open #modal-root .modal-overlay { position: static; background: none; padding: 0; display: block; }
  body.modal-open #modal-root .modal { max-width: none; box-shadow: none; border-radius: 0; max-height: none; }
  body.modal-open #modal-root .modal-body { overflow: visible; max-height: none; }
  body.modal-open #modal-root .modal-foot, body.modal-open .modal-head .x { display: none !important; }
}
.print-only { display: none; }
