:root {
  --asphalt: #2B2E33;
  --asphalt-2: #373B41;
  --lane: #FFC20E;
  --concrete: #E9EBEE;
  --panel: #FFFFFF;
  --ink: #1D2025;
  --ink-2: #555B64;
  --rule: #D5D9DE;
  --go: #2F8A3C;
  --signal: #D7261F;
  --info: #1E63C4;
  --purple: #6B4FC8;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--concrete); color: var(--ink); font: 15px/1.45 var(--body); }
a { color: var(--info); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--lane); outline-offset: 2px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Gate ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; background: var(--asphalt); color: #F4F4EF; padding: 24px; }
.gate-box { max-width: 420px; }
.gate h1 { font: 700 64px/1 var(--display); margin: 0 0 12px; }
.gate p { color: #C9CCD1; }
.gate .brand { color: var(--lane); font: 700 24px var(--display); margin: 0;
  display: inline-flex; align-items: center; gap: 10px; }
.gate .brand::before, .side .brand::before, .topbar .brand::before {
  content: ""; flex: none; width: 30px; height: 30px; border-radius: 8px;
  background: url("/icons/logo.png") center/cover no-repeat; }
.gate-back { display: inline-block; margin-top: 16px; color: #C9CCD1; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; background: var(--asphalt); color: #E8E9EB; padding: 18px 0 16px;
  background-image: linear-gradient(var(--lane) 50%, transparent 50%); background-size: 3px 22px; background-repeat: repeat-y; background-position: right 0 top 0; }
.side .brand { padding: 0 20px 16px; font: 700 28px/1 var(--display); color: #fff; text-decoration: none;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.side .brand::before { width: 36px; height: 36px; border-radius: 10px; }
.side .brand > span { flex: 1 1 100%; }
.side .brand span { display: block; font: 500 14px var(--body); color: #AEB3BA; margin-top: 2px; }
.nav { display: grid; gap: 2px; padding: 8px 10px; overflow-y: auto; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 8px; color: #D4D7DB; text-decoration: none; font: 600 18px var(--display); }
.nav a:hover { background: var(--asphalt-2); color: #fff; }
.nav a[aria-current="page"] { background: var(--lane); color: var(--ink); }
.nav .count { min-width: 24px; padding: 0 7px; border-radius: 12px; background: var(--signal); color: #fff; font: 700 13px/22px var(--body); text-align: center; }
.nav .group { margin: 14px 12px 4px; color: #8E949C; font: 500 13px var(--body); }
.side-foot { margin-top: auto; padding: 14px 20px 0; border-top: 1px solid #454A51; }
.me { margin: 0; font-weight: 600; }
.me-role { margin: 0 0 10px; color: #AEB3BA; font-size: 13px; }
.topbar { display: none; }
.view { padding: 28px 32px 60px; min-width: 0; }
.view:focus { outline: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .topbar { display: flex; gap: 10px; align-items: center; position: sticky; top: 0; z-index: 20; padding: 8px 14px; background: var(--asphalt); color: #fff; }
  .topbar .brand { font: 700 22px var(--display); display: inline-flex; align-items: center; gap: 8px; }
  .topbar .brand::before { width: 24px; height: 24px; border-radius: 7px; }
  .view { padding: 18px 14px 60px; }
}

/* ---------- Heading ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { margin: 0; font: 700 40px/1 var(--display); }
.page-head .crumb { margin: 0 0 4px; color: var(--ink-2); }
.page-head .crumb a { color: var(--ink-2); }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
h2.section { margin: 26px 0 10px; font: 700 24px var(--display); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--rule); background: var(--panel); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--lane); border-color: #E0A800; color: var(--ink); }
.btn.primary:hover { background: #FFCF3A; }
.btn.danger { color: var(--signal); border-color: #F0B7B4; }
.btn.success { color: var(--go); border-color: #B5D9BA; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.big { min-height: 54px; padding: 0 22px; font: 700 20px var(--display); }
.btn.icon { min-width: 38px; padding: 0; border: 0; background: transparent; font-size: 20px; color: inherit; }
.btn.ghost-dark { background: transparent; color: #E8E9EB; border-color: #5A6069; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; margin-bottom: 22px; }
.stat { background: var(--panel); padding: 14px 16px; }
.stat b { display: block; font: 700 36px/1 var(--display); }
.stat span { color: var(--ink-2); }
.stat small { display: block; color: var(--go); font-weight: 600; margin-top: 2px; }

/* ---------- Panel & table ---------- */
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.panel-head h3 { margin: 0; font: 700 21px var(--display); }
.panel-body { padding: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--rule); background: #F6F7F8; }
.filters input, .filters select { min-height: 38px; padding: 0 10px; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
.filters input[type="search"] { min-width: 240px; flex: 1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid #ECEEF1; }
th { font: 600 13px var(--body); color: var(--ink-2); background: #FAFBFC; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #FFF8E1; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { display: block; color: var(--ink-2); font-size: 13px; }
td.actions { white-space: nowrap; text-align: right; }
.empty { padding: 36px 16px; text-align: center; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); font: 700 22px var(--display); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; color: var(--ink-2); }

/* status "rambu" */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 4px; font: 600 13px var(--body); background: #EEF0F3; color: var(--ink-2); border-left: 4px solid #A6ACB4; white-space: nowrap; }
.pill.go { background: #E7F4E9; color: #1F6A2A; border-color: var(--go); }
.pill.warn { background: #FFF4D1; color: #7A5600; border-color: var(--lane); }
.pill.bad { background: #FDE8E7; color: #9A1A15; border-color: var(--signal); }
.pill.info { background: #E6EEFA; color: #174A95; border-color: var(--info); }
.pill.pro { background: #EEE9FB; color: #4B31A0; border-color: var(--purple); }

/* SOS: satu-satunya elemen yang mencolok */
.hazard { border: 0; background: repeating-linear-gradient(-45deg, #D7261F 0 16px, #BD1F19 16px 32px); color: #fff; }
.hazard .panel-head { border-color: rgba(255,255,255,.25); }
.hazard table td, .hazard table th { background: transparent; border-color: rgba(255,255,255,.2); color: #fff; }
.hazard a { color: #fff; }
.hazard .btn { background: #fff; border-color: #fff; color: var(--signal); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.f { display: grid; gap: 4px; }
.f > span { font-weight: 600; font-size: 14px; }
.f small { color: var(--ink-2); font-size: 13px; }
.f input, .f select, .f textarea { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
.f textarea { min-height: 110px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.check input { width: 18px; height: 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--rule); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; margin-bottom: -2px; border-bottom: 3px solid transparent; color: var(--ink-2); text-decoration: none; font: 600 18px var(--display); white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--lane); }

.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.plan-card { border: 2px solid var(--rule); border-radius: 12px; padding: 14px; background: #fff; display: grid; gap: 6px; }
.plan-card.current { border-color: var(--purple); }
.plan-card h4 { margin: 0; font: 700 24px var(--display); }
.plan-card .price { font: 700 28px var(--display); }
.plan-card ul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.bank { padding: 12px 14px; border-left: 4px solid var(--lane); background: #FFF8E1; white-space: pre-wrap; }

.att-matrix td.cp, .att-matrix th.cp { text-align: center; }
.att-dot { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--rule); background: #fff; cursor: pointer; }
.att-dot.on { background: var(--go); border-color: var(--go); }
.att-dot.on.gps { box-shadow: inset 0 0 0 3px #fff; }

/* ---------- Modal & toast ---------- */
.modal { width: min(640px, calc(100% - 24px)); border: 0; border-radius: 14px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal::backdrop { background: rgba(29, 32, 37, .55); }
.modal-inner { margin: 0; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--rule); }
.modal h2 { margin: 0; font: 700 26px var(--display); }
.modal-body { padding: 18px; max-height: 70dvh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--rule); background: #FAFBFC; }
.form-error { color: var(--signal); font-weight: 600; margin: 10px 0 0; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 100; }
.toast { max-width: 380px; padding: 10px 14px; border-radius: 8px; background: var(--asphalt); color: #fff; border-left: 4px solid var(--lane); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.bad { border-color: var(--signal); }
.muted { color: var(--ink-2); }
.mono-code { font: 600 15px var(--display); letter-spacing: .06em; background: #F1F2F4; padding: 1px 6px; border-radius: 4px; }
.hazard td .sub { color: rgba(255,255,255,.85); }
.mono-code { white-space: nowrap; }
/* ---------- logo organisasi ---------- */
.org-logo { flex: none; display: inline-grid; place-items: center; border-radius: 10px; object-fit: contain; background: #F1F2F4; border: 1px solid var(--rule); }
.org-logo.placeholder { background: var(--asphalt); color: var(--lane); border: 0; font: 700 18px var(--display); }
.with-logo { display: flex; align-items: center; gap: 12px; }
.page-head .with-logo .org-logo { width: 52px; height: 52px; }
.logo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.logo-row .org-logo.placeholder { font-size: 40px; border-radius: 16px; }
.logo-row img.org-logo { border-radius: 16px; }
.logo-editor { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; }
.logo-preview { width: 200px; height: 200px; border-radius: 16px; display: grid; place-items: center; overflow: hidden; color: var(--ink-2);
  background-color: #fff; background-image: linear-gradient(45deg, #E6E8EB 25%, transparent 25%), linear-gradient(-45deg, #E6E8EB 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #E6E8EB 75%), linear-gradient(-45deg, transparent 75%, #E6E8EB 75%);
  background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; border: 1px solid var(--rule); }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-controls { display: grid; gap: 12px; }
.logo-controls fieldset { border: 0; padding: 0; margin: 0; }
.logo-controls label.btn { justify-self: start; }
@media (max-width: 560px) { .logo-editor { grid-template-columns: 1fr; } .logo-preview { width: 100%; height: auto; aspect-ratio: 1; } }
/* ---------- anggota & undangan ---------- */
.stats.compact .stat b { font-size: 28px; }
.count-inline { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--signal); color: #fff; font: 700 12px/20px var(--body); text-align: center; }
.share-invite { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; align-items: start; }
.qr { width: 180px; height: 180px; display: grid; place-items: center; background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 6px; }
.qr svg { width: 100%; height: 100%; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.copy-row input { min-height: 38px; padding: 0 10px; border: 1px solid var(--rule); border-radius: 8px; background: #F6F7F8; font-size: 13px; }
.small-note { font-size: 13px; margin-top: 10px; }
.seg-radio label.check { align-items: flex-start; font-weight: 600; }
.seg-radio small { font-weight: 400; }
.policy-form { display: grid; gap: 10px; max-width: 620px; }
.policy-opt { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 12px 14px; border: 2px solid var(--rule); border-radius: 12px; cursor: pointer; }
.policy-opt:has(input:checked) { border-color: var(--lane); background: #FFFBEA; }
.policy-opt input { width: 18px; height: 18px; margin-top: 3px; }
.policy-opt .sub { display: block; color: var(--ink-2); font-weight: 400; }
td .msg { display: block; max-width: 280px; white-space: normal; }
td select { min-height: 32px; padding: 0 6px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; }
@media (max-width: 640px) { .share-invite { grid-template-columns: 1fr; } .qr { margin: 0 auto; } }
/* ---------- struktur nasional / regional / chapter ---------- */
.pill.lvl { border-left-width: 0; border-radius: 12px; padding: 1px 9px; font-size: 12px; }
.pill.lvl-national { background: #1D2025; color: var(--lane); }
.pill.lvl-regional { background: #DDE8F9; color: #174A95; }
.pill.lvl-chapter { background: #E7F4E9; color: #1F6A2A; }
.structure-panel .struct-path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.struct-cta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.struct-cta .sub { display: block; color: var(--ink-2); max-width: 70ch; }
.tree-table td { vertical-align: middle; }
.tree-name { display: flex; align-items: center; gap: 10px; padding-left: calc(var(--depth) * 28px); position: relative; }
.tree-name .branch { position: absolute; left: calc(var(--depth) * 28px - 18px); top: -12px; width: 12px; height: 26px; border-left: 2px solid var(--rule); border-bottom: 2px solid var(--rule); border-bottom-left-radius: 6px; }
.tree-name a { color: var(--ink); text-decoration: none; }
.tree-name a:hover { text-decoration: underline; }
.tree-table tr.depth-0 td { background: #FFFBEA; }
.tree-table tr.inactive td { opacity: .55; }
.seg-switch { display: inline-flex; gap: 0; }
.seg-switch .btn { border-radius: 0; }
.seg-switch .btn:first-child { border-radius: 8px 0 0 8px; }
.seg-switch .btn:last-child { border-radius: 0 8px 8px 0; margin-left: -1px; }
/* ---------- afiliasi ---------- */
.aff-dialog { display: grid; gap: 10px; }
.aff-search { min-height: 42px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 8px; }
.aff-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; border: 1px solid var(--rule); border-radius: 10px; }
.aff-list li + li { border-top: 1px solid #ECEEF1; }
.aff-list > li.muted { padding: 14px; }
.aff-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; }
.aff-item:hover { background: #FFF8E1; }
.aff-item.blocked { opacity: .55; cursor: not-allowed; }
.aff-item input { width: 18px; height: 18px; }
.aff-item .sub { display: block; color: var(--ink-2); font-size: 13px; }
.aff-alert { border: 2px solid var(--lane); }
.aff-result { margin: 0; padding-left: 4px; list-style: none; display: grid; gap: 8px; }

/* ---------- notifikasi ---------- */
.btn.notif { margin-bottom: 8px; justify-content: space-between; }
.notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.notif-list a { display: grid; gap: 2px; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.notif-list a:hover { background: #FFF8E1; }
.notif-list li.unread a { border-left: 4px solid var(--lane); background: #FFFDF2; }
.notif-list .sub { color: var(--ink-2); font-size: 13px; }

.chan-admin { display: grid; gap: 2px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.chan-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 4px; }
.chan-line .sub { display: block; color: var(--ink-2); font-size: 13px; }
.steps { padding-left: 20px; display: grid; gap: 12px; }

/* tombol kembali ke aplikasi */
.btn.back-app { width: 100%; margin-bottom: 8px; background: var(--lane); border-color: var(--lane); color: var(--ink); text-decoration: none; }
.btn.back-app:hover { background: #FFCF3A; }
.btn.logout { color: #C9CCD1; }
.back-app-top { margin-left: auto; min-height: 34px; padding: 0 10px; background: var(--lane); border-color: var(--lane); color: var(--ink); text-decoration: none; }
.btn.back-app { white-space: nowrap; font-size: 14px; padding: 0 8px; }

/* ---------- v5.0: pilihan masuk (Google & Apple) ---------- */
.login-row { display: grid; gap: 10px; margin: 14px 0; }
.login-row .btn-login {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; border: 0; border-radius: 10px; cursor: pointer;
  background: #fff; color: #1F1F1F; font: 600 17px var(--body); width: 100%;
}
.login-row .btn-login svg { width: 20px; height: 20px; flex: none; }
.login-row .btn-login--apple { background: #000; color: #fff; }
