:root {
  --series-1: #2a78d6; --series-2: #eb6834;
  --bg: #faf8f5; --fg: #1f1d1a; --muted: #6b665e; --line: #e2ddd5;
  --accent: #2f6b4f; --accent-fg: #fff; --warn: #a3481c; --card: #fff;
}
@media (prefers-color-scheme: dark) {
  :root { --series-1: #3987e5; --series-2: #d95926;
          --bg: #181715; --fg: #eeeae3; --muted: #a39d93; --line: #34312c;
          --accent: #5fae86; --accent-fg: #0e1a14; --warn: #e08a5c; --card: #22211e; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg);
       font: 17px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; gap: .75rem; align-items: center; padding: .6rem 1rem;
         border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
header .brand { font-weight: 700; color: var(--fg); text-decoration: none; }
header nav { display: flex; gap: 1rem; order: 3; flex-basis: 100%; overflow-x: auto; white-space: nowrap;
  padding-bottom: .2rem; }
header form { margin-left: auto; }
main { max-width: 720px; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.5rem; margin: .5rem 0 1rem; }
a { color: var(--accent); }
.flash { background: var(--card); border-left: 4px solid var(--warn); padding: .6rem .8rem; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }

label { display: block; margin: .75rem 0; }
input, select, textarea { display: block; width: 100%; margin-top: .25rem; padding: .7rem;
  font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
input[type=checkbox], input[type=radio] { display: inline; width: auto; margin: 0 .4rem 0 0; }
button, .button { display: inline-block; padding: .7rem 1.1rem; font: inherit; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer; text-decoration: none;
  white-space: nowrap; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); width: 100%; }
button.link { background: none; border: 0; padding: 0; color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin-bottom: .5rem; }

.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.choice { margin: 0; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; padding: .9rem; text-align: center; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); }
.choice input:checked + span { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.menu { list-style: none; padding: 0; display: grid; gap: .5rem; }
.menu a { display: block; padding: 1rem; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; text-decoration: none; color: var(--fg); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.inactive td { color: var(--muted); text-decoration: line-through; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; }

.small { font-size: .85rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
section { margin-bottom: 1.5rem; }
.actions { margin-bottom: 1rem; }
.actions form { flex: 0; }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: .75rem; margin-bottom: .5rem; color: var(--fg); text-decoration: none; }
.card-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .4rem; border-radius: 4px;
  background: var(--warn); color: var(--card); }
.summary { display: flex; gap: 1rem; flex-wrap: wrap; }
.notes { white-space: pre-line; background: var(--card); border-left: 3px solid var(--line); padding: .4rem .6rem; }
.state { font-size: .85rem; white-space: nowrap; }
.state-unpaid, .state-partial { color: var(--warn); font-weight: 600; }
.state-paid { color: var(--accent); }
.state-invoice, .state-on_site, .state-free, .state-cancelled { color: var(--muted); }
.inactive-title { text-decoration: line-through; }
label.inline { display: inline; margin: 0; }
button.suggest { width: 100%; text-align: left; margin: .25rem 0; white-space: normal; }
button.danger, .danger-zone button { background: var(--warn); border-color: var(--warn); color: var(--card); }
.danger-zone { margin-top: 2rem; }
details { margin: .5rem 0; }
summary { cursor: pointer; color: var(--accent); }

.scroll { overflow-x: auto; }
table.payroll { font-size: .9rem; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.balance strong { font-size: 1.6rem; }

/* kassa */
.chips, .cats { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; }
.cats { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .3rem; }
.chip { padding: .55rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--fg); text-decoration: none; white-space: nowrap; font: inherit; }
.chip.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: .4rem; margin-bottom: .8rem; }
.product-grid form { margin: 0; }
button.product { width: 100%; min-height: 4.2rem; padding: .5rem; white-space: normal; line-height: 1.2; text-align: left; }
button.product span { display: block; color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.order-lines td.qty { white-space: nowrap; }
.order-lines td.qty form { display: inline; }
button.qbtn { padding: .35rem .7rem; }
details.note summary { color: var(--muted); }
pre.receipt { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1rem;
  white-space: pre-wrap; font: .95rem/1.5 ui-monospace, Menlo, monospace; }
.ticket ul { list-style: none; padding: 0; margin: .5rem 0; font-size: 1.15rem; }
.ticket li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.ticket li.removed { text-decoration: line-through; }
.note-line { font-weight: 600; color: var(--warn); }

/* ladu */
label.shop-line { display: flex; gap: .6rem; align-items: flex-start; margin: .5rem 0; }
label.shop-line input { width: 1.4rem; height: 1.4rem; margin-top: .15rem; flex: none; }
.purchase-lines td { padding: .25rem; }
.purchase-lines input, .purchase-lines select { margin: 0; }

/* ülevaade */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; margin: 1rem 0 .5rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .7rem; }
.kpi strong { display: block; font-size: 1.35rem; }
.delta { font-size: .8rem; font-weight: 600; }
.delta.good { color: var(--accent); }
.delta.bad { color: var(--warn); }
.legend { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; color: var(--muted); }
.swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-left: .4rem; }
.swatch.s1, svg.bars .s1 { background: var(--series-1); fill: var(--series-1); }
.swatch.s2, svg.bars .s2 { background: var(--series-2); fill: var(--series-2); }
svg.bars { width: 100%; height: auto; display: block; }
svg.bars .axis { stroke: var(--line); stroke-width: 1; }
svg.bars .hit { fill: transparent; }
svg.bars a:hover .hit { fill: var(--line); opacity: .35; }
svg.bars text { fill: var(--muted); font-size: 11px; }
tr.more { display: none; }
section:has(details.show-more[open]) tr.more { display: table-row; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1.5rem; }
.fill { display: grid; grid-template-columns: 1fr 40% auto; gap: .6rem; align-items: center; margin: .3rem 0; }
.meter { height: .6rem; background: var(--line); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--series-1); border-radius: 999px; }

th.section-head { padding-top: 1rem; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.count-sheet input { margin: 0; max-width: 7rem; }

/* Broneeringute kalender */
.cal-nav { display: flex; gap: 1rem; align-items: center; }
.cal { width: 100%; table-layout: fixed; border-collapse: collapse; margin-bottom: 1.5rem; }
.cal th { font-size: .75rem; color: var(--muted); font-weight: 600; text-align: center; padding: .2rem 0; }
.cal td { border: 1px solid var(--line); padding: 0; vertical-align: top; height: 4.2rem; }
.cal td a { display: flex; flex-direction: column; gap: .1rem; height: 100%; padding: .15rem; color: var(--fg);
  text-decoration: none; overflow: hidden; }
.cal td.other a { color: var(--muted); }
.cal td.busy { background: var(--card); }
.cal td.today .cal-day { font-weight: 700; text-decoration: underline; }
.cal-day { font-size: .8rem; }
.cal-event { font-size: .6rem; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; overflow-wrap: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal-guests { font-size: .7rem; color: var(--muted); }
.cal-unpaid { font-size: .7rem; color: var(--warn); font-weight: 600; }
