/* Layout: sticky brand bar with tabs, one column of sections, cards only where an item is its own object. */
:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --ink: #13263a;
  --muted: #5c6b7a;
  --line: #dde3e9;
  --accent: #1f5fbf;
  --accent-soft: #e6eefa;
  --gold: #b8862a;
  --ok: #1d7a4c;
  --warn: #a8660b;
  --bad: #b3261e;
  --bar: #13263a;
  --bar-ink: #f3f5f7;
  --font-display: "Rubik", "Heebo", system-ui, sans-serif;
  --font-body: "Heebo", system-ui, "Segoe UI", Arial, sans-serif;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1722; --surface: #142232; --ink: #e8eef4; --muted: #94a3b3; --line: #24384c;
    --accent: #6ea3f0; --accent-soft: #1a2f4a; --gold: #e0b45a; --ok: #5cc28d; --warn: #e3a64a; --bad: #f07c73;
    --bar: #0a121b; --bar-ink: #e8eef4; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1722; --surface: #142232; --ink: #e8eef4; --muted: #94a3b3; --line: #24384c;
  --accent: #6ea3f0; --accent-soft: #1a2f4a; --gold: #e0b45a; --ok: #5cc28d; --warn: #e3a64a; --bad: #f07c73;
  --bar: #0a121b; --bar-ink: #e8eef4; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font-body); }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; text-wrap: balance; }
h2 { font-size: 1.25rem; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* top bar */
.bar { background: var(--bar); color: var(--bar-ink); position: sticky; top: 0; z-index: 5; }
.bar .wrap { display: flex; align-items: center; gap: 20px; padding-block: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.mono { width: 34px; height: 34px; border-radius: 9px; background: color-mix(in srgb, var(--bar-ink) 10%, transparent); color: var(--gold); display: grid; place-items: center; font: 600 20px Georgia, serif; }
.brand b { font-family: var(--font-display); font-size: 1.05rem; display: block; line-height: 1.1; }
.brand small { opacity: .7; font-size: .78rem; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tabs a { color: inherit; text-decoration: none; padding: 7px 12px; border-radius: 8px; opacity: .75; white-space: nowrap; }
.tabs a:hover { opacity: 1; background: color-mix(in srgb, var(--bar-ink) 8%, transparent); }
.tabs a[aria-current="page"] { opacity: 1; background: color-mix(in srgb, var(--bar-ink) 14%, transparent); }
.bar .out { color: inherit; opacity: .7; font-size: .85rem; text-decoration: none; }

main { padding-block: 24px 60px; display: flex; flex-direction: column; gap: 28px; }
section.view { display: flex; flex-direction: column; gap: 28px; }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 16px; }
.lede { color: var(--muted); margin: 4px 0 0; max-width: 70ch; }
.lede b { color: var(--ink); font-variant-numeric: tabular-nums; }
.fresh { color: var(--muted); font-size: .8rem; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi .l { color: var(--muted); font-size: .82rem; }
.kpi .v { font-family: var(--font-display); font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .d { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.up { color: var(--ok); } .down { color: var(--bad); }

/* day timeline */
.timeline { display: flex; flex-direction: column; border-inline-start: 2px solid var(--line); margin-inline-start: 8px; }
.slot { position: relative; padding: 10px 22px 10px 0; display: grid; grid-template-columns: 64px 1fr auto; gap: 4px 14px; align-items: start; }
.slot::before { content: ""; position: absolute; inset-inline-start: -7px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.slot.done::before { background: var(--ok); border-color: var(--ok); }
.slot.fail::before { background: var(--bad); border-color: var(--bad); }
.slot .t { font-family: var(--font-display); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.slot .k { font-weight: 600; }
.slot .h { color: var(--muted); font-size: .9rem; grid-column: 2 / 3; }
.empty { color: var(--muted); padding: 18px; border: 1px dashed var(--line); border-radius: var(--r); text-align: center; }

.pill { display: inline-block; font-size: .75rem; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: currentColor; }
.pill.bad { color: var(--bad); border-color: currentColor; }
.pill.warn { color: var(--warn); border-color: currentColor; }
.pill.sched { color: var(--accent); border-color: currentColor; }
.tag { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }

.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; }
.grid2 > * { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

/* chart */
.chart { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.chart svg { display: block; width: 100%; height: auto; direction: ltr; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.legend { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 5px; vertical-align: middle; }
.tip { position: absolute; top: 8px; pointer-events: none; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 20px rgb(0 0 0 / .12); border-radius: 8px; padding: 6px 10px; font-size: .8rem; white-space: nowrap; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select, .filters input, .field input, .field select, .field textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: .85rem; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* content list */
.items { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.item > summary { list-style: none; cursor: pointer; padding: 12px 16px; display: grid; grid-template-columns: 92px 1fr auto; gap: 4px 14px; align-items: center; }
.item > summary::-webkit-details-marker { display: none; }
.item .when { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; line-height: 1.3; }
.item .when b { display: block; color: var(--ink); font-family: var(--font-display); font-size: 1.05rem; }
.item .what { min-width: 0; }
.item .what .k { font-weight: 600; }
.item .what .h { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item[open] .what .h { white-space: normal; }
.item .body { padding: 0 16px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.item .body h4 { margin: 0 0 4px; font-size: .78rem; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.item .body p { margin: 0; white-space: pre-wrap; }
.item .links a { margin-inline-end: 10px; }
@media (max-width: 560px) { .item > summary { grid-template-columns: 70px 1fr; } .item > summary .pill { grid-column: 2; justify-self: start; } }

/* tables */
.tbl { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .8rem; font-weight: 500; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.n { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* inspiration */
.add { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.add .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: .8rem; color: var(--muted); }
.drop { border: 1.5px dashed var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); cursor: pointer; font-size: .9rem; }
.drop.has { border-style: solid; }
.drop img { max-height: 120px; border-radius: 6px; display: block; margin: 0 auto 6px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 9px 18px; cursor: pointer; font-weight: 500; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 4px 10px; font-size: .82rem; }
.btn.danger { color: var(--bad); }
.msg { font-size: .85rem; color: var(--muted); }
.msg.err { color: var(--bad); }
@media (max-width: 700px) { .add { grid-template-columns: 1fr; } }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.card .shot { aspect-ratio: 4 / 3; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); font-family: var(--font-display); font-size: 1.1rem; max-width: 100%; }
.card .shot img { width: 100%; height: 100%; object-fit: cover; }
.card .in { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.card .note { margin: 0; white-space: pre-wrap; }
.card .url { font-size: .8rem; overflow-wrap: anywhere; }
.card .used { font-size: .82rem; color: var(--ok); }
.card .foot { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.card.is-used { opacity: .75; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login form { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login .mono { background: var(--bar); width: 44px; height: 44px; font-size: 26px; }
