/* Mavesi kontrollivaade v2. Kuju: Lineari tume teema (docs/uuringud/14-prototuup/stiil-viide-linear.webp).
   Fondid samad mis Allika rakenduses (app/src/tokens.css). */
@font-face { font-family: "Inter Variable"; font-weight: 100 900; font-display: swap; src: url(fondid/inter-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: "Inter Variable"; font-weight: 100 900; font-display: swap; src: url(fondid/inter-latin-ext-wght-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --ink: #141516;
  --font: "Inter Variable", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --bg: #08090A;          /* akna taust */
  --frame: #0F1011;       /* külgriba */
  --surface: #141516;     /* põhipaneel */
  --raised: #1A1B1D;      /* kaardid, ujuv paneel */
  --hover: rgba(255, 255, 255, .045);
  --active: rgba(255, 255, 255, .075);
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .12);
  --text: #E3E4E6; --soft: #C4C6CA; --muted: #8A8F98; --faint: #5C6069;
  /* värv ainult olekutel */
  --green: #4CB782; --amber: #F2C94C; --orange: #F2994A; --purple: #A08BEF; --red: #EB5757; --blue: #5E6AD2;
  --t: 120ms ease;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 13.5px/20px var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 1.5px solid var(--blue); outline-offset: 1px; border-radius: 5px; }
::selection { background: rgba(94, 106, 210, .45); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
kbd { font: 500 10.5px/1 var(--font); color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 2px 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 17px; }
.mono { font-variant-numeric: tabular-nums; }
code { font: 12px/1 var(--mono); background: var(--raised); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; }

/* ikoonid */
.ic { width: 14px; height: 14px; flex: none; display: inline-block; vertical-align: -2px; }
.ic-btn { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 999px; color: var(--muted); border: 1px solid var(--line-2); transition: background var(--t), color var(--t); }
.ic-btn:hover { background: var(--hover); color: var(--text); }
.ic-btn.flat { border-color: transparent; border-radius: 6px; width: 24px; height: 24px; }

/* nupud ja sildid */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--soft); font-weight: 500; font-size: 12.5px; white-space: nowrap; transition: background var(--t), color var(--t); }
.btn:hover { background: var(--hover); color: var(--text); }
.btn-pri { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-pri:hover { background: #6C78E0; color: #fff; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.plain { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 6px; border-radius: 5px; color: var(--muted); font-size: 12px; transition: background var(--t), color var(--t); }
.plain:hover { background: var(--hover); color: var(--text); }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 11.5px; font-weight: 500; color: var(--soft); white-space: nowrap; }
.chip.off { opacity: .35; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.d-fakt { background: var(--green); } .d-mall { background: var(--faint); } .d-hinnang { background: var(--amber); }
.d-ebakindel { background: var(--orange); } .d-erineb { background: var(--purple); } .d-viga { background: var(--red); }

/* raam: külgriba + paneel */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); height: 100vh; padding: 8px 8px 8px 0; background: var(--frame); }
.side { display: flex; flex-direction: column; gap: 2px; padding: 10px 10px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; font-weight: 600; font-size: 14px; color: var(--text); text-decoration: none; margin-bottom: 10px; }
.brand .logo { width: 18px; height: 18px; border-radius: 5px; background: linear-gradient(135deg, #F67748, #C2501E); display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; }
.brand .dom { color: var(--muted); font-weight: 500; }
.brand small { color: var(--muted); font-weight: 500; font-size: 12px; }
.nav-a { display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 8px; border-radius: 6px; color: var(--soft); text-decoration: none; font-weight: 500; transition: background var(--t); }
.nav-a:hover { background: var(--hover); }
.nav-a.on { background: var(--active); color: var(--text); }
.nav-a .ic { color: var(--muted); }
.nav-a .n { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.side .grp { margin: 18px 8px 4px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.side .foot { margin-top: auto; padding: 8px; font-size: 11.5px; color: var(--faint); line-height: 16px; }

.main { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; position: relative; }
.bar { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); flex: none; }
.bar .crumb { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 500; }
.bar .crumb .id { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar .crumb b { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .sp { flex: 1; }
.bar .meta { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }
.timer::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-right: 2px; }
.timer.idle::before { background: var(--faint); }

/* töö */
.work { display: grid; grid-template-columns: minmax(0, 1fr) 320px; flex: 1; min-height: 0; }
.docwrap { overflow-y: auto; padding: 40px 56px 140px; }
.doc { max-width: 680px; margin: 0 auto; }
.doc h1 { font: 600 22px/30px var(--font); color: var(--text); letter-spacing: -.01em; }
.doc .lead { margin: 8px 0 6px; color: var(--soft); font-size: 14px; line-height: 22px; }
.doc .legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 26px; }
.doc .legend .chip { cursor: pointer; }
.doc h2 { font: 600 12px/16px var(--font); color: var(--muted); margin: 34px 0 10px; letter-spacing: .02em; }
.doc h3 { font: 500 13.5px/20px var(--font); color: var(--soft); margin: 20px 0 6px; }

.s { position: relative; display: block; margin: 0 -12px 2px; padding: 6px 12px 6px 12px; border-radius: 6px; border-left: 2px solid transparent; font-size: 14.5px; line-height: 24px; color: var(--text); cursor: pointer; transition: background var(--t); }
.s:hover { background: var(--hover); }
.s.fakt { border-left-color: rgba(76, 183, 130, .45); }
.s.mall { border-left: 2px dashed var(--line-2); }
.s.hinnang { border-left-color: rgba(242, 201, 76, .7); }
.s.sel { background: var(--active); box-shadow: inset 0 0 0 1px var(--line-2); }
.s.dim { opacity: .25; }
.s .id { position: absolute; left: -40px; top: 9px; font: 500 10.5px/1 var(--font); color: var(--faint); font-variant-numeric: tabular-nums; }
.s .st { position: absolute; right: -26px; top: 10px; }
.s.loe { border-left-width: 3px; }
.s .marks { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: 1px; }
.s .flag { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 11px; font-weight: 500; color: var(--muted); }
.s del { color: var(--faint); text-decoration-color: var(--red); }
.s ins { text-decoration: none; color: var(--text); background: rgba(76, 183, 130, .16); border-radius: 3px; }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 2px var(--blue); } 100% { box-shadow: 0 0 0 0 transparent; } }

.toolbar { display: flex; gap: 2px; margin-top: 8px; padding: 3px; background: var(--raised); border: 1px solid var(--line-2); border-radius: 8px; width: max-content; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toolbar button { color: var(--soft); height: 26px; padding: 0 8px; border-radius: 5px; font-size: 12px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.toolbar button:hover { background: var(--hover); color: var(--text); }

.gate { margin: 8px -12px; padding: 14px 16px; border: 1px dashed rgba(242, 201, 76, .45); border-radius: 8px; background: rgba(242, 201, 76, .04); }
.gate p { margin-bottom: 10px; }
.gate .row { display: flex; gap: 8px; }

/* tegevuste voog */
.activity { margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); }
.activity h2 { font: 600 15px/22px var(--font); color: var(--text); margin: 0 0 14px; letter-spacing: 0; }
.act { position: relative; display: flex; gap: 10px; padding: 0 0 14px 0; font-size: 12.5px; line-height: 18px; color: var(--muted); }
.act::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.act:last-child::before { display: none; }
.act .ico { width: 15px; height: 15px; flex: none; display: grid; place-items: center; margin-top: 1px; }
.act b { color: var(--soft); font-weight: 500; }
.act .card { margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); color: var(--soft); }
.act .card del { color: var(--faint); }
.act .card ins { text-decoration: none; color: var(--text); }
.act .when { color: var(--faint); }

/* parem veerg (nagu Lineari omaduste veerg) */
.props { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 8px 10px; }
.tab { height: 26px; padding: 0 9px; border-radius: 6px; font-weight: 500; font-size: 12.5px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); background: var(--hover); }
.tab.on { color: var(--text); background: var(--active); }
.tab .n { font-size: 11px; color: var(--muted); }
.pane { flex: 1; overflow-y: auto; padding: 4px 14px 20px; }
.lbl { font-size: 12px; color: var(--muted); margin: 14px 0 6px; }

