/* Tokens (M3-style roles) */
:root {
  /* Calm, neutral (zinc) surfaces with thin borders; the teal brand only where it means something. */
  --primary: #0f766e;
  --on-primary: #ffffff;
  --primary-container: #ccfbf1;
  --on-primary-container: #134e4a;
  --secondary-container: #e4e4e7;
  --on-secondary-container: #09090b;
  --error: #ba1a1a;
  --on-error: #ffffff;
  --error-container: #ffdad6;
  --on-error-container: #410002;
  --warn-container: #ffe0b2;
  --on-warn-container: #3d2400;
  --surface: #fafafa;
  --surface-1: #ffffff;
  --surface-2: #f4f4f5;
  --on-surface: #09090b;
  --on-surface-variant: #52525b;
  --outline: #a1a1aa;
  --outline-variant: #e4e4e7;
  --scrim: rgba(0, 0, 0, .4);
  /* Entry boxes in the week grid, by kind group */
  --tone-work: #9cf1f1; --on-tone-work: #002020;
  --tone-out: #dbe1ff; --on-tone-out: #00164e;
  --tone-free: #d8ecc4; --on-tone-free: #112007;
  --plan-liquid: #b45309;
  /* Project types (phase bar, tags). */
  --tag-service: #3557c9; --tag-automation: #c25e00; --tag-oem: #7b3fbf; --tag-parts: #2e7d5b;
  --unas: #e8590c; --on-unas: #8a2c00;
  --stage-1: #2e9d48; --stage-2: #e0b000; --stage-3: #ef6c00; --stage-4: #d32f2f; --stage-late: #7f0000;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r-s: 6px; --r-m: 8px; --r-l: 12px; --r-xl: 16px; --r-full: 999px;
  --target: 48px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --headline: 600 1.5rem/2rem var(--font);
  --title-l: 600 1.375rem/1.75rem var(--font);
  --title-m: 600 1rem/1.5rem var(--font);
  --body-l: 400 1rem/1.5rem var(--font);
  --body-m: 400 .875rem/1.25rem var(--font);
  --label-l: 500 .875rem/1.25rem var(--font);
  --label-s: 500 .75rem/1rem var(--font);
  --shadow: 0 4px 12px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .06);
  color-scheme: light;
}
/* Dark: the device's setting, or the user's own choice (Settings › Teema) – app.js sets data-mode before anything draws. */
:root[data-mode="dark"] {
    --primary: #2dd4bf;
    --on-primary: #042f2e;
    --primary-container: #134e4a;
    --on-primary-container: #ccfbf1;
    --secondary-container: #27272a;
    --on-secondary-container: #fafafa;
    --error: #ffb4ab;
    --on-error: #690005;
    --error-container: #93000a;
    --on-error-container: #ffdad6;
    --warn-container: #5c3a00;
    --on-warn-container: #ffddb3;
    --surface: #09090b;
    --surface-1: #111113;
    --surface-2: #18181b;
    --on-surface: #fafafa;
    --on-surface-variant: #a1a1aa;
    --outline: #52525b;
    --outline-variant: #27272a;
    --scrim: rgba(0, 0, 0, .6);
    --tone-work: #004f50; --on-tone-work: #9cf1f1;
    --tone-out: #2f4578; --on-tone-out: #dbe1ff;
    --tone-free: #3a4b2e; --on-tone-free: #d8ecc4;
    --plan-liquid: #fbbf24;
    --tag-service: #8fa8ff; --tag-automation: #ffab5c; --tag-oem: #c9a0ff; --tag-parts: #6fd3a3;
    --unas: #ff8a4c; --on-unas: #ffc9a8;
    --stage-1: #4cc764; --stage-2: #ffd43b; --stage-3: #ff9433; --stage-4: #ff5449; --stage-late: #c3000f;
    color-scheme: dark;
}
/* Ready themes (Settings › Teema): only the accent changes (Liiv also warms the surfaces); the default is the above. */
:root[data-theme="ocean"][data-mode="light"] { --primary: #1d4ed8; --on-primary: #fff; --primary-container: #dbeafe; --on-primary-container: #1e3a8a; }
:root[data-theme="ocean"][data-mode="dark"] { --primary: #93c5fd; --on-primary: #0b1f4d; --primary-container: #1e3a8a; --on-primary-container: #dbeafe; }
:root[data-theme="forest"][data-mode="light"] { --primary: #15803d; --on-primary: #fff; --primary-container: #dcfce7; --on-primary-container: #14532d; }
:root[data-theme="forest"][data-mode="dark"] { --primary: #86efac; --on-primary: #052e16; --primary-container: #14532d; --on-primary-container: #dcfce7; }
:root[data-theme="violet"][data-mode="light"] { --primary: #6d28d9; --on-primary: #fff; --primary-container: #ede9fe; --on-primary-container: #4c1d95; }
:root[data-theme="violet"][data-mode="dark"] { --primary: #c4b5fd; --on-primary: #2e1065; --primary-container: #4c1d95; --on-primary-container: #ede9fe; }
:root[data-theme="sunset"][data-mode="light"] { --primary: #c2410c; --on-primary: #fff; --primary-container: #ffedd5; --on-primary-container: #7c2d12; }
:root[data-theme="sunset"][data-mode="dark"] { --primary: #fdba74; --on-primary: #431407; --primary-container: #7c2d12; --on-primary-container: #ffedd5; }
:root[data-theme="rose"][data-mode="light"] { --primary: #be185d; --on-primary: #fff; --primary-container: #fce7f3; --on-primary-container: #831843; }
:root[data-theme="rose"][data-mode="dark"] { --primary: #f9a8d4; --on-primary: #500724; --primary-container: #831843; --on-primary-container: #fce7f3; }
:root[data-theme="graphite"][data-mode="light"] { --primary: #27272a; --on-primary: #fff; --primary-container: #e4e4e7; --on-primary-container: #18181b; }
:root[data-theme="graphite"][data-mode="dark"] { --primary: #e4e4e7; --on-primary: #18181b; --primary-container: #3f3f46; --on-primary-container: #fafafa; }
:root[data-theme="sand"][data-mode="light"] { --primary: #92400e; --on-primary: #fff; --primary-container: #fef3c7; --on-primary-container: #78350f;
  --surface: #faf8f5; --surface-1: #fffdfa; --surface-2: #f3efe8; --outline-variant: #e7e0d6; --secondary-container: #ece6dc; }
:root[data-theme="sand"][data-mode="dark"] { --primary: #fcd34d; --on-primary: #451a03; --primary-container: #78350f; --on-primary-container: #fef3c7;
  --surface: #0f0d0a; --surface-1: #17140f; --surface-2: #1f1b15; --outline-variant: #2e2820; --secondary-container: #2e2820; }

* { box-sizing: border-box; }
html, body { margin: 0; }
/* Room for the scrollbar always kept, so a long page doesn't shift the page and the bottom bar sideways. */
html { scrollbar-gutter: stable; }
body {
  background: var(--surface);
  color: var(--on-surface);
  font: var(--body-l);
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
main { max-width: 640px; margin: 0 auto; padding: var(--s4); }
h1 { font: var(--headline); margin: var(--s2) 0 var(--s4); }
h2 { font: var(--title-m); margin: var(--s5) 0 var(--s2); color: var(--on-surface-variant); }
a { color: var(--primary); }
.muted { color: var(--on-surface-variant); font: var(--body-m); }
.row { display: flex; gap: var(--s2); align-items: center; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: var(--s3); }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* Buttons */
button, .btn {
  font: var(--label-l);
  min-height: 40px;
  min-width: var(--target);
  padding: 0 var(--s5);
  border-radius: var(--r-m);
  border: 1px solid var(--outline-variant);
  background: transparent;
  color: var(--on-surface);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  position: relative;
  touch-action: manipulation;
}
button::after { content: ""; position: absolute; inset: -4px; } /* 48px touch target */
button:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
button:active { background: color-mix(in srgb, var(--on-surface) 10%, transparent); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--primary); outline-offset: 2px;
}
button:disabled { opacity: .38; cursor: default; }
button[data-busy] { cursor: progress; }
button.filled { background: var(--primary); color: var(--on-primary); border-color: transparent; }
button.filled:hover { background: color-mix(in srgb, var(--primary) 92%, var(--on-primary)); }
a.btn { text-decoration: none; }
button.tonal, .btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); border-color: transparent; }
button.text, .btn.text { border-color: transparent; padding: 0 var(--s3); color: var(--primary); }
.btn:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
button.danger { color: var(--error); border-color: var(--error); }
button.big { min-height: 56px; font: var(--title-m); border-radius: var(--r-l); }
button.icon { padding: 0; width: var(--target); height: var(--target); border: none; font-size: 1.4rem; }
/* Lucide line icons: sized by the text around them, 20px alone in an icon button. */
.ic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
button .ic { margin-right: 2px; }
button.icon .ic { width: 20px; height: 20px; margin: 0; vertical-align: middle; }
.nav .nav-ico .ic { width: 22px; height: 22px; }
.ficon .ic { width: 20px; height: 20px; color: var(--on-surface-variant); }

/* Inputs */
label.field { display: grid; gap: var(--s1); font: var(--label-l); color: var(--on-surface-variant); }
input, select, textarea {
  font: var(--body-l);
  color: var(--on-surface);
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--r-s);
  min-height: var(--target);
  padding: 0 var(--s3);
  width: 100%;
}
textarea { padding: var(--s3); min-height: 72px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--on-surface-variant); opacity: .8; }
input.dur { font: var(--title-m); text-align: center; }

/* Cards */
.card { background: var(--surface-1); border: 1px solid var(--outline-variant); border-radius: var(--r-l); padding: var(--s4); }
.card + .card { margin-top: var(--s3); }

/* Day header */
.dayhead { display: flex; align-items: center; gap: var(--s1); margin-bottom: var(--s3); }
.dayhead .date-btn { flex: 1; flex-direction: column; font: var(--title-l); border: none; color: var(--on-surface); padding: 0 var(--s2); min-height: var(--target); }
.dayhead .date-btn small { display: block; font: var(--label-s); color: var(--on-surface-variant); }

/* Status */
.status { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-l); margin-bottom: var(--s3); }
.status.ok { background: var(--secondary-container); color: var(--on-secondary-container); }
.status.gap { background: var(--warn-container); color: var(--on-warn-container); }
.status.bad { background: var(--error-container); color: var(--on-error-container); }
.status b { font: var(--title-m); }
.status button { color: inherit; border-color: currentColor; padding: 0 var(--s3); }

/* Running */
.running { background: var(--primary-container); color: var(--on-primary-container); border-radius: var(--r-l); padding: var(--s3) var(--s4); display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.running .pulse { width: 10px; height: 10px; border-radius: 50%; background: currentColor; animation: pulse 1.5s infinite; flex: none; }
@keyframes pulse { 50% { opacity: .25; } }
.running button { background: var(--primary); color: var(--on-primary); border: none; }

/* Topic picker */
.picker { position: relative; }
.picker ul {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px);
  list-style: none; margin: 0; padding: var(--s1) 0;
  background: var(--surface-2); border-radius: var(--r-m); box-shadow: var(--shadow);
  max-height: 280px; overflow: auto;
}
.picker li { padding: var(--s3) var(--s4); cursor: pointer; min-height: var(--target); display: flex; align-items: center; gap: var(--s2); }
.picker li[aria-selected="true"], .picker li:hover { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.picker li.new { color: var(--primary); font: var(--label-l); border-top: 1px solid var(--outline-variant); }
.picker li .muted { margin-left: auto; }
.picker li .pto { color: var(--on-surface-variant); }
.picker li.pnote { cursor: default; min-height: 0; font-size: .85em; white-space: normal; }
.picker li.pnote:hover { background: none; }
.recent { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: var(--s1); scrollbar-width: none; }
.recent button { flex: none; padding: 0 var(--s4); border-color: var(--outline-variant); color: var(--on-surface); }

/* Kind chips */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  font: var(--label-l); min-height: 36px; padding: 0 var(--s3);
  border-radius: var(--r-s); border: 1px solid var(--outline-variant);
  color: var(--on-surface-variant); background: transparent;
}
.chip[aria-pressed="true"] { background: var(--secondary-container); color: var(--on-secondary-container); border-color: transparent; }
.chip[aria-pressed="true"]::before { content: "✓"; }

/* Add form actions */
.add-actions { display: grid; grid-template-columns: 1fr auto; gap: var(--s2); align-items: stretch; }
.add-actions .or { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s2); align-items: center; grid-column: 1 / -1; color: var(--on-surface-variant); font: var(--label-s); }
.add-actions .or::before, .add-actions .or::after { content: ""; height: 1px; background: var(--outline-variant); }
.add-actions input[type="time"] { min-width: 0; }

/* Entry list */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s2); border-bottom: 1px solid var(--outline-variant); cursor: pointer; border-radius: var(--r-s); }
.entry:hover { background: var(--surface-1); }
.entry .t { font: var(--label-s); color: var(--on-surface-variant); width: 48px; flex: none; padding-top: 3px; }
.entry .main { flex: 1; min-width: 0; }
.entry .title { font: var(--title-m); overflow-wrap: anywhere; }
.entry .comment { font: var(--body-m); color: var(--on-surface-variant); overflow-wrap: anywhere; }
.entry .dur { font: var(--title-m); white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; }
.entry .cut, table.rep tr.cut td, .cutsum { font: var(--body-m); color: var(--on-surface-variant); }
table.rep tr.cut td { border-bottom: none; padding-top: 0; }
table.rep tr:has(+ tr.cut) td { border-bottom: none; }
table.rep tr.cut.res td { border-bottom: 1px solid var(--outline-variant); color: var(--on-surface); }
.tag { display: inline-block; font: var(--label-s); padding: 2px var(--s2); border-radius: var(--r-s); background: var(--secondary-container); color: var(--on-secondary-container); margin-right: var(--s1); }
.empty { text-align: center; padding: var(--s6) var(--s4); color: var(--on-surface-variant); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal .wd { font: var(--label-s); color: var(--on-surface-variant); padding: var(--s2) 0; }
.cal button { min-width: 0; padding: 0; border: none; border-radius: var(--r-full); height: 44px; color: var(--on-surface); font: var(--body-l); flex-direction: column; gap: 0; }
.cal button.today { font-weight: 800; color: var(--primary); outline: 2px solid var(--primary); outline-offset: -2px; }
.cal button.sel { background: var(--primary); color: var(--on-primary); }
.cal button.other { visibility: hidden; }
.cal button .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--error); }
.cal button .dot.ok { background: var(--primary); }
.cal button.sel .dot { background: var(--on-primary); }

/* Dialog */
dialog { border: 1px solid var(--outline-variant); border-radius: var(--r-xl); padding: var(--s5); background: var(--surface-1); box-shadow: var(--shadow); color: var(--on-surface); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
dialog::backdrop { background: var(--scrim); }
dialog h2 { font: var(--title-l); color: var(--on-surface); margin: 0 0 var(--s4); }
dialog .actions { display: flex; gap: var(--s2); justify-content: flex-end; margin-top: var(--s5); flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.seg { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--outline-variant); border-radius: var(--r-m); }
.seg button { flex: 1; border: none; border-radius: var(--r-s); min-width: 0; min-height: 34px; padding: 0 var(--s2); color: var(--on-surface-variant); }
.seg button[aria-pressed="true"] { background: var(--surface-1); color: var(--on-surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* Lists (topics, users) */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) 0; border-bottom: 1px solid var(--outline-variant); min-height: 56px; }
.list li .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list a.grow { color: inherit; text-decoration: none; }
.list .task { cursor: pointer; }
.list .struck { text-decoration: line-through; color: var(--on-surface-variant); }
.waiting { display: inline-block; margin-top: var(--s1); font: var(--label-s); padding: 2px var(--s2); border-radius: var(--r-s); background: var(--warn-container); color: var(--on-warn-container); }

/* Report */
.report-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s2); margin: var(--s3) 0; }
.report-sum div { background: var(--surface-1); border-radius: var(--r-m); padding: var(--s3); }
.report-sum b { display: block; font: var(--title-l); }
.report-sum label.ksum { display: grid; grid-template-columns: auto 1fr; column-gap: var(--s2); align-items: center; cursor: pointer; background: var(--surface-1); border-radius: var(--r-m); padding: var(--s3); }
.report-sum label.ksum input { width: 20px; min-height: 20px; grid-row: span 2; }
.report-sum label.ksum.off { opacity: .45; }
.report-sum span { font: var(--label-s); color: var(--on-surface-variant); }
.table-wrap { overflow-x: auto; }
table.rep { width: 100%; border-collapse: collapse; font: var(--body-m); }
table.rep th, table.rep td { text-align: left; padding: var(--s2); border-bottom: 1px solid var(--outline-variant); vertical-align: top; }
table.rep td.num, table.rep th.num { text-align: right; white-space: nowrap; }
table.rep tr.off td { opacity: .4; text-decoration: line-through; }
table.rep input[type="checkbox"] { width: 22px; min-height: 22px; }
.print-only { display: none; }

/* Bottom nav */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  background: var(--surface-2);
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--outline-variant);
}
.nav a {
  flex: 1; max-width: 160px; min-height: 64px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--on-surface-variant); font: var(--label-s);
}
.nav .nav-ico { font-size: 1.25rem; width: 56px; height: 30px; display: grid; place-items: center; border-radius: var(--r-full); }
.nav a.active { color: var(--on-surface); }
.nav a.active .nav-ico { background: var(--secondary-container); color: var(--on-secondary-container); }

/* Toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 30;
  background: var(--on-surface); color: var(--surface);
  padding: var(--s3) var(--s4); border-radius: var(--r-s); font: var(--body-m);
  max-width: calc(100vw - 32px); box-shadow: var(--shadow);
}

/* Login */
.login { max-width: 360px; margin: 12vh auto 0; }
.login .logo { width: 72px; height: 72px; margin-bottom: var(--s3); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Zero page margin removes the browser's own header/footer (date, title, URL, page number). */
@page { margin: 0; }
@media print {
  :root { --surface-1: #f3f3f3; --on-surface: #000; --on-surface-variant: #555; --outline-variant: #ccc; color-scheme: light; }
  body { padding: 15mm; background: #fff; color: #000; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  .report-sum { display: flex; flex-wrap: wrap; gap: 2px var(--s5); margin: var(--s1) 0; }
  .report-sum div, .report-sum label.ksum { display: flex; align-items: baseline; gap: 6px; background: none; padding: 0; }
  .report-sum span { font: var(--body-m); }
  .report-sum b { display: inline; font: var(--title-m); }
  .nav, .toast, .no-print, button { display: none !important; }
  .print-only { display: block; }
  table.rep tr.off, .report-sum label.ksum.off { display: none; }
  .report-sum label.ksum input { display: none; }
  table.rep th, table.rep td { border-color: #ccc; }
  main { max-width: none; padding: 0; }
}

/* "Correct" button on uncategorised entries, under the hours */
.entry button.small { min-height: 36px; margin-top: var(--s2); padding: 0 var(--s4); }

/* Day / Week switch (computers only) */
.view-seg { flex: none; width: 200px; }
.view-seg button { min-height: 40px; }

/* Week grid (computers) */
body.wide main { max-width: 1440px; }
body.wkfull main { max-width: none; } /* the week calendar uses the whole width: wider boxes */
.wk-bar { display: flex; align-items: center; gap: var(--s3); padding: var(--s1) 0 var(--s2) 56px; }
.wk-bar button { min-height: 32px; }
.wk-bar button::after { inset: -2px; }
.wk-range { border: none; padding: 0 var(--s2); margin-left: calc(-1 * var(--s2)); font: var(--title-m); color: var(--on-surface); border-radius: var(--r-s); }
.wk-num { margin-left: var(--s2); font: var(--label-l); color: var(--on-surface-variant); white-space: nowrap; }
.wk-bar .muted b { color: var(--on-surface); font-weight: 600; }
.wk-bar .tonal { padding: 0 var(--s4); }
.wk-bar .view-seg { width: 160px; }
.wk-bar .view-seg button { min-height: 32px; }
.wk { display: grid; }
.wk-head, .wk-grid { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)) 40px; }
.wk-top { position: sticky; top: 0; z-index: 5; background: var(--surface); padding-top: var(--s2); margin-top: calc(-1 * var(--s2)); }
.wk-head { border-bottom: 1px solid var(--outline-variant); padding-bottom: var(--s2); user-select: none; align-items: start; }
.wk-head > .icon { width: 32px; height: 32px; min-height: 32px; justify-self: center; }
.wk-head > .icon::after { inset: -4px; }
.wk-dh { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); justify-content: center; align-items: center; align-content: start; padding: 0 var(--s1); min-width: 0; }
.wk-date { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 var(--s3); border-radius: var(--r-full); color: var(--on-surface); }
.wk-date span { font: var(--label-s); color: var(--on-surface-variant); text-transform: uppercase; }
.wk-date b { font: var(--title-m); }
.wk-dh.today .wk-date b { color: var(--primary); }
.wk-dh.today .wk-date { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.wk-sum { font: var(--label-s); padding: 2px var(--s2); border-radius: var(--r-s); }
.wk-sum.ok { background: var(--secondary-container); color: var(--on-secondary-container); }
.wk-sum.gap { background: var(--warn-container); color: var(--on-warn-container); }
.wk-sum.bad { background: var(--error-container); color: var(--on-error-container); }
.wk-chip { width: 100%; min-width: 0; min-height: 28px; padding: 0 var(--s2); border: none; border-radius: var(--r-s); font: var(--label-s); justify-content: flex-start; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.wk-chip::after { display: none; }
.wk-gutter > div { height: var(--hour); font: var(--label-s); color: var(--on-surface-variant); text-align: right; padding-right: var(--s2); transform: translateY(-.5em); }
.wk-col {
  position: relative; height: calc(24 * var(--hour)); cursor: cell; user-select: none;
  border-left: 1px solid var(--outline-variant);
  background: repeating-linear-gradient(to bottom, var(--outline-variant) 0 1px, transparent 1px var(--hour));
}
.wk-off { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--on-surface) 4%, transparent); pointer-events: none; }
.wk-now { position: absolute; left: -1px; right: 0; height: 2px; background: var(--error); z-index: 3; pointer-events: none; }
.wk-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--error); }
.wk-ev {
  position: absolute; z-index: 1; margin-left: 2px; padding: 2px var(--s2); overflow: hidden;
  border-radius: var(--r-s); font: var(--label-s); cursor: grab; box-shadow: 0 0 0 1px var(--surface);
  display: flex; flex-direction: column; gap: 0;
}
.wk-ev b { font: var(--label-l); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.wk-ev span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; opacity: .85; }
.wk-ev::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.wk-ev.live::after { display: none; }
.wk-ev:hover { filter: brightness(1.05); z-index: 2; }
.wk-ev.dragging { cursor: grabbing; z-index: 4; box-shadow: var(--shadow); opacity: .9; }
.wk-ev.copying { cursor: copy; outline: 2px dashed currentColor; outline-offset: -2px; }
/* Right-click menu (copy / paste an entry) */
.ctxmenu { position: fixed; z-index: 1000; min-width: 200px; max-width: min(360px, calc(100vw - 16px)); padding: var(--s1) 0; border-radius: var(--r-m);
  background: var(--surface-1); color: var(--on-surface); box-shadow: var(--shadow); border: 1px solid var(--outline-variant); }
