/* Travelmarket weekly ads dashboard — "Ink" theme: monochrome, sharp corners,
   a single accent (black in light mode, lime in dark mode). Tokens on :root,
   dark mode is its own set (not an automatic inversion). Status colours are
   only used for better/worse and always come with an arrow and a
   visually-hidden word. */
:root {
  --bg: #f1f1ee;
  --surface: #ffffff;
  --surface-2: #f6f6f3;
  --ink: #111113;
  --ink-2: #44444c;
  --muted: #64646c;
  --line: #dcdcd6;
  --accent: #111113;
  --accent-ink: #d4f54a;
  --accent-soft: #e9e9e3;
  --bar-old: #d6d6d0;
  --bar-prev: #9a9a94;
  --good: #17703a;   --good-bg: #e2f1e6;
  --bad: #b3261e;    --bad-bg: #fbe8e6;
  --flat: #44444c;   --flat-bg: #ebebe6;
  --shadow: none;
  --radius: 4px;
  --radius-sm: 3px;
  --pill: 3px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-head: var(--font);
  --logo-bg: var(--accent);
  --logo-ink: var(--accent-ink);
  --logo-shadow: none;
  --hero-bg: transparent;
  --hero-ink: var(--ink);
  --hero-sub: var(--muted);
  --hero-pad: 0;
  color-scheme: light dark;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0d;
    --surface: #141416;
    --surface-2: #1a1a1d;
    --ink: #f4f4f5;
    --ink-2: #c4c4ca;
    --muted: #8b8b94;
    --line: #2a2a2f;
    --accent: #c9f23c;
    --accent-ink: #101300;
    --accent-soft: #222a0b;
    --bar-old: #2e2e34;
    --bar-prev: #5b5b66;
    --good: #7ee08f;   --good-bg: #102214;
    --bad: #ff7a70;    --bad-bg: #2c1514;
    --flat: #c4c4ca;   --flat-bg: #212125;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0d;
  --surface: #141416;
  --surface-2: #1a1a1d;
  --ink: #f4f4f5;
  --ink-2: #c4c4ca;
  --muted: #8b8b94;
  --line: #2a2a2f;
  --accent: #c9f23c;
  --accent-ink: #101300;
  --accent-soft: #222a0b;
  --bar-old: #2e2e34;
  --bar-prev: #5b5b66;
  --good: #7ee08f;   --good-bg: #102214;
  --bad: #ff7a70;    --bad-bg: #2c1514;
  --flat: #c4c4ca;   --flat-bg: #212125;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font);
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 64px; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.hero { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; margin-bottom: 22px; background: var(--hero-bg); color: var(--hero-ink); padding: var(--hero-pad); border-radius: var(--radius); }
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 42px; height: 42px; border-radius: var(--radius-sm); display: grid; place-items: center;
  background: var(--logo-bg); color: var(--logo-ink); font-weight: 700; font-size: 18px; letter-spacing: -.02em;
  box-shadow: var(--logo-shadow);
}
h1 { font-family: var(--font-head); font-size: 22px; line-height: 1.2; margin: 0; letter-spacing: -.02em; font-weight: 700; }
.sub { margin: 2px 0 0; color: var(--hero-sub); font-size: 14px; }
.hero-right { display: flex; align-items: center; gap: 10px; }
.theme-toggle { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.theme-toggle:hover { color: var(--ink); border-color: var(--bar-prev); filter: none; }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
.stamp { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--pill); background: var(--surface); color: var(--ink-2); font-size: 13px; }
.stamp .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }

