/* Paket Lebaran: Buku Kas Komunitas
   Arah visual: kertas hangat, tinta hijau, aksen kuningan.
   Sumber keputusan: DESIGN.md. */

:root {
  --font-display: "Literata", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --paper: #f4efe3;
  --paper-deep: #e9e1cf;
  --surface: #fcf9f1;
  --surface-soft: #f7f2e6;
  --surface-sunken: #eee7d8;

  --ink: #1b2a22;
  --ink-strong: #0e1b15;
  --muted: #52635a;
  --muted-soft: #5e6e64;

  --line: #d9d0bd;
  --line-strong: #bdb29b;

  --brand: #1e4d3b;
  --brand-mid: #173e2f;
  --brand-dark: #102e22;
  --brand-deep: #0a2118;
  --brand-soft: #dce8df;
  --brand-ink: #123b2b;

  --accent: #9a4a1a;
  --accent-bright: #c9862e;
  --accent-light: #d9b36c;
  --accent-soft: #f0e1c4;

  --ok: #2c6a47;
  --ok-soft: #e0ebdf;
  --warn: #80540f;
  --warn-soft: #f3e6c4;
  --bad: #98352a;
  --bad-soft: #f4ded8;
  --info: #365e75;
  --info-soft: #e1e9ec;

  --radius-sm: 2px;
  --radius: 3px;
  --radius-lg: 4px;

  --shadow-sm: 0 0 0 transparent;
  --shadow-md: 0 0 0 transparent;
  --shadow-lg: 0 18px 40px rgba(10, 33, 24, .18);

  --sidebar-w: 264px;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  color-scheme: light;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-soft); color: var(--ink-strong); }

a { color: var(--brand); text-decoration: none; text-underline-offset: 2px; }
a:hover { color: var(--accent); text-decoration: underline; }

h1, h2, h3 {
  margin: 0 0 .35em;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  color: var(--ink-strong);
  line-height: 1.15;
  letter-spacing: -.015em;
}
h1 { font-size: clamp(1.75rem, 2.8vw, 2.35rem); }
h2 { font-size: 1.08rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 .8em; }
small { color: var(--muted-soft); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

/* Interactive affordance and focus. */
a[href],
button:not(:disabled),
summary,
select,
label[for],
label.check,
input[type="checkbox"],
input[type="radio"] { cursor: pointer; }
a, button, summary, select, input, textarea, label[for] { touch-action: manipulation; }
button:disabled,
input:disabled,
select:disabled,
textarea:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 20px; height: 20px; flex: 0 0 auto; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.center { text-align: center; }

.eyebrow {
  margin: 0 0 .4rem;
  font-family: var(--font-sans);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

.skip-link {
  position: fixed; top: -60px; left: 12px; z-index: 100;
  padding: .75rem 1rem; border-radius: var(--radius);
  background: var(--brand-dark); color: var(--paper); font-weight: 600;
  box-shadow: var(--shadow-lg); transition: top .16s ease;
}
.skip-link:focus { top: 12px; color: var(--paper); text-decoration: none; }

/* ---------------------------------------------------------------- shell */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky; top: 0; z-index: 30;
  height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
  background: var(--surface-soft);
  color: var(--ink);
  border-right: 1px solid var(--line);
  border-left: 6px solid var(--brand-dark);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 0; }

.sidebar-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 18px; padding-bottom: 14px;
  border-bottom: 3px double var(--line-strong);
}
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; color: inherit; }
.brand:hover { color: inherit; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: 0 0 auto;
  border: 1px solid var(--brand-deep);
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--paper);
}
.brand-mark .icon { width: 22px; height: 22px; }
.brand-copy { display: grid; gap: 1px; min-width: 0; }
.brand-copy strong {
  color: var(--ink-strong); font-family: var(--font-display);
  font-size: .98rem; font-weight: 600; letter-spacing: -.01em; white-space: nowrap;
}
.brand-copy small { color: var(--muted-soft); font-size: .68rem; letter-spacing: .02em; white-space: nowrap; }
.brand.compact .brand-copy small { display: none; }

