/* =====================================================================
   Portal Superadmin
   Arah: bahasa visual botani yang hangat untuk bisnis herbal.
   Dial: ENERGY 2 / RHYTHM 2 / MOTION 1 (hanya transisi hover/fokus).
   Aksen kunyit dipakai di 3 tempat saja: app terakhir dibuka, banner
   status, dan cincin fokus. Motif identitas: sudut berbentuk daun.
   ===================================================================== */

:root {
  --ground: #F1F3EC;
  --surface: #FFFFFF;
  --ink: #1D2A22;
  --muted: #55635A;
  --rule: #D6DCD1;
  --field: #7F8C83;       /* border kontrol, kontras >= 3:1 */
  --leaf: #24402F;
  --on-leaf: #FFFFFF;
  --leaf-soft: #E2EADF;
  --kunyit: #A86E00;
  --kunyit-soft: #F6EAD0;
  --kunyit-ink: #4A3507;
  --danger: #9B3426;
  --danger-soft: #F5E1DC;

  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: Fraunces, Georgia, "Times New Roman", serif;
  --leaf-shape: 28px 6px 28px 6px;
  --radius: 10px;
  --radius-box: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #121A15; --surface: #1A251F; --ink: #E6ECE6; --muted: #A3B0A7;
    --rule: #2C3A32; --field: #6A7B70; --leaf: #8FC2A2; --on-leaf: #0F1712;
    --leaf-soft: #22322A; --kunyit: #E3A93A; --kunyit-soft: #3A2E14; --kunyit-ink: #F3DDB0;
    --danger: #F0998A; --danger-soft: #3B2420;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #121A15; --surface: #1A251F; --ink: #E6ECE6; --muted: #A3B0A7;
  --rule: #2C3A32; --field: #6A7B70; --leaf: #8FC2A2; --on-leaf: #0F1712;
  --leaf-soft: #22322A; --kunyit: #E3A93A; --kunyit-soft: #3A2E14; --kunyit-ink: #F3DDB0;
  --danger: #F0998A; --danger-soft: #3B2420;
  color-scheme: dark;
}

/* ------------------------------ Dasar ------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--ground); color: var(--ink);
  font: 400 16px/1.55 var(--font-body);
}
a { color: var(--leaf); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--kunyit); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; }
[hidden] { display: none !important; }

.skip-link { position: absolute; left: 12px; top: -60px; padding: 10px 14px; background: var(--surface); border-radius: var(--radius); z-index: 10; }
.skip-link:focus { top: 12px; }

.display { margin: 0; font-family: var(--font-display); font-weight: 500; letter-spacing: -0.015em; line-height: 1.1; }
.h-page { font-size: clamp(30px, 3.8vw, 42px); }
.h-section { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
.lead { margin: 0; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }

/* ------------------------------ Topbar ------------------------------ */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px; padding: 10px clamp(16px, 4vw, 40px);
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.brand { font-family: var(--font-display); font-weight: 600; font-size: 20px; color: var(--leaf); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 14px; font-weight: 500; }
.nav a, .nav button {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 0; border-radius: 8px; background: none; color: var(--muted);
  text-decoration: none; cursor: pointer; font-size: 14px; font-weight: 500;
}
.nav a:hover, .nav button:hover { background: var(--leaf-soft); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--leaf-soft); color: var(--ink); }
.inline-form { display: inline; margin: 0; }

/* ------------------------------ Layout ------------------------------ */
.wrap { max-width: 1120px; margin: 0 auto; padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 40px) 64px; display: flex; flex-direction: column; gap: 32px; }
.intro { display: flex; flex-direction: column; gap: 8px; }
.split { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 32px; }
.split-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 36px; }
.split-side { flex: 1 1 280px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 20px; }

/* ------------------------------ Panel ------------------------------ */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-box); padding: 24px; }
.panel-leaf { border-radius: var(--leaf-shape); padding: clamp(24px, 4vw, 40px); }
.state-empty { border-style: dashed; border-color: var(--field); }
.state-error { background: var(--danger-soft); border-color: transparent; }
.state-error .h-section { color: var(--danger); }
.panel-stack > * { margin-top: 0; margin-bottom: 0; }
.panel-stack > * + * { margin-top: 12px; }
.panel-stack p { margin-bottom: 0; line-height: 1.55; max-width: 60ch; }