.ctxmenu button { display: flex; align-items: center; gap: var(--s2); width: 100%; padding: 8px 12px; border: 0; border-radius: 0; background: none; color: inherit;
  font: var(--body-m); text-align: left; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-height: 0; }
.ctxmenu button:hover, .ctxmenu button:focus-visible { background: var(--surface-2); outline: none; }
.wk-ev.live { border-bottom: 3px dashed currentColor; }
.tone-work { background: var(--tone-work); color: var(--on-tone-work); }
.tone-out { background: var(--tone-out); color: var(--on-tone-out); }
.tone-free { background: var(--tone-free); color: var(--on-tone-free); }
.tone-other { background: var(--surface-2); color: var(--on-surface); outline: 1px dashed var(--outline); outline-offset: -1px; }
.wk-ev.low { opacity: .8; }
.wk-ev.short span { display: none; }
/* Description: wraps into whatever height the box has left; the box clips the rest. */
.wk-ev > * { flex: none; }
.wk-ev span.wk-note { flex: 0 1 auto; white-space: pre-line; text-overflow: clip; margin-top: 2px; }
.wk-ghost { background: color-mix(in srgb, var(--primary) 30%, transparent); color: var(--on-surface); border: 2px solid var(--primary); z-index: 4; pointer-events: none; font: var(--label-l); }
/* Planned task blocks: the plan, not logged time – see-through with a dashed edge. */
/* Planned time: dotted = a plan (liquid ones in their own colour, a meeting not confirmed yet in the app's); solid = I am
   going (set in stone, or a meeting I said I will be at). Out of the office: getting ready / driving striped. */
