/*
 * Skyo Global design system: tokens + base + shell + shared components.
 * Black and white carry the page, Inter does the heavy lifting, one orange accent.
 * No decorative shadows: the only shadow is the keyboard focus ring.
 */
:root {
  --color-primary: #ff4d0a;
  --surface: #ffffff;
  --surface-alt: #f5f5f3;
  --surface-sunken: #e9e9e7;
  --surface-glass: rgba(255, 255, 255, 0.86);
  --ink: #000000;
  --ink-body: #222222;
  --ink-muted: #666666;
  --line: #d9d9d9;
  --accent: #ff4d0a;
  --accent-text: #c73a04;
  --on-accent: #000000;
  --focus: #000000;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 999px;

  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 40px;
  --space-xl: 64px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --focus-ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--focus);
  --ease-editorial: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: 200ms ease;
  --sidebar-w: 248px;
}

[data-theme="dark"] {
  --surface: #000000;
  --surface-alt: #111111;
  --surface-sunken: #222222;
  --ink: #ffffff;
  --ink-body: #e9e9e7;
  --ink-muted: #a3a3a3;
  --line: rgba(255, 255, 255, 0.2);
  --accent-text: #ff4d0a;
  --focus: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-body);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: var(--radius-pill); z-index: 100; }
.skip:focus { top: 12px; }

.muted { color: var(--ink-muted); }
.block { display: block; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { justify-content: center; }
.pad { padding: var(--space-md); }
.strong { font-weight: 700; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-gap { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; }

/* ---------- type ---------- */
.label { font-size: 12px; line-height: 1.2; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); }
.page-title { font-size: clamp(32px, 4vw, 44px); line-height: 1.02; font-weight: 700; letter-spacing: -0.03em; color: var(--ink); margin-top: 10px; }
.page-sub { margin-top: 10px; color: var(--ink-muted); max-width: 62ch; }
.section-title { font-size: 20px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.num { color: var(--accent-text); margin-right: 6px; }

/* ---------- shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--surface); color: var(--ink-body);
  display: flex; flex-direction: column; padding: 28px 20px 24px; gap: 32px; overflow-y: auto;
}
.wordmark { font-weight: 800; font-size: 22px; letter-spacing: -0.04em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: baseline; gap: 0; }
/* The brand logo is set in Castoro Titling (all capitals by design). */
.wordmark-name { font-family: "Castoro Titling", Georgia, "Times New Roman", serif; font-weight: 400; font-size: 26px; letter-spacing: 0.04em; line-height: 1; }
.topbar .wordmark-name { font-size: 22px; }
.wordmark .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin: 0 6px 0 2px; align-self: flex-end; margin-bottom: 4px; }
.wordmark-sub { font-weight: 500; letter-spacing: -0.01em; font-size: 15px; color: var(--ink-muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; display: block; padding: 11px 14px; border-radius: var(--radius-pill);
  font-size: 15px; font-weight: 500; line-height: 1.1; color: var(--ink-muted); text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); background: var(--surface-sunken); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.nav a.active::before { content: ""; position: absolute; left: 4px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent); }
.side-note { margin-top: auto; font-size: 13px; line-height: 1.45; color: var(--ink-muted); }

.side-out { margin-top: auto; align-self: flex-start; }
.side-out + .side-note { margin-top: 0; }

/* login gate */
.lock { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; background: var(--surface); color: var(--ink-body); }
.lock-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 16px; }
.lock-title { font-size: clamp(36px, 7vw, 52px); line-height: 0.98; font-weight: 800; letter-spacing: -0.04em; color: var(--ink); margin-top: 24px; }
.lock-sub { color: var(--ink-muted); }
.lock-note { font-size: 13px; line-height: 1.45; color: var(--ink-muted); }
.lock .field input { background: var(--surface-alt); border-color: var(--line); }
.locked { overflow: hidden; }
@media print { .lock { display: none !important; } }

.topbar { display: none; }
.scrim { display: none; }

.view { margin-left: var(--sidebar-w); padding: 48px clamp(20px, 4vw, 56px) 96px; max-width: calc(1160px + var(--sidebar-w)); outline: none; }
.view.wide { max-width: none; }

@media (max-width: 1023px) {
  .topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; height: 60px; padding: 0 16px;
    background: var(--surface-glass); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  }
  .topbar .wordmark { font-size: 20px; }
  .sidebar { transform: translateX(-100%); transition: transform 350ms var(--ease-editorial); width: min(300px, 86vw); }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 35; }
  .view { margin-left: 0; padding-top: 32px; max-width: none; }
}

.burger, .burger::before, .burger::after { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; }
.burger::after { top: 6px; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; background: transparent; border-radius: var(--radius-pill); cursor: pointer; font-size: 26px; line-height: 1; color: var(--ink); }
.icon-btn:hover { background: var(--surface-sunken); }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 32px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 26px;
  border-radius: var(--radius-pill); border: 1px solid transparent; font-size: 16px; font-weight: 600; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}
.btn:hover { transform: scale(1.02); }
.btn:active { transform: scale(0.99); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--ink); color: var(--surface); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.btn-ghost:hover { color: var(--accent-text); }
.btn-sm { height: 38px; padding: 0 18px; font-size: 14px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn:focus-visible { border-radius: var(--radius-pill); }

.link-btn {
  background: none; border: 0; padding: 4px 6px; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.link-btn:hover { color: var(--accent-text); }

/* ---------- badges + chips ---------- */
.badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 4px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.badge-neutral { background: var(--surface-sunken); color: var(--ink); }
.badge-dark { background: var(--ink); color: var(--surface); }
.badge-outline { border: 1px solid var(--ink); color: var(--ink); }
.badge-accent { background: var(--accent); color: var(--on-accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip { height: 36px; padding: 0 16px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: transparent; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--ink-body); }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-top: 1px solid var(--ink); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); padding: 14px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 16px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th.right, .table td.right { text-align: right; }
.table tbody tr:hover { background: var(--surface-alt); }
.table .actions { white-space: normal; min-width: 210px; }
.table .actions .link-btn { display: inline-block; }
.table strong { color: var(--ink); font-weight: 600; }
.table td:first-child strong { white-space: nowrap; }

.empty { padding: 56px 24px; text-align: center; color: var(--ink-muted); border-top: 1px solid var(--line); }
.empty.slim { padding: 20px; border: 1px dashed var(--line); border-radius: var(--radius-md); }
.empty-title { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); margin-bottom: 6px; }
.empty .row-gap { margin-top: 20px; }

.list-lines li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-lines li:first-child { border-top: 1px solid var(--line); }

/* ---------- dialog ---------- */
.modal { border: 0; padding: 0; width: min(480px, calc(100vw - 32px)); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink-body); }
.modal-wide { width: min(720px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(0, 0, 0, 0.55); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 20px 0 28px; }
.modal-head h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.modal-body { padding: 16px 28px 8px; max-height: 70vh; overflow-y: auto; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 16px 28px 24px; }
.success-line { font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 10px; word-break: break-all; }
.success-line .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { background: var(--ink); color: var(--surface); padding: 14px 20px; border-radius: var(--radius-pill); font-size: 15px; font-weight: 500; max-width: min(460px, calc(100vw - 40px)); animation: toast-in 500ms var(--ease-editorial); transition: opacity 300ms, transform 300ms; }
.toast-error { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:hover { transform: none; }
}
