:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #15202b;
  --muted: #5e6b78;
  --line: #dce1e7;
  --soft: #eaeef3;
  --primary: #2343c9;
  --primary-ink: #ffffff;
  --danger: #c8372a;
  --danger-soft: #fdecea;
  --warn-soft: #fff4dc;
  --warn: #9a6200;

  --st-confirmed: #6b7a8c;
  --st-design_ready: #7a4dd8;
  --st-ready: #c98a0b;
  --st-done: #2f8f5b;
  --st-cancelled: #a9b2bc;

  --radius-s: 6px;
  --radius-m: 10px;
  --sidebar: 212px;
  font-family: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b;
    --panel: #1a2027;
    --ink: #e8edf2;
    --muted: #93a0ad;
    --line: #2b333d;
    --soft: #222a33;
    --primary: #7b93ff;
    --primary-ink: #0d1330;
    --danger: #ff7a6b;
    --danger-soft: #3a1f1c;
    --warn-soft: #3a2f16;
    --warn: #f0c060;
    --st-confirmed: #8c9bad;
    --st-design_ready: #a786f0;
    --st-ready: #e6a92c;
    --st-done: #4fbf83;
    --st-cancelled: #59636e;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Kest ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--line); background: var(--panel);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 2px;
}
.logo { font-weight: 700; font-size: 18px; padding: 4px 10px 18px; letter-spacing: -0.01em; }
.logo span { color: var(--muted); font-weight: 500; }
.nav a {
  display: block; padding: 9px 10px; border-radius: var(--radius-s);
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--soft); }
.nav a.on { background: var(--soft); color: var(--primary); }
.side .me { margin-top: auto; padding: 10px; font-size: 13px; color: var(--muted); }
.side .me b { display: block; color: var(--ink); font-weight: 600; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font-size: 13px; }

main.page { padding: 24px 28px 64px; min-width: 0; }
.bottomnav { display: none; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  main.page { padding: 16px 14px 96px; }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--panel); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav a {
    flex: 1; text-align: center; padding: 8px 2px; font-size: 13px; font-weight: 500;
    color: var(--muted); text-decoration: none; border-radius: var(--radius-s);
  }
  .bottomnav a.on { color: var(--primary); background: var(--soft); }
}

/* ---------- Päis ---------- */
.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.bar h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.015em; margin-right: auto; }
.bar h1 small { display: block; font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-top: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: var(--panel); }
.seg a, .seg button {
  padding: 7px 12px; border: 0; background: none; text-decoration: none; color: var(--ink);
  font-weight: 500; cursor: pointer; border-right: 1px solid var(--line);
}
.seg > :last-child { border-right: 0; }
.seg .on { background: var(--soft); color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 14px; border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.iconbtn { width: 36px; padding: 8px 0; }

/* ---------- Päevatahvel ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col {
  flex: 0 0 264px; background: var(--soft); border-radius: var(--radius-m);
  padding: 10px; min-height: 140px; transition: background 0.12s, box-shadow 0.12s;
}
.col.unassigned { background: transparent; border: 1.5px dashed var(--line); }
.col.over { box-shadow: inset 0 0 0 2px var(--primary); }
.col h3 { font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; padding: 2px 4px 10px; }
.col h3 span { color: var(--muted); font-weight: 500; }
.col .empty { color: var(--muted); font-size: 13px; padding: 16px 4px; text-align: center; }

.card {
  display: block; background: var(--panel); border-radius: var(--radius-s); border: 1px solid var(--line);
  border-left: 4px solid var(--st, var(--line)); padding: 10px 12px; margin-bottom: 8px;
  color: var(--ink); text-decoration: none; cursor: grab;
}
.card:hover { border-color: var(--muted); border-left-color: var(--st); }
.card.dragging { opacity: 0.4; }
.card.conflict { box-shadow: 0 0 0 1.5px var(--danger); }
.card .time { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.card .time small { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.card .loc { font-weight: 500; margin-top: 4px; }
.card .who { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip {
  font-size: 12px; font-weight: 500; padding: 2px 7px; border-radius: 4px;
  background: var(--soft); color: var(--ink); white-space: nowrap;
}
.chip.bg { background: transparent; border: 1px solid var(--line); }
.chip.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.card .warn { color: var(--danger); font-size: 12.5px; font-weight: 600; margin-top: 8px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--st); margin-right: 6px; vertical-align: 1px; }

@media (max-width: 760px) {
  .board { flex-direction: column; overflow: visible; }
  .col { flex: none; width: 100%; min-height: 0; }
  .col .empty { display: none; }
  .col.is-empty { display: none; }
  .card { cursor: pointer; }
}

/* ---------- Nädal ja kuu ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.wday { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); min-height: 220px; padding: 8px; }
.wday.today { border-color: var(--primary); }
.wday > a { display: flex; justify-content: space-between; text-decoration: none; color: var(--ink); font-weight: 600; padding: 2px 4px 8px; }
.wday > a span { color: var(--muted); font-weight: 500; }
.mini {
  display: block; border-left: 3px solid var(--st); padding: 5px 7px; margin-bottom: 6px; background: var(--soft);
  border-radius: 4px; text-decoration: none; color: var(--ink); font-size: 13px;
}
.mini b { font-weight: 650; }
.mini .sub { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini.conflict { box-shadow: inset 0 0 0 1.5px var(--danger); }
@media (max-width: 960px) {
  .week { grid-template-columns: 1fr; }
  .wday { min-height: 0; }
}

.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-m); overflow: hidden; }
.month .dow { padding: 6px 8px; font-size: 12px; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-weight: 500; }
.mcell {
  min-height: 104px; padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  text-decoration: none; color: var(--ink); display: block;
}
.mcell:hover { background: var(--soft); }
.mcell.out { color: var(--muted); background: var(--bg); }
.mcell .d { display: flex; justify-content: space-between; font-weight: 600; font-size: 13px; }
.mcell.today .d > span:first-child { background: var(--primary); color: var(--primary-ink); border-radius: 4px; padding: 0 5px; }
.mcell .count { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; }
.mcell .line { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcell .flag { color: var(--danger); font-size: 12px; font-weight: 600; }
@media (max-width: 760px) {
  .mcell { min-height: 64px; padding: 4px; }
  .mcell .line { display: none; }
  .mcell .count { font-size: 18px; }
}

/* ---------- Vormid ---------- */
.layout2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .layout2 { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px; margin-bottom: 16px; }
.panel h2 { font-size: 16px; font-weight: 650; margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 14px; }
.grid .wide { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
label.f.inline { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=time], input[type=search], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--panel); color: var(--ink); font-size: 15px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }

.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick button {
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  cursor: pointer; font-weight: 500; font-size: 14px;
}
.pick button.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.pick button[disabled] { opacity: 0.4; cursor: not-allowed; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.bglist { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.bgrow { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-s); }
.bgrow.bad { border-color: var(--danger); background: var(--danger-soft); }
.bgrow .n { font-weight: 650; min-width: 44px; }
.bgrow .name { flex: 1; min-width: 0; }
.sides { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.sides button { border: 0; background: none; padding: 2px 9px; cursor: pointer; font-size: 13px; font-weight: 600; }
.sides button.on { background: var(--ink); color: var(--panel); }
.x { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 4px; }

.search-pop { position: relative; }
.search-pop .results {
  position: absolute; z-index: 10; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: 0 8px 24px rgba(10, 20, 40, 0.12);
}
.search-pop .results button {
  display: flex; width: 100%; gap: 8px; text-align: left; border: 0; background: none; padding: 8px 10px; cursor: pointer;
}
.search-pop .results button:hover, .search-pop .results button.active { background: var(--soft); }
.search-pop .results .busy { margin-left: auto; color: var(--danger); font-size: 12.5px; font-weight: 600; }

.alerts { border-radius: var(--radius-m); background: var(--danger-soft); color: var(--danger); padding: 12px 14px; margin-bottom: 16px; }
.alerts b { display: block; margin-bottom: 4px; }
.alerts ul { margin: 0; padding-left: 18px; }
.alerts a { color: inherit; font-weight: 600; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sticky-actions {
  position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px);
  padding: 12px 0; border-top: 1px solid var(--line); margin-top: 8px; z-index: 5;
}
@media (max-width: 760px) { .sticky-actions { bottom: 58px; } }

/* ---------- Ülesanded ---------- */
.task { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; margin-bottom: 8px; background: var(--panel); }
.task.done .desc { color: var(--muted); text-decoration: line-through; }
.task .top { display: flex; gap: 10px; align-items: flex-start; }
.task input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--st-done); flex: none; }
.task .desc { white-space: pre-wrap; font-weight: 500; flex: 1; }
.task .meta { font-size: 13px; color: var(--muted); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.task .meta .late { color: var(--danger); font-weight: 600; }
.files { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.file { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.file a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file span { color: var(--muted); font-size: 12px; }
.upload { display: inline-flex; margin-top: 8px; }
.upload input { display: none; }

.links .lrow { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.links .lrow:last-child { border-bottom: 0; }
.links .lrow b { font-weight: 600; }
.links input { font-size: 13px; color: var(--muted); }

/* ---------- Tabelid ---------- */
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 13px; color: var(--muted); font-weight: 500; background: var(--soft); }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.off td { color: var(--muted); }
table.list td.n { font-weight: 650; width: 70px; }
.tablewrap { overflow-x: auto; }

/* ---------- Sisselogimine ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth form { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth h1 { font-size: 22px; }
.auth p { color: var(--muted); margin: 0; }
.err { color: var(--danger); font-size: 14px; min-height: 1em; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: var(--radius-s); font-weight: 500;
  transition: opacity 0.18s, transform 0.18s; pointer-events: none; z-index: 50; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--danger); color: #fff; }
@media (max-width: 760px) { #toast { bottom: 84px; } }

.muted { color: var(--muted); }
.loading { color: var(--muted); padding: 40px 0; }

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

/* ---------- v2: kaart, seadmed, taustad, kontaktid ---------- */
.card { outline-offset: 2px; }
.card .time small { font-size: 12px; margin-left: 6px; }
.card .work { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.card .work b { color: var(--ink); font-weight: 600; }
.card .missing { margin-top: 8px; font-size: 12.5px; color: var(--warn); font-weight: 600; }
.card .warn div + div { margin-top: 2px; }
.chip b { font-weight: 700; }
button.chip { border: 1px solid transparent; cursor: pointer; font-family: inherit; line-height: 1.45; }
.chip.dev { background: var(--soft); }
.chip.dev:hover { border-color: var(--muted); }
.chip.dev.open { background: var(--warn-soft); color: var(--warn); border: 1px dashed currentColor; }
.chip.dev.bad { background: var(--danger-soft); color: var(--danger); }
.chip-select { width: auto; padding: 2px 6px; font-size: 12.5px; border-radius: 4px; }

.items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.items:empty { display: none; }
.itemrow { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-s); }
.itemrow.bad { border-color: var(--danger); background: var(--danger-soft); }
.itemrow .name { font-weight: 600; min-width: 110px; }
.itemrow select { flex: 1; max-width: 260px; }

.thumb { width: 44px; height: 33px; object-fit: cover; border-radius: 4px; flex: none; background: var(--soft); display: inline-block; }
.thumb.empty { border: 1px dashed var(--line); background: none; }
.search-pop .results button { align-items: center; }
.bgrow .n { font-size: 17px; }

.contacts { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.contactrow { display: grid; grid-template-columns: 1fr 1fr 1fr 28px; gap: 10px; align-items: end; width: 100%; }
.contactrow .x { padding-bottom: 10px; }
@media (max-width: 760px) { .contactrow { grid-template-columns: 1fr 28px; } .contactrow .x { grid-row: 1; grid-column: 2; } }

.bggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
@media (max-width: 760px) { .bggrid { grid-template-columns: 1fr; } }
.bgcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px; position: relative; }
.bgcard.off { opacity: 0.55; }
.bgcard.editing { border-color: var(--primary); }
.bgcard .edit { position: absolute; top: 10px; right: 10px; }
.sides2 { display: flex; flex-direction: column; gap: 10px; padding-right: 64px; }
.bgside { display: flex; gap: 12px; align-items: center; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.photo {
  width: 104px; height: 78px; border-radius: 6px; border: 1px solid var(--line); background: var(--soft);
  padding: 0; overflow: hidden; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13px;
}
.photo.empty { border-style: dashed; background: none; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot .linkbtn { font-size: 12px; }
.bignum { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.bgname { font-weight: 500; }
.small { font-size: 12.5px; }

.devgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.panel.off { opacity: 0.6; }
.devhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.devhead h2 { margin: 0; font-size: 18px; }
.devlist { display: flex; flex-direction: column; margin-bottom: 10px; border-top: 1px solid var(--line); }
.devrow { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.devrow.off .name { color: var(--muted); text-decoration: line-through; }
.devrow .name { flex: 1; font-weight: 500; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 10px; width: 100%; }
.inline-form input { flex: 1; min-width: 160px; }
.bggrid { align-items: start; }
@media (max-width: 760px) {
  .bottomnav { gap: 2px; overflow-x: auto; }
  .bottomnav a { font-size: 12px; padding: 8px 6px; flex: 1 0 auto; }
}

/* ---------- v3: asukoht, varukoopiad ---------- */
.locbox { display: flex; flex-direction: column; gap: 8px; }
.mapframe { width: 100%; height: 260px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--soft); }
.maplinks { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; align-items: center; }
.maplinks a { font-weight: 600; }
.pointrow { display: flex; gap: 8px; }
.pointrow input { flex: 1; }
.pointinfo { font-size: 13px; }
.backups { display: flex; flex-direction: column; }
.brow { display: grid; grid-template-columns: 140px 1fr auto; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); align-items: center; }
.brow:last-child { border-bottom: 0; }
@media (max-width: 760px) { .brow { grid-template-columns: 1fr auto; } .brow .muted { display: none; } }

/* ---------- v4: sõiduajad ---------- */
.col .office { font-size: 13px; color: var(--muted); margin: -6px 4px 10px; min-height: 1em; }
.col .office b { color: var(--primary); font-size: 15px; }
.card .drive { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.card .drive:empty { display: none; }
.card .drive .late { color: var(--danger); font-weight: 600; margin-top: 2px; }
.drivebox { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; padding-top: 4px; }

/* ---------- v5: sularaha, nimekiri ---------- */
.card .cashline { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--st-done); }
.packchip { display: inline-flex; align-items: center; gap: 2px; padding: 4px 4px 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-weight: 500; font-size: 14px; }
.packchip .x { font-size: 16px; }
[hidden] { display: none !important; }

/* ---------- v6: ilma taustata, nimekiri seadme järgi ---------- */
.chip.nobg { background: transparent; border: 1px dashed var(--muted); color: var(--muted); }
.packlist { display: flex; flex-wrap: wrap; gap: 6px; }
.packchk { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-weight: 500; font-size: 14px; cursor: pointer; }
.packchk input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.packchk.off { color: var(--muted); text-decoration: line-through; background: var(--bg); }
.packchk.extra { border-color: var(--primary); padding-right: 4px; cursor: default; }
.devpack { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.devpack-title { font-weight: 600; margin-bottom: 8px; }
.pick .packchip .x, .packlist .x { border: 0; background: none; padding: 0 6px; border-radius: 4px; }

/* ---------- v7: seadme värv ja kood ---------- */
.card { position: relative; border-left: 1px solid var(--line); padding-left: 16px; overflow: hidden; }
.card:hover { border-left-color: var(--muted); }
.card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--devbar, var(--line)); }
.card.dim { opacity: 0.28; }
.card .time { display: flex; align-items: baseline; }
.card .time .status-dot { align-self: center; margin-right: 8px; }
.code {
  display: inline-block; min-width: 22px; padding: 0 5px; margin-right: 6px; border-radius: 3px;
  color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; line-height: 17px; text-align: center; vertical-align: 1px;
}
.code.big { font-size: 14px; line-height: 26px; min-width: 40px; padding: 0 8px; border-radius: 5px; margin: 0; }
.chip.dev { padding-left: 3px; }
.chip.dev .code { margin-right: 5px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -6px 0 14px; }
.legend button[data-type] {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px 4px 5px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 500; font-size: 13.5px;
}
.legend button[data-type] .muted { margin-left: 2px; }
.legend button[data-type].on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

.mini { border-left: 0; position: relative; padding-left: 10px; overflow: hidden; }
.mini::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--devbar, var(--line)); }
.mcell .dots { display: flex; flex-wrap: wrap; gap: 3px; margin: 4px 0 2px; }
.mcell .dot { width: 9px; height: 9px; border-radius: 50%; }

.devlook { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -2px 0 12px; }
.swatches { display: flex; gap: 6px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.codeinput { width: 64px !important; text-transform: uppercase; text-align: center; font-weight: 700; }
.mini { display: block; }
.mini .top { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; }
.mini .top .code { margin: 0; font-size: 10px; line-height: 15px; min-width: 20px; padding: 0 3px; }
.mini .top b { margin-left: 3px; }
.mini .loc { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* päise reegel (.wday > a) ei tohi kehtida kaartidele */
.wday > a.mini { display: block; font-weight: 400; padding: 5px 7px 5px 10px; }
.wday > a.mini span.code { color: #fff; font-weight: 700; }

/* ---------- v8: rahandus ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px; }
.stat .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat .value { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; margin-top: 2px; }
.stat.main { border-color: var(--primary); }
.stat.main .value { font-size: 28px; color: var(--primary); }
.stat.warn .value { color: var(--warn); }
table.fin th.r, table.fin td.r { text-align: right; }
table.fin tr.click { cursor: pointer; }
table.fin tr.click:hover td { background: var(--soft); }
table.fin tr.sel td { background: var(--soft); font-weight: 600; }
table.fin tr.unpaid td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.warnt { color: var(--warn); font-weight: 600; }

/* ---------- v9: töötajate tasud ---------- */
.pays { display: flex; flex-direction: column; gap: 6px; }
.payrow { display: flex; align-items: center; gap: 10px; }
.payrow > span:first-child { min-width: 110px; font-weight: 500; }
.payrow input { width: 120px; }
.workerpay { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.workerpay h3 { font-size: 16px; margin-bottom: 10px; }
.payinput { width: 120px !important; text-align: right; }
.payinput.missing { border-color: var(--warn); background: var(--warn-soft); }

/* ---------- v10: avaleht ---------- */
.nav a .badge, .bottomnav a .badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px;
  background: var(--warn); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 18px; text-align: center;
}
.panel.home h2 { display: flex; align-items: center; gap: 8px; }
.panel.home h2 .count { font-size: 13px; color: var(--muted); font-weight: 600; background: var(--soft); border-radius: 9px; padding: 0 8px; line-height: 20px; }
.panel.home.urgent { border-color: var(--warn); box-shadow: inset 4px 0 0 var(--warn); }
.panel.home.urgent h2 .count { background: var(--warn); color: #fff; }
.homegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.homegrid .panel { margin-bottom: 16px; }
@media (max-width: 900px) { .homegrid { grid-template-columns: 1fr; gap: 0; } }
.hlist { display: flex; flex-direction: column; }
.hrow {
  display: grid; grid-template-columns: 110px 1fr auto auto; gap: 14px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none;
  transition: opacity 0.3s;
}
.hrow:last-child { border-bottom: 0; }
.hrow.compact { grid-template-columns: 64px 1fr auto; }
a.hrow:hover .what { color: var(--primary); }
.hrow.done { opacity: 0.25; }
.hrow .what { min-width: 0; font-weight: 500; }
.hrow .what a { font-weight: 600; }
.hrow .acts { display: flex; gap: 8px; align-items: center; }
.hrow .codes .code { margin: 0 0 0 3px; }
.issues { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.issue { font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 4px; padding: 1px 7px; }
@media (max-width: 760px) {
  .hrow { grid-template-columns: 1fr auto; }
  .hrow .when { grid-column: 1 / -1; display: flex; gap: 8px; align-items: baseline; }
  .hrow .acts { grid-column: 1 / -1; }
  .hrow.compact { grid-template-columns: 56px 1fr auto; }
  .hrow.compact .when { grid-column: auto; display: block; }
}
.photobar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; font-size: 14px; color: var(--muted); }
.photobar.todo { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-s); padding: 8px 12px; }
.hrow.compact.dated { grid-template-columns: 100px 1fr auto; }
@media (max-width: 760px) { .hrow.compact.dated { grid-template-columns: 92px 1fr auto; } }

/* ---------- v11: kliendid, kohad ---------- */
.kind { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; vertical-align: 1px; margin-right: 4px; }
.kind.company { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.kind.person { background: color-mix(in srgb, var(--st-done) 16%, transparent); color: var(--st-done); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.evchips { display: flex; flex-wrap: wrap; gap: 4px; }
.clientline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.newclient { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.newclient input { flex: 1; min-width: 200px; }
.seg.small button { padding: 5px 10px; font-size: 13.5px; }
.search-pop .results button { align-items: center; flex-wrap: wrap; }
.venueline { font-size: 14px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.venueline .hint { width: 100%; white-space: pre-line; }
.venuegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.venuecard { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; color: var(--ink); text-decoration: none; }
.venuecard:hover { border-color: var(--muted); }
.venuecard img, .venuecard .nophoto { width: 100%; height: 140px; object-fit: cover; display: block; background: var(--soft); }
.venuecard .nophoto { display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.venuecard .vbody { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.venuecard .vinfo { margin-top: 4px; color: var(--ink); }
.vgallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.vph { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-s); overflow: hidden; background: var(--soft); }
.vph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vph .x { position: absolute; top: 4px; right: 4px; background: rgba(0, 0, 0, 0.55); color: #fff; border-radius: 4px; }
.vph.add { border: 1.5px dashed var(--line); cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; }

/* ---------- v12: telefoni külgmenüü ---------- */
.topbar, .backdrop, .closemenu { display: none; }
.bottomnav { display: none !important; }
@media (max-width: 760px) {
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
    background: var(--panel); border-bottom: 1px solid var(--line); padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top));
  }
  .toptitle { flex: 1; font-weight: 650; font-size: 17px; }
  .menubtn { position: relative; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-s); width: 42px; height: 38px; display: grid; place-items: center; cursor: pointer; }
  .burger { display: grid; gap: 4px; }
  .burger i { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 1px; }
  .menubtn .badge { position: absolute; top: -6px; right: -6px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; }
  .side {
    display: flex; position: fixed; top: 0; bottom: 0; left: 0; height: 100%; z-index: 50;
    width: min(82vw, 300px); transform: translateX(-102%); transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.2); overflow-y: auto;
  }
  .shell.open .side { transform: none; }
  .backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(10, 15, 25, 0.4); opacity: 0; pointer-events: none; transition: opacity 0.22s; }
  .shell.open .backdrop { opacity: 1; pointer-events: auto; }
  .logo { display: flex; align-items: center; }
  .closemenu { display: block; margin-left: auto; font-size: 26px; }
  .side .nav a { padding: 12px 12px; font-size: 16px; }
  main.page { padding-bottom: 40px; }
  .sticky-actions { bottom: 0; }
  #toast { bottom: 24px; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) { .side, .backdrop { transition: none; } }

/* ---------- v12: kliendi ankeet ---------- */
.cform .filled { display: inline-block; background: color-mix(in srgb, var(--st-done) 14%, transparent); color: var(--st-done); font-weight: 600; font-size: 13.5px; border-radius: 6px; padding: 3px 9px; }
.panel.home.fresh { border-color: var(--st-done); box-shadow: inset 4px 0 0 var(--st-done); }
.panel.home.fresh h2 .count { background: var(--st-done); color: #fff; }
.setupinput { width: 110px !important; }

/* ---------- v13: taustade liik ja lisatasu, kujundus ---------- */
.fee { display: inline-block; background: #111; color: #fff; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px; margin-left: 6px; white-space: nowrap; }
.feeline { margin-top: 8px; font-size: 13.5px; font-weight: 600; color: var(--warn); }
.chip.bg.live { background: linear-gradient(135deg, #f3d27a33, #c9a7e833); border-color: #b8862b; }
.chip.bg.live::after { content: ' ✦'; color: #b8862b; }
.bgmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.bgmeta .fee { margin-left: 0; }
.bgmeta a { margin-left: auto; color: var(--primary); text-decoration: none; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 1px 7px; background: var(--line); color: var(--ink); }
.tag.live { background: #f3d27a; color: #4a3500; }
.tag.client { background: color-mix(in srgb, var(--st-done) 18%, transparent); color: var(--st-done); }
.panel.design textarea { min-height: 56px; }
.dfiles { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.dfile { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 6px 8px; }
.dfile .thumb { flex: none; width: 44px; height: 44px; border-radius: 6px; background: var(--line); display: grid; place-items: center; overflow: hidden; }
.dfile .thumb img { width: 100%; height: 100%; object-fit: contain; }
.dfile .thumb.ext { font-size: 11px; font-weight: 800; color: var(--muted); }
.dfile .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dfile .meta a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.results .fee, .bgrow .fee { margin-left: auto; }

/* ---------- v15: aksessuaarid, lähimad üritused ---------- */
.proprow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 6px 0; }
.proprow .plabel { width: 120px; font-size: 14px; }
.nextpanel .nextday + .nextday { margin-top: 14px; }
.nextpanel .nextdate { display: inline-block; font-weight: 650; margin-bottom: 6px; color: var(--primary); text-decoration: none; }
.hrow .when.stack { display: flex !important; flex-direction: column; gap: 1px; line-height: 1.2; }
.hrow .when.stack small { font-size: 12.5px; }

/* ---------- v16: paigaldus päev varem, üle südaöö ---------- */
.daybefore { margin: 4px 0; font-size: 12.5px; font-weight: 700; color: #fff; background: var(--warn); border-radius: 6px; padding: 2px 8px; display: inline-block; }
.daybefore.soft { background: var(--warn-soft); color: var(--warn); }
.daybefore.inline { margin: 0 0 0 8px; vertical-align: 1px; }
.plus1 { font-weight: 700; color: var(--warn); }
.mini.setupday { border-style: dashed; }
.sub.strong { color: var(--warn); font-weight: 650; }
.mcell .line.setupday { color: var(--warn); font-weight: 600; }
input.timefield { font-variant-numeric: tabular-nums; }
input.timefield.bad { border-color: var(--danger); background: var(--danger-soft); }
input.datefield {
  font-variant-numeric: tabular-nums; min-width: 140px; padding-right: 34px; cursor: text;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235e6b78' stroke-width='1.6'%3E%3Crect x='2' y='3' width='12' height='11' rx='2'/%3E%3Cpath d='M2 7h12M5 1.5v3M11 1.5v3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input.datefield.bad { border-color: var(--danger); background-color: var(--danger-soft); }

/* ---------- v17: operaator ---------- */
.opbtn { border: 1px dashed var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.opbtn.on { border-style: solid; border-color: #2f8f5b; color: #fff; background: #2f8f5b; }
.opbtn.extra { background: #f08c00; border-color: #f08c00; color: #fff; }
.opflag { margin: 6px 0 2px; display: inline-block; background: #f08c00; color: #fff; font-weight: 800; font-size: 12.5px; letter-spacing: 0.02em; border-radius: 6px; padding: 3px 8px; }
.opflag.mini { margin: 3px 0; font-size: 11px; padding: 1px 6px; }
.opmark { color: #e67700; font-weight: 800; }
.opmark.pill { background: #f08c00; color: #fff; border-radius: 4px; padding: 1px 5px; font-size: 11px; margin-right: 4px; }

/* ---------- v18: klient teeb kujunduse ise ---------- */
.selfdesign { background: #fff3e0; border: 1px solid #f08c00; color: #7a3d00; border-radius: var(--radius-s); padding: 8px 10px; margin-bottom: 10px; font-size: 13.5px; }
.selfdesign b { display: block; color: #c25e00; }
.selftag { display: inline-block; margin: 4px 0; font-size: 12px; font-weight: 700; color: #c25e00; border: 1px solid #f08c00; border-radius: 6px; padding: 1px 7px; }
@media (prefers-color-scheme: dark) { .selfdesign { background: #3a2a12; color: #ffd8a8; } .selfdesign b, .selftag { color: #ffa94d; } }

/* ---------- v19: paigalduse kuupäev ---------- */
.setupday { margin-top: -4px; }
.setupday-on { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; background: var(--warn-soft); border: 1px solid var(--warn); border-radius: var(--radius-s); padding: 8px 10px; }
.setupday-on b { color: var(--warn); }
.setupday-on .f.inline { margin: 0; gap: 6px; }
.setupday-on input.datefield { width: 150px; }
.setupday-on .hint { flex-basis: 100%; margin: 0; }
.hint.bad { color: var(--danger); }

/* ---------- v20: arve andmed ---------- */
.invbox { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px; font-size: 13.5px; line-height: 1.45; }
.invhead { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.invnotes { margin-top: 4px; white-space: pre-wrap; }

/* ---------- v21: hinnapakkumised ---------- */
.ostatus { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.ostatus.ok { background: color-mix(in srgb, var(--st-done) 16%, transparent); color: var(--st-done); }
.ostatus.bad { background: var(--danger-soft); color: var(--danger); }
.ostatus.open { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.hrow.fresh { box-shadow: inset 3px 0 0 var(--st-done); }
a.btnlike { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; text-decoration: none; color: var(--ink); font-size: 14px; }
a.btnlike.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.offeropts { display: flex; flex-direction: column; gap: 12px; }
.offeropt { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px; background: var(--panel); }
.offeropt .ohead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.offeropt .chip { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; }
form.locked input, form.locked textarea, form.locked .pick button { pointer-events: none; opacity: 0.7; }
.small.bad { color: var(--danger); }

/* ---------- v23: muudatuste ajalugu ---------- */
.chg { font-size: 13.5px; line-height: 1.45; margin: 2px 0; overflow-wrap: anywhere; }
.chg .old { color: var(--muted); text-decoration: line-through; }
.chg .new { color: var(--ink); font-weight: 600; }
.panel.clientchg { border-color: var(--st-done); box-shadow: inset 4px 0 0 var(--st-done); }
.hgroup { border-top: 1px solid var(--line); padding: 8px 0; }
.hgroup:first-child { border-top: 0; }
.hwho { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.whotag { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 8px; background: var(--soft); color: var(--ink); }
.whotag.client { background: color-mix(in srgb, var(--st-done) 18%, transparent); color: var(--st-done); }
.chgmini { margin-top: 4px; font-size: 12.5px; color: var(--ink); background: color-mix(in srgb, var(--st-done) 8%, transparent); border-radius: 6px; padding: 4px 8px; }
.chgmini b { font-weight: 650; }
details.views { margin-top: 6px; font-size: 13px; }
details.views summary { cursor: pointer; color: var(--muted); }

/* v27: lisad */
.exline { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.exline .x { margin-left: 6px; }
.extras-list { display: grid; gap: 12px; }
.exrow2 { display: flex; gap: 14px; align-items: flex-start; }
.exph { width: 120px; flex: 0 0 120px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.exph img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius-m); display: block; }
@media (max-width: 640px) { .exrow2 { flex-direction: column; } }

.livefee{margin:0 0 10px;padding:8px 10px;border-radius:10px;background:rgba(116,64,220,.07)}
.livefee label{display:flex;align-items:center;gap:6px;font-weight:600;flex-wrap:wrap}

/* ---------- v28: kalender ---------- */
.cal { position: fixed; z-index: 1000; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(20,20,40,.18); padding: 10px; width: 266px; user-select: none; }
.calhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.calhead b { text-transform: capitalize; font-size: 14.5px; }
.calhead button { border: 0; background: var(--soft); width: 30px; height: 30px; border-radius: 8px; font-size: 18px; line-height: 1; cursor: pointer; color: var(--ink); }
.calhead button:hover { background: var(--line); }
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.calgrid .wd { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.calgrid .d { border: 0; background: transparent; height: 32px; border-radius: 8px; font: inherit; font-size: 13.5px; cursor: pointer; color: var(--ink); font-variant-numeric: tabular-nums; }
.calgrid .we { color: var(--danger); }
.calgrid .d:hover { background: var(--soft); }
.calgrid .d.today { box-shadow: inset 0 0 0 1.5px var(--primary); font-weight: 700; }
.calgrid .d.sel { background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.calfoot { display: flex; justify-content: space-between; margin-top: 6px; }
.calfoot button { border: 0; background: transparent; color: var(--primary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.calfoot button:hover { background: var(--soft); }

/* ---------- v28: e-kirjad ---------- */
.notifycl { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; cursor: pointer; padding: 0 6px; white-space: nowrap; }
.notifycl input { width: 17px; height: 17px; margin: 0; }
.maillog { border-top: 1px solid var(--line); padding: 7px 0; }
.maillog summary { cursor: pointer; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; list-style: none; }
.maillog summary::-webkit-details-marker { display: none; }
.mstat { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; background: var(--st-done); }
.mstat.error { background: var(--danger); }
.mstat.off { background: var(--st-cancelled); }
.mailbody { white-space: pre-wrap; font: inherit; font-size: 13px; background: var(--soft); border-radius: 8px; padding: 8px 10px; margin: 6px 0 0; max-height: 260px; overflow: auto; }

/* ---------- v29: autom. kirjad, fotod ---------- */
.autotoggle { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; cursor: pointer; margin: 0 0 8px; line-height: 1.35; }
.autotoggle input { width: 17px; height: 17px; margin: 1px 0 0; flex: 0 0 auto; }
.mauto { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.phrow { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); align-items: center; }
.phrow input { min-width: 0; }
.phrow .phu { grid-column: 1 / -1; grid-row: 1; }

/* ---------- v30: päringud ---------- */
.leadgrid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14.5px; }
.leadgrid b { font-weight: 600; word-break: break-word; }
.leadmsg { margin-top: 12px; padding: 10px 12px; background: var(--soft); border-radius: 8px; white-space: pre-wrap; font-size: 14px; }
.leadbox.compact { border-left: 3px solid var(--primary); }
.panel .btn.small + .btn.small { margin-left: 6px; }

/* ---------- v31: import ---------- */
.imptable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.imptable th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.imptable td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.imptable tr.past td { opacity: .55; }
.imptable tr.on td { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.imptable .tag { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 6px; margin-top: 3px; background: var(--soft); color: var(--muted); }
.imptable .tag.warn { background: var(--warn-soft); color: var(--warn); }
.imptable .tag.bad { background: var(--danger-soft); color: var(--danger); }
.imptable details pre { max-width: 360px; }

/* ---------- v32: vestlus ---------- */
.chatpanel .cpl { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; margin-bottom: 8px; }
.cpm { max-width: 88%; padding: 7px 10px; border-radius: 12px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; }
.cpm small { display: block; font-size: 11px; opacity: .7; margin-top: 2px; }
.cpm.client { align-self: flex-start; background: var(--soft); border-bottom-left-radius: 3px; }
.cpm.team { align-self: flex-end; background: var(--primary); color: var(--primary-ink); border-bottom-right-radius: 3px; }
.cpform { display: flex; gap: 6px; align-items: flex-end; }
.cpform textarea { flex: 1; min-height: 44px; margin: 0; }
.cpimg { display: block; max-width: 220px; max-height: 220px; border-radius: 8px; margin-bottom: 4px; }
.cpfile { color: inherit; text-decoration: underline; display: block; margin-bottom: 2px; }

/* ---------- v34: rakendus + teavitused ---------- */
.modalwrap { position: fixed; inset: 0; z-index: 2000; background: rgba(10, 12, 20, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); color: var(--ink); border-radius: 14px; padding: 16px 18px; width: min(440px, 100%); box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.modalhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 16px; }
.modal .steps { padding-left: 20px; margin: 6px 0 10px; line-height: 1.55; }
.modal .steps li { margin-bottom: 6px; }
.pushbanner { display: flex; align-items: center; gap: 10px; justify-content: space-between; background: color-mix(in srgb, var(--primary) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--line)); border-radius: var(--radius-m); padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.pushbanner[hidden] { display: none !important; }
.pushbanner .btn { flex: 0 0 auto; }
.sticky-actions { padding-bottom: max(10px, env(safe-area-inset-bottom)); }

/* Kujunduse variandid */
.dvars { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 4px; }
.dvhead { font-weight: 700; margin-bottom: 6px; }
.dvlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 4px; }
.dvar { border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.dvar.chosen { border-color: #2f8f5b; box-shadow: 0 0 0 2px rgba(47, 143, 91, .25); }
.dvar a { display: flex; justify-content: center; }
.dvar img { width: auto; max-width: 100%; height: 120px; border-radius: 4px; background: linear-gradient(135deg, #b79cf2, #f3a6c8); }
.dvok { color: #2f8f5b; font-weight: 700; }
.dvbtns { display: flex; gap: 6px; flex-wrap: wrap; }

/* Kalender: kliendi e-post */
.who { font-size: 12.5px; color: var(--muted, #6b7280); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .who { font-size: 11.5px; }

.tag.final { background: #2f8f5b; color: #fff; border-radius: 999px; padding: 0 7px; margin-right: 4px; font-weight: 700; }
.btn.star { color: #b8860b; font-size: 15px; padding: 2px 8px; }
.btn.star.on { background: #fff4d6; border-color: #e0b84a; }

.mailok { color: #2f8f5b; font-weight: 600; }
.mailno { color: #b06a00; font-weight: 600; }

/* Autod */
.vehgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.vehcard { display: flex; flex-direction: column; gap: 4px; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: inherit; text-decoration: none; }
.vehcard.off { opacity: .55; }
.vehcard .vh { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.plate { font-family: ui-monospace, monospace; font-weight: 700; border: 1.5px solid currentColor; border-radius: 4px; padding: 0 6px; font-size: 12.5px; }
.valerts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.valert { font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 2px 9px; }
.valert.warn { background: #fff1d6; color: #8a5a00; }
.valert.bad { background: #fde2df; color: #b42318; }
.small.ok { color: #2f8f5b; font-weight: 600; }
.vlog .vrow { display: grid; grid-template-columns: 80px 1fr auto; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.vevent { border: 1.5px dashed var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.vehrow { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.vehtag { font-size: 12.5px; font-weight: 600; color: #2b5fb4; margin-top: 4px; }
.vehtag.mini { font-size: 11.5px; }

/* Päeva auto veeru päises */
.daycar { display: inline-flex; align-items: center; gap: 4px; margin: -4px 4px 10px; padding: 3px 10px; border-radius: 999px; border: 1px dashed var(--line); background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.daycar.on { border-style: solid; border-color: var(--primary); color: var(--primary); background: var(--card); font-size: 14px; }
.daycar.warn { border-color: #e0a100; }
.carpick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.rentbox { border-top: 1px solid var(--line); padding-top: 10px; }

/* ---------- Arved ---------- */
.kind.seg-organizer { background: #fde7c8; color: #8a4b00; }
.kind.seg-public { background: #dbeafe; color: #1e4fa3; }
.ist { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap; background: var(--line); color: var(--ink); }
.ist.draft { background: #eee; color: #666; }
.ist.open { background: #fff1c7; color: #7a5a00; }
.ist.overdue { background: #fde0de; color: #b42318; }
.ist.paid { background: #dcf3e5; color: #1f7a45; }
.ist.credit, .ist.credited { background: #ece7f8; color: #5b3fa8; }
.invrows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.invrow { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); color: inherit; text-decoration: none; }
.invrow:hover { border-color: var(--primary); }
.invrow b { white-space: nowrap; margin-right: auto; }
.invrow .num { white-space: nowrap; }
.invlines { display: flex; flex-direction: column; gap: 6px; }
.invline { display: grid; grid-template-columns: 1fr 70px 110px 100px 28px; gap: 6px; align-items: center; }
.invline.head { font-size: 12px; color: var(--muted); font-weight: 600; }
.invline { align-items: start; }
.invtitle { display: flex; flex-direction: column; gap: 4px; }
.invtitle textarea { min-height: 76px; resize: vertical; font-size: 14px; }
.invline .r, .invline.head .r { text-align: right; }
.invopts { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin: 12px 0 6px; font-size: 14px; }
.invopts label { display: inline-flex; gap: 6px; align-items: center; }
.invtotals { margin-left: auto; max-width: 300px; display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.invtotals > div { display: flex; justify-content: space-between; gap: 12px; }
.invtotals .sum { border-top: 2px solid var(--ink); padding-top: 6px; font-size: 17px; }
.invinfo { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 12px; }
.invinfo dt { color: var(--muted); }
.invinfo dd { margin: 0; }
.invframewrap { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-s); background: #f3f1f8; margin-bottom: 8px; }
.invframe { position: absolute; top: 0; left: 0; width: 880px; height: 1240px; border: 0; transform-origin: 0 0; display: block; }
.inl { display: flex; gap: 8px; align-items: center; }
.linkrow { display: flex; gap: 8px; }
.linkrow input { flex: 1; min-width: 0; font-size: 13px; }
.linkbtn.danger { color: var(--bad, #b42318); }
@media (max-width: 640px) {
  .invline { grid-template-columns: 1fr 60px 90px 28px; }
  .invline > :nth-child(4) { display: none; }
}
.pendlist { display: flex; flex-direction: column; }
.pendrow { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.pendrow:first-child { border-top: 0; }
.pendrow .when { width: 92px; }
.pendrow .what { flex: 1; min-width: 160px; overflow-wrap: anywhere; }
.pendrow .dvbtns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nowrap { white-space: nowrap; }

/* ---------- Statistika ---------- */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 120px; padding: 6px 0; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.bar1 { flex: 1; max-width: 28px; height: 100%; display: flex; align-items: flex-end; }
.bar1 i { display: block; width: 100%; background: var(--primary); border-radius: 3px 3px 0 0; opacity: .8; }
.bar1:hover i { opacity: 1; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.statgrid h3, .panel h3 { font-size: 14px; margin: 12px 0 6px; }
details.conn { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; margin-bottom: 10px; }
details.conn summary { cursor: pointer; }
details.conn[open] summary { margin-bottom: 8px; }
.howto { margin: 6px 0 10px; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.howto code { font-size: 12px; background: var(--soft); padding: 1px 5px; border-radius: 4px; word-break: break-all; }

/* ---------- AI ---------- */
.aibox { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); background: color-mix(in srgb, var(--primary) 4%, var(--panel)); }
.aimiss { background: #fff4d6; color: #6b4e00; border-radius: 8px; padding: 6px 10px; margin: 8px 0; font-size: 14px; }
.aiopts { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.aiopt { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.aiopt .num { margin-left: auto; }
.aisug { border: 1px dashed var(--primary); border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: color-mix(in srgb, var(--primary) 5%, var(--panel)); }
.aisug.handoff { border-color: #d97706; }
.aisughead { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.aisugbody { white-space: pre-wrap; margin-bottom: 6px; }
.aimodes { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.aimode { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.aimode input { grid-row: span 2; align-self: center; }
.aimode.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.cpm.team small:only-child { }
.sitefiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 10px; }
.sitefile { border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; display: flex; flex-direction: column; }
.sitefile img { width: 100%; height: 100px; object-fit: cover; display: block; background: var(--line); }
.sitefile .sfdoc { display: block; padding: 10px; font-size: 13px; word-break: break-all; min-height: 60px; }
.sfmeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 6px; font-size: 12px; }
.sfmeta .x { margin-left: auto; }

.savecfg { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.savecfg .hint { flex-basis: 100%; }

.kind.unk { background: var(--line); color: var(--muted); }
.kind.guess { opacity: .75; border: 1px dashed currentColor; }
.kindpanel { padding-top: 12px; padding-bottom: 12px; }
.kindrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kindco { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.kindco .search-pop { flex: 1; }

.devwarn { background: #fde0de; color: #b42318; border-radius: var(--radius-s); padding: 8px 12px; margin: 0 0 12px; font-weight: 600; font-size: 14px; }