.wk-plan { background: color-mix(in srgb, var(--plan-liquid) 10%, transparent); color: var(--on-surface); border: 2px dotted var(--plan-liquid); box-shadow: none; }
.wk-plan.invite { background: color-mix(in srgb, var(--primary) 6%, transparent); border: 2px dotted var(--primary); }
.wk-plan.solid { background: color-mix(in srgb, var(--primary) 16%, var(--surface-1)); border: 1.5px solid var(--primary); }
.wk-plan.site { background-image: repeating-linear-gradient(135deg, color-mix(in srgb, currentColor 16%, transparent) 0 4px, transparent 4px 8px),
  repeating-linear-gradient(135deg, color-mix(in srgb, currentColor 16%, transparent) 0 4px, transparent 4px 8px);
  background-size: 100% var(--pre, 0%), 100% var(--post, 0%); background-position: top, bottom; background-repeat: no-repeat; }
.wk-plan.done { opacity: .5; }
/* An entry someone asked me along to, until I say "Osalen": dotted. */
.wk-ev.invite, .entry.invite { outline: 2px dotted var(--primary); outline-offset: -2px; opacity: .8; }
.entry.plan { opacity: .85; border: 2px dotted var(--plan-liquid); }
.entry.plan.invite { border: 2px dotted var(--primary); }
.entry.plan.solid { opacity: 1; border: 1.5px solid var(--primary); }
/* A comment linked to a task. */
.picker.linked input, .picker.linked textarea { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
/* ▾ inside the comment field: opens the task list. */
.picker.tc input, .picker.tc textarea { padding-right: 48px; }
.tc-open { position: absolute; top: 0; right: 0; width: var(--target); height: var(--target); border: none; background: none;
  color: var(--primary); font-size: 18px; cursor: pointer; border-radius: var(--r-s); }
.tc-open:hover { background: color-mix(in srgb, var(--primary) 12%, transparent); }
/* Projects: cards packed in columns, so short ones leave no gaps (one column on phones). */
.ptop { flex-wrap: wrap; gap: var(--s3); margin-bottom: var(--s3); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Projects / Archive / Other topics: tabs in the title's place, the open one underlined. */
.ptabs { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; gap: 0 var(--s4); }
.ptabs a { display: flex; align-items: center; gap: var(--s1); min-height: var(--target); font: var(--title-l); color: var(--on-surface-variant); text-decoration: none;
  border-bottom: 3px solid transparent; }
.ptabs a + a { font: var(--title-m); } /* archive and other topics: less important */
.ptabs a:hover { color: var(--on-surface); }
.ptabs a[aria-current="page"] { color: var(--on-surface); border-bottom-color: var(--primary); font-weight: 600; }
.ptabs .pcount { font: var(--label-l); color: var(--on-surface-variant); }
.ptop .seg { flex: none; width: auto; }
.ptop .seg button { flex: none; white-space: nowrap; padding: 0 var(--s3); }
@media (max-width: 599px) { .ptop .seg { width: 100%; } .ptop .seg button { flex: 1 1 auto; white-space: normal; padding: 0 var(--s2); } .ptop .seg button[data-s="abc"] { white-space: nowrap; } }
.ptop .pscale { width: auto; flex: none; min-height: var(--target); }
/* Meeting view: the projects under each lead. */
.plead { font: var(--title-m); margin: var(--s4) 0 var(--s2); }
.pmeet .pdrag { display: none; } /* grouped: nowhere to move a card to */
.plead .pcount { font: var(--label-l); color: var(--on-surface-variant); }
/* One card under another, the project on the left and its tasks on the right (one column on a phone). */
.pcard .pinfo, .pcard .pwork { display: contents; }
.plist { display: grid; gap: var(--s3); margin-bottom: var(--s3); }
.plist .pcard { margin: 0; }
.psplit { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.pdrop { min-height: 56px; padding: var(--s1) var(--s2); border-radius: var(--r-m); border: 1px dashed var(--outline-variant); }
.pdrop > b { font: var(--label-l); color: var(--on-surface-variant); }
.pdrop.drop { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.pdrop li[draggable] { cursor: grab; }
.pdrop li.dragging { opacity: .5; }
.pmemo-item { display: grid; gap: var(--s1); margin-top: var(--s1); }
.pmemo-item .row { min-height: 0; gap: var(--s1); font: var(--label-s); }
.pmemo-text { white-space: pre-wrap; overflow-wrap: anywhere; font: var(--body-m); }
.pmemo details { margin-top: var(--s2); }
.pmemo summary { cursor: pointer; font: var(--label-l); color: var(--on-surface-variant); min-height: 32px; display: list-item; }
.pmemo details .pmemo-item { padding-top: var(--s2); border-top: 1px dashed var(--outline-variant); opacity: .85; }
@media (min-width: 700px) {
  .plist .pcard { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: var(--s4); align-items: start; }
  .plist .pinfo, .plist .pwork { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
  .plist .pbanner { margin-right: 0; border-radius: var(--r-l) 0 0 0; }
  .plist .pwork > .pgroup:first-child { border-top: 0; padding-top: 0; }
}
/* Packed: each card spans as many 4px rows as it is tall (set in packCards), so a short card leaves no hole under it.
   Grid placement keeps the order roughly left to right, top to bottom. */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); grid-auto-rows: 4px; column-gap: var(--s3);
  align-items: start; margin-bottom: var(--s3); }
.pgrid .pcard { margin: 0; }
/* Custom order on a wide screen: a table of post-it notes, each card where it was put (left/top/z set in packCards). */
.pgrid.free { display: block; position: relative; }
.pgrid.free .pcard { position: absolute; box-shadow: 0 1px 3px rgb(0 0 0 / .18); }
/* A card pushed aside by another slides there (not the one being dragged). */
@media (prefers-reduced-motion: no-preference) { .pgrid.free .pcard:not(.moving) { transition: left .2s ease, top .2s ease; } }
@media (pointer: fine) { .pgrid:not(.narrow) .pcard { cursor: grab; } .pgrid .pcard :is(a, button, input, label, select, textarea) { cursor: pointer; } .pgrid .pcard input.pnew { cursor: text; } }
.pcard .pdrag { width: 32px; margin-left: calc(-1 * var(--s2)); cursor: grab; touch-action: none; color: var(--on-surface-variant); font-size: 1.2rem; }
.pgrid.narrow .pdrag { display: none; } /* one column on a phone: nowhere to put a card but in the list */
.pcard.moving { z-index: 1000 !important; cursor: grabbing; box-shadow: 0 8px 24px rgb(0 0 0 / .28); }
.pcard.moving .pdrag { cursor: grabbing; }
.pcard { display: flex; flex-direction: column; gap: var(--s2); }
.pcard .ptitle { font: var(--title-m); color: var(--on-surface); text-decoration: none; overflow-wrap: anywhere; }
.pcard .ptitle:hover { text-decoration: underline; }
/* The project's picture: a low banner behind the title, edge to edge, darkened so the title reads. */
.pbanner { position: relative; min-height: 56px; margin: calc(-1 * var(--s4)) calc(-1 * var(--s4)) 0; padding: var(--s1) var(--s2) var(--s1) var(--s4);
  border-radius: var(--r-l) var(--r-l) 0 0; background: center / cover no-repeat; isolation: isolate; }
.pbanner::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: linear-gradient(90deg, rgb(0 0 0 / .62), rgb(0 0 0 / .18)); }
.pbanner .ptitle, .pbanner button.icon { color: #fff; text-shadow: 0 1px 2px rgb(0 0 0 / .6); }
.pimgrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.pimg { flex: 1 0 100%; height: 56px; border-radius: var(--r-m); background: center / cover no-repeat; }
.pcard .late { color: var(--error); font-weight: 600; }
.ptag { display: inline-block; font: var(--label-s); padding: 2px var(--s2); margin: 0 var(--s1) var(--s1) 0; border-radius: var(--r-s);
  border: 1px solid var(--tag-x); color: var(--on-surface); background: color-mix(in srgb, var(--tag-x) 18%, transparent); }
.ptag-service { --tag-x: var(--tag-service); }
.ptag-automation { --tag-x: var(--tag-automation); }
.ptag-oem { --tag-x: var(--tag-oem); }
.ptag-parts { --tag-x: var(--tag-parts); }
/* Planned time filled up to today, the whole fill in the colour of its quarter (green → red, dark red when late);
   the ticks mark the quarters. */
.pbar { --tick: var(--surface); position: relative; height: 12px; border-radius: 6px; overflow: hidden; background: var(--outline-variant); }
.card .pbar { --tick: var(--surface-1); }
.pbar::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent calc(25% - 1px), var(--tick) 0 25%, transparent 0 calc(50% - 1px),
    var(--tick) 0 50%, transparent 0 calc(75% - 1px), var(--tick) 0 75%, transparent 0); }
.pfill { display: block; height: 100%; background: var(--stage); }
.stage-1 { --stage: var(--stage-1); } .stage-2 { --stage: var(--stage-2); } .stage-3 { --stage: var(--stage-3); }
.stage-4 { --stage: var(--stage-4); } .stage-late { --stage: var(--stage-late); }
.pgroup { border-top: 1px solid var(--outline-variant); padding-top: var(--s2); }
.pgroup > b { font: var(--label-l); color: var(--on-surface-variant); }
.ptodo { list-style: none; margin: 0; padding: 0; font: var(--body-m); }
.ptodo li { display: flex; align-items: center; gap: var(--s1); overflow-wrap: anywhere; }
.ptodo li { min-height: 40px; gap: var(--s2); }
.ptodo input[type="checkbox"] { width: 22px; min-height: 22px; flex: none; margin: 0; }
.pcard .pnew { min-height: 40px; }
/* Main levels: a completed one is quiet, the one being worked on is marked in the primary colour. */
.plhead { display: flex; align-items: center; gap: var(--s2); min-height: 40px; }
.plhead label { flex: 1; display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.plhead .ladd { width: 36px; height: 36px; min-height: 36px; font-size: 1.25rem; }
.plevel .pnew { width: calc(100% - var(--s4)); margin: var(--s1) 0 var(--s2) var(--s4); min-height: 40px; }
.plhead b { font: var(--label-l); color: var(--on-surface-variant); }
.plhead input[type="checkbox"] { width: 22px; min-height: 22px; flex: none; margin: 0; accent-color: var(--outline); }
.plevel.current .plhead b { color: var(--primary); }
.plevel.done .plhead b { color: var(--on-surface-variant); opacity: .7; text-decoration: line-through; }
.plevel .ptodo { padding-left: var(--s4); }
.ongoing { font: var(--label-s); color: var(--on-primary-container); background: var(--primary-container); border-radius: var(--r-s); padding: 1px var(--s1); }
.row select.lvlsel { flex: 0 1 30%; width: auto; min-width: 0; }
/* An enquiry's steps, one under the other: a numbered (✓ when done) mark, the name, the current one's button. */
.lsteps { list-style: none; display: grid; gap: 2px; margin: 0; padding: 0; }
.lsteps li { display: flex; align-items: center; gap: var(--s2); font: var(--body-m); min-height: 34px; padding: 2px var(--s2); border-radius: var(--r-s);
  border: 1px solid transparent; color: var(--on-surface-variant); }
.lsteps li.done { color: var(--on-surface); }
.lsteps li.current { border-color: var(--primary); color: var(--on-surface); font-weight: 600; background: var(--surface-2); }
.lsteps .smark { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font: var(--label-s); border: 1px solid var(--outline-variant); }
.lsteps .smark .ic { width: 14px; height: 14px; }
.lsteps li.done .smark { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.lsteps li.current .smark { border-color: var(--primary); color: var(--primary); }
.lsteps .sbtn { min-height: 30px; padding: 0 var(--s3); font: var(--label-l); flex: none; }
.lsteps .icon { width: 30px; height: 30px; min-height: 30px; flex: none; }
.ldue { margin-left: var(--s1); color: var(--on-surface-variant); font-weight: 400; cursor: help; }
.ldue.soon { color: var(--stage-3); }
.ldue.late { color: var(--error); }
.ldue.ok { color: var(--stage-1); }
.ldates { margin-top: var(--s4); }
.ldates summary { cursor: pointer; font-weight: 600; padding: var(--s3) 0; }
/* Todo: planned / ongoing / done side by side on wide screens, stacked on phones. */
.tdpick { flex: 1 1 260px; max-width: 420px; }
.tdinfo { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s3); max-width: 640px; }
/* Enquiries: cards in a plain grid; won / lost; what is asked (read-only, for someone given a task in one). */
.egrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: var(--s3); align-items: start; }
.egrid .pcard { margin: 0; }
.econt { font: var(--body-m); overflow-wrap: anywhere; }
.econt a { color: inherit; white-space: nowrap; }
.econt .ic, .eout .ic { vertical-align: -2px; }
.estatus { display: inline-block; font: var(--label-l); padding: 2px var(--s2); border-radius: var(--r-s); }
.estatus.won { background: var(--secondary-container); color: var(--on-secondary-container); }
.estatus.lost { background: var(--error-container); color: var(--on-error-container); }
.easked { border-left: 3px solid var(--primary); background: var(--surface-2); border-radius: var(--r-s); padding: var(--s2) var(--s3); margin-bottom: var(--s3); overflow-wrap: anywhere; }
.easkd summary { cursor: pointer; font: var(--label-l); color: var(--primary); padding: var(--s1) 0; }
/* The offer's price and how it changed while haggling (down = cheaper for the customer). */
.eoffer { font: var(--body-m); }
.eoffer details summary { cursor: pointer; font: var(--label-l); color: var(--primary); padding: var(--s1) 0; }
.ehist { margin: 0; padding-left: var(--s4); overflow-wrap: anywhere; }
.ehist .down { color: var(--error); }
.ehist .up { color: var(--stage-1); }
/* Tellimused: an order card – what is ordered, its delivery (stages / tasks / steps), the closing checklist. */
.olines { list-style: none; margin: 0; padding: 0; font: var(--body-m); }
.olines li { display: flex; gap: var(--s2); padding: var(--s1) 0; border-bottom: 1px dashed var(--outline-variant); }
.olines li:last-child { border-bottom: none; }
.osec { display: flex; flex-direction: column; gap: var(--s2); border-top: 1px solid var(--outline-variant); padding-top: var(--s3); }
.osec h3 { margin: 0; font: var(--label-s); text-transform: uppercase; letter-spacing: .06em; color: var(--on-surface-variant); }
.osegs { list-style: none; display: flex; gap: 3px; margin: 0; padding: 0; }
.osegs li { flex: 1; height: 8px; border-radius: var(--r-full); background: var(--outline-variant); }
.osegs li.done { background: var(--primary); }
.osegs li.current { background: color-mix(in srgb, var(--primary) 40%, var(--outline-variant)); }
.oprog { height: 6px; border-radius: var(--r-full); background: var(--outline-variant); overflow: hidden; }
.oprog span { display: block; height: 100%; width: var(--p); background: var(--primary); border-radius: inherit; }
.otasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font: var(--body-m); }
.otasks li { display: flex; align-items: center; gap: var(--s2); min-height: 36px; }
.otasks li.done { color: var(--on-surface-variant); }
.otasks li.done a { color: inherit; text-decoration: line-through; }
.otasks a { color: var(--on-surface); text-decoration: none; }
.otasks a:hover { text-decoration: underline; }
.otasks .smark { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--outline); display: inline-flex; align-items: center; justify-content: center; }
.otasks li.done .smark { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.otasks .smark .ic { width: 12px; height: 12px; }
.ochecks { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); }
.ocheck { display: inline-flex; align-items: center; gap: var(--s2); min-height: 36px; font: var(--body-m); color: var(--on-surface-variant); }
.ocheck.on { color: var(--on-surface); }
.ocheck input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.oclose { align-self: flex-start; }
.ohint { margin: 0; font: var(--body-m); color: var(--on-surface-variant); display: flex; gap: var(--s2); align-items: flex-start; }
.ohint .ic { flex: none; margin-top: 2px; }
/* An order line in the enquiry dialog: code, name, quantity, unit, remove. */
.oline { display: grid; grid-template-columns: 1fr 1.6fr .9fr auto auto; gap: var(--s1); align-items: center; }
.oline input, .oline select { min-width: 0; }
@media (max-width: 520px) { .oline { grid-template-columns: 1fr 1fr auto; } .oline [data-l="name"] { grid-column: 1 / -1; grid-row: 1; } }
/* Määramata: work nobody has shouts (and is the button to give it to someone). */
.unas { flex: none; display: inline-flex; align-items: center; gap: var(--s1); min-height: 28px; padding: 0 var(--s2); border-radius: var(--r-full);
  border: 1px solid var(--unas); background: color-mix(in srgb, var(--unas) 14%, transparent); color: var(--on-unas); font: var(--label-s); cursor: pointer; }
