/* DocTrack — design tokens, direction A "Gatehouse" (see docs/DESIGN.md) */
:root {
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --surface-2: #FBFAF7;
  --ink: #14213D;
  --ink-2: #5A6275;
  --ink-3: #8A90A0;
  --line: #E4E2DA;
  --accent: #D97706;
  --accent-ink: #FFFFFF;
  --accent-soft: #FEF3C7;
  --ok: #15803D;
  --ok-soft: #DCFCE7;
  --info: #1D4ED8;
  --info-soft: #DBEAFE;
  --muted-soft: #EEEDE8;
  --danger: #B91C1C;
  --warn-bg: #FEF3C7;
  --focus: #D97706;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 16px rgba(20, 33, 61, .06);

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-sm: 8px;
  --r-md: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --surface: #1B1E23;
    --surface-2: #171A1E;
    --ink: #E8EAEE;
    --ink-2: #A2A9B6;
    --ink-3: #757D8B;
    --line: #2A2F36;
    --accent: #F59E0B;
    --accent-ink: #1B1200;
    --accent-soft: #3A2E10;
    --ok: #4ADE80;
    --ok-soft: #12301E;
    --info: #7AA2FF;
    --info-soft: #172544;
    --muted-soft: #262A30;
    --danger: #F87171;
    --warn-bg: #3A2E10;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip--draft { background: var(--muted-soft); color: var(--ink-2); }
.chip--received { background: var(--accent-soft); color: var(--accent); }
.chip--notified { background: var(--info-soft); color: var(--info); }
.chip--handed_over { background: var(--ok-soft); color: var(--ok); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 500; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--ink-3); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.05); border-color: var(--accent); }
.btn--ink { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.field { display: grid; gap: 4px; }
.field > label, .field > .label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); font-size: 16px; /* 16px stops iOS zoom-on-focus */
}
textarea.input { min-height: 64px; resize: vertical; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field--check .input { background: var(--warn-bg); border-color: var(--accent); }
.field--check > label::after { content: " · periksa"; color: var(--accent); font-weight: 600; }

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 17px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.is-key::before { background: var(--accent); }
.timeline .t-title { font-weight: 500; }
.timeline .t-meta { font-size: 12.5px; color: var(--ink-2); }

/* label photo with AI confidence boxes (borrowed from direction B) */
.lphoto-wrap { display: grid; gap: 8px; justify-items: center; }
.lphoto { position: relative; display: inline-block; margin: 0; max-width: 100%; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--muted-soft); }
.lphoto img { display: block; max-width: 100%; width: auto; height: auto; }
.lboxes { position: absolute; inset: 0; }
.lbox {
  position: absolute; padding: 0; margin: 0; cursor: pointer;
  border: 2px solid var(--lb); border-radius: 4px; background: color-mix(in srgb, var(--lb) 12%, transparent);
}
.lbox--high { --lb: #16A34A; }
.lbox--medium { --lb: #D97706; }
.lbox--low { --lb: #DC2626; }
.lbox-tag {
  position: absolute; left: -2px; top: -2px; transform: translateY(-100%);
  background: var(--lb); color: #fff; font: 600 11px/1 var(--mono);
  padding: 4px 6px; border-radius: 4px 4px 4px 0; white-space: nowrap;
}
.lbox:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
.lphoto--plain .lboxes { display: none; }
.lphoto-tools { display: flex; gap: 14px; align-items: center; justify-content: space-between; width: 100%; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.lphoto-legend { display: inline-flex; gap: 6px; align-items: center; }
.lphoto-actions { display: inline-flex; gap: 14px; margin-left: auto; }
.lphoto-legend i { width: 10px; height: 10px; border-radius: 2px; background: var(--lb); display: inline-block; margin-left: 4px; }
.linkish { border: 0; background: none; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 8px 0; font-size: 13px; }
.flash-group { animation: flashGroup 1.6s ease-out; }
@keyframes flashGroup { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 3px transparent; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