/* ------------------------------ Tombol ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius);
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: filter .15s, background-color .15s;
}
.btn-primary { background: var(--leaf); color: var(--on-leaf); }
.btn-primary:hover { color: var(--on-leaf); filter: brightness(1.12); }
.btn-line { background: none; color: var(--leaf); border-color: var(--field); }
.btn-line:hover { background: var(--leaf-soft); color: var(--leaf); }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { background: var(--leaf-soft); color: var(--muted); cursor: not-allowed; filter: none; }

/* ------------------------------ Banner & alert ------------------------------ */
.banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 10px 10px 10px 18px; border-radius: 12px;
  background: var(--kunyit-soft); color: var(--kunyit-ink); font-size: 14px; line-height: 1.5;
}
.banner strong { font-weight: 700; }
.banner button { min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--kunyit-ink); font-weight: 600; font-size: 14px; cursor: pointer; }
.alert { margin: 16px 0 0; padding: 12px 14px; border-radius: var(--radius); font-size: 14px; line-height: 1.5; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--leaf-soft); color: var(--ink); }

/* ------------------------------ Mark (motif daun) ------------------------------ */
.mark {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 20px 4px 20px 4px;
  background: var(--leaf-soft); color: var(--leaf);
  font-family: var(--font-display); font-weight: 600; font-size: 16px;
}
.mark-lg { width: 88px; height: 88px; border-radius: 40px 6px 40px 6px; font-size: 30px; background: var(--kunyit-soft); color: var(--kunyit-ink); }
.mark-md { width: 56px; height: 56px; border-radius: 26px 4px 26px 4px; background: var(--kunyit-soft); color: var(--kunyit-ink); }

/* ------------------------------ Kartu lanjutkan ------------------------------ */
.resume { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.resume-body { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.resume-title { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: clamp(26px, 3vw, 32px); line-height: 1.15; overflow-wrap: anywhere; }
.resume .btn { flex: none; }

/* ------------------------------ Daftar app ------------------------------ */
.app-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-box); }
.app-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 16px 18px; }
.app-row + .app-row { border-top: 1px solid var(--rule); }
.app-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.app-name { font-weight: 600; overflow-wrap: anywhere; }
.app-meta { flex: 0 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
.app-meta span { overflow-wrap: anywhere; }

/* ------------------------------ Keamanan ------------------------------ */
.facts { margin: 0; display: flex; flex-direction: column; gap: 14px; font-size: 14px; }
.facts div { display: flex; flex-direction: column; gap: 2px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.facts dd.warn { color: var(--danger); }
.side-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 15px; }

/* ------------------------------ Filter chip ------------------------------ */
.filters { display: flex; flex-wrap: wrap; gap: 16px 40px; }
.filter-group { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.filter-label { font-size: 14px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--field); background: var(--surface);
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500;
}
.chip:hover { background: var(--leaf-soft); color: var(--ink); }
.chip[aria-current="true"] { background: var(--leaf); border-color: var(--leaf); color: var(--on-leaf); }

/* ------------------------------ Tabel ------------------------------ */
.table-box { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-box); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { font-weight: 600; color: var(--muted); background: var(--ground); }
tbody tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; background: var(--leaf-soft); color: var(--ink); }
.tag-bad { background: var(--danger-soft); color: var(--danger); }
.table-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 24px 16px; font-size: 14px; }

/* ------------------------------ Halaman masuk ------------------------------ */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: clamp(32px, 6vw, 72px) 20px; }
.auth-inner { width: 100%; max-width: 960px; display: flex; flex-wrap: wrap; align-items: center; gap: clamp(32px, 6vw, 80px); }
.auth-copy { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.auth-copy .display { font-size: clamp(34px, 4.6vw, 52px); line-height: 1.08; }
.auth-form { flex: 1 1 340px; max-width: 420px; min-width: 0; display: flex; flex-direction: column; }
.auth-form h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.field-label { display: block; font-size: 14px; font-weight: 600; margin: 18px 0 6px; }
.input {
  width: 100%; min-height: 48px; padding: 12px 14px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--ground); border: 1px solid var(--field); border-radius: var(--radius);
}
.input:focus-visible { border-color: var(--leaf); }
.pw-row { display: flex; gap: 8px; }
.pw-row .input { flex: 1 1 auto; min-width: 0; }
.pw-row .btn { flex: none; min-height: 48px; }
.auth-form .btn-lg { margin-top: 24px; }
.hint { margin: 18px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.secret-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
code { font-size: 13px; background: var(--ground); border: 1px solid var(--rule); border-radius: 6px; padding: 2px 6px; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
