/* ============================================================
   IN-RIGA · ops — Archery-ops style system
   ============================================================ */

/* Custom scrollbars — minimal, ink-on-paper, matches the system */
* {
  scrollbar-width: thin;
  scrollbar-color: #0e0e0c44 transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: #0e0e0c33;
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: #0e0e0c66;
  background-clip: padding-box;
  border: 2px solid transparent;
}
*::-webkit-scrollbar-corner {
  background: transparent;
}
[data-theme="dark"] * {
  scrollbar-color: #f4efe644 transparent;
}
[data-theme="dark"] *::-webkit-scrollbar-thumb {
  background: #f4efe633;
  background-clip: padding-box;
  border: 2px solid transparent;
}
[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
  background: #f4efe666;
  background-clip: padding-box;
}

/* Even tinier scrollbars inside dialogs / textareas / scroll-y panels */
.dialog::-webkit-scrollbar,
.dialog-body::-webkit-scrollbar,
.textarea::-webkit-scrollbar,
.scroll-y::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.dialog::-webkit-scrollbar-thumb,
.dialog-body::-webkit-scrollbar-thumb,
.textarea::-webkit-scrollbar-thumb,
.scroll-y::-webkit-scrollbar-thumb {
  background: #0e0e0c26;
  border-radius: 3px;
  border: none;
  background-clip: border-box;
}
.dialog::-webkit-scrollbar-thumb:hover,
.dialog-body::-webkit-scrollbar-thumb:hover,
.textarea::-webkit-scrollbar-thumb:hover,
.scroll-y::-webkit-scrollbar-thumb:hover {
  background: #0e0e0c66;
}
.dialog, .dialog-body, .textarea, .scroll-y {
  scrollbar-width: thin;
  scrollbar-color: #0e0e0c33 transparent;
}
[data-theme="dark"] .dialog::-webkit-scrollbar-thumb,
[data-theme="dark"] .dialog-body::-webkit-scrollbar-thumb,
[data-theme="dark"] .textarea::-webkit-scrollbar-thumb,
[data-theme="dark"] .scroll-y::-webkit-scrollbar-thumb {
  background: #f4efe626;
}
[data-theme="dark"] .dialog::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .dialog-body::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .textarea::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .scroll-y::-webkit-scrollbar-thumb:hover {
  background: #f4efe666;
}

:root {
  /* Color */
  --paper: #f4efe6;
  --paper-2: #ebe5d8;
  --paper-3: #e1dac9;
  --ink: #0e0e0c;
  --ink-soft: #1a1814;
  --orange: #ff4612;
  --orange-soft: #ff461215;
  --line: #0e0e0c1f;
  --line-strong: #0e0e0c;
  --muted: #0e0e0c88;
  --muted-2: #0e0e0c66;

  /* State colors (per spec) */
  --good: #2a8a3e;
  --bad: #c4321a;
  --warn: #d99100;
  --info: #1a4cf2;

  /* State-pill / audit-actor hues — theme-aware pairs (dark values below).
     navy = RESERVED/BALANCE_REQUESTED, blue = AWAITING_CUSTOMER_RESPONSE,
     purple = Stripe actor, slate = balance payment-intent accent. Light values
     chosen to clear WCAG 4.5:1 as pill text; dark values lightened per the
     --info precedent so the money-state pills stay legible at night. */
  --navy: #1a3a6d;
  --blue: #1857b0;
  --purple: #6a34a8;
  --slate: #55647a;
  --orange-dark: #d05a1d;
  --good-bg: #2a8a3e14;

  /* Type */
  --font-sans: 'Archivo', -apple-system, sans-serif;
  --font-display: 'Archivo', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Spacing scale */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;
}

