@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #f6f1ea;
  --surface: #fffdf9;
  --surface-2: #efe7dc;
  --ink: #2a1d15;
  --ink-2: #6b5a4c;
  --line: #e2d6c6;
  --brand: #5b3a24;
  --brand-ink: #fffaf3;
  --accent: #c8702f;
  --ok: #2f7d4f;
  --ok-bg: #e3f2e8;
  --warn: #a8641a;
  --warn-bg: #fbeedb;
  --bad: #b03a2e;
  --bad-bg: #f8e1dd;
  --info: #2c5d86;
  --info-bg: #e2edf6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(42,29,21,.06), 0 6px 18px rgba(42,29,21,.06);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: 'Fraunces', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
a { color: var(--brand); }
img { max-width: 100%; display: block; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* tombol & input */
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; transition: transform .05s, background .15s; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: #e7b9b2; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn.lg { min-height: 52px; font-size: 1.05rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-height: 42px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); font-size: .95rem; }
.check input { width: 20px; min-height: 20px; height: 20px; accent-color: var(--brand); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }

/* toast */
#toasts { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; animation: tin .2s ease-out; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }

/* modal / sheet */
.overlay { position: fixed; inset: 0; background: rgba(30,20,12,.45); z-index: 500; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: sup .22s ease-out; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 20px; } }
@keyframes sup { from { transform: translateY(30px); opacity: .5; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }

/* staf: navbar */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; gap: 8px; padding: 10px 16px; }
.topbar .brand { font-family: var(--display); font-size: 1.15rem; font-weight: 700; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar a, .topbar button { color: var(--brand-ink); background: transparent; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px 10px; font: inherit; font-size: .88rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.topbar a.active { background: rgba(255,255,255,.18); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 16px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 999px; font: inherit; font-weight: 600; font-size: .9rem; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); font-weight: 700; }
.table-scroll { overflow-x: auto; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); }

.empty { text-align: center; padding: 30px 10px; color: var(--ink-2); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