.unas:hover { background: color-mix(in srgb, var(--unas) 26%, transparent); }
.unas .ic { width: 14px; height: 14px; }
.ocard.needs, .pcard.needs { box-shadow: inset 3px 0 0 var(--unas); }
.unas.sm { width: 28px; padding: 0; justify-content: center; }
.dunas { border-left: 4px solid var(--unas); margin-bottom: var(--s3); }
.dunas h2 { color: var(--on-unas); margin-top: 0; }
.dunas .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); column-gap: var(--s4); }
.nav-ico { position: relative; }
.nbadge { position: absolute; top: -4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full);
  background: var(--unas); color: #fff; font: 600 .6875rem/18px var(--font); text-align: center; }
/* Tootmine > Juhtimine: everyone's load by day; the table scrolls sideways, the names stay. */
.wl { overflow-x: auto; border: 1px solid var(--outline-variant); border-radius: var(--r-s); }
.wl table { border-collapse: collapse; font: var(--label-s); }
.wl th, .wl td { padding: 4px 6px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--outline-variant); }
.wl th[scope="row"] { position: sticky; left: 0; z-index: 1; text-align: left; background: var(--surface-1); min-width: 120px; }
.wl .wl-sum th, .wl .wl-sum td { font-weight: 600; border-top: 2px solid var(--outline-variant); }
.wl .wl-now { color: var(--primary); }
.wl .wl-we, .wl .wl-off { background: var(--surface-2); }
.wl .wl-away { color: var(--on-surface-variant); }
.wl .wl-0, .wlcard.wl-0 { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.wl .wl-1, .wlcard.wl-1 { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.wl .wl-2, .wlcard.wl-2 { background: color-mix(in srgb, #e8a33d 35%, transparent); }
.wl .wl-3, .wlcard.wl-3 { background: color-mix(in srgb, var(--error) 35%, transparent); }
/* Müük > Kliendid: contacts and portal users. */
.cul { list-style: none; margin: var(--s1) 0 0; padding: 0; display: grid; gap: var(--s1); }
.cul .row { gap: var(--s2); }
/* AI abiline: the round button above the nav, the side panel (full screen on a phone). */
.aibtn { position: fixed; right: 16px; bottom: 96px; z-index: 40; width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--primary); color: var(--on-primary); font-size: 1.4rem; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.aipanel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(440px, 100%); display: flex; flex-direction: column;
  background: var(--surface-1); border-left: 1px solid var(--outline-variant); box-shadow: -4px 0 16px rgba(0, 0, 0, .25); }
.aihead { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--outline-variant); gap: var(--s1); }
.aihead select { max-width: 150px; min-height: 36px; }
.aimsgs { flex: 1; overflow-y: auto; padding: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.aimsg { max-width: 88%; padding: var(--s2) var(--s3); border-radius: var(--r-m); background: var(--surface-2); overflow-wrap: anywhere; }
.aimsg.user { align-self: flex-end; background: var(--secondary-container); color: var(--on-secondary-container); }
.aimsg.error { color: var(--error); background: transparent; }
.aiconfirm ul { margin: 0; padding-left: 1.2em; }
.aiask { display: flex; gap: var(--s2); padding: var(--s2) var(--s3) var(--s3); border-top: 1px solid var(--outline-variant); }
.aiask textarea { flex: 1; resize: none; }
.wlcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s2); }
.wlcard { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: var(--s2) var(--s3); border: 1px solid var(--outline-variant);
  border-radius: var(--r-s); text-align: left; min-height: 0; }
.wlcard b { font-size: 1.4rem; }
.wlcard[aria-pressed="true"] { outline: 2px solid var(--primary); }
.cucrow { gap: var(--s1); }
.cucrow input { flex: 1 1 0; min-width: 0; }
/* Juhtimine > Planeerimine: waiting tasks beside the team's week. */
.pboard { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: var(--s3); align-items: start; }
@media (max-width: 899px) { .pboard { grid-template-columns: 1fr; } }
.pwaitcol h3 { margin: 0; }
.pwaitlist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); max-height: 70vh; overflow-y: auto; }
.pwait { padding: var(--s2); border: 1px solid var(--outline-variant); border-radius: var(--r-s); background: var(--surface-2); cursor: grab; font: var(--label-m); }
.pwait.urgent { border-left: 3px solid var(--error); }
.pteam td.pcell { vertical-align: top; text-align: left; min-width: 120px; white-space: normal; }
.pteam td.pcell.drop { outline: 2px dashed var(--primary); outline-offset: -2px; }
.pteam td.pcell.over .psum { color: var(--error); }
.pblock { padding: 2px 6px; margin-bottom: 2px; border-radius: var(--r-s); background: var(--secondary-container); color: var(--on-secondary-container); cursor: grab; }
.pblock.fixed { cursor: default; }
.pblock.done { opacity: .5; text-decoration: line-through; }
/* A calendar entry (not a task's plan): it takes the day but is not moved here. */
.pblock.pentry { cursor: default; background: var(--surface-2); color: var(--on-surface); }
.pblock.pentry.pending { background: transparent; border: 1px dashed var(--outline); }
.psum { font: var(--label-s); }
/* Settings: something new in the changelog. */
.ndot { position: absolute; top: -2px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
/* Müük cards: a slim header (the edit button doesn't push the subject down), documents as small links. */
.ecard .icon[data-eedit] { width: 32px; height: 32px; min-height: 32px; margin: -4px -8px -4px 0; }
.ecsum { min-height: 32px; }
.ecsum .text { min-height: 32px; }
.ocard .odocs { display: flex; flex-wrap: wrap; gap: 0 var(--s4); }
.ocard .odocs .ofrow { gap: var(--s1); }
.ocard .odocs .btn { min-height: 32px; padding: 0 var(--s1); }
/* Settings: for an admin on a computer their own settings beside the admin ones (server, users, clients). */
.setwrap { display: grid; gap: var(--s3); align-items: start; }
.setcol { display: grid; gap: var(--s3); min-width: 0; }
.setcol .card + .card { margin-top: 0; }
body:not(.wide) .setwrap { max-width: 640px; }
@media (min-width: 1000px) { body.wide .setwrap.two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 1200px; } }
.skchip.main { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; }
.skchip.acc { border-style: dashed; }
.wsrow { border-top: 1px solid var(--outline-variant); padding-top: var(--s2); }
.wsrow select { width: auto; }
.chip.exc { background: var(--warn-container); color: var(--on-warn-container); }
.excw { color: var(--on-surface); } /* a scarce specialist used outside their main role */
.uflags { display: grid; gap: 0 var(--s4); margin-top: var(--s1); }
.uflags label.row { min-height: 36px; }
@media (min-width: 1000px) { body.wide .uflags { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dbar { height: 10px; border-radius: var(--r-full); background: var(--surface-2); border: 1px solid var(--outline-variant); overflow: hidden; }
.dbar span { display: block; height: 100%; background: var(--primary); }
.dbar.low span { background: var(--unas); }
.dwarn { margin: 0; color: var(--on-unas); font: var(--label-l); display: flex; gap: var(--s2); align-items: center; }
.dstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.dstats div { display: grid; }
.plist1 { display: grid; gap: var(--s2); max-height: 60vh; overflow: hidden auto; padding: 2px; }
.plist1 button { justify-content: flex-start; }
.plist1 button[hidden] { display: none; }
.plist1 button .grow { text-align: left; }
/* Skills: small chips beside a name; as toggles (Settings > Users, the picker's filter) filled when on. */
.skchips { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.skchip { display: inline-flex; align-items: center; font: var(--label-s); padding: 2px var(--s2); border-radius: var(--r-full);
  border: 1px solid var(--outline-variant); background: transparent; color: var(--on-surface-variant); min-height: 0; }
.skfilter { display: flex; flex-wrap: wrap; gap: var(--s1); margin: var(--s2) 0; }
.skfilter .skchip { min-height: 32px; cursor: pointer; }
.skfilter .skchip[aria-pressed="true"] { background: var(--secondary-container); color: var(--on-secondary-container); border-color: transparent; }
/* With a mouse the card's edit button shows on hover (always on touch screens). */
@media (hover: hover) {
  .ecard .icon[data-eedit] { opacity: 0; transition: opacity .15s; }
  .ecard:hover .icon[data-eedit], .ecard .icon[data-eedit]:focus-visible { opacity: 1; }
}
.tcols { display: grid; gap: var(--s4); margin-top: var(--s3); }
@media (min-width: 900px) { .tcols { grid-template-columns: repeat(3, 1fr); } }
.tcol { background: var(--surface-1); border-radius: var(--r-l); padding: var(--s2) var(--s3); min-width: 0; }
.tcol h2 { margin: var(--s2) 0; }
.tcol .list li:last-child { border-bottom: none; }
.tcol [draggable="true"] { cursor: grab; }
.tcol [draggable="true"].dragging { opacity: .5; }
.tcol.drop { outline: 2px dashed var(--primary); outline-offset: -2px; }
/* Where a dragged task lands, and tasks nested under the one they wait for. */
.tcol li.drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.tcol li.drop-after { box-shadow: inset 0 -2px 0 var(--primary); }
.tcol li.tsub { padding-left: calc(var(--d) * 20px - 20px); }
.tnest { display: flex; flex: none; width: 20px; color: var(--on-surface-variant); opacity: .7; }
.tnest svg { width: 16px; height: 16px; }
/* Task notes (rich text) and attachments: short on the Todo card, all of it when opened. */
.notes { overflow-wrap: anywhere; }
.notes p, .notes div { margin: 0; }
.notes ul, .notes ol { margin: var(--s1) 0; padding-left: var(--s5); }
.list .notes li, .notes li { display: list-item; min-height: 0; padding: 0; border: none; }
.tnotes { margin-top: var(--s1); color: var(--on-surface-variant); font: var(--body-m); }
.tnotes.short { max-height: 4.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.tthumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); margin-top: var(--s2); }
.tthumbs a { position: relative; display: block; color: inherit; text-decoration: none; }
.tthumbs.open { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s2); }
.tthumbs.open .fname { display: block; font: var(--label-s); color: var(--on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tthumbs .fthumb { width: 48px; height: 48px; }
.tthumbs.open .fthumb { width: 100%; height: 80px; }
.tthumbs a.vid::after { content: "▶"; position: absolute; top: 0; left: 0; right: 0; height: 48px; display: grid; place-items: center; color: #fff; text-shadow: 0 1px 3px rgb(0 0 0 / .8); }
.tthumbs.open a.vid::after { height: 80px; }
.tmorecount { font: var(--label-l); color: var(--on-surface-variant); padding: 0 var(--s1); }
.fthumb { display: block; width: 40px; height: 40px; flex: none; object-fit: cover; border-radius: var(--r-s); background: var(--surface-2); }
.ficon { display: grid; place-items: center; font-size: 1.3rem; }
.tmore { min-height: 40px; padding: 0 var(--s2); margin: var(--s1) 0 0 calc(-1 * var(--s2)); font: var(--label-l); color: var(--primary); }
.tfiles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s1); }
.tfiles:empty { display: none; }
.tfiles li { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.tfiles a { color: var(--on-surface); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tfiles .icon { width: 40px; height: 40px; min-height: 40px; font-size: 1.2rem; }
.neditor { border: 1px solid var(--outline); border-radius: var(--r-s); background: var(--surface); }
.neditor:focus-within { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.ntools { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-bottom: 1px solid var(--outline-variant); }
.ntools .icon { width: 40px; height: 36px; min-height: 36px; font-size: 1rem; color: var(--on-surface-variant); }
.nbody { min-height: 120px; max-height: 40vh; overflow-y: auto; padding: var(--s3); color: var(--on-surface); font: var(--body-l); outline: none; }
/* Service: a task is two lines, the place or machine above the job; done ones carry their feedback. */
.tmach { display: block; font: var(--label-s); color: var(--on-surface-variant); text-transform: none; }
.ptodo .two { padding: var(--s1) 0; }
.pnew2 { display: flex; flex-direction: column; gap: var(--s1); }
.tdadd .grow { min-width: 0; }
.tdadd #tdMach { flex: 0 1 35%; }
.tdadd { flex-wrap: wrap; }
.tdadd #tdNote { flex: 1 0 100%; }
/* Milestones (Todo page and the Koosolek card): ticked ones struck through. */
.mstone .ldue { white-space: nowrap; }
.mstone.done .grow { text-decoration: line-through; color: var(--on-surface-variant); }
.tfeed, .hfeed { white-space: pre-wrap; overflow-wrap: anywhere; font: var(--body-m); color: var(--on-surface); margin-top: var(--s1);
  padding: var(--s1) var(--s2); border-left: 3px solid var(--stage-1); background: var(--surface-2); border-radius: 0 var(--r-s) var(--r-s) 0; }
.tfeed svg { color: var(--stage-1); }
/* The service map: picked in the project dialog, opened full size (a tap zooms in where tapped). */
.pmaprow { display: flex; flex-direction: column; gap: var(--s2); }
.pmapimg { max-width: 100%; max-height: 180px; object-fit: contain; align-self: flex-start; border-radius: var(--r-m); border: 1px solid var(--outline-variant); }
dialog.mapdlg { width: min(1400px, calc(100vw - 16px)); max-width: none; max-height: calc(100dvh - 16px); padding: var(--s2); display: flex; flex-direction: column; }
dialog.mapdlg:not([open]) { display: none; }
.mapview { overflow: auto; flex: 1; min-height: 0; max-height: calc(100dvh - 104px); border-radius: var(--r-m); background: var(--surface); }
.mapview img { display: block; max-width: 100%; max-height: calc(100dvh - 104px); margin: auto; cursor: zoom-in; }
.mapview.zoom img { max-width: none; max-height: none; cursor: zoom-out; }
dialog.mapdlg .actions { margin-top: var(--s2); align-items: center; }
/* Service history: filters over the day done, the place or machine and who did it. */
.hist { margin-top: var(--s5); background: var(--surface-1); border-radius: var(--r-l); padding: var(--s2) var(--s3) var(--s3); }
.hist h2 { display: flex; align-items: center; gap: var(--s2); margin: var(--s2) 0 var(--s3); }
.hfilters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--s3); margin-bottom: var(--s3); }
.hitems li { align-items: flex-start; }
.hjob { position: relative; cursor: pointer; border-radius: var(--r-s); margin: calc(-1 * var(--s1)); padding: var(--s1) 36px var(--s1) var(--s1); }
.hjob:hover { background: var(--surface-2); }
.hjob:focus-visible { outline: 2px solid var(--primary); }
.hpen { position: absolute; top: var(--s1); right: var(--s1); display: flex; color: var(--on-surface-variant); opacity: .6; }
/* "When it was done" in the feedback and task dialogs. */
.dwhen { display: grid; gap: var(--s1); margin: var(--s3) 0; font: var(--label-l); color: var(--on-surface-variant); }
.dwhen .row { flex-wrap: wrap; }
.dwhen input[type="date"] { flex: 1 1 150px; }
.dwhen input[type="time"] { flex: 1 1 100px; }
.dwhint { font: var(--label-s); }
/* Admin: how many days ahead work entries still show for users with hiding on. */
.hideahead { flex-wrap: wrap; gap: var(--s2); font: var(--body-m); color: var(--on-surface-variant); }
.hideahead select { width: auto; }
.hjob:hover .hpen { opacity: 1; }
.htimes { list-style: none; margin: var(--s1) 0 0; padding: 0; font: var(--label-l); color: var(--on-surface-variant); }
.list .htimes li { display: block; min-height: 0; padding: 2px 0; border: none; }
.htimes a { color: var(--primary); text-decoration: none; }
.htimes a:hover { text-decoration: underline; }
.hdate { flex: none; width: 92px; font: var(--label-l); color: var(--on-surface-variant); padding-top: 2px; }
@media (max-width: 599px) { .hitems li { flex-direction: column; gap: var(--s1); } .hdate { width: auto; } }
.ptask { cursor: pointer; border-radius: var(--r-s); }
.ptask:hover { background: var(--surface-2); }
.ptask:focus-visible { outline: 2px solid var(--primary); }
/* My tasks: planned for today stands out. */
.tcol .list li.mtoday { background: color-mix(in srgb, var(--primary) 14%, transparent); border-left: 3px solid var(--primary);
  border-radius: var(--r-s); padding-left: var(--s2); padding-right: var(--s2); }
/* Haldus: done / arrived ones folded away; supplies with a small photo, urgent marked, a date gone by in red. */
.hdone { margin-top: var(--s4); }
.hdone summary { cursor: pointer; font: var(--label-l); padding: var(--s2) 0; }
.sphoto { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; display: block; }
.sphoto.big { width: auto; height: auto; max-width: 100%; max-height: 240px; }
.list li.surgent { border-left: 3px solid var(--error); padding-left: var(--s2); }
.ptag.surg { background: var(--error-container); color: var(--on-error-container); }
.slate { color: var(--error); font-weight: 600; }
/* Üritused: a description and posts keep their lines; a poll's Yes / No buttons and its own actions. */
.evname { margin: 0; font: var(--title-l); }
.evdesc { white-space: pre-wrap; overflow-wrap: anywhere; margin: var(--s1) 0; }
.evvote { width: auto; display: inline-flex; margin: var(--s2) 0; }
.evvote button { min-width: 72px; }
.evact { display: flex; flex-direction: column; align-items: flex-end; }
.list li.evpoll, .evposts li { align-items: flex-start; }
/* Eelarvestamine */
.cprice { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cvals { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--s3); margin-bottom: var(--s3); }
.ctable { overflow-x: auto; }
.ctable td.num, .ctable th.num { font-variant-numeric: tabular-nums; }
.cedit { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: var(--s2) 0; border-bottom: 1px solid var(--outline-variant); }
.cedit > input, .cedit > select { flex: 1 1 110px; width: auto; min-width: 0; }
.cedit > textarea { flex: 1 1 100%; order: 1; }
.cedit > .citem, .cedit > .cformula[data-l] { flex: 2 1 240px; }
.cformula { font-family: ui-monospace, Consolas, monospace; }
.cedit [data-lres] { flex: 1 1 auto; }
.cmargins { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s3); }
#mErr:empty { display: none; }
.cact { margin-top: var(--s4); flex-wrap: wrap; }
/* Kalkulatsioon */
.ecalc { display: inline-flex; align-items: center; gap: var(--s1); margin: var(--s1) 0; }
.kitem { padding: var(--s3) 0; border-bottom: 1px solid var(--outline-variant); }
.kitem .cvals { margin: var(--s2) 0 0; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
#kAddM { flex: 1 1 200px; width: auto; }
.kcount { gap: var(--s1); flex: none; }
.kcount input { width: 72px; }
.klines summary { cursor: pointer; }
.klines table { margin-top: var(--s1); }
/* Client tickets: the client's page, a ticket's line on the Todo page, the comment thread. */
.clproj { margin-top: var(--s5); }
.clproj h2 { margin: 0; }
.clhead { flex-wrap: wrap; gap: var(--s2); }
.clhead .grow { flex: 1 1 200px; }
.ticket { gap: var(--s2); }
.ticket .late, .tticket .late { color: var(--error); font-weight: 600; }
.tag.urgent, .tticket.urgent { background: var(--error-container); color: var(--on-error-container); }
.tticket { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s1); margin-top: var(--s1); font: var(--label-s); padding: 2px var(--s2);
  border-radius: var(--r-s); background: var(--secondary-container); color: var(--on-secondary-container); }
.pticket { color: var(--on-surface-variant); }
.pticket.urgent { color: var(--error); }
.cthread ul { list-style: none; margin: 0 0 var(--s2); padding: 0; display: grid; gap: var(--s2); }
.cthread li { padding: var(--s1) var(--s2); border-radius: var(--r-s); background: var(--surface-2); max-width: 85%; overflow-wrap: anywhere; }
.cthread .ctext { white-space: pre-wrap; }
.cthread li.staff { border-left: 3px solid var(--primary); }
.cthread li.cust { border-left: 3px solid var(--stage-3); }
.cthread li .muted { display: block; font: var(--label-s); }
.cthread .row { gap: var(--s1); }
.cthread input { min-width: 0; }
#tkU button { min-height: 56px; line-height: 1.2; }
/* Dashboard (computers): today's calendar, then the newest tasks and the open tickets side by side. */
.dash { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.dash .card + .card { margin-top: 0; }
.dash h2 { margin-top: 0; display: flex; align-items: center; gap: var(--s2); }
.dash .wk-chip { display: flex; align-items: center; margin-top: var(--s2); }
.dgrid { display: grid; grid-template-columns: 48px 1fr; margin-top: var(--s4); padding-top: var(--s2); cursor: pointer; }
.dgrid .wk-col { cursor: pointer; }
.dgrid .wk-ev { cursor: pointer; }
.dgrid .wk-ev::after { display: none; }
@media (max-width: 1023px) { .dash { grid-template-columns: 1fr; } }
/* A client's new ticket / order: room between the fields; the response choice as a full-width switch. */
.tkform { display: grid; gap: var(--s4); }
.tkform div.field { display: grid; gap: var(--s1); font: var(--label-l); color: var(--on-surface-variant); }
.tkform .row { gap: var(--s2); }
.tkform .seg button { min-height: 44px; }
label.btn { cursor: pointer; }
@media (min-width: 900px) { .tcols.four { grid-template-columns: repeat(4, 1fr); } }
/* The client's page on a computer: tickets and orders side by side. */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: var(--s3); align-items: start; }
.tgrid .card + .card { margin-top: 0; }
.tgrid.packed { grid-auto-rows: 4px; row-gap: 0; }
.tgrid.list { grid-template-columns: 1fr; }
.tdates { font: var(--body-m); display: grid; gap: 2px; }
.ooffer { padding: var(--s2) var(--s3); border-radius: var(--r-s); background: var(--surface-2); gap: var(--s2); }
.tag.ok { display: inline-flex; align-items: center; gap: 4px; }
/* An enquiry or order the client sees in their portal. */
.tag.pmark { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-container); color: var(--on-primary-container); }
.tag.pmark svg { width: 14px; height: 14px; }
.tag.pmark.revived { background: var(--warn-container); color: var(--on-warn-container); }
/* A project seen without being in it (Näeb kõiki projekte). */
.tag.vmark { display: inline-flex; align-items: center; gap: 4px; }
.tag.vmark svg { width: 14px; height: 14px; }
.echat { margin-top: var(--s2); }
.cchat > summary { display: flex; align-items: center; gap: var(--s1); cursor: pointer; padding: var(--s1) 0; font: var(--label-l); list-style: none; }
.cchat > summary::-webkit-details-marker { display: none; }
.cchat > summary::after { content: '▸'; margin-left: auto; color: var(--on-surface-variant); font-size: 1.25rem; line-height: 1; }
.cchat[open] > summary::after { content: '▾'; }
.cchat .clast { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: var(--body-m); margin-left: var(--s2); }
.cchat[open] .clast { display: none; } /* packed like the project cards: each card spans its own height */
.ofacts { font: var(--body-m); }
.dash .seg { margin-left: auto; }
.dash .seg button { min-height: 32px; }
.dtop { justify-content: flex-end; margin-bottom: var(--s3); }
.dtop .seg { width: 200px; }
.dtop .seg button { min-height: 32px; }
/* Dashboard log ("Viimati"): a console – dark in both themes, monospace, newest on top; resizable by its bottom edge. */
.dlog { margin-bottom: var(--s4); }
.dlog > .row { gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s2); }
.dlog > .row b { display: flex; align-items: center; gap: var(--s2); font: var(--title-m); }
.dlog input[type="search"] { width: 320px; min-height: 36px; }
.dlog select { min-height: 36px; width: auto; }
.dconsole {
  list-style: none; margin: 0; padding: var(--s2) var(--s3); height: 240px; min-height: 120px; overflow: auto; resize: vertical;
  background: #0b1014; color: #c9d4dc; border: 1px solid #1f2a31; border-radius: var(--r-m, 12px);
  font: 12.5px/1.6 ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}
