/* Martella hinnaülevaade: Selgara demo design system "Forest" (same tokens as demo.selgara.eu), one file for every page.
   Motion is small and functional: the page settles in once, hovers respond, opened sections and saved changes show it.
   Nothing counts up, pulses or draws itself; prefers-reduced-motion turns all of it off. */
:root {
  --bg: #fafafa; --panel: #ffffff; --text: #1e1e1e; --muted: #666666; --subtle: #8d8d8d; --line: #eeeeee; --line-2: #d8d8d8;
  --accent: #1f7a4d; --accent-2: #3c7851; --accent-soft: #e4ece6; --accent-ink: #224930;
  --signal: #94680f; --signal-soft: #faf1e0; --signal-dot: #e8a317;
  --info: #3e6fa8; --info-soft: #e7eff8; --info-dot: #548ccb;
  --ok: #4f7a16; --ok-soft: #e7efdd; --ok-dot: #6c9a2e; --warn: #94680f; --warn-soft: #faf1e0;
  --bad: #b8423d; --bad-soft: #fce8e7; --bad-dot: #ed6d68;
  --radius: 12px; --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 20, .04);
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 6px 20px -8px rgba(20, 20, 20, .10);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
       background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Left menu (base.html): app name, page links with icons and counts, Juhised and the user at the bottom. Same shape as
   the Karl app's menu. On a phone it slides in over the page from a top bar. ------------------------------------- */
body.has-side { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap;
         color: var(--text); text-decoration: none; }
.brand small { display: block; font-weight: 400; font-size: .76rem; color: var(--subtle); letter-spacing: 0; }
.brand:hover { color: var(--text); }
.mark { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; flex: none;
        background: var(--accent); color: #fff; font-size: .82rem; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); }
.logo { display: block; height: 21px; width: auto; flex: none; }
.brand .name { font-size: 1.05rem; line-height: 1.15; }
.brand-lg { margin: 0 0 18px; gap: 11px; }
.brand-lg .logo { height: 30px; }
.brand-lg .name { font-size: 1.35rem; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
        padding: 20px 12px 16px; background: var(--panel); border-right: 1px solid var(--line); }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 18px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px; border-radius: 10px; border: 0;
             background: none; color: var(--muted); font-size: .9rem; text-decoration: none; text-align: left; width: 100%;
             cursor: pointer; transition: background-color .15s, color .15s; }