.nav-groups { display: grid; gap: 16px; padding-bottom: 14px; }
.nav-group { display: grid; gap: 3px; }
.nav-group-title {
  margin: 0 0 4px; padding: 0 2px 6px;
  font-size: .64rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted-soft);
  border-bottom: 1px solid var(--line);
}
.nav-group a {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink); font-size: .845rem; font-weight: 500;
  transition: background .16s ease, color .16s ease;
}
.nav-group a .icon { width: 18px; height: 18px; color: var(--muted-soft); transition: color .16s ease; }
.nav-group a:hover { background: var(--surface); color: var(--brand-ink); text-decoration: none; }
.nav-group a:hover .icon { color: var(--brand); }
.nav-group a.active {
  background: var(--brand); color: var(--paper); font-weight: 600;
  box-shadow: none;
}
.nav-group a.active .icon { color: var(--accent-light); }
.nav-group a.active:hover { background: var(--brand-mid); color: var(--paper); }
.nav-group a.active:hover .icon { color: var(--accent-light); }

.sidebar-foot {
  margin-top: auto; padding-top: 12px;
  border-top: 3px double var(--line-strong);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 38px; height: 38px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--brand);
  font-size: .76rem; font-weight: 700; letter-spacing: .02em;
}
.sidebar-user-copy { display: grid; gap: 1px; min-width: 0; }
.sidebar-user-copy strong {
  color: var(--ink-strong); font-size: .8rem; font-weight: 600; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-copy small { color: var(--muted-soft); font-size: .68rem; }
.logout-form { margin-left: auto; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: inherit; cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.sidebar .icon-btn { color: var(--muted-soft); }
.sidebar .icon-btn:hover { background: var(--bad-soft); color: var(--bad); }
.sidebar-close { display: none; }
.nav-scrim { display: none; }

/* ---------------------------------------------------------------- main */
.main { min-width: 0; padding: 0 clamp(18px, 3vw, 40px) 52px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  min-height: 64px; margin: 0 calc(clamp(18px, 3vw, 40px) * -1) 24px;
  padding: 9px clamp(18px, 3vw, 40px);
  background: var(--paper);
  border-bottom: 3px double var(--line-strong);
}
.menu-btn { display: none; border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.topbar-context { display: grid; gap: 0; min-width: 0; }
.topbar-kicker {
  color: var(--accent); font-size: .62rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.topbar-title {
  font-family: var(--font-display); font-size: 1.02rem; font-weight: 600;
  color: var(--ink-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-meta { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topbar-date { color: var(--muted-soft); font-size: .75rem; }
.role-chip {
  display: inline-flex; align-items: center; min-height: 28px; padding: 4px 8px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--brand-ink);
  font-size: .63rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}

/* ---------------------------------------------------------------- page head */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 3px double var(--line-strong);
}
.page-head h1 { margin-bottom: .2rem; }
.page-head .eyebrow { margin-bottom: .25rem; }
.page-head p { margin: .35rem 0 0; max-width: 68ch; color: var(--muted); }
.page-head-tool { display: flex; align-items: flex-start; justify-content: flex-end; gap: 8px; margin-left: auto; }
.program-switch { display: flex; align-items: center; gap: 8px; min-width: 0; }
.program-switch-label {
  color: var(--muted-soft); font-size: .62rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.program-switch select {
  width: clamp(210px, 22vw, 320px); min-height: 44px;
  padding: 6px 32px 6px 10px; font-size: .8rem;
}
.program-switch-submit { width: 44px; min-width: 44px; padding: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn { min-height: 44px; }

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(280px, .92fr);
  gap: clamp(20px, 3vw, 42px); align-items: center;
  margin-bottom: 18px; padding: clamp(24px, 3vw, 36px);
  border: 1px solid var(--brand-deep); border-radius: var(--radius);
  background-color: var(--brand-dark);
  background-image: repeating-linear-gradient(180deg, transparent 0, transparent 39px, rgba(244, 239, 227, .045) 39px, rgba(244, 239, 227, .045) 40px);
  color: var(--paper);
  box-shadow: none;
}
.hero-copy { position: relative; z-index: 1; min-width: 0; }
.hero .eyebrow { color: var(--accent-light); }
.hero-title {
  margin: 0 0 .45rem; color: var(--paper);
  font-family: var(--font-display); font-size: clamp(1.9rem, 3vw, 2.55rem);
  font-weight: 600; letter-spacing: -.025em; line-height: 1.12;
}
.hero-description { margin: 0; max-width: 58ch; color: #d7dfd6; font-size: .92rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.hero-actions .btn {
  border-color: rgba(244, 239, 227, .34); background: transparent; color: var(--paper);
}
.hero-actions .btn:hover {
  border-color: var(--paper); background: rgba(244, 239, 227, .12); color: var(--paper);
}
.hero-actions .btn.primary {
  border-color: var(--accent-bright); background: var(--accent-bright); color: #2b1a00;
  box-shadow: none;
}
.hero-actions .btn.primary:hover {
  border-color: var(--accent-light); background: var(--accent-light); color: #2b1a00;
}
.hero-aside { position: relative; z-index: 1; min-width: 0; }
.hero-panel {
  display: grid; gap: 14px;
  padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  box-shadow: 6px 6px 0 rgba(10, 33, 24, .3);
}
.hero-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-panel-head strong {
  color: var(--ink-strong); font-family: var(--font-display); font-size: .95rem; font-weight: 600;
}
.hero-panel-head span { color: var(--muted-soft); font-size: .72rem; }
.hero-panel .progress { background: var(--paper-deep); }
.hero-panel .progress > span { background: var(--accent); }
.hero-panel .progress-top { color: var(--muted); }
.hero-panel .progress-top strong { color: var(--ink-strong); }
.hero-panel .progress-hint { color: var(--muted-soft); }
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--line); padding-top: 10px; }
.hero-mini { padding: 0 10px 0 0; min-width: 0; }
.hero-mini + .hero-mini { padding: 0 0 0 10px; border-left: 1px solid var(--line); }
.hero-mini span {
  display: block; color: var(--muted-soft); font-size: .63rem;
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.hero-mini strong {
  display: block; margin-top: 2px; color: var(--ink-strong);
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- numbers */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(188px, 1fr));
  gap: 0; margin-bottom: 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.stats:has(> .stat:nth-child(6)):not(:has(> .stat:nth-child(7))) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.stat {
  position: relative; overflow: hidden;
  padding: 15px 18px; border: 0; border-radius: 0;
  background: transparent; box-shadow: inset -1px -1px 0 var(--line);
}
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stat-label {
  color: var(--muted); font-size: .64rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.stat-icon {
  display: grid; place-items: center; width: 26px; height: 26px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-soft); color: var(--brand);
}
.stat-icon .icon { width: 15px; height: 15px; }
.tone-amber .stat-icon { border-color: #dfc79c; background: var(--accent-soft); color: var(--accent); }
.tone-rose .stat-icon { border-color: #dfb8ae; background: var(--bad-soft); color: var(--bad); }
.tone-neutral .stat-icon { border-color: var(--line); background: var(--surface-sunken); color: var(--muted); }
.tone-green .stat-icon { border-color: #b8cab9; background: var(--ok-soft); color: var(--ok); }
.stat-value {
  margin-top: 7px; color: var(--ink-strong);
  font-family: var(--font-display); font-size: 1.48rem; font-weight: 600;
  letter-spacing: -.02em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
.tone-green .stat-value { color: var(--brand); }
.tone-amber .stat-value { color: var(--accent); }
.tone-rose .stat-value { color: var(--bad); }
.tone-neutral .stat-value { color: var(--ink-strong); }
.stat-sub { margin-top: 3px; color: var(--muted-soft); font-size: .73rem; }
.stat .progress { margin-top: 10px; }

.metric-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-soft); overflow: hidden;
}
.metric { padding: 12px 16px; border-right: 1px solid var(--line); min-width: 0; }
.metric:last-child { border-right: 0; }
.metric span {
  display: block; color: var(--muted); font-size: .63rem;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.metric strong {
  display: block; margin-top: 3px; color: var(--ink-strong);
  font-family: var(--font-display); font-size: 1.03rem; font-weight: 600;
  overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
.metric small { display: block; margin-top: 1px; color: var(--muted-soft); font-size: .69rem; }

/* ---------------------------------------------------------------- cards */
.card {
  min-width: 0; margin-bottom: 16px; padding: 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: none;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 3px double var(--line-strong);
}
.card-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.card-title h2 { margin: 0; }
.card-icon {
  display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 auto;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--brand);
}
.card-icon .icon { width: 16px; height: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.section-title {
  margin: 1.2rem 0 .4rem; padding-bottom: 6px;
  color: var(--brand-ink); font-family: var(--font-display); font-size: 1.05rem; font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.empty {
  display: grid; place-items: center; gap: 8px;
  padding: 28px 20px; text-align: center; color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-soft);
}
.empty .icon { width: 26px; height: 26px; color: var(--accent); }
.empty p { margin: 0; color: var(--muted-soft); font-size: .86rem; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 9px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font: 600 .84rem/1.2 var(--font-sans);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.btn .icon { width: 17px; height: 17px; }
.btn:hover {
  background: var(--paper); border-color: var(--ink); color: var(--ink-strong);
  text-decoration: none;
}
.btn.primary { border-color: var(--brand); background: var(--brand); color: var(--paper); }
.btn.primary:hover { border-color: var(--brand-mid); background: var(--brand-mid); color: var(--paper); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); color: var(--brand-ink); }
.btn.danger { border-color: var(--bad); background: var(--bad); color: #fff; }
.btn.danger:hover { background: #7f2a22; border-color: #7f2a22; color: #fff; }
.btn.small { min-height: 34px; padding: 5px 9px; font-size: .75rem; border-radius: var(--radius-sm); }
.btn[disabled], .btn:disabled { opacity: .48; cursor: not-allowed; }
.btn.is-loading::before {
  content: ""; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.link {
  padding: 0; border: 0; background: none; color: var(--brand);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline;
  text-underline-offset: 2px;
}
.link:hover { color: var(--accent); }

/* ---------------------------------------------------------------- flash */
.flash {
  display: flex; align-items: flex-start; gap: 9px;
  margin-bottom: 16px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); font-size: .86rem;
}
.flash .icon { width: 18px; height: 18px; margin-top: 1px; }
.flash > span { flex: 1 1 auto; }
.flash.success { border-color: #b7cbb8; border-left: 4px solid var(--ok); background: var(--ok-soft); color: #1f4a32; }
.flash.error { border-color: #dfb8ae; border-left: 4px solid var(--bad); background: var(--bad-soft); color: #6f251f; }
.flash.info { border-color: #b8cdbd; border-left: 4px solid var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.flash-close {
  display: grid; place-items: center; width: 44px; height: 44px;
  margin: -9px -9px 0 0; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: inherit; cursor: pointer; opacity: .76;
}
.flash-close:hover { background: rgba(0, 0, 0, .06); opacity: 1; }
.flash-close .icon { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- tables */
.table-card { padding: 0; overflow: hidden; }
.table-card .card-head {
  margin: 0; padding: 15px 18px 11px;
  border-bottom: 3px double var(--line-strong);
  background: var(--surface-soft);
}
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th {
  background: var(--surface-sunken); color: var(--muted);
  font-size: .63rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
  border-bottom: 2px solid var(--line-strong);
}
td { color: var(--ink); font-variant-numeric: tabular-nums; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: var(--surface-soft); }
tbody tr:last-child td { border-bottom: 0; }
td form { display: inline-flex; }
td .btn + .btn { margin-left: 3px; }
.table-card .pagination, .table-card .empty { margin: 14px 18px 18px; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: .67rem; font-weight: 700; line-height: 1.35;
  letter-spacing: .01em; white-space: nowrap;
}
.badge.ok { border-color: #b7cbb8; background: var(--ok-soft); color: #1f4a32; }
.badge.warn { border-color: #dfc79c; background: var(--warn-soft); color: #6b450b; }
.badge.bad { border-color: #dfb8ae; background: var(--bad-soft); color: #7f2a22; }
.badge.muted { border-color: var(--line); background: var(--surface-sunken); color: var(--muted); }

/* ---------------------------------------------------------------- forms */
.form {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px; max-width: 1000px; align-items: start;
}
.form > * { grid-column: 1 / -1; }
.form > .field { grid-column: span 1; }
.form > .field.wide { grid-column: 1 / -1; }
.form-inline { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; max-width: none; grid-template-columns: none; }
.form-inline .field { flex: 1 1 170px; }
.field { display: grid; gap: 6px; font-size: .84rem; }
.field-label { color: var(--ink); font-size: .82rem; font-weight: 600; }
.field-label em { color: var(--accent); font-style: normal; }
.field small { color: var(--muted-soft); font-size: .74rem; line-height: 1.45; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-size: .9rem;
  transition: border-color .16s ease, background .16s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted-soft); }
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  box-shadow: none;
}
textarea { resize: vertical; min-height: 94px; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); padding: 0; }
input[type="file"] { padding: 8px; background: var(--surface-soft); font-size: .8rem; }
input[type="file"]::file-selector-button {
  margin-right: 10px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer;
}
.check {
  display: flex; align-items: center; gap: 9px; min-height: 44px;
  font-size: .86rem; font-weight: 500; cursor: pointer;
}
.form-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 5px; padding-top: 14px; border-top: 1px solid var(--line);
}
.filter-card { padding: 14px 16px; background: var(--surface-soft); }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.filters .field { flex: 1 1 170px; min-width: 140px; }
.filters .field:first-child { flex: 1.6 1 220px; }
.filters-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------- modal */
.modal {
  width: min(440px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(10, 33, 24, .62); }
.modal-card { padding: 24px; }
.modal-icon {
  display: inline-grid; place-items: center; width: 42px; height: 42px;
  margin-bottom: 14px; border: 1px solid #dfb8ae; border-radius: var(--radius-sm);
  background: var(--bad-soft); color: var(--bad);
}
.modal-icon .icon { width: 20px; height: 20px; }
.modal h2 { margin-bottom: 6px; font-size: 1.3rem; }
.modal p { margin: 0; color: var(--muted); font-size: .88rem; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 22px; }

/* ---------------------------------------------------------------- detail lists */
.kv { display: grid; grid-template-columns: minmax(130px, 180px) 1fr; gap: 7px 18px; margin: 0; }
.kv dt {
  color: var(--muted-soft); font-size: .65rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; padding-top: 3px;
}
.kv dd { margin: 0; overflow-wrap: anywhere; font-size: .88rem; }

/* ---------------------------------------------------------------- pagination */
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.page {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-size: .77rem; font-weight: 600;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.page:hover { border-color: var(--ink); background: var(--paper); text-decoration: none; }
.page.active { border-color: var(--brand); background: var(--brand); color: var(--paper); }

/* ---------------------------------------------------------------- progress */
.progress-block { display: grid; gap: 6px; }
.progress-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  color: var(--muted); font-size: .75rem; font-weight: 600;
}
.progress-top strong { color: var(--ink-strong); font-size: .77rem; font-variant-numeric: tabular-nums; }
.progress { height: 4px; overflow: hidden; border-radius: 0; background: var(--paper-deep); }
.progress > span { display: block; height: 100%; border-radius: 0; background: var(--brand); transition: width .4s ease; }
.progress-hint { margin: 0; color: var(--muted-soft); font-size: .73rem; }

/* ---------------------------------------------------------------- quick actions */
.quick-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.quick-action {
  display: flex; align-items: center; gap: 11px;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color .16s ease, background .16s ease;
}
.quick-action:hover {
  border-color: var(--brand); background: var(--surface-soft);
  color: var(--ink); text-decoration: none;
}
.quick-icon {
  display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--brand);
}
.quick-copy { display: grid; gap: 1px; min-width: 0; }
.quick-copy strong { font-size: .84rem; font-weight: 600; }
.quick-copy small { color: var(--muted-soft); font-size: .72rem; }

/* ---------------------------------------------------------------- auth */
.auth-main { min-height: 100vh; }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(420px, .96fr); min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 32px;
  padding: clamp(28px, 4vw, 56px);
  border-right: 6px solid var(--accent);
  background-color: var(--brand-dark);
  background-image: repeating-linear-gradient(180deg, transparent 0, transparent 39px, rgba(244, 239, 227, .045) 39px, rgba(244, 239, 227, .045) 40px);
  color: var(--paper);
}
.auth-brand .brand-copy strong { color: var(--paper); font-size: 1.05rem; }
.auth-brand .brand-copy small { color: #c9d3c9; }
.auth-brand .brand-mark { border-color: var(--accent-light); background: var(--accent-bright); color: #2b1a00; }
.auth-brand-copy { position: relative; z-index: 1; max-width: 560px; margin: auto 0; }
.auth-brand .eyebrow { color: var(--accent-light); }
.auth-brand h1 {
  margin: 0 0 .7rem; color: var(--paper);
  font-family: var(--font-display); font-size: clamp(2.2rem, 4vw, 3.4rem);
  font-weight: 600; line-height: 1.06; letter-spacing: -.03em;
}
.auth-lead { max-width: 48ch; color: #d7dfd6; font-size: .95rem; }
.trust-list { display: grid; gap: 0; margin: 30px 0 0; padding: 0; list-style: none; border-top: 1px solid rgba(244, 239, 227, .2); }
.trust-list li {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid rgba(244, 239, 227, .2);
}
.trust-list .icon {
  width: 33px; height: 33px; padding: 7px; flex: 0 0 auto;
  border: 1px solid rgba(244, 239, 227, .26); border-radius: var(--radius-sm);
  background: transparent; color: var(--accent-light);
}
.trust-list span { display: grid; gap: 1px; }
.trust-list strong { color: var(--paper); font-size: .82rem; font-weight: 600; }
.trust-list small { color: #c9d3c9; font-size: .74rem; line-height: 1.45; }
.auth-brand-foot { position: relative; z-index: 1; margin: 0; color: #a9b9ae; font-size: .71rem; }
.auth-panel { display: grid; place-items: center; padding: clamp(20px, 4vw, 48px); background: var(--paper); }
.auth-card {
  width: min(430px, 100%); padding: clamp(24px, 3vw, 34px);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 7px 7px 0 rgba(30, 77, 59, .1);
}
.auth-card-head { margin-bottom: 18px; }
.auth-card-head h2 { margin: 0 0 .3rem; font-size: 1.7rem; }
.auth-card-head p:last-child { margin: 0; font-size: .86rem; }
.auth-card .form { gap: 14px; max-width: none; grid-template-columns: 1fr; }
.auth-card .btn { width: 100%; }
.auth-foot {
  margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line);
  color: var(--muted-soft); font-size: .73rem; text-align: center;
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .page-head:has(.page-head-tool) { flex-direction: column; }
  .page-head:has(.page-head-tool) .page-head-tool { width: 100%; margin-left: 0; justify-content: flex-start; }
  .page-head:has(.page-head-tool) .program-switch { width: 100%; max-width: 520px; }
  .page-head:has(.page-head-tool) .program-switch select { flex: 1 1 auto; width: auto; min-width: 0; }
}
@media (max-width: 1080px) {
  :root { --sidebar-w: 238px; }
  .hero { grid-template-columns: 1fr; }
  .hero-aside { max-width: 560px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 88vw); height: 100dvh;
    transform: translateX(-105%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg); z-index: 50;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-group a { min-height: 44px; }
  .sidebar-close { display: inline-grid; }
  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 40;
    background: rgba(10, 33, 24, .55);
    opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease;
  }
  body.nav-open .nav-scrim { opacity: 1; visibility: visible; }
  body.nav-open { overflow: hidden; }
  .main { padding-inline: 18px; }
  .topbar { margin-inline: -18px; padding-inline: 18px; }
  .menu-btn { display: inline-grid; }
  .topbar-date { display: none; }
  .auth-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand {
    min-height: 0; padding: 20px 24px; gap: 0; align-self: start;
    border-right: 0; border-bottom: 6px solid var(--accent);
  }
  .auth-brand-copy, .auth-brand-foot { display: none; }
  .auth-panel { padding: 24px 18px 40px; align-items: center; }
  .auth-card { margin-block: auto; box-shadow: none; }
}
@media (max-width: 760px) {
  .page-head { flex-direction: column; }
  .page-head-tool { width: 100%; margin-left: 0; justify-content: flex-start; }
  .program-switch { width: 100%; }
  .program-switch select { flex: 1 1 auto; width: auto; min-width: 0; }
  .actions { width: 100%; }
  .actions .btn { flex: 1 1 auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats:has(> .stat:nth-child(6)):not(:has(> .stat:nth-child(7))) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2n) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .metric:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .form > .field { grid-column: 1 / -1; }
  .btn.small { min-height: 44px; }
  .table-card { padding: 0; }
  .table-wrap { overflow: visible; }
  table, thead, tbody, tr, th, td { display: block; width: 100%; }
  table { min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  tbody { padding: 8px; }
  tbody tr {
    margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); overflow: hidden;
  }
  tbody tr:last-child { margin-bottom: 0; }
  tbody tr:last-child td { border-bottom: 0; }
  tbody tr:hover { background: var(--surface); }
  td {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
    padding: 9px 12px; border-bottom: 1px solid var(--line);
  }
  td::before {
    content: attr(data-label); flex: 0 0 40%;
    color: var(--muted-soft); font-size: .64rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; padding-top: 3px;
  }
  td[data-label=""]::before { display: none; }
  td[data-label=""] { justify-content: flex-end; }
  .table-card .pagination, .table-card .empty { margin: 14px; }
  .filters-actions { width: 100%; }
  .filters-actions .btn { flex: 1; }
}
@media (max-width: 560px) {
  .main { padding-inline: 13px; }
  .topbar { margin-inline: -13px; padding-inline: 13px; }
  .topbar-title { max-width: 52vw; }
  .role-chip { display: none; }
  .hero { padding: 20px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .hero-panel { box-shadow: 4px 4px 0 rgba(10, 33, 24, .3); }
  .hero-split { grid-template-columns: 1fr 1fr; }
  .stat { padding: 13px; }
  .stat-value { font-size: 1.3rem; }
  .card { padding: 14px; }
  .table-card { padding: 0; }
  .table-card .card-head { padding: 14px 14px 10px; }
  .auth-card { padding: 22px 18px; }
  .auth-panel { padding-top: 10px; }
  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline .field,
  .form-inline .btn { flex: 0 0 auto; width: 100%; }
  .program-switch { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; }
  .program-switch-label { grid-column: 1 / -1; }
  .program-switch select { width: 100%; }
  .modal-card { padding: 20px; }
  .modal-actions .btn { flex: 1; }
}
/* ---------------------------------------------------------------- mobile comfort */
/* Alasan: layar sentuh butuh kontrol 16px agar Safari tidak memperbesar halaman,
   label nilai vertikal agar kolom kanan tidak sempit, dan ruang aman untuk home indicator. */
@media (max-width: 900px) {
  .shell, .auth-shell { min-height: 100vh; min-height: 100dvh; }
  .sidebar {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }
  .sidebar-head {
    position: sticky; top: 0; z-index: 2;
    background: var(--surface-soft);
  }
  .topbar { padding-top: max(9px, env(safe-area-inset-top)); }
  .main { padding-bottom: calc(44px + env(safe-area-inset-bottom)); }
  .auth-brand { padding-top: max(20px, env(safe-area-inset-top)); }
  .auth-panel { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
  input, select, textarea, .program-switch select { font-size: 16px; }
}
@media (max-width: 760px) {
  table { font-size: .95rem; }
  td { overflow-wrap: anywhere; }
  .stats > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .form-actions .btn { flex: 1 1 auto; }
}
@media (max-width: 560px) {
  .page-head h1 { font-size: 1.72rem; }
  .hero-title { font-size: 1.72rem; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { padding-top: 9px; }
  .kv dd { padding-bottom: 7px; }
  .kv dt:first-child { padding-top: 0; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters .field,
  .filters .field:first-child { flex: 0 0 auto; width: 100%; min-width: 0; }
  .form-actions .btn { flex: 1 1 100%; }
  .modal { max-height: calc(100dvh - 24px); overflow: auto; }
  .stat-label { font-size: .66rem; }
  .stat-sub { font-size: .76rem; }
  .metric span { font-size: .66rem; }
  .metric small { font-size: .72rem; }
  td::before { font-size: .66rem; }
}
@media (hover: none) {
  .btn:active, .page:active, .quick-action:active, .nav-group a:active { background: var(--paper-deep); }
  .btn.primary:active { background: var(--brand-mid); }
  .btn.danger:active { background: #7f2a22; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