[data-theme="dark"] {
  --paper: #14130f;
  --paper-2: #1d1c17;
  --paper-3: #26241e;
  --ink: #f4efe6;
  --ink-soft: #e6dfd0;
  --orange: #ff5a2a;
  --orange-soft: #ff5a2a1f;
  --line: #f4efe61f;
  --line-strong: #f4efe6;
  --muted: #f4efe688;
  --muted-2: #f4efe666;

  --good: #5fc777;
  --bad: #ee6a55;
  --warn: #f0b13d;
  --info: #6a8af7;

  /* Dark pill/actor hues — lightened for the near-black paper (>=4.5:1). */
  --navy: #7fa8e8;
  --blue: #6fa8ff;
  --purple: #c79df0;
  --slate: #9aa9bd;
  --orange-dark: #e0672f;
  --good-bg: #5fc7771f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── shared atoms ─── */

.mono { font-family: var(--font-mono); }
.display { font-family: var(--font-display); font-weight: 900; letter-spacing: -0.01em; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 500;
}

.label-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* Pill (tag) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--ink);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  white-space: nowrap;
}
.pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
}
.pill.solid {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* State badges (booking states) */
.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;
}
.state-badge .marker { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.state-badge.preauth { color: var(--warn); border-color: var(--warn); background: #d9910010; }
.state-badge.preauth .marker { background: var(--warn); }
.state-badge.confirmed { color: var(--good); border-color: var(--good); background: #2a8a3e10; }
.state-badge.confirmed .marker { background: var(--good); }
.state-badge.reserved { color: var(--info); border-color: var(--info); background: #1a4cf210; }
.state-badge.reserved .marker { background: var(--info); }
.state-badge.cancelled { color: var(--muted); border-color: var(--line); background: var(--paper-2); }
.state-badge.cancelled .marker { background: var(--muted); }
.state-badge.refund { color: var(--orange); border-color: var(--orange); background: var(--orange-soft); }
.state-badge.refund .marker { background: var(--orange); }
.state-badge.bad { color: var(--bad); border-color: var(--bad); background: #c4321a10; }
.state-badge.bad .marker { background: var(--bad); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.05s, background 0.1s;
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--ink);
  color: var(--paper);
}
.btn.primary:hover { background: var(--ink-soft); }
.btn.accent {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}
.btn.accent:hover { background: #e63d0e; }
[data-theme="dark"] .btn.accent:hover { background: #ff7045; }
.btn.danger {
  background: var(--paper);
  border-color: var(--bad);
  color: var(--bad);
}
.btn.danger:hover { background: #c4321a08; }
.btn.danger.solid {
  background: var(--bad);
  color: #fff;
}
.btn.ghost {
  border-color: var(--line);
  color: var(--ink);
}
.btn.ghost:hover { border-color: var(--ink); background: var(--paper-2); }
.btn.sm { padding: 6px 12px; font-size: 10px; }
.btn.full { width: 100%; }
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Inputs */
.input, .textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-md);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-soft);
}
.textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
  font-family: var(--font-sans);
  font-size: 13px;
}
.input.confirm {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Card */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-soft {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.card-head {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-head .title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-transform: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-head .title .marker {
  display: none;
}
.card-body {
  padding: 18px;
}
.card-soft .card-head { border-bottom: 1px solid var(--line); padding: 12px 16px; }
.card-soft .card-body { padding: 16px; }

/* Bullseye logo */
.bullseye {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  position: relative;
  flex-shrink: 0;
}
.bullseye::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--orange);
}
.bullseye::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--ink);
}
.bullseye.sm { width: 16px; height: 16px; }
.bullseye.sm::before { inset: 2px; }
.bullseye.sm::after { inset: 6px; }

/* Numbered step circle */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Ledger row */
.ledger {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.9;
}
.ledger .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.ledger .row + .row { border-top: 1px dotted var(--line); }
.ledger .row .k {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  font-weight: 500;
}
.ledger .row .v {
  font-feature-settings: "tnum";
  font-weight: 500;
}
.ledger .row .v.bad { color: var(--bad); }
.ledger .row .v.warn { color: var(--warn); }
.ledger .row .v.good { color: var(--good); }

/* Modal scrim + dialog */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(14, 14, 12, 0.45);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
[data-theme="dark"] .scrim { background: rgba(0, 0, 0, 0.65); }
.dialog {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-lg);
  width: 540px;
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
@media (prefers-reduced-motion: reduce) {
  .scrim, .dialog { animation: none; }
}
.dialog-head {
  padding: 16px 22px;
  border-bottom: 1.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 1;
}
.dialog-head .left { display: flex; align-items: center; gap: 10px; }
.dialog-body { padding: 22px; }
.dialog-foot {
  padding: 14px 22px;
  border-top: 1.5px dashed var(--ink);
  display: flex;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: var(--paper);
}

/* C3 (Drop 027): promote .dialog-title / .dialog-sub / .empty-state to base
   primitives so every screen that loads styles.css gets them (they were only in
   per-screen CSS before, rendering unstyled where that CSS wasn't loaded). Token-only. */
.dialog-title {
  font-family: var(--font-display, var(--font-sans));
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
}
.dialog-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.empty-state {
  padding: 64px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg, 14px);
  background: var(--paper);
}
.empty-state .eyebrow { color: var(--muted-2, var(--muted)); }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Radio cards */
.radio-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  background: var(--paper);
  transition: background 0.1s;
}
.radio-card + .radio-card { margin-top: 6px; }
.radio-card:hover { background: var(--paper-2); }
.radio-card.sel {
  background: var(--ink);
  color: var(--paper);
}
.radio-card .check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
  position: relative;
}
.radio-card.sel .check::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--orange);
}
.radio-card .end { font-family: var(--font-mono); font-size: 12px; }

/* Checkbox (square) */
.check-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  padding: 6px 0;
}
.check-card .box {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
}
.check-card.sel .box { background: var(--ink); color: var(--paper); }
.check-card.sel .box::after { content: "✓"; }

/* Toast — DEPRECATED dead block removed. Live styles live in app/feedback.css for ToastHost (§3.3). */

/* Utility */
.row { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.muted { color: var(--muted); }
.center { display: flex; align-items: center; justify-content: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.divider { border-top: 1px solid var(--line); margin: 14px 0; }
.divider-strong { border-top: 1.5px solid var(--ink); margin: 16px 0; }
.divider-dashed { border-top: 1.5px dashed var(--ink); margin: 14px 0; }

/* Hover details */
[data-tip] { position: relative; cursor: help; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: nowrap;
  z-index: 50;
  margin-bottom: 4px;
  pointer-events: none;
}

/* Action-button tooltips wrap (longer state-machine explanations) */
.action-btn[data-tip] { cursor: not-allowed; }
.action-btn[data-tip]:hover::after,
.action-btn[data-tip]:focus-visible::after {
  white-space: normal;
  width: max-content;
  max-width: 260px;
  line-height: 1.45;
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 8px 10px;
  text-align: left;
  letter-spacing: 0;
  left: auto;
  right: 8px;
  transform: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}
/* Mirror the generic [data-tip]:hover::after for keyboard focus */
.action-btn[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  z-index: 50;
  margin-bottom: 4px;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .action-btn[data-tip]:hover::after,
  .action-btn[data-tip]:focus-visible::after { transition: none; }
}