.q { display: block; width: 100%; padding: 8px 10px; border-radius: 6px; margin-bottom: 2px; transition: background var(--t); }
.q:hover { background: var(--hover); }
.q.on { background: var(--active); }
.q.done { opacity: .5; }
.q .h { display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.q p { font-size: 12.5px; line-height: 18px; color: var(--soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.progress { height: 3px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 2px 0 10px; }
.progress i { display: block; height: 100%; background: var(--green); transition: width .3s; }

.src .kind { font-size: 11.5px; color: var(--muted); }
.src h3 { font: 500 13.5px/19px var(--font); color: var(--text); margin: 4px 0 10px; }
.src blockquote { margin: 0 0 12px; padding: 10px 12px; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; line-height: 19px; color: var(--soft); }
.src dl { display: grid; grid-template-columns: 70px 1fr; gap: 4px 10px; font-size: 12px; margin: 0 0 12px; }
.src dt { color: var(--muted); }
.src dd { margin: 0; word-break: break-word; color: var(--soft); }
.src a { color: var(--soft); text-decoration-color: var(--faint); }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 12px; line-height: 17px; color: var(--soft); margin-bottom: 8px; }
.check .dot { margin-top: 5px; }
.note { font-size: 11px; color: var(--faint); border-top: 1px solid var(--line); padding-top: 8px; }

.cite { display: inline-flex; align-items: center; height: 17px; padding: 0 5px; margin: 0 1px; border-radius: 4px; background: var(--active); border: 1px solid var(--line-2); color: var(--soft); font: 500 10.5px/1 var(--mono); cursor: pointer; vertical-align: 1px; }
.cite:hover { color: var(--text); border-color: var(--muted); }

.rule { padding: 10px 2px; border-bottom: 1px solid var(--line); }
.rule.new .h b::after { content: "uus"; margin-left: 6px; font-size: 10.5px; color: var(--blue); font-weight: 600; }
.rule.off { opacity: .45; }
.rule .h { display: flex; gap: 6px; align-items: center; margin-bottom: 3px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.rule .h b { color: var(--soft); font: 500 11px/1 var(--mono); }
.rule p { font-size: 12.5px; line-height: 18px; color: var(--text); }
.rule .o { font-size: 11.5px; line-height: 16px; color: var(--muted); margin-top: 4px; }
.rule .acts { display: flex; gap: 2px; margin-top: 4px; margin-left: -6px; }
.rule textarea { width: 100%; min-height: 60px; background: var(--raised); border: 1px solid var(--line-2); border-radius: 6px; padding: 6px 8px; font-size: 12.5px; }
.sect { font-size: 11.5px; font-weight: 500; color: var(--muted); margin: 16px 0 2px; }

/* ujuv vestluspaneel (nagu Lineari agendipaneel) */
.msg { margin-bottom: 14px; font-size: 13px; line-height: 19.5px; }
.msg .who { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.msg.me { display: flex; flex-direction: column; align-items: flex-end; }
.msg.me .bubble { background: var(--active); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; max-width: 88%; white-space: pre-wrap; font-weight: 500; }
.msg.ai .bubble { white-space: pre-wrap; color: var(--text); }
.msg ul { margin: 2px 0 8px; padding-left: 16px; color: var(--soft); }
.msg li { margin: 2px 0; }
.msg h4 { font-size: 12px; font-weight: 600; color: var(--soft); margin: 10px 0 2px; }
.hit { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin: 6px 0; font-size: 12px; line-height: 17px; white-space: normal; background: var(--surface); color: var(--soft); }
.reply { margin: 0 10px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); padding: 8px 8px 6px 10px; flex: none; }
.reply input { width: 100%; background: transparent; border: 0; outline: none; height: 26px; color: var(--text); }
.reply input::placeholder { color: var(--faint); }
.send { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--active); border: 1px solid var(--line-2); color: var(--text); }

/* dialoog */
.veil { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: grid; place-items: center; z-index: 20; }
.dlg { width: min(620px, 94vw); max-height: 92vh; overflow-y: auto; background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 24px 64px rgba(0,0,0,.6); padding: 20px 22px; }
.dlg h2 { font: 600 16px/22px var(--font); color: var(--text); margin-bottom: 2px; }
.dlg label.f { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin: 14px 0 6px; }
.dlg textarea, .dlg input[type=text], .dlg select { width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 9px; font-size: 13px; line-height: 19px; color: var(--text); }
.dlg textarea:focus, .dlg input:focus, .dlg select:focus { outline: none; border-color: var(--blue); }
.dlg textarea { min-height: 80px; resize: vertical; }
.choice { display: flex; gap: 6px; flex-wrap: wrap; }
.choice button { flex: 1; min-width: 120px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 7px; font-size: 12px; line-height: 16px; color: var(--muted); }
.choice button b { display: block; font-size: 13px; color: var(--text); font-weight: 500; }
.choice button.on { border-color: var(--blue); background: rgba(94, 106, 210, .12); }
.dlg .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dlg .err { color: var(--red); font-size: 12px; margin-top: 8px; }
.before { padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; line-height: 18px; color: var(--muted); }

/* kokkuvõte, lehed */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.kpi { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.kpi b { display: block; font: 600 20px/26px var(--font); color: var(--text); font-variant-numeric: tabular-nums; }
.kpi span { font-size: 11.5px; color: var(--muted); }
table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 6px 0 12px; }
table.t th, table.t td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
table.t th { font-weight: 500; color: var(--muted); font-size: 11.5px; }
table.t td { color: var(--soft); }
.page { overflow-y: auto; padding: 36px 40px; flex: 1; }
.page .inner { max-width: 900px; margin: 0 auto; }
.page h1 { font: 600 20px/28px var(--font); color: var(--text); margin-bottom: 4px; }
.list { margin-top: 20px; border-top: 1px solid var(--line); }
.list a, .list .hd { display: grid; grid-template-columns: 22px 64px 1fr 140px 90px 110px; gap: 10px; align-items: center; padding: 10px 8px; border-bottom: 1px solid var(--line); text-decoration: none; }
.list a:hover { background: var(--hover); }
.list .hd { font-size: 11.5px; color: var(--muted); padding: 6px 8px; }
.list b { color: var(--text); font-weight: 500; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--raised); border: 1px solid var(--line-2); color: var(--text); padding: 10px 14px; border-radius: 8px; box-shadow: 0 12px 32px rgba(0,0,0,.5); font-size: 12.5px; z-index: 30; max-width: 560px; }

/* v0.6: värvid, leht „Allikas”, lohistatav vestlus */
.cite.c-a { color: #8DB8F0; border-color: rgba(95,160,232,.35); background: rgba(95,160,232,.10); }
.cite.c-s { color: #EBC970; border-color: rgba(227,179,65,.35); background: rgba(227,179,65,.10); }
.cite.c-r { color: #C9A9E8; border-color: rgba(180,140,219,.35); background: rgba(180,140,219,.10); }
.rule .h b { color: #C9A9E8; }
.u { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 500; border: 1px solid var(--line-2); }
.u-koik { color: #8DB8F0; background: rgba(95,160,232,.10); border-color: rgba(95,160,232,.30); }
.u-tooliik { color: #EFA06A; background: rgba(229,133,63,.10); border-color: rgba(229,133,63,.30); }
.u-too { color: var(--soft); }
.sect { display: flex; align-items: center; gap: 7px; color: var(--soft); }
.sect .dot, .msg h4 .dot, .grp-h .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }
.msg h4 { display: flex; align-items: center; gap: 7px; }
.h-ebakindel { color: #F2B27A; } .h-ebakindel .dot { background: var(--orange); }
.h-erineb { color: #C2B2F5; } .h-erineb .dot { background: var(--purple); }
.h-ei { color: #F09A9A; } .h-ei .dot { background: var(--red); }
.h-kata { color: var(--muted); } .h-kata .dot { background: var(--faint); }
.who.ai-who { color: #6FCABF; font-weight: 500; }
.who.otsing-who { color: #8DB8F0; font-weight: 500; }
.subtabs { display: flex; gap: 4px; margin: 16px 0 6px; border-bottom: 1px solid var(--line); }
.subtab { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtab:hover { color: var(--text); }
.subtab.on { color: var(--text); border-bottom-color: var(--text); }
.subtab .n, .grp-h .n { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.grp-h { display: flex; align-items: center; gap: 8px; margin: 22px 0 6px; font-size: 13px; }
.grp-h b { font-weight: 600; }
.t.kb td { vertical-align: top; padding-top: 7px; padding-bottom: 7px; }
.t.kb a { color: var(--text); text-decoration: none; }
.t.kb a:hover { text-decoration: underline; }
.t.kb a.chip { text-decoration: none; margin: 1px 0; }
.chip.kasut { color: #6FCABF; border-color: rgba(69,184,172,.35); }
.l-register { background: #5FA0E8; } .l-oigusakt { background: #B48CDB; } .l-planeering { background: #52BE8A; }
.l-uuring { background: #E5853F; } .l-kov { background: #45B8AC; } .l-juhend { background: #E3B341; }
.empty { padding: 6px 2px 2px; }
.inner.wide { max-width: 980px; }

/* hele teema: Slite'i-laadne soe beež */
.nav-a.teema { width: 100%; margin-top: auto; color: var(--muted); font-weight: 500; }
.nav-a.teema + .foot { margin-top: 0; }
[data-theme="hele"] {
  --ink: #FFFFFF;
  --bg: #F1ECE3; --frame: #F6F2EA; --surface: #FDFBF7; --raised: #FFFFFF;
  --hover: rgba(70, 50, 20, .05); --active: rgba(70, 50, 20, .085);
  --line: rgba(70, 50, 20, .09); --line-2: rgba(70, 50, 20, .16);
  --text: #2E2A25; --soft: #4B453D; --muted: #7C7468; --faint: #A69E91;
  --green: #3E9C6C; --amber: #D4A21C; --orange: #E07B39; --purple: #8B6FD9; --red: #D64545; --blue: #5E6AD2;
  color-scheme: light;
}
[data-theme="hele"] * { scrollbar-color: rgba(70,50,20,.18) transparent; }
[data-theme="hele"] .btn-pri { background: #F07A4A; border-color: #F07A4A; }
[data-theme="hele"] .btn-pri:hover { background: #E2683A; }
[data-theme="hele"] .main { box-shadow: 0 1px 2px rgba(70,50,20,.06); }
[data-theme="hele"] .chat, [data-theme="hele"] .dlg { box-shadow: 0 14px 40px rgba(70,50,20,.18); }
[data-theme="hele"] .chat.drag { box-shadow: 0 22px 60px rgba(70,50,20,.28); }
[data-theme="hele"] .veil { background: rgba(60,45,25,.28); }
[data-theme="hele"] .cite.c-a, [data-theme="hele"] .u-koik, [data-theme="hele"] .who.otsing-who { color: #2F6FB8; }
[data-theme="hele"] .cite.c-s { color: #8F6700; }
[data-theme="hele"] .cite.c-r, [data-theme="hele"] .rule .h b { color: #7A4FB0; }
[data-theme="hele"] .u-tooliik, [data-theme="hele"] .h-ebakindel { color: #B5561B; }
[data-theme="hele"] .h-erineb { color: #6E52C4; }
[data-theme="hele"] .h-ei { color: #C03A3A; }
[data-theme="hele"] .who.ai-who, [data-theme="hele"] .chip.kasut { color: #23877C; }
.otsus-rida { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 14px 0; }

/* sisselogimine ja agendi ühendamine (serveriversioon) */
.login-body { display: grid; place-items: center; min-height: 100vh; background: var(--frame); }
.login { width: min(360px, 92vw); padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.08); }
.login h1 { font: 600 20px/28px var(--font); margin: 6px 0 2px; }
.login form { display: grid; gap: 6px; margin-top: 18px; }
.login input, .connect input { height: 34px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--raised); }
.login .btn { height: 34px; justify-content: center; margin-top: 6px; }
.viga { color: var(--red); font-size: 12.5px; min-height: 18px; }
.connect { display: grid; gap: 18px; }
.connect .step { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--raised); }
.connect .step h3 { font: 600 14px/20px var(--font); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.connect .step ol { margin: 6px 0 0; padding-left: 18px; color: var(--soft); }
.connect .step li { margin: 3px 0; }
.connect .url { display: flex; gap: 6px; margin-top: 8px; }
.connect .url input { flex: 1; font: 12px var(--mono); }
.connect pre { font: 12px/18px var(--mono); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 10px; overflow-x: auto; margin: 8px 0 0; }
.connect .num { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11.5px; background: var(--hover); color: var(--soft); }
.msg .thinking { color: var(--muted); font-style: italic; }

/* v0.7: UX-kriitika järgi. Külgriba, tööde loend, vihje, paneel, küsimused, dialoogid, kitsas ekraan */
.side .nav { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; }
.side .grp { margin: 16px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.side .user { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.side .kes { display: flex; align-items: center; gap: 8px; padding: 4px 8px 6px; font-weight: 600; color: var(--text); }
.side .kes .av { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--blue); color: #fff; font-size: 11.5px; font-weight: 600; }
.side .foot { margin-top: 6px; }
.nav-a { width: 100%; }
.nav-a .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-a .ic { flex: none; }

.page .lead, .doc .meta-rida { color: var(--soft); font-size: 14px; line-height: 22px; margin: 4px 0 6px; max-width: 680px; }
.page .lead a { color: var(--text); }
.laeb { display: grid; gap: 10px; padding: 24px 0; }
.laeb i { display: block; height: 14px; border-radius: 6px; background: var(--hover); animation: laeb 1.2s ease-in-out infinite; }
.laeb i:nth-child(2) { width: 80%; } .laeb i:nth-child(3) { width: 60%; }
@keyframes laeb { 50% { opacity: .45; } }

/* tööde loend */
.sammud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; list-style: none; padding: 0; margin: 18px 0 6px; counter-reset: s; }
.sammud li { counter-increment: s; padding: 10px 12px 10px 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); position: relative; }
.sammud li::before { content: counter(s); position: absolute; left: 12px; top: 11px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--active); font-size: 11.5px; font-weight: 600; }
.sammud b { display: block; font-weight: 600; color: var(--text); }
.sammud span { font-size: 12px; color: var(--muted); }
.list a.row, .list .hd { grid-template-columns: minmax(0, 1fr) 170px 120px 130px 170px; }
.list a.row { padding: 12px 8px; }
.list .tn { display: flex; flex-direction: column; min-width: 0; }
.list .tn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .edu { display: flex; flex-direction: column; gap: 4px; }
.list .edu .progress { margin: 0; width: 90px; }
.list .olek { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.list .ava { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.list a.row:hover .ava { color: var(--text); }
.st-uus, .st-pooleli, .st-valmis { display: inline-flex; height: 20px; align-items: center; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; }
.st-uus { background: var(--hover); color: var(--soft); }
.st-pooleli { background: rgba(242, 201, 76, .16); color: #9A7400; }
.st-valmis { background: rgba(76, 183, 130, .16); color: #2E7D55; }
[data-theme="tume"] .st-pooleli { color: var(--amber); } [data-theme="tume"] .st-valmis { color: var(--green); }
.empty { padding: 14px 8px; }

/* töö ülariba */
.work-bar .crumb b { font-weight: 600; }
.edu-bar { display: inline-flex; align-items: center; gap: 8px; color: var(--soft); }
.edu-bar .progress { width: 80px; margin: 0; }
.edu-bar b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.chip.vead { color: var(--red); border-color: rgba(214, 69, 69, .35); }
.timer { font-size: 12px; }
.ic-btn.abi { font-weight: 600; font-size: 13px; color: var(--muted); }
.paneel-btn, .sulge-paneel { display: none; }

/* vihje ja legend */
.vihje { position: relative; display: flex; gap: 10px; margin: 18px 0 4px; padding: 14px 40px 14px 16px; border: 1px solid rgba(94, 106, 210, .3); background: rgba(94, 106, 210, .06); border-radius: 10px; }
.vihje b { font-weight: 600; }
.vihje p { margin-top: 4px; color: var(--soft); }
.vihje .keys { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12px; color: var(--muted); }
.vihje .keys kbd { margin-right: -6px; }
.vihje > .ic-btn { position: absolute; top: 8px; right: 8px; }
.vihje .ise { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.vihje .ise label { font-weight: 500; }
.vihje .ise input { width: 80px; height: 28px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--raised); }
.doc .legend { align-items: center; }
.doc .legend .lg { font-size: 11.5px; color: var(--muted); margin: 0 2px 0 6px; }
.doc .legend .lg:first-child { margin-left: 0; }
.chip.off { opacity: .45; text-decoration: line-through; }

/* lause tööriistariba */
.toolbar { flex-wrap: wrap; max-width: 100%; align-items: center; }
.toolbar button.pri { background: var(--green); color: #fff; }
.toolbar button.pri:hover { background: #379163; color: #fff; }
.toolbar button.pri kbd { color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.45); }
.toolbar .tb-sep { width: 1px; align-self: stretch; background: var(--line-2); margin: 3px 4px; }
.toolbar .tb-lbl { padding: 0 6px; color: var(--muted); }
.otsus-rida b { font-weight: 600; }

/* parem paneel */
.props { background: var(--surface); }
.tabs { align-items: center; border-bottom: 1px solid var(--line); }
.lbl { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.lbl b { font-weight: 600; color: var(--text); }
.q .h .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.markmed { margin: 10px 0 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
.mk-hd { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px; }
.mk-hd b { font-weight: 600; font-size: 12.5px; }
.mk-hd .n { font-size: 11px; color: var(--muted); }
.mk-hd .sp { flex: 1; }
.mk-body { padding: 0 12px 10px; font-size: 12.5px; line-height: 18.5px; }
.mk-body ul { margin: 2px 0 8px; padding-left: 16px; color: var(--soft); }
.mk-body h4 { font-size: 12px; font-weight: 600; margin: 10px 0 2px; display: flex; align-items: center; gap: 7px; }
.mk-body h4 .dot { width: 7px; height: 7px; border-radius: 50%; }
.valmis-kast, .otsus-kast, .info, .hoiatus { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin: 8px 0 12px; }
.valmis-kast, .otsus-kast.hea { background: rgba(76, 183, 130, .1); border: 1px solid rgba(76, 183, 130, .35); }
.otsus-kast.halb { background: rgba(214, 69, 69, .08); border: 1px solid rgba(214, 69, 69, .3); }
.valmis-kast .btn, .info p, .otsus-kast p { margin-top: 6px; }
.otsus-kast b { font-size: 14px; font-weight: 600; }
.info { background: var(--raised); border: 1px solid var(--line); }
.hoiatus { display: block; background: rgba(242, 153, 74, .1); border: 1px solid rgba(242, 153, 74, .4); font-size: 12.5px; line-height: 20px; }
.btn-hoiatus { border-color: var(--orange); color: var(--orange); }
.tyhi { text-align: center; padding: 34px 16px; color: var(--muted); }
.tyhi .ic { width: 22px; height: 22px; margin-bottom: 8px; }
.tyhi.small { padding: 16px 8px; text-align: left; }
.src-chips { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.src-chips .chip { cursor: pointer; }
.src-chips .chip.on { background: var(--text); color: var(--surface); border-color: var(--text); }
details.muud { margin: 12px 0; }
details.muud summary { cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--soft); padding: 4px 0; }
details.muud select { margin-top: 8px; }

/* küsimused */
.pane.kusi { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.kusi-hd { display: flex; align-items: center; gap: 7px; padding: 10px 14px 6px; }
.msgs { flex: 1; overflow-y: auto; padding: 6px 14px 12px; }
.reply { display: flex; align-items: center; gap: 6px; margin: 0 10px; padding: 6px 6px 6px 10px; }
.reply input:disabled { opacity: .5; }
.reply-note { padding: 6px 14px 12px; }
.send[disabled] { opacity: .4; }
.naited { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.naited .chip { cursor: pointer; height: auto; min-height: 24px; padding: 3px 9px; white-space: normal; text-align: left; }
.connect .naited { justify-content: flex-start; }
.rate { margin-top: 4px; display: flex; gap: 2px; align-items: center; }

/* dialoogid */
.dlg.wide { width: min(760px, 94vw); }
.dlg .acts { position: sticky; bottom: -20px; margin: 18px -22px -20px; padding: 12px 22px; background: var(--raised); border-top: 1px solid var(--line); align-items: center; }
.dlg .acts .sp { flex: 1; }
.dlg .acts .vihje-kb { margin-right: auto; }
.plain.ohtlik { color: var(--muted); }
.plain.ohtlik:hover { color: var(--red); }
.reegel-lyliti { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.reegel-lyliti input { margin-top: 3px; }
.reegel-lyliti b { font-weight: 600; }
.reegel-plokk { padding: 0 2px 4px 12px; border-left: 2px solid rgba(180, 140, 219, .5); margin-left: 6px; }

/* mõõdikud */
.suur { display: flex; align-items: baseline; gap: 10px; margin: 18px 0 6px; }
.suur b { font: 700 40px/1 var(--font); color: var(--text); font-variant-numeric: tabular-nums; }
.suur span { color: var(--soft); font-size: 15px; }
.kriteeriumid { margin: 4px 0 0; padding-left: 18px; color: var(--soft); }
.tbl { overflow-x: auto; }
.connect .step p { color: var(--soft); }

/* sahtel: kitsam sülearvuti */
@media (max-width: 1100px) {
  .work { grid-template-columns: minmax(0, 1fr); }
  .props { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 92vw); z-index: 15; transform: translateX(105%); transition: transform .2s ease; box-shadow: -12px 0 40px rgba(0,0,0,.18); border-left: 1px solid var(--line-2); }
  .props.open { transform: none; }
  .props-veil { position: fixed; inset: 0; z-index: 14; background: rgba(0,0,0,.2); }
  .paneel-btn, .sulge-paneel { display: inline-grid; }
  .sulge-paneel { margin-left: auto; }
  .docwrap { padding: 32px 40px 120px; }
}
/* telefon */
@media (max-width: 760px) {
  .shell { display: flex; flex-direction: column; padding: 0; height: 100dvh; }
  .side { flex-direction: row; align-items: center; gap: 4px; padding: 6px 8px; overflow-x: auto; flex: none; border-bottom: 1px solid var(--line); }
  .side .brand { margin: 0 6px 0 0; padding: 0 4px; flex: none; }
  .side .nav { flex-direction: row; overflow: visible; gap: 2px; }
  .side .grp, .side .pool, .side .foot, .side .kes, .nav-a .n { display: none; }
  .side .user { flex-direction: row; margin: 0; padding: 0; border: 0; }
  .nav-a { width: auto; white-space: nowrap; flex: none; padding: 0 8px; }
  .side .user .nav-a span { display: none; }
  .main { border-radius: 0; border: 0; flex: 1; }
  .page { padding: 22px 16px; }
  .sammud { grid-template-columns: 1fr; }
  .list .hd { display: none; }
  .list a.row { grid-template-columns: 1fr auto; gap: 6px 10px; }
  .list a.row > span:nth-child(2), .list a.row > span:nth-child(4) { display: none; }
  .list .olek { grid-column: 1 / -1; }
  .bar { gap: 6px; padding: 0 8px 0 12px; }
  .work-bar .crumb .id, .work-bar .timer, .work-bar .chip.vead, .work-bar .abi, .work-bar .nool, .edu-bar .progress { display: none; }
  .work-bar .btn { padding: 0 8px; }
  .main > .bar:not(.work-bar) { display: none; }
  .edu-bar .small { white-space: nowrap; }
  .docwrap { padding: 18px 16px 120px; }
  .s { margin: 0 0 2px; }
  .s .id { position: static; display: block; margin-bottom: 2px; }
  .s .st { right: 6px; top: 6px; }
  .toolbar { width: auto; }
  .dlg { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .choice button { min-width: 0; flex-basis: 100%; }
  .grid { grid-template-columns: 1fr 1fr; }
  .vihje { padding-right: 36px; }
}
.kood-rida { display: flex; gap: 6px; }
.kood-rida input { flex: 1; min-width: 0; }
.login .kood-rida .btn { margin-top: 0; }
.login p.small { margin-top: 8px; }
