/* Pulz šport visual identity (pulzsport.si):
   Pulz črna #1D1D1B, lipa #C6D445, jekleno siva #4F5E65, svetlo siva #E4E9E9,
   Archivo (text) and Archivo SemiExpanded (headings). */
:root {
  --pulz-black: #1D1D1B; --pulz-lime: #C6D445; --pulz-steel: #4F5E65; --pulz-light: #E4E9E9;
  --bg: #E4E9E9; --fg: #1D1D1B; --muted: #4F5E65; --card: #fff; --line: #D2D9D9;
  --link: #4F5E65; --accent: #C6D445; --accent-fg: #1D1D1B; --accent-line: #9AA62A;
  --ok: #3F6B50; --warn: #9A6A00; --bad: #A93D40; --info: #2F7F94;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121312; --fg: #E4E9E9; --muted: #A4A7A8; --card: #1D1D1B; --line: #33373A;
    --link: #C6D445; --accent-line: #C6D445;
    --ok: #7FB592; --warn: #E3B04B; --bad: #E07A7C; --info: #5EA9BD;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--fg); }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--fg); }
main { max-width: 72rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
h1, h2, h3 { font-stretch: 112.5%; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 800; margin: .5rem 0 1rem; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 1.75rem 0 .75rem; }
.muted, small { color: var(--muted); }
code { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; font-size: .9em; }

/* header */
.top { background: var(--pulz-black); padding: .6rem 1rem; display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; align-items: center;
  border-bottom: 3px solid var(--pulz-lime); }
.brand { display: flex; align-items: center; }
.brand img { height: 30px; width: auto; display: block; }
.top nav { display: flex; gap: .15rem; overflow-x: auto; white-space: nowrap; flex: 1; min-width: 0; scrollbar-width: none; }
.top nav a { color: #E4E9E9; text-decoration: none; padding: .4rem .65rem; border-radius: var(--radius); font-size: .95rem; font-weight: 500; }
.top nav a:hover { color: var(--pulz-lime); }
.top nav a.active { background: var(--pulz-lime); color: var(--pulz-black); }
.top nav a.logout { margin-left: auto; color: #A4A7A8; }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid var(--line); border-left-width: 4px; background: var(--card); }
.flash.ok { border-left-color: var(--accent-line); }
.flash.error { border-left-color: var(--bad); color: var(--bad); }
.flash.warn { border-left-color: var(--warn); color: var(--warn); }

/* login */
.narrow { max-width: 24rem; margin: 2rem auto; }
.narrow form.card { display: flex; flex-direction: column; gap: .7rem; }
.narrow form.card h2 { margin-bottom: 0; }
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand img { height: 64px; width: auto; }
.login-brand p { margin: .25rem 0 0; color: var(--muted); font-stretch: 112.5%; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .85rem; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo-light { display: none; } .logo-dark { display: inline; } }

/* forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card h2 { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .8rem 1rem; }
.grid .wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--muted); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--fg); }
input, select, textarea, button, .btn {
  font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .5rem .7rem; min-height: 2.6rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pulz-lime); outline-offset: 0; border-color: var(--accent-line); }
input[type=checkbox] { accent-color: var(--pulz-steel); min-height: 0; }
textarea { width: 100%; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); }
button, .btn { cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
button:hover, .btn:hover { border-color: var(--fg); color: var(--fg); }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.primary:hover, .btn.primary:hover { background: var(--pulz-black); color: var(--pulz-lime); border-color: var(--pulz-black); }
button.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
button.small, .btn.small { min-height: 2rem; padding: .2rem .6rem; font-size: .85rem; }
button.big { min-height: 3.1rem; font-size: 1.05rem; width: 100%; }
form.inline { display: inline; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.row label { flex-direction: row; align-items: center; }
.actions { display: flex; gap: .5rem; }
.actions.sticky { position: sticky; bottom: 0; background: var(--bg); padding: .75rem 0; margin-top: 1rem; }
.actions.sticky .big { flex: 1; }

/* tables */
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: color-mix(in srgb, var(--bg) 50%, var(--card)); }
tr:last-child td { border-bottom: 0; }
tr.inactive td, label.inactive { opacity: .55; }
td.nowrap, .nowrap { white-space: nowrap; }
.overdue { color: var(--bad); }
table.sums { max-width: 32rem; }
table.sums td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.sums tr.total td { font-weight: 800; font-size: 1.1rem; border-top: 2px solid var(--fg); }
@media (max-width: 640px) {
  table { display: block; overflow-x: auto; }
}

/* tags */
.tag { display: inline-block; font-size: .76rem; font-weight: 600; padding: .05rem .5rem; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.ok, .tag.continue, .tag.sent { color: var(--ok); border-color: var(--ok); }
.tag.reminded, .tag.approved { color: var(--info); border-color: var(--info); }
.tag.stop { color: var(--bad); border-color: var(--bad); }
.tag.draft, .tag.pending { color: var(--warn); border-color: var(--warn); }

/* dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--muted); }
.tile:hover { border-top-color: var(--fg); color: var(--muted); }
.tile b { display: block; font-size: 2rem; font-weight: 800; font-stretch: 112.5%; color: var(--fg); }
.tile.warn { border-top-color: var(--pulz-lime); }
.tabs { display: flex; gap: .25rem; margin: 1rem 0 .5rem; flex-wrap: wrap; }
.tabs a { padding: .4rem .85rem; border-radius: var(--radius); text-decoration: none; border: 1px solid transparent; color: var(--fg); font-weight: 500; }
.tabs a:hover { border-color: var(--line); }
.tabs a.active { background: var(--pulz-black); color: var(--pulz-lime); }
@media (prefers-color-scheme: dark) { .tabs a.active { background: var(--pulz-lime); color: var(--pulz-black); } }

/* attendance */
.daynav { display: flex; gap: .5rem; align-items: center; }
.daynav form { flex: 1; }
.daynav input { width: 100%; }
.slotcard { display: flex; flex-direction: column; gap: .15rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .6rem; text-decoration: none; color: var(--fg); }
.slotcard:hover { color: var(--fg); border-color: var(--fg); }
.slotcard.own { border-left: 6px solid var(--pulz-lime); }
.slotcard .time { font-size: 1.35rem; font-weight: 800; font-stretch: 112.5%; }
.roll { display: flex; flex-direction: column; gap: .45rem; margin-bottom: 1rem; }
.person { flex-direction: row; align-items: center; gap: .9rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; font-size: 1.1rem; color: var(--fg); cursor: pointer; font-weight: 500; }
.person input[type=checkbox] { width: 1.6rem; height: 1.6rem; accent-color: var(--pulz-black); }
.person:has(input:checked) { border-color: var(--accent-line); background: color-mix(in srgb, var(--pulz-lime) 18%, var(--card)); }
.person.extra { border-style: dashed; }
@media (prefers-color-scheme: dark) { .person input[type=checkbox] { accent-color: var(--pulz-lime); } }
.slotpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .35rem 1rem; }
pre.card { white-space: pre-wrap; font: .9rem/1.5 ui-monospace, Consolas, monospace; }

/* ---- user manuals ---- */
.manual { max-width: 46rem; }
.manual-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.manual .lead { font-size: 1.05rem; }
.manual h2 { margin-top: 2.25rem; padding-top: .75rem; border-top: 3px solid var(--pulz-lime); scroll-margin-top: 1rem; }
.manual h3 { font-size: 1rem; margin: 1.25rem 0 .4rem; }
.manual li { margin-bottom: .35rem; }
.manual ol.steps > li { padding-left: .25rem; }
.manual ol.steps > li::marker { font-weight: 800; }
.toc { display: flex; flex-direction: column; gap: .2rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.tip { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--pulz-lime); border-radius: var(--radius); padding: .7rem 1rem; margin: 1rem 0; }
.tip.warn { border-left-color: var(--warn); }
.tip ul { margin: .4rem 0 0; }
.warn-text { color: var(--warn); font-style: normal; font-weight: 600; }
table.legend td:first-child { width: 38%; font-weight: 600; }
.faq dt { font-weight: 700; margin-top: .8rem; }
.faq dd { margin: .2rem 0 0; }
@media print {
  .top, .manual-head button, .toc { display: none; }
  body { background: #fff; color: #000; }
  .manual { max-width: none; }
  .manual h2 { break-after: avoid; }
}

/* ---- schedule / calendar ---- */
.cal-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.cal-toolbar .row { margin-bottom: 0; }
.cal-toolbar h1 { margin: 0 .5rem; font-size: 1.35rem; }
.cal-toolbar .tabs { margin: 0; }
.cal-event, .cal-chip {
  --c: #A4A7A8;
  background: color-mix(in srgb, var(--c) 24%, var(--card)); border-left: 4px solid var(--c);
  color: var(--fg); text-decoration: none; border-radius: 4px; font-size: .8rem; line-height: 1.25;
}
.cal-event:hover, .cal-chip:hover { color: var(--fg); background: color-mix(in srgb, var(--c) 40%, var(--card)); }
.cal-event b { font-weight: 800; }
.cal-event.missing, .cal-chip.missing { outline: 2px dashed var(--warn); outline-offset: -2px; }
.cal-event em { color: var(--warn); font-style: normal; font-weight: 600; }
.cal-event.past { opacity: .7; }

.cal-week { display: grid; grid-template-columns: 3.2rem repeat(7, minmax(0, 1fr)); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-corner, .cal-dayhead { border-bottom: 1px solid var(--line); padding: .5rem .25rem; }
.cal-dayhead { text-align: center; text-decoration: none; color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-left: 1px solid var(--line); }
.cal-dayhead b { display: block; font-size: 1.35rem; font-weight: 800; font-stretch: 112.5%; color: var(--fg); letter-spacing: 0; }
.cal-dayhead.today b { background: var(--pulz-lime); color: var(--pulz-black); border-radius: 99px; width: 2.3rem; margin: 0 auto; }
.cal-hours div { height: var(--px); font-size: .72rem; color: var(--muted); text-align: right; padding-right: .35rem; transform: translateY(-.45em); }
.cal-hours div:first-child { transform: none; }
.cal-col { position: relative; height: calc(var(--hours) * var(--px)); border-left: 1px solid var(--line);
  background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--px)); }
.cal-col.today { background-color: color-mix(in srgb, var(--pulz-lime) 10%, transparent); }
.cal-week .cal-event { position: absolute; padding: .2rem .35rem; font-size: .75rem; line-height: 1.2; overflow: hidden; display: flex; flex-direction: column;
  box-sizing: border-box; border-right: 2px solid var(--card); }
.cal-agenda { display: none; }
.cal-agenda section { margin-bottom: 1rem; }
.cal-agenda h3 { font-size: 1rem; margin: 0 0 .4rem; }
.cal-agenda section.today h3 { display: inline-block; background: var(--pulz-lime); color: var(--pulz-black); padding: .1rem .5rem; border-radius: 4px; }
.cal-event.flat { display: flex; flex-wrap: wrap; gap: .1rem .75rem; padding: .7rem .9rem; margin-bottom: .4rem; font-size: .95rem; }

.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-mhead { text-align: center; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .45rem 0; border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 6.5rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .25rem;
  display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.out { opacity: .45; }
.cal-daynum { font-size: .85rem; font-weight: 700; text-decoration: none; color: var(--fg); align-self: flex-start; padding: 0 .4rem; border-radius: 99px; }
.cal-cell.today .cal-daynum { background: var(--pulz-lime); color: var(--pulz-black); }
.cal-chip { padding: .1rem .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 720px) {
  .cal-week { display: none; }
  .cal-agenda { display: block; }
  .cal-cell { min-height: 4.5rem; padding: .15rem; }
  .cal-chip { font-size: .68rem; padding: .05rem .15rem; border-left-width: 3px; }
  .cal-chip span { display: none; }
}

/* training types, trials, trainee status */
.tag.kind { --c: #A4A7A8; color: var(--fg); border-color: var(--c); background: color-mix(in srgb, var(--c) 24%, var(--card)); }
.tag.free { color: var(--info); border-color: var(--info); }
.tag.st-active, .tag.st-starting { color: var(--ok); border-color: var(--ok); }
.tag.st-trial, .tag.st-waiting, .tag.st-new { color: var(--info); border-color: var(--info); }
.tag.st-inactive, .tag.st-archived { color: var(--muted); }
.slotcard { border-left: 6px solid var(--c, var(--line)); }
.person.trial { border-color: var(--info); }
table.price-list input { width: 100%; min-width: 0; }
/* One price table per training type: each in its own column, never wider than it */
.price-grids { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); gap: 1rem; }
.price-grids, .price-grids table { min-width: 0; max-width: 100%; }
.price-grids { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.price-grids table { margin: 0; width: 100%; table-layout: fixed; display: table; }
.price-grids th, .price-grids td { padding: .45rem .4rem; overflow-wrap: anywhere; }
.price-grids th:first-child, .price-grids td:first-child { width: 4.5rem; }

/* payments, bank, incoming invoices, finance charts */
:root { --c-in: #1F7FA3; --c-out: #C0702A; --c-net: #1D1D1B; --c-run: #C2474A; --c-swim: #1F86B0;
        --c-functional: #7F9216; --c-other: #8A9396; }
@media (prefers-color-scheme: dark) {
  :root { --c-in: #3C97C8; --c-out: #D07A34; --c-net: #E4E9E9; --c-run: #D25E61; --c-swim: #3C97C8;
          --c-functional: #7F9216; --c-other: #7A8285; }
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.table-wrap table { margin-bottom: 0; }
.late { font-weight: 700; white-space: nowrap; }
.late-1 { color: var(--warn); }
.late-2 { color: var(--bad); }
.tag.paid, .tag.bill-paid { color: var(--ok); border-color: var(--ok); }
.tag.bill-review { color: var(--warn); border-color: var(--warn); }
.tag.bill-open { color: var(--info); border-color: var(--info); }
.amt-in { color: var(--ok); font-weight: 600; }
.amt-out { color: var(--fg); }
table.bank td:last-child { min-width: 16rem; }
form.suggest { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .5rem; margin-bottom: .35rem; }
.row.tight { margin-bottom: .35rem; flex-wrap: nowrap; }
.row.tight select { min-width: 0; flex: 1; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.preview { position: sticky; top: 1rem; }
.preview iframe { width: 100%; height: 80vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.preview img { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }
.qr-pay { display: flex; gap: 1rem; align-items: center; }
.qr-pay img { flex: none; background: #fff; border-radius: 4px; }
.chart-card h2 { margin-bottom: .25rem; }
.chart-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(26rem, 100%), 1fr)); gap: 0 1rem; }
.legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .85rem; color: var(--fg); margin: .5rem 0; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.sw { width: .8rem; height: .8rem; border-radius: 3px; background: var(--c); display: inline-block; }
.sw.line { height: 2px; width: 1rem; border-radius: 0; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .zero { stroke: var(--muted); stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 12px; font-family: inherit; }
svg.chart .value { fill: var(--fg); font-size: 12px; font-weight: 600; font-family: inherit; }
svg.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; }
svg.chart .dot { stroke: var(--card); stroke-width: 2; }
svg.chart .hit { fill: transparent; }
svg.chart .hit:hover { fill: color-mix(in srgb, var(--fg) 6%, transparent); }
details summary { cursor: pointer; color: var(--link); font-weight: 600; margin-top: .5rem; }
table.wide-sums { max-width: none; margin-top: .5rem; }
table.wide-sums td { text-align: right; }
table.wide-sums td:first-child { text-align: left; }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .preview { position: static; }
  .preview iframe { height: 60vh; }
}
.chart-scroll { overflow-x: auto; }
@media (max-width: 600px) { svg.chart { min-width: 560px; } }
