/* Oran Defteri — a betting-slip ledger: tabular numerals, ruled rows, one green accent. */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #15201d;
  --muted: #5d6b67;
  --rule: #dbe2df;
  --accent: #0d6b5e;
  --accent-soft: #dcefeb;
  --down: #0d7a3f;
  --up: #b3382c;
  --warn: #9a6200;
  --warn-soft: #fbefd7;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513; --surface: #16201d; --ink: #e2ebe8; --muted: #93a39f; --rule: #2a3733;
    --accent: #55c3b1; --accent-soft: #173a34; --down: #5fd38e; --up: #f08a7e; --warn: #f0b14f; --warn-soft: #3a2c13;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); }
button, input { font: inherit; color: inherit; }
h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 650; text-wrap: balance; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
  background: var(--surface); border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark {
  font: 600 11px/1 var(--mono); letter-spacing: 0.08em; color: var(--accent);
  border: 1.5px solid var(--accent); border-radius: 4px; padding: 5px 6px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.chip {
  font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--rule);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chip.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.chip.ok { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

button.ghost, button.icon {
  background: transparent; border: 1px solid var(--rule); border-radius: 6px; padding: 6px 12px; cursor: pointer;
}
button.icon { width: 34px; height: 34px; padding: 0; font-size: 20px; line-height: 1; }
button.ghost:hover, button.icon:hover { border-color: var(--accent); color: var(--accent); }
button:focus-visible, input:focus-visible, tr:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.controls {
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) 4px max(16px, env(safe-area-inset-left, 0px));
}
.daynav { display: flex; align-items: center; gap: 6px; }
input[type="date"], input[type="search"] {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 6px 10px; min-height: 34px;
}
input[type="search"] { flex: 1; min-width: 180px; max-width: 360px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }

main { padding: 6px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
.summary { color: var(--muted); margin: 6px 0 10px; font-size: 13px; }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.matches { min-width: 860px; }
.matches th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 9px 8px; border-bottom: 1px solid var(--rule); background: var(--surface);
  position: sticky; top: 0;
}
.matches th.odds { text-align: center; }
.matches td { padding: 7px 8px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.matches tbody tr { cursor: pointer; }
.matches tbody tr:hover { background: var(--accent-soft); }
.matches tr.league-row td {
  background: var(--bg); font-size: 12px; font-weight: 600; color: var(--muted); cursor: default; padding: 5px 8px;
}
.matches td.time { font-family: var(--mono); font-size: 13px; color: var(--muted); width: 56px; }
.matches td.teams { font-weight: 500; min-width: 0; }
.league-line { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.m-only { display: none; }
.matches td.score { font-family: var(--mono); white-space: nowrap; }
.matches td.score small { color: var(--muted); }
.matches td.price { font-family: var(--mono); text-align: right; width: 48px; font-size: 13px; }
.matches td.price.gap { border-left: 1px solid var(--rule); }
.price.down { color: var(--down); }
.price.up { color: var(--up); }
.price.none { color: var(--rule); }
.badges { display: flex; flex-wrap: wrap; gap: 3px; }
.badge {
  font: 600 10px/1 var(--mono); padding: 3px 4px; border-radius: 3px; background: var(--bg); border: 1px solid var(--rule); color: var(--muted);
}
.badge.full { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.flag { color: var(--warn); font-size: 12px; margin-left: 6px; }

dialog {
  width: min(1100px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--rule);
  border-radius: 10px; background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: rgb(10 20 18 / 0.45); }
.dialog-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 16px 18px 10px; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.eyebrow { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--rule); overflow-x: auto; }
.tabs button {
  background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 10px; cursor: pointer; color: var(--muted); white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.dialog-body { padding: 14px 18px 22px; overflow: auto; }
.dialog-body h3 { font-size: 14px; margin: 18px 0 8px; }
.dialog-body h3:first-child { margin-top: 0; }

.groups { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.groups button { background: var(--bg); border: 1px solid var(--rule); border-radius: 999px; padding: 4px 11px; cursor: pointer; font-size: 13px; }
.groups button[aria-pressed="true"] { background: var(--accent); color: var(--surface); border-color: var(--accent); }

.grid { overflow-x: auto; border: 1px solid var(--rule); border-radius: 8px; }
.grid table th, .grid table td { padding: 6px 8px; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
.grid table th:first-child, .grid table td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.grid thead th { font-size: 11px; color: var(--muted); font-weight: 600; }
.grid thead tr:first-child th { text-transform: none; font-size: 12px; color: var(--ink); border-bottom: none; }
.grid td { font-family: var(--mono); font-size: 13px; }
.grid td.label { font-family: var(--font); }
.grid .sep { border-left: 1px solid var(--rule); }

.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 18px; margin: 0; }
.kv div { min-width: 0; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }

.chart { width: 100%; height: auto; display: block; background: var(--bg); border-radius: 8px; }
.chart text { fill: var(--muted); font: 11px var(--mono); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin: 8px 0; }
.legend i { display: inline-block; width: 12px; height: 3px; margin-right: 5px; vertical-align: middle; }
.note { color: var(--muted); font-size: 13px; }
.jobs td, .jobs th { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.jobs th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.jobs .err { color: var(--up); font-size: 12px; }
.jobs code { font-size: 12px; }
.status-ok { color: var(--down); }
.status-bad { color: var(--up); }
.bar { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar span { display: block; height: 100%; background: var(--accent); }

@media (max-width: 760px) {
  .matches { min-width: 0; }
  .matches .d-only { display: none; }
  .matches .m-only { display: table-cell; }
  .matches td.time { width: 44px; font-size: 12px; }
  .matches td.price { width: 40px; font-size: 12px; padding-inline: 4px; }
  .matches td, .matches th { padding-inline: 5px; }
  .matches td.score { white-space: normal; font-size: 13px; }
  .matches td.score small { display: block; white-space: nowrap; font-size: 11px; }
  .matches td.teams { font-size: 13px; }
}
@media (max-width: 640px) {
  .chips { order: 3; flex-basis: 100%; }
  input[type="search"] { min-width: 0; flex-basis: 100%; max-width: none; }
  dialog { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; margin: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .matches tbody tr { transition: background 0.12s; }
}
.stats-table { width: 100%; max-width: 560px; }
.stats-table th, .stats-table td { text-align: center; }
.stats-table .stat-label { text-align: center; color: var(--muted); font-size: 13px; }
details { margin: 6px 0; }
details > summary { cursor: pointer; padding: 6px 0; font-weight: 600; }
.badge.stat { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.badge.arch { border-style: dashed; }
.matches tr.archive-row td.teams { font-weight: 400; }
.status-wait { color: var(--warn); }
.jobs .status-wait .err { color: var(--muted); }
.coverage td, .coverage th { text-align: right; font-variant-numeric: tabular-nums; }
.coverage td:first-child, .coverage th:first-child { text-align: left; }
.legend-line { color: var(--muted); font-size: 12px; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.legend-line .price { font-weight: 600; }
.grid table.jobs { width: 100%; table-layout: fixed; }
.grid table.jobs td, .grid table.jobs th { white-space: normal; font-family: var(--font); text-align: left; position: static; }
.grid table.jobs th:nth-child(1) { width: 42%; }
.grid table.jobs th:nth-child(2) { width: 22%; }
.grid table.jobs th:nth-child(3) { width: 12%; }
.grid table.jobs .note { font-size: 12px; margin: 2px 0 0; }
@media (max-width: 700px) {
  .grid table.jobs thead { display: none; }
  .grid table.jobs, .grid table.jobs tbody, .grid table.jobs tr, .grid table.jobs td { display: block; width: auto; }
  .grid table.jobs tr { padding: 8px 10px; border-bottom: 1px solid var(--rule); }
  .grid table.jobs td { border: none; padding: 2px 0; }
}
.logout { margin: 0; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 24px; }
.login-box .brand { margin-bottom: 18px; }
.login-box form { display: grid; gap: 12px; }
.login-box label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login-box input { font: inherit; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg); color: var(--ink); }
.login-box button { font: inherit; font-weight: 600; padding: 10px 12px; border: none; border-radius: 8px; background: var(--accent); color: var(--surface); cursor: pointer; }
.login-error { color: var(--up); font-size: 13px; margin: 0; }