.notice { padding: 11px 16px; border-radius: 12px; margin: 0 0 12px; background: var(--bad-bg); color: var(--bad); font-size: 14px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card, .kpis + .card, .card + .columns { margin-top: 20px; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
h2 { font-family: var(--font-head); font-size: 16px; margin: 0; letter-spacing: -.01em; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin: 26px 2px 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.section-label .toggle { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; color: var(--ink-2); text-decoration: none; padding: 3px 10px; border: 1px solid var(--line); border-radius: var(--pill); background: var(--surface); }
.section-label .toggle:hover { color: var(--ink); border-color: var(--bar-prev); }
.scope { text-transform: none; letter-spacing: 0; background: var(--accent-soft); color: var(--accent); padding: 2px 10px; border-radius: var(--pill); font-size: 12.5px; font-weight: 600; }

/* ---------- toolbar (filters) ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; padding: 16px 20px; }
.sel { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sel select {
  appearance: none; -webkit-appearance: none; font: inherit; font-size: 14.5px; font-weight: 500; text-transform: none; letter-spacing: 0;
  color: var(--ink); background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 34px 9px 12px; min-width: 160px; max-width: 100%; cursor: pointer;
}
.sel select:hover { border-color: var(--bar-prev); }
.sel select:focus-visible, .seg a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toolbar .spacer { flex: 1; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); flex-wrap: wrap; }
.seg a { padding: 7px 14px; border-radius: calc(var(--radius-sm) - 2px); text-decoration: none; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.seg a:hover { color: var(--ink); }
.seg a.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .15); font-weight: 650; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg a.active { background: var(--accent-soft); color: var(--accent); box-shadow: none; } }
:root[data-theme="dark"] .seg a.active { background: var(--accent-soft); color: var(--accent); box-shadow: none; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.kpis.n4 { grid-template-columns: repeat(4, 1fr); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tile .label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; }
.tile .value { font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; white-space: nowrap; }
.tile .value .unit { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.tile .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tile .refs { font-size: 12.5px; color: var(--muted); }
.tile-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--pill); font-size: 12.5px; font-weight: 650; white-space: nowrap; background: var(--flat-bg); color: var(--flat); }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip .vs { font-weight: 500; opacity: .85; }
.chip.none { opacity: .6; }

.trio { display: flex; align-items: flex-end; gap: 6px; height: 40px; flex: none; }
.trio span { width: 24px; border-radius: 3px 3px 1px 1px; min-height: 3px; height: var(--h); background: var(--bar-old); }
.trio span:nth-child(2) { background: var(--bar-prev); }
.trio span:nth-child(3) { background: var(--accent); }
.trio-key { font-size: 10.5px; color: var(--muted); display: flex; gap: 6px; margin-top: 4px; }
.trio-key span { width: 24px; text-align: center; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.perf { width: 100%; border-collapse: collapse; }
.perf th, .perf td { padding: 11px 12px; text-align: left; font-weight: 400; border-bottom: 1px solid var(--line); }
.perf thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; vertical-align: bottom; border-bottom: 1px solid var(--line); white-space: nowrap; }
.perf thead .range { display: block; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
.perf tbody th { font-weight: 600; color: var(--ink); white-space: nowrap; }
.perf tbody tr:last-child th, .perf tbody tr:last-child td { border-bottom: 0; }
.perf tbody tr:hover { background: var(--surface-2); }
.perf .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.perf .now { font-weight: 700; }
.perf td.cur { background: var(--accent-soft); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.perf thead th.cur { color: var(--accent); }
.perf tbody th a { color: var(--ink); text-decoration: none; border-bottom: 1px dashed var(--bar-prev); }
.perf tbody th a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.table-foot { margin: 14px 2px 0; }

/* breakdown data bars */
.perf .barcell { position: relative; min-width: 160px; }
.perf .barcell .bar { position: absolute; left: 12px; bottom: 7px; height: 4px; width: calc((100% - 24px) * var(--w)); background: var(--accent); border-radius: 4px; opacity: .85; }
.perf .barcell .v { position: relative; }

/* ---------- to-do / done ---------- */
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.columns .card { margin: 0; }
.count { font-size: 12px; font-weight: 650; color: var(--accent); background: var(--accent-soft); border-radius: var(--pill); padding: 1px 9px; }
.items { list-style: none; margin: 14px 0 0; padding: 0; }
.items li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.items li:last-child { border-bottom: 0; }
.items li.empty { color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; justify-content: center; padding: 18px; }
.items .text { flex: 1; overflow-wrap: anywhere; }
form.inline { margin: 0; display: flex; }
form.add { display: flex; gap: 8px; }
form.add input { flex: 1; }

input[type=text], input[type=password] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); font: inherit; }
input::placeholder { color: var(--muted); }
button { font: inherit; font-weight: 600; padding: 10px 16px; border-radius: var(--radius-sm); border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button:hover { filter: brightness(1.08); }
button.check, button.ghost { background: none; color: var(--muted); padding: 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; font-size: 15px; font-weight: 400; }
button.check { border: 1.5px solid var(--bar-prev); margin-top: 1px; }
button.check:hover { border-color: var(--good); color: var(--good); background: var(--good-bg); filter: none; }
button.check.checked { background: var(--good); border-color: var(--good); color: #fff; }
button.ghost { opacity: 0; transition: opacity .12s; }
.items li:hover button.ghost, button.ghost:focus-visible { opacity: 1; }
button.ghost:hover { color: var(--bad); background: var(--bad-bg); filter: none; }
@media (hover: none) { button.ghost { opacity: .7; } }
.items .when { font-size: 12.5px; color: var(--muted); padding-top: 2px; white-space: nowrap; }

/* ---------- login ---------- */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 20px; }
.login .brand { justify-content: center; margin-bottom: 22px; flex-direction: column; text-align: center; gap: 12px; }
.login .card label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.login .card input { margin-top: 6px; }
.login .card button { width: 100%; margin-top: 4px; }
.login .error { color: var(--bad); background: var(--bad-bg); padding: 10px 14px; border-radius: 10px; font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) { .kpis.n4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  main { padding: 18px 14px 48px; }
  .columns { grid-template-columns: 1fr; }
  .toolbar { padding: 14px; }
  .sel { flex: 1 1 140px; } .sel select { width: 100%; min-width: 0; }
  .card { padding: 16px; }
}
@media (max-width: 520px) {
  .toolbar nav.seg, .card-head nav.seg { width: 100%; flex-wrap: nowrap; }
  .seg a { flex: 1 1 auto; text-align: center; padding: 7px 8px; font-size: 13.5px; white-space: nowrap; }
  .kpis { grid-template-columns: 1fr; gap: 12px; }
  .tile .value { font-size: 28px; }
}