.dconsole li { display: flex; gap: 1ch; white-space: nowrap; min-width: 0; }
.dconsole li > * { flex: none; }
.dconsole li > :last-child { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.dconsole .lt { color: #6b7d88; }
.dconsole .lw { color: #7fd1d3; min-width: 10ch; }
.dconsole .lv { color: #e6edf3; }
.dconsole a, .dconsole span { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.dconsole a { color: #a5c8ff; }
.dconsole a:hover { text-decoration: underline; }
.dconsole .ld { color: #8b9aa5; }
.dconsole .ld::before { content: "— "; }
.dconsole .g-ticket .lv { color: #ff9b8e; }
.dconsole .g-comment .lv { color: #d7b4ff; }
.dconsole .g-file .lv { color: #ffd479; }
.dconsole .g-plan .lv { color: #8fe3a6; }
.dconsole .g-project .lv, .dconsole .g-enquiry .lv { color: #7fd1d3; }
.dconsole .muted { color: #6b7d88; }
.ofrow { flex-wrap: wrap; gap: var(--s1) var(--s2); }
.ofrow .btn { white-space: nowrap; }
.odocs { display: grid; gap: var(--s1); }
.odoc { display: inline-flex; align-items: center; gap: 2px; }
.odoc .icon { width: 28px; height: 28px; min-height: 28px; }
.odoc a.btn.icon { display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; background: none; color: var(--on-surface-variant); }
.odoc a.btn.icon:hover { color: var(--primary); }
/* The client's page: one bar – who, the view, the language, logging out (wraps on a phone; the view's words hide there). */
.clbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-bottom: var(--s3); }
.clbar h1 { margin: 0; }
.clbar .grow { flex: 1 1 220px; min-width: 0; }
.clbar .seg button { display: inline-flex; align-items: center; gap: var(--s1); }
@media (max-width: 600px) { .clbar .sl { display: none; } }
/* The sales roadmap: one step at a time; "Samm n/m" opens the whole way. */
.steps { display: grid; gap: 2px; }
.steps:not(.open) .lsteps li.more { display: none; }
.lsteps li.later { color: var(--on-surface-variant); }
.steps .sall { justify-self: start; min-height: 28px; padding: 0 var(--s1); font: var(--label-s); color: var(--on-surface-variant); }
.sdue { font: var(--label-s); font-weight: 400; color: var(--on-surface-variant); margin-left: var(--s1); white-space: nowrap; }
.sdue .ic { width: 12px; height: 12px; vertical-align: -1px; }
.sdue.late { color: var(--error); font-weight: 600; }
.elost { align-self: flex-start; color: var(--on-surface-variant); }
.ocard.flash { animation: oflash 2.4s ease-out; }
@keyframes oflash { 0%, 40% { box-shadow: 0 0 0 3px var(--primary); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .ocard.flash { animation: none; outline: 2px solid var(--primary); } }
/* Settings: the order templates – a numbered row a step: its name, then days / who / what the client sees. */
.ofh { margin: var(--s2) 0 0; font: var(--title-m); }
.oflist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.ofrow { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s2); border: 1px solid var(--outline-variant); border-radius: var(--r-s); background: var(--surface-1); }
.ofrow .smark { flex: none; width: 24px; height: 24px; margin-top: 8px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--outline); font: var(--label-s); color: var(--on-surface-variant); }
.ofmain { flex: 1; min-width: 0; display: grid; gap: var(--s2); }
.offixed { min-height: 40px; display: flex; align-items: center; gap: var(--s1); }
.ofopts { display: grid; grid-template-columns: 90px minmax(140px, 1fr) minmax(140px, 1fr); gap: var(--s2); }
.ofopts input, .ofopts select { width: 100%; min-width: 0; }
.ofchecks { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); font: var(--body-m); }
.ofbtns { flex: none; display: flex; flex-direction: column; }
.ofbtns .icon { width: 36px; height: 36px; min-height: 36px; }
@media (max-width: 599px) { .ofopts { grid-template-columns: 80px minmax(0, 1fr); } .ofopts label:nth-child(3) { grid-column: 1 / -1; } }
/* Who has a step or task on an order card (tap: give it to one more); a work task ticked there. */
.swho { min-height: 28px; padding: 0 var(--s1); font: var(--label-s); color: var(--on-surface-variant); font-weight: 400; }
.otasks button.smark { flex: none; box-sizing: border-box; width: 22px; height: 22px; min-width: 0; min-height: 0; padding: 0; border-radius: 50%; background: none; cursor: pointer; }
.otasks button.smark:hover { border-color: var(--primary); background: var(--surface-2); }
/* An admin's delete on an order card: quiet, at its foot, in the error colour. */
.ocard .odel { align-self: flex-start; color: var(--error); }
/* Development ideas: cards side by side on a wide screen; the texts keep their line breaks. */
.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: var(--s3); align-items: start; }
.ideas .card + .card { margin-top: 0; }
.itext { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Töölaud > Loo / Muuda: the menu of what to make, the search list of what to change, and the open-after-saving box. */
.qmenu { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: var(--s2); }
.qmenu button, .qrow { display: flex; align-items: center; justify-content: flex-start; gap: var(--s3); text-align: left; min-height: 56px; padding: var(--s2) var(--s3);
  border: 1px solid var(--outline-variant); border-radius: var(--r-m); background: var(--surface-1); color: var(--on-surface); font: inherit; cursor: pointer; width: 100%; }
.qmenu button:hover, .qrow:hover, .qmenu button:focus-visible, .qrow:focus-visible { background: var(--surface-2); }
.qmenu button > svg { flex: none; width: 24px; height: 24px; color: var(--primary); }
.qrow { min-height: 48px; border: 0; border-radius: var(--r-s); }
.qlist { max-height: min(60vh, 480px); overflow: hidden auto; margin-top: var(--s2); }
#qS { width: 100%; }
dialog .actions .qgo { margin-right: auto; gap: var(--s2); }
dialog .actions .qgo input { width: 20px; min-height: 20px; }

/* Pictures on an enquiry / order form: a small x on each */
.picsf { margin-bottom: var(--s2); }
.picsf:empty { display: none; }
.picsf .pic { position: relative; display: inline-flex; }
.picsf .pic .icon { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; min-height: 0; padding: 0; border-radius: var(--r-full);
  background: var(--surface-1); box-shadow: var(--shadow); }
.picsf .pic.new .fthumb { object-fit: cover; outline: 2px dashed var(--outline); outline-offset: -2px; }

/* Planned work that was missed: dotted like a plan, waiting for "Tegin" */
.missed.card { border: 2px dashed var(--plan-liquid); }
.missed .list li { gap: var(--s2); flex-wrap: wrap; }
.wk-chip.missed { background: transparent; border: 1.5px dashed var(--plan-liquid); color: var(--plan-liquid); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.guidehint { display: flex; align-items: center; gap: var(--s2); margin: 0 0 var(--s3); }
.guidehint a { display: inline-flex; align-items: center; gap: var(--s1); }
.mtgo { flex: none; }
.smproj { display: flex; flex-wrap: wrap; gap: 2px var(--s3); } /* the summary report: projects / people in a cell */
.trlog { margin-top: 2px; font: var(--label-s); color: var(--on-surface-variant); } /* the task report: a task's entries by date */
.mtgo.on { background: var(--primary); color: var(--on-primary); } /* its timer is running: Stop */
/* Õpetus (Settings): a card per topic, opened one by one */
.guide { display: grid; gap: var(--s3); max-width: 760px; }
.guide summary { display: flex; align-items: center; gap: var(--s2); cursor: pointer; min-height: 32px; }
.guide ol { margin: var(--s3) 0 var(--s2); padding-left: 1.4em; display: grid; gap: var(--s2); }
.guide details > p { margin: 0 0 var(--s3); }

/* Settings › Teema: light / dark, the ready themes as swatches, and the own colours' preview. */
.thgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s2); }
.thsw { display: flex; align-items: center; justify-content: flex-start; white-space: nowrap; gap: var(--s2); min-height: 44px; border: 1px solid var(--outline-variant); background: var(--surface-1); color: var(--on-surface); }
.thsw[aria-checked="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); font-weight: 600; }
#thMode button { white-space: nowrap; }
.thdot { width: 18px; height: 18px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.thprev { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; padding: var(--s3); border: 1px solid var(--outline-variant); border-radius: var(--r-m); background: var(--surface); }
.thprev span { padding: var(--s1) var(--s2); border-radius: var(--r-s); font: var(--label-l); }
.thcolors input[type="color"] { width: 100%; min-height: 40px; padding: 2px; }