.side-link .ico { flex: none; }
.side-link .lbl { flex: 1 1 auto; min-width: 0; }
.side-link:hover { background: #f3f3f1; color: var(--text); }
.side-link.on, .side-link.on:hover { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.side-link kbd { font: .72rem/1 ui-monospace, monospace; border: 1px solid var(--line-2); border-radius: 4px; padding: 2px 5px;
                 color: var(--subtle); background: var(--bg); }
.side-sep { height: 1px; background: var(--line); margin: 8px 10px; }
.side-grow { flex: 1 1 auto; min-height: 16px; }
.side .count { margin-left: 0; }
.who { display: flex; gap: 10px; align-items: center; margin: 8px 0 0; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.who .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: .72rem;
               font-weight: 700; display: inline-flex; align-items: center; justify-content: center; letter-spacing: .02em; flex: none; }
.who .name { flex: 1 1 auto; min-width: 0; font-size: .86rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .linkish { color: var(--subtle); text-decoration: none; }
.who .linkish:hover { color: var(--text); text-decoration: underline; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 5px; border-radius: 999px; background: var(--warn-soft);
         color: var(--warn); font-size: .74rem; font-weight: 600; text-align: center; line-height: 1.6; }
.count.bad { background: var(--bad-soft); color: var(--bad); }
.linkish { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.topbar, .menu-btn, .side-backdrop { display: none; }
.menu-btn { align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--panel); border-radius: 999px;
            padding: 6px 12px; font-size: .86rem; cursor: pointer; color: var(--text); }
.menu-btn.close { padding: 6px; border-color: transparent; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Page ---------------------------------------------------------------------------------------------- */
main { padding: 26px 32px 64px; }
h1 { font-size: 1.85rem; line-height: 1.15; letter-spacing: -.03em; margin: 0 0 8px; }
h2 { font-size: 1.05rem; letter-spacing: -.01em; margin: 0 0 4px; }
.phead { display: flex; gap: 28px; align-items: flex-end; justify-content: space-between; margin: 0 0 22px; flex-wrap: wrap; }
.phead .lead { margin: 0; }
.eyebrow { display: inline-block; font-size: .76rem; font-weight: 500; color: var(--accent-ink); background: var(--accent-soft);
           padding: 3px 11px; border-radius: 999px; margin: 0 0 12px; }
.lead { color: var(--muted); margin: 0 0 20px; max-width: 780px; font-size: 1rem; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 34px 0 12px; }
.section-title h2 { font-size: 1.2rem; margin: 0; }
.muted { color: var(--muted); } .small { font-size: .84rem; } .subtle { color: var(--subtle); } .nowrap { white-space: nowrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; margin: 0 0 18px;
        box-shadow: var(--shadow-sm); }
.card > p.muted { margin: 0 0 12px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin: 0 0 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0 0 2px; }
.card-head p { margin: 0; }
.card-head .more { font-size: .86rem; white-space: nowrap; text-decoration: none; font-weight: 500; }
.card-head .more:hover { text-decoration: underline; }
.tablewrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

/* Buttons, pills ------------------------------------------------------------------------------------ */
.btn { padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-size: .9rem;
       text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
       transition: border-color .15s, background-color .15s, color .15s, transform .1s, box-shadow .15s; }
.btn:hover { border-color: var(--subtle); color: var(--text); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
.btn.small { padding: 4px 11px; font-size: .8rem; }
.btn.done { border-color: var(--ok-dot); background: var(--ok-soft); color: var(--ok); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 500; padding: 1px 9px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--info-soft); color: var(--info); }

/* Numbers and tables -------------------------------------------------------------------------------- */
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.big { font-weight: 700; font-size: 1.02rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.unit { font-size: .74rem; font-weight: 500; color: var(--subtle); margin-left: 2px; }
.up, .down { color: var(--text); font-weight: 600; }  /* neutral: Eduard both buys and sells, so a rise is not good or bad by itself */
.chg { display: inline-flex; align-items: center; gap: 3px; font-size: .8rem; font-weight: 600; padding: 1px 8px; border-radius: 999px;
       background: #f3f3f1; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chg.flat { color: var(--subtle); font-weight: 500; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--subtle); font-weight: 600;
             padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th.n { text-align: right; }
table.t td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tbody tr { transition: background-color .12s; }
table.t tbody tr:hover td { background: #fbfbfa; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tr.group td { background: transparent; font-weight: 700; font-size: .8rem; letter-spacing: .01em; color: var(--accent-ink);
                      padding: 16px 10px 6px; border-bottom: 1px solid var(--line); }
table.t tr.group:hover td { background: transparent; }
table.t tr.stale td, table.t tr.old td { color: var(--subtle); }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; vertical-align: middle; margin-right: 6px; background: var(--line-2); }

/* Details ------------------------------------------------------------------------------------------- */
details > summary { cursor: pointer; color: var(--muted); margin: 10px 0 0; list-style: none; display: inline-flex; align-items: center; gap: 6px;
                    font-size: .88rem; user-select: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
                            transform: rotate(-45deg); transition: transform .18s var(--ease); margin-right: 2px; }
details[open] > summary::before { transform: rotate(45deg); }
details > summary:hover { color: var(--text); }
details[open] > :not(summary) { animation: rise .22s var(--ease) both; }

/* Forms --------------------------------------------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: .86rem; margin: 0 0 5px; }
.field { margin: 0 0 16px; }
.field .hint, label .hint { font-weight: 400; color: var(--subtle); font-size: .8rem; }
input[type=text], input[type=date], input[type=url], input[type=password], select, textarea {
  width: 100%; max-width: 420px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel);
  transition: border-color .15s, box-shadow .15s; }
input[type=text]:hover, input[type=date]:hover, input[type=url]:hover, input[type=password]:hover, select:hover, textarea:hover { border-color: #c4c4c0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 122, 77, .14); }
textarea { max-width: 640px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.err { color: var(--bad); font-size: .84rem; margin-top: 4px; }
.alert { background: var(--bad-soft); color: var(--text); border-radius: var(--radius); padding: 11px 16px; margin: 0 0 18px; border: 1px solid #f6d3d1; }
.field.bad input, .field.bad select { border-color: var(--bad); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; max-width: 920px; }
.flash { display: flex; align-items: center; gap: 10px; background: var(--ok-soft); color: var(--ok); border-radius: var(--radius); padding: 11px 16px;
         margin: 0 0 18px; font-weight: 500; animation: pop .35s var(--ease) both; }
.flash::before { content: "✓"; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%;
                 background: var(--ok); color: #fff; font-size: .72rem; font-weight: 700; }
input[type=file] { font-size: .86rem; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-weight: 500; color: var(--text); background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 999px; padding: 6px 14px; margin-right: 12px; cursor: pointer; transition: border-color .15s, background-color .15s; }
input[type=file]::file-selector-button:hover { border-color: var(--subtle); background: #f6f6f4; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 0 18px; align-items: start; }
.split > * { min-width: 0; }

/* Review list (Kinnita) ------------------------------------------------------------------------------ */
.review { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 28px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.reviews > .review:first-child { border-top: 0; padding-top: 2px; }
.reviews > .review:last-child { padding-bottom: 2px; }
.review .top { font-size: .9rem; }
.review .price { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 4px 0 3px; color: var(--muted); font-size: .86rem; }
.review .price .v { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.review form { display: flex; gap: 8px; align-items: center; }
.review form input { width: 230px; }

/* Filters: label, segmented choice, chips ----------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: flex-end; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
.filters legend, .flabel { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--subtle); font-weight: 600; margin: 0 0 6px; padding: 0; }
.filters select { width: auto; padding: 7px 34px 7px 14px; border-radius: 999px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: #f1f1ef; }
.seg label { position: relative; margin: 0; font-weight: 500; font-size: .86rem; }   /* keeps the hidden radio inside the scrolling pill */
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 5px 13px; border-radius: 999px; cursor: pointer; color: var(--muted); white-space: nowrap;
            transition: background-color .18s var(--ease), color .18s, box-shadow .18s; }
.seg span:hover { color: var(--text); }
.seg input:checked + span { background: var(--panel); color: var(--accent-ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px rgba(0, 0, 0, .03); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; font-size: .86rem; margin: 0; cursor: pointer; padding: 5px 12px 5px 10px;
        border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); user-select: none;
        transition: border-color .15s, background-color .15s, box-shadow .15s; }
.chip:hover { border-color: var(--subtle); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip .n { color: var(--subtle); font-weight: 400; font-size: .78rem; }
.chip .swatch { margin: 0; }
.chip:has(input:checked) { border-color: transparent; background: #f3f3f1; box-shadow: inset 0 0 0 1.5px var(--text); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.plain::before { content: ""; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--line-2); background: #fff; flex: none;
                      transition: background-color .15s, border-color .15s; }
.chip.plain:has(input:checked)::before { background: var(--text) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.2 2.2 4.8-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/10px no-repeat; border-color: var(--text); }
.filter-row { padding-top: 14px; margin-top: 16px; border-top: 1px solid var(--line); }
.filter-row .flabel { display: block; }
fieldset.filter-row > legend { float: left; width: 100%; margin-bottom: 8px; }
fieldset.filter-row > legend + * { clear: both; }

/* Charts -------------------------------------------------------------------------------------------- */
.chartbox { position: relative; height: 400px; }
.chartbox canvas { animation: fade .45s ease-out both; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.legend button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; padding: 3px 9px 3px 6px; border-radius: 999px;
                 font-size: .82rem; color: var(--text); cursor: pointer; transition: background-color .15s, opacity .15s; }
.legend button:hover { background: #f3f3f1; }
.legend button.off { opacity: .4; }
.legend button.off .key { filter: grayscale(1); }
.legend .key { width: 16px; height: 3px; border-radius: 2px; flex: none; }
.legend .key.dash { background-image: linear-gradient(90deg, currentColor 60%, transparent 0) !important; background-size: 6px 3px !important; }
/* Filter changes swap only the data (live.js): it dims while loading, then the new data simply replaces it. */
.part { display: contents; }
[data-part="data"], [data-part="markets"] { transition: opacity .18s; }
html.is-loading [data-part="data"], html.is-loading [data-part="markets"] { opacity: .5; transition-delay: .12s; }
html.swapped .chartbox canvas { animation: none; }
.hint { color: var(--subtle); font-size: .8rem; margin: 10px 0 0; line-height: 1.55; }
.empty { padding: 56px 10px; text-align: center; color: var(--muted); }

/* Price ladder: every market on one €/kg axis (templates/_ladder.html) ---------------------------------
   A bar is the source's day range, a dot its usual price. Freshness is a state: faded at 4-14 days, hatched after. */
.ladder { --cols: minmax(150px, 220px) minmax(0, 1fr) 132px 92px 88px; --grid: #ececea;
          --mark: #4f4f4a; --bar: rgba(79, 79, 74, .16); --bar-strong: rgba(79, 79, 74, .42); }
.lsec.own { --mark: var(--accent); --bar: rgba(31, 122, 77, .20); --bar-strong: rgba(31, 122, 77, .5); }
.laxis, .lrow { display: grid; grid-template-columns: var(--cols); column-gap: 18px; align-items: center; }
.laxis { padding: 0 calc(10px + 5.5rem + 6px) 0 10px; height: 20px; font-size: .72rem; color: var(--subtle); font-variant-numeric: tabular-nums; }
.laxis .ltrack { height: 20px; background: none; box-shadow: none; }
.laxis .ltrack i { position: absolute; top: 2px; transform: translateX(-50%); font-style: normal; white-space: nowrap; }
.laxis .ltrack i:first-child { transform: none; }
.laxis .ltrack i:last-child { transform: translateX(-100%); }
.lhead { font-size: .8rem; font-weight: 600; color: var(--muted); padding: 14px 10px 4px; }
.lsec.own .lhead { color: var(--accent-ink); }
.lrow { padding: 8px 10px; border-radius: 10px; color: var(--text); text-decoration: none; min-height: 52px; transition: background-color .15s; }
a.lrow:hover, a.lrow:focus-visible { background: #f6f6f4; color: var(--text); }
/* A row and its source link side by side; the axis above leaves the same right-hand space (5.5rem + 6px gap). */
.lline { display: flex; align-items: center; gap: 6px; }
.lline > .lrow { flex: 1 1 auto; min-width: 0; }
.lsrc { flex: 0 0 5.5rem; padding: 8px 4px; border-radius: 6px; font-size: .74rem; color: var(--subtle);
        white-space: nowrap; text-decoration: underline; text-underline-offset: 2px; }
.lsrc:hover, .lsrc:focus-visible { color: var(--accent-ink); }
.ltrack { position: relative; align-self: stretch; min-height: 30px;
          background: repeating-linear-gradient(90deg, var(--grid) 0 1px, transparent 1px calc(100% / var(--n)));
          box-shadow: inset -1px 0 0 var(--grid); }
.lbar { position: absolute; top: 50%; height: 8px; margin-top: -4px; min-width: 3px; border-radius: 4px; background: var(--bar); }
.ronly .lbar { background: var(--bar-strong); box-shadow: inset 2px 0 0 var(--mark), inset -2px 0 0 var(--mark); }
.ldot { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--mark);
        box-shadow: 0 0 0 2px var(--panel); }
.lname { min-width: 0; }
.lname b { display: block; font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }
.lname small { display: block; color: var(--subtle); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lval { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.25; }
.lval b { font-size: 1.12rem; font-weight: 700; letter-spacing: -.02em; }
.lval small { font-size: .74rem; color: var(--subtle); }
.lval .lrange { display: block; color: var(--muted); }
.lspark { display: flex; justify-content: flex-end; }
.lspark .spark polyline { stroke: #8f8f89; stroke-width: 1.5; }
.lspark .spark circle { fill: var(--mark); }
.lage { text-align: right; font-size: .8rem; color: var(--subtle); white-space: nowrap; }
.lrow.vananeb .lbar, .lrow.vananeb .ldot, .lrow.vananeb .spark { opacity: .45; }
.lrow.vananeb .lval b { color: var(--muted); }
.lrow.vana .lbar { background: repeating-linear-gradient(135deg, var(--bar-strong) 0 2px, transparent 2px 5px); box-shadow: none; }
.lrow.vana .ldot { background: var(--panel); box-shadow: inset 0 0 0 2px #a8a8a2, 0 0 0 2px var(--panel); }
.lrow.vana .lval b, .lrow.vana .lname b { color: var(--subtle); }
.lrow.vana .spark { opacity: .45; }
.pill.old { background: #f1f1ef; color: var(--muted); }
.howto { margin: 6px 0 0; }
.howto > summary { font-size: .82rem; }
.key { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 10px 26px; margin: 12px 0 0;
       font-size: .82rem; color: var(--muted); }
.key > div { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; align-items: start; }
.key dt { display: flex; align-items: center; justify-content: center; height: 20px; }
.key dd { margin: 0; line-height: 1.45; }
.kbar { width: 56px; height: 8px; border-radius: 4px; background: rgba(79, 79, 74, .16); }
.kbar.strong { background: rgba(79, 79, 74, .42); box-shadow: inset 2px 0 0 #4f4f4a, inset -2px 0 0 #4f4f4a; }
.kdot { width: 56px; height: 8px; border-radius: 4px; background: rgba(79, 79, 74, .16); position: relative; }
.kdot::after { content: ""; position: absolute; left: 34px; top: -2px; width: 12px; height: 12px; border-radius: 50%; background: #4f4f4a;
               box-shadow: 0 0 0 2px var(--panel); }
.kdot.alone { background: none; }
.key .spark polyline { stroke: #8f8f89; stroke-width: 1.5; }

/* Allikad ------------------------------------------------------------------------------------------- */
.src-sum { display: flex; gap: 8px; flex-wrap: wrap; }
.copy-prompt { min-width: 132px; justify-content: center; margin-top: 4px; }
.src-filters { margin: 0 0 14px; padding: 0 0 14px; border-bottom: 1px solid var(--line); }
.src-filters .src-count { margin: 0 0 6px; flex: 1 1 auto; text-align: right; }
.src-name { min-width: 150px; }
.src-note { min-width: 170px; max-width: 300px; }
.src-err { max-width: 220px; margin: 4px 0; overflow-wrap: anywhere; }
.btn[hidden] { display: none; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-edit > summary { margin: 2px 0 0; font-size: .8rem; }
.note-edit form { display: grid; gap: 8px; justify-items: start; margin: 8px 0 0; }
.note-edit textarea { width: 100%; max-width: none; min-width: 200px; font-size: .86rem; }
tr:target td { background: var(--accent-soft); }

/* Seaded: AI cost ---------------------------------------------------------------------------------- */
.totals { display: flex; gap: 8px 26px; margin: 0; flex-wrap: wrap; }
.totals div { display: flex; flex-direction: column; }
.totals dt { font-size: .76rem; color: var(--subtle); }
.totals dd { margin: 0; font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

/* Juhised: topic list | article (same shape as the Karl app's guide) ------------------------------------- */
.guide { display: grid; grid-template-columns: 210px minmax(0, 720px); gap: 56px; align-items: start; }
.guide-toc { position: sticky; top: 26px; }
.guide-toc > summary { display: none; }
.guide-toc nav { display: flex; flex-direction: column; gap: 1px; }
.guide-sec { margin: 18px 0 6px; padding: 0 10px; font-size: .78rem; font-weight: 600; font-variant: all-small-caps;
             letter-spacing: .05em; color: var(--subtle); }
.guide-sec:first-child { margin-top: 2px; }
.guide-link { display: block; padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .9rem;
              line-height: 1.35; }
.guide-link:hover { background: var(--line); color: var(--text); }
.guide-link.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.guide-body h1 { font-size: 2.3rem; line-height: 1.12; margin: 6px 0 10px; }
.guide-body .lead { font-size: 1.08rem; }
.guide-body h2 { font-size: 1.3rem; margin: 34px 0 10px; padding-top: 24px; border-top: 1px solid var(--line); }
.guide-body p, .guide-body li { line-height: 1.6; }
.guide-apps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -6px 0 26px; }
.guide-app { padding: 4px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); font-size: .86rem;
             text-decoration: none; font-weight: 500; }
.guide-app:hover { border-color: var(--accent); }
.guide-steps { list-style: none; counter-reset: step; padding: 0; margin: 14px 0 18px; }
.guide-steps li { counter-increment: step; position: relative; padding: 0 0 10px 34px; }
.guide-steps li::before { content: counter(step); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%;
                          background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: .8rem;
                          display: grid; place-items: center; }
.guide-list { padding-left: 20px; margin: 10px 0 16px; }
.guide-list li { margin: 0 0 6px; }
.guide-box { margin: 18px 0; padding: 12px 16px; border-radius: 10px; border-left: 3px solid; line-height: 1.55; }
.guide-box.nb { background: var(--warn-soft); border-color: var(--signal-dot); }
.guide-box.nb b { color: var(--warn); }
.guide-box.tip { background: var(--accent-soft); border-color: var(--accent); }
.guide-fig { margin: 22px 0 26px; }
.guide-fig .frame { border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; background: var(--panel);
                    box-shadow: var(--shadow); }
.guide-fig img { display: block; width: 100%; height: auto; }
.guide-fig figcaption { margin: 8px 2px 0; font-size: .84rem; color: var(--muted); }
.guide-next { display: flex; flex-direction: column; gap: 2px; margin: 40px 0 0; padding: 14px 18px; border: 1px solid var(--line-2);
              border-radius: var(--radius); background: var(--panel); text-decoration: none; color: var(--text); }
.guide-next:hover { border-color: var(--accent); color: var(--text); }
.guide-next b { color: var(--accent-ink); }

/* Season overlay and the picker-to-shelf chain on the overview ----------------------------------------- */
.olead { margin: 0 0 12px; font-size: .95rem; line-height: 1.55; max-width: 72ch; }
.olead .pill { margin-left: 4px; vertical-align: 1px; }
.okey { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0 0 8px; padding: 0; font-size: .8rem; color: var(--muted); }
.okey li { display: flex; align-items: center; gap: 8px; }
.okey i { display: inline-block; width: 20px; border-radius: 2px; }
.okey .k-this { height: 3px; background: #2a78d6; }
.okey .k-last { height: 2px; background: #eb6834; }
.okey .k-band { height: 12px; border-radius: 3px; background: rgba(79, 79, 74, .13); }
.chartbox.short { height: 330px; }
.ladder.chain { --cols: minmax(150px, 220px) minmax(0, 1fr) 150px; margin-top: 4px; }
.chain .lrow { min-height: 46px; }
.chain .lrow.own { --mark: var(--accent); --bar: rgba(31, 122, 77, .20); }
.chain .lrow.own .lname b { color: var(--accent-ink); }
.chain .lval b { font-size: .95rem; font-weight: 600; letter-spacing: 0; }
.cpts { margin: 10px 0 0; font-size: .82rem; color: var(--muted); display: grid; gap: 8px; }
.cpts > div { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 4px 18px; }
.cpts dt { font-weight: 600; color: var(--text); }
.cpts dd { margin: 0; line-height: 1.5; }
.cpts b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.cdot { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--mark);
        box-shadow: 0 0 0 2px var(--panel); }

/* Comments ------------------------------------------------------------------------------------------ */
.kbd { font: .72rem/1 ui-monospace, monospace; border: 1px solid var(--line-2); border-radius: 4px; padding: 2px 5px; margin-left: 4px;
                          color: var(--subtle); background: var(--bg); }
.rowc { visibility: hidden; border: 0; background: none; cursor: pointer; padding: 0 0 0 6px; color: var(--subtle); font-size: .95rem; }
tr:hover .rowc, .rowc:focus { visibility: visible; }
@media (hover: none) { .rowc { visibility: visible; } }
#comment-dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; width: min(560px, calc(100vw - 32px));
                  background: var(--panel); color: var(--text); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .35); }
#comment-dialog[open] { animation: pop .22s var(--ease) both; }
#comment-dialog::backdrop { background: rgba(20, 20, 20, .28); backdrop-filter: blur(2px); }
#comment-dialog textarea { width: 100%; max-width: none; min-height: 110px; }
#comment-dialog .ctx { margin: 0 0 10px; } #comment-dialog .row-ctx { background: var(--bg); border-radius: 8px; padding: 6px 10px; margin: 0 0 10px; }
#comment-dialog .actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

/* Motion -------------------------------------------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.985); } to { opacity: 1; transform: none; } }
main { animation: rise .34s var(--ease) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Phone --------------------------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .guide { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .guide-toc { position: static; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 4px 8px; }
  .guide-toc > summary { display: flex; margin: 0; padding: 8px 4px; font-weight: 600; color: var(--text); }
  .guide-toc nav { padding: 0 0 8px; }
  .guide-body h1 { font-size: 1.8rem; }
  body.has-side { display: block; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px;
            background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .menu-btn { display: inline-flex; }
  .side { position: fixed; z-index: 40; top: 0; left: 0; bottom: 0; width: min(280px, 86vw); height: auto;
          transform: translateX(-102%); transition: transform .2s var(--ease); box-shadow: 0 0 40px -10px rgba(0, 0, 0, .3); }
  .side.open { transform: none; }
  .side-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(20, 20, 20, .28); }
  html.side-open { overflow: hidden; }
  #comment-open kbd { display: none; }
  .review { grid-template-columns: 1fr; }
  .review form { flex-wrap: wrap; }
  .review form input { flex: 1 0 100%; width: auto; max-width: none; }
}
@media (max-width: 700px) {
  main { padding: 16px 14px 70px; }
  table.t.stack thead { display: none; }
  table.t.stack, table.t.stack tbody, table.t.stack tr, table.t.stack td { display: block; width: 100%; }
  table.t.stack tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.t.stack tbody tr:last-child { border-bottom: 0; }
  table.t.stack td { border: 0; padding: 3px 0; max-width: none; min-width: 0; }
  table.t.stack td[data-label] { position: relative; padding-left: 122px; }
  table.t.stack td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: 5px; width: 112px;
                                         color: var(--subtle); font-size: .8rem; }
  table.t.stack td:empty { display: none; }
  .src-name { font-size: 1rem; padding-bottom: 6px !important; }
  .src-filters .src-count { text-align: left; }
  .src-filters select { max-width: 100%; }
  h1 { font-size: 1.5rem; }
  .card { padding: 14px; border-radius: 14px; }
  .chartbox { height: 300px; }
  .opt { display: none; }
  .filters { gap: 12px 16px; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .split { grid-template-columns: 1fr; }
  .ladder { --cols: minmax(0, 1fr) auto; }
  .laxis { grid-template-columns: minmax(0, 1fr); padding: 0 calc(8px + 5.5rem + 6px) 0 8px; }
  .laxis > span:first-child { display: none; }
  .lrow { grid-template-areas: "name val" "track track" "age spark"; row-gap: 2px; padding: 9px 8px; }
  .lrow .lname { grid-area: name; } .lrow .lval { grid-area: val; } .lrow .ltrack { grid-area: track; min-height: 24px; }
  .lrow .lspark { grid-area: spark; } .lrow .lage { grid-area: age; text-align: left; }
  .lhead { padding: 12px 8px 2px; }
  .chain .lrow { grid-template-areas: "name val" "track track"; }
  .cpts > div { grid-template-columns: 1fr; }
  .chartbox.short { height: 260px; }
}

/* Tooltips (static/tip.js): data-tip on a cell or an "i" button explains what a number or a chart means */
.tipbox { position: fixed; z-index: 1000; max-width: min(340px, calc(100vw - 16px)); padding: 8px 11px; border-radius: 8px;
          background: #1f1f1d; color: #fff; font-size: .8rem; line-height: 1.4; box-shadow: 0 4px 16px rgba(0,0,0,.18);
          pointer-events: none; }
[data-tip] { cursor: help; }
button.info { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 6px; padding: 0;
              border: 1px solid var(--line-2, #d6d6d0); border-radius: 50%; background: transparent; color: var(--muted);
              font: 600 11px/1 Georgia, serif; font-style: italic; vertical-align: 2px; cursor: help; }
button.info:hover, button.info:focus-visible { color: var(--text); border-color: var(--muted); }
.pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
