/* TeraKu design system — tokens lifted from overview.diawan.id / diawan.id */
:root {
  --brand: #16a8aa;
  --brand-700: #089193;
  --brand-strong: #0b7d7f;
  --brand-text: #076b6d;
  --brand-100: #d6f4f4;
  --accent: #7ae7e9;
  --navy: #12294a;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e2e8f0;

  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-300: #475569;

  --ok: #047857;
  --ok-bg: #d1fae5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warn: #b45309;
  --warn-bg: #fef3c7;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .08);
  --topbar-h: 56px;
  --leftnav-w: 232px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #1e293b;
    --line: #1e293b;
    --ink-900: #f1f5f9;
    --ink-700: #cbd5e1;
    --ink-500: #94a3b8;
    --ink-300: #cbd5e1;
    --brand-text: #5ed8da;
    --brand-100: #0e3b3c;
    --ok: #34d399;
    --ok-bg: #06281f;
    --danger: #f87171;
    --danger-bg: #3f1d1d;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink-900);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- topbar ---- */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800;
}
.brand em { font-style: normal; color: var(--brand-text); }
.topbar .spacer { flex: 1; }
.tagline { color: var(--ink-500); font-size: 12px; }

/* ---- layout ---- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px; }
.grid { display: grid; grid-template-columns: var(--leftnav-w) 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 13px; font-weight: 700; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-500); }
.card h3 { font-size: 15px; font-weight: 700; margin: 0 0 6px; }

/* ---- forms ---- */
label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-700); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=date], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 13px;
  color: var(--ink-900); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.hint { font-size: 11px; color: var(--ink-500); margin-top: 5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; font: inherit; font-size: 13px; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-700); }
.btn-ghost { background: var(--surface-2); color: var(--ink-700); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- canvas stage ---- */
.stage {
  position: relative; background: var(--surface-2);
  border: 1px dashed var(--line); border-radius: var(--radius);
  min-height: 340px; display: grid; place-items: center; overflow: hidden;
}
.stage.has-doc { border-style: solid; }
#canvas { max-width: 100%; height: auto; display: block; cursor: crosshair; touch-action: none; }
.empty { text-align: center; color: var(--ink-500); padding: 48px 24px; }
.empty strong { display: block; color: var(--ink-700); font-size: 15px; margin-bottom: 4px; }

/* ---- chips / badges ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--brand-100); color: var(--brand-text);
}
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }

.redaction-list { list-style: none; margin: 0; padding: 0; }
.redaction-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: 6px; font-size: 12px;
}
.redaction-list button { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12px; font-weight: 600; }

.notice {
  padding: 11px 13px; border-radius: var(--radius-sm); font-size: 12px;
  background: var(--brand-100); color: var(--brand-text); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
}
.notice-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }

/* ---- verify page ---- */
.verify { max-width: 560px; margin: 40px auto; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 13px; }
.kv dt { color: var(--ink-500); font-weight: 600; }
.kv dd { margin: 0; color: var(--ink-900); font-weight: 500; word-break: break-word; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.dropzone {
  margin-top: 14px; padding: 20px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface-2);
  color: var(--ink-500); font-size: 12px; cursor: pointer;
}
.dropzone.drag { border-color: var(--brand); background: var(--brand-100); color: var(--brand-text); }
