/* Aylence dispatch dashboard -- see /DESIGN.md for the full rationale.
   Light only, by explicit request: no dark-mode variant. Color is spent on
   exactly two things -- semantic status badges, and an action's risk tier
   (quiet / primary / caution / danger). Everything else stays neutral so
   that when color shows up, it means something. */

:root {
  color-scheme: light;

  --bg: oklch(99% 0.002 260);
  --surface: oklch(100% 0 0);
  --border: oklch(90% 0.004 260);
  --border-strong: oklch(82% 0.006 260);
  --ink: oklch(20% 0.006 260);
  --ink-muted: oklch(46% 0.008 260);
  --accent: oklch(52% 0.14 258);
  --accent-ink: oklch(30% 0.1 258);

  --ok-fg: oklch(40% 0.13 152);   --ok-bg: oklch(94% 0.05 152);
  --bad-fg: oklch(42% 0.19 25);   --bad-bg: oklch(94% 0.04 25);
  --warn-fg: oklch(38% 0.13 70);  --warn-bg: oklch(93% 0.07 80);
  --live-fg: oklch(38% 0.16 300); --live-bg: oklch(93% 0.06 300);

  --radius: 10px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

main { max-width: 1100px; margin: 0 auto; padding: 28px 24px 60px; }

h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; }
h2 {
  font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--ink-muted); margin: 0 0 14px;
}
p { line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  background: var(--bg); border: 1px solid var(--border); padding: 1px 6px;
  border-radius: 5px; font-size: 0.85em;
}
.muted { color: var(--ink-muted); font-size: 0.85em; }

/* ---------------------------------------------------------------- */
/* Top bar -- neutral, no color, nav weight/underline does the work  */
/* ---------------------------------------------------------------- */

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 600; color: var(--ink); text-decoration: none; }
.topbar nav { display: flex; gap: 20px; flex: 1; }
.topbar nav a { color: var(--ink-muted); font-size: 0.9rem; font-weight: 500; }
.topbar nav a:hover { color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--ink); }
.topbar .logout { margin-left: auto; color: var(--ink-muted); font-size: 0.85rem; }
.topbar .logout:hover { color: var(--ink); }

/* ---------------------------------------------------------------- */
/* Flash messages                                                    */
/* ---------------------------------------------------------------- */

.flashes { margin: 0 0 18px; }
.flash {
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 8px;
  font-size: 0.9rem; border: 1px solid transparent;
  animation: flash-in 180ms var(--ease-out);
}
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }
@keyframes flash-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.flash-success { background: var(--ok-bg); color: var(--ok-fg); border-color: color-mix(in oklch, var(--ok-fg) 20%, transparent); }
.flash-error { background: var(--bad-bg); color: var(--bad-fg); border-color: color-mix(in oklch, var(--bad-fg) 20%, transparent); }

/* ---------------------------------------------------------------- */
/* Panels                                                             */
/* ---------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 18px 0;
}
.panel.budget { padding: 12px 20px; font-size: 0.9rem; }
.panel.budget strong { font-weight: 600; }

/* ---------------------------------------------------------------- */
/* Tables                                                             */
/* ---------------------------------------------------------------- */

table.matrix, table.status-table { width: 100%; border-collapse: collapse; }
table.matrix { display: block; overflow-x: auto; }
table.matrix th {
  text-align: left; padding: 10px 12px; white-space: nowrap;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--ink-muted); border-bottom: 1px solid var(--border-strong);
}
table.matrix td {
  text-align: left; padding: 12px; white-space: nowrap;
  border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
table.matrix tbody tr:hover { background: var(--bg); }
table.status-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
table.status-table td:first-child { color: var(--ink-muted); width: 320px; }
tr.row-kill { background: color-mix(in oklch, var(--bad-bg) 60%, transparent); }
tr.row-kill:hover { background: var(--bad-bg); }

/* ---------------------------------------------------------------- */
/* Badges -- the only place color encodes meaning by default          */
/* ---------------------------------------------------------------- */

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 650;
}
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-bad { background: var(--bad-bg); color: var(--bad-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-live { background: var(--live-bg); color: var(--live-fg); }

/* ---------------------------------------------------------------- */
/* Buttons -- four risk tiers. Quiet is the default; color is spent   */
/* only when an action commits to something or is dangerous.          */
/* ---------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink);
  font-size: 0.87rem; font-weight: 500; cursor: pointer;
  transition: background 120ms var(--ease-out), border-color 120ms var(--ease-out);
}
.btn:hover { background: var(--bg); border-color: var(--ink-muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-caution { background: var(--warn-fg); border-color: var(--warn-fg); color: #fff; font-weight: 600; }
.btn-caution:hover { filter: brightness(0.92); }
.btn-danger { background: var(--bad-fg); border-color: var(--bad-fg); color: #fff; font-weight: 600; }
.btn-danger:hover { filter: brightness(0.92); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* ---------------------------------------------------------------- */
/* Forms                                                               */
/* ---------------------------------------------------------------- */

.action-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.action-row:last-child { margin-bottom: 0; }
.action-row form { display: flex; gap: 8px; align-items: flex-end; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; }
form.filters { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; align-items: flex-end; }

input[type=text], input[type=password], input[type=datetime-local], select {
  padding: 7px 10px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font-size: 0.87rem;
}
input:focus, select:focus, .btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
label { display: flex; flex-direction: column; gap: 5px; font-size: 0.78rem; color: var(--ink-muted); font-weight: 500; }
.mode-pick { display: flex; gap: 20px; margin: 12px 0; }
.mode-pick label { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 0.9rem; font-weight: 400; }

/* ---------------------------------------------------------------- */
/* Login                                                               */
/* ---------------------------------------------------------------- */

.login-box {
  max-width: 340px; margin: 100px auto; padding: 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.login-box h1 { margin-bottom: 20px; }
.login-box form { display: flex; flex-direction: column; gap: 16px; }
.login-box button { margin-top: 4px; }

/* ---------------------------------------------------------------- */
/* Log viewer                                                         */
/* ---------------------------------------------------------------- */

pre.log {
  background: var(--ink); color: oklch(92% 0.005 260);
  padding: 16px; border-radius: var(--radius); overflow-x: auto;
  max-height: 70vh; overflow-y: auto; font-size: 0.82rem; line-height: 1.5;
}

ul.run-list, ul.event-pick { list-style: none; padding: 0; margin: 0; }
ul.run-list li, ul.event-pick li { padding: 6px 0; border-bottom: 1px solid var(--border); }
ul.run-list li:last-child, ul.event-pick li:last-child { border-bottom: none; }
.pager { display: flex; gap: 16px; margin-top: 14px; font-size: 0.9rem; }
