/* Quality Control — design direction 4 ("שילוב 1 ו-3"): cream surfaces, deep teal ink, green for "ok", terracotta for "fail".
   RTL only via logical properties. Mobile first (360px), comfortable on desktop. */
:root {
  --bg: #FBF6EE; --card: #FFFDF9; --sunk: #F4ECDF; --ink: #173F3B; --ink-2: #2D5550; --muted: #5F655A; --line: #ECE2D2; --line-2: #D6C8B2;
  --accent: #0D8466; --accent-ink: #0A7259; --accent-soft: #DDF4EC; --on-accent: #fff;
  --terra: #B84A33; --terra-ink: #A53F2A; --terra-soft: #F8E3DC;
  --mid: #D9952E; --mid-ink: #8C5A0E; --mid-soft: #FBEBD0;
  --info-soft: #E4EEF0;
  --r: 22px; --r-sm: 16px; --r-xs: 12px;
  --shadow: 0 2px 10px rgba(58, 36, 24, .06);
  --shadow-lg: 0 18px 40px rgba(23, 63, 59, .18);
  --font: "Assistant", "Segoe UI", Arial, sans-serif;
  --nav-h: 68px; --side-w: 264px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
svg[aria-hidden="true"] { width: 20px; height: 20px; flex: none; vertical-align: middle; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.2px; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 8px; }
.skip { position: absolute; inset-inline-start: -9999px; }
.skip:focus { inset-inline-start: 12px; top: 12px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 10px; }
:focus-visible { outline: 3px solid #0E7C66; outline-offset: 2px; border-radius: 6px; }
bdi, .ltr { unicode-bidi: isolate; }
.ltr { direction: ltr; display: inline-block; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- boot / states ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } * { scroll-behavior: auto !important; } }
.state { text-align: center; padding: 36px 16px; color: var(--muted); }
.state .ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 10px; background: var(--sunk); color: var(--ink-2); }
.state h3 { color: var(--ink); margin-bottom: 4px; }
.state.err .ico { background: var(--terra-soft); color: var(--terra-ink); }
.skeleton { background: linear-gradient(90deg, var(--sunk), #FAF3E8, var(--sunk)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-xs); min-height: 18px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- layout ---------- */
.shell { min-height: 100vh; }
.side { display: none; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 6px 16px; max-width: 1180px; margin: 0 auto; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; min-width: 0; }
.topbar .brand img, .topbar .brand svg { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.topbar .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.netpill { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--mid-soft); color: var(--mid-ink); display: inline-flex; gap: 6px; align-items: center; text-decoration: none; }
.netpill.off { background: var(--terra-soft); color: var(--terra-ink); }
main { padding: 16px 16px calc(var(--nav-h) + 28px + var(--safe-b)); max-width: 1180px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

.bottomnav { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: space-around; align-items: stretch; }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 700; min-width: 44px; position: relative; }
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a[aria-current="page"] { color: var(--accent-ink); }
.bottomnav a[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.badge-dot { position: absolute; top: 9px; inset-inline-end: calc(50% - 20px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--terra); color: #fff; font-size: 11px; display: grid; place-items: center; }

@media (min-width: 980px) {
  .shell { display: grid; grid-template-columns: var(--side-w) 1fr; }
  .side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--card); border-inline-end: 1px solid var(--line); padding: 18px 14px; gap: 2px; }
  .side .brand { display: flex; gap: 10px; align-items: center; font-weight: 800; font-size: 18px; padding: 4px 8px 18px; }
  .side .brand svg, .side .brand img { width: 38px; height: 38px; border-radius: 12px; }
  .side .group { font-size: 12px; font-weight: 800; color: var(--muted); padding: 14px 10px 4px; }
  .side a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink-2); font-weight: 600; min-height: 44px; }
  .side a svg { width: 20px; height: 20px; flex: none; }
  .side a:hover { background: var(--sunk); }
  .side a[aria-current="page"] { background: var(--ink); color: #fff; }
  .side .count { margin-inline-start: auto; background: var(--terra); color: #fff; border-radius: 99px; font-size: 12px; padding: 0 7px; }
  .bottomnav { display: none; }
  .topbar .brand { display: none; }
  main { padding: 22px 28px 48px; }
}

/* ---------- cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card.hero { background: var(--ink); color: #FFF8EE; border: none; }
.card.hero .muted { color: #B9D2C8; }
.card.flat { box-shadow: none; }
.card.warn { border-color: #EBC9BD; background: #FFF8F5; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(46%, 150px), 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
.stat b { display: block; font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat small { color: var(--muted); font-size: 14px; }
.stat .hint { font-size: 12px; color: var(--muted); }
.stat.bad b { color: var(--terra-ink); }
.stat.good b { color: var(--accent-ink); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.sep { height: 1px; background: var(--line); margin: 12px 0; border: 0; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li, .list > a { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 56px; }
.list > :first-child { border-top: none; }
.list .title { font-weight: 700; overflow-wrap: anywhere; }
.list .meta { font-size: 14px; color: var(--muted); }
.list a:hover .title { text-decoration: underline; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line-2); }
.dot.critical, .dot.high { background: var(--terra); }
.dot.medium { background: var(--mid); }
.dot.low { background: var(--accent); }
.chev { width: 18px; height: 18px; color: var(--muted); flex: none; transform: scaleX(-1); }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; background: var(--sunk); color: var(--ink-2); }
.pill.ok { background: var(--accent-soft); color: var(--accent-ink); }
.pill.bad, .pill.critical, .pill.high { background: var(--terra-soft); color: var(--terra-ink); }
.pill.critical { background: var(--terra); color: #fff; }
.pill.mid, .pill.medium { background: var(--mid-soft); color: var(--mid-ink); }
.pill.low { background: #E7F0EC; color: #2E5E50; }
.pill.info { background: var(--info-soft); color: #23515A; }
.pill.dark { background: var(--ink); color: #fff; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: var(--r-sm); border: 2px solid transparent; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 16px; cursor: pointer; text-decoration: none; touch-action: manipulation; }
.btn:hover { filter: brightness(.96); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; }
.btn svg { width: 20px; height: 20px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--sunk); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.danger { background: var(--terra); color: #fff; }
.btn.soft { background: var(--sunk); color: var(--ink); }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
.btn.link { background: none; color: var(--accent-ink); border: none; padding: 0 6px; min-height: 44px; text-decoration: underline; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--card); cursor: pointer; color: var(--ink); text-decoration: none; }
.iconbtn svg { width: 20px; height: 20px; }
.fab { position: fixed; inset-inline-start: 16px; bottom: calc(var(--nav-h) + 16px + var(--safe-b)); z-index: 25; width: 58px; height: 58px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow-lg); text-decoration: none; }
.fab svg { width: 28px; height: 28px; }
@media (min-width: 980px) { .fab { bottom: 24px; inset-inline-start: 24px; } }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 700; margin-bottom: 6px; }
.field .help { font-size: 14px; color: var(--muted); margin-top: 4px; }
.field .err { font-size: 14px; color: var(--terra-ink); margin-top: 4px; font-weight: 600; }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line-2); background: #fff; font-size: 16px; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"] { border-color: var(--terra); }
.input.ltr-in { direction: ltr; text-align: right; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 8px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin-top: 2px; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 14px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: none; background: transparent; padding: 8px 14px; min-height: 40px; border-radius: 10px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line-2); background: var(--card); padding: 8px 14px; min-height: 40px; border-radius: 99px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.chip[aria-pressed="true"], .chip.on { background: var(--terra); border-color: var(--terra); color: #fff; }
.chip .n { opacity: .8; font-weight: 600; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters .input { width: auto; min-width: 150px; flex: 1 1 160px; }

/* ---------- tables (desktop) ---------- */
.tablewrap { overflow-x: auto; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card); }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; }
table.t th, table.t td { text-align: right; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t th { font-size: 13px; color: var(--muted); font-weight: 800; background: var(--sunk); white-space: nowrap; }
table.t tr:last-child td { border-bottom: none; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #FCF8F1; }
.num { text-align: center !important; white-space: nowrap; }

/* ---------- sheet / dialog ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(23, 40, 37, .42); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); box-shadow: var(--shadow-lg); }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line-2); margin: -6px auto 12px; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { flex: 1; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; position: sticky; bottom: calc(-18px - var(--safe-b)); background: var(--card); padding: 10px 0 0; flex-wrap: wrap; }
.sheet-actions .btn { flex: 1; min-width: 140px; }
@media (min-width: 700px) { .overlay { align-items: center; padding: 20px; } .sheet { border-radius: 24px; padding: 22px; } .sheet .grab { display: none; } .sheet.wide { max-width: 920px; } }

/* ---------- toasts ---------- */
#toasts { position: fixed; z-index: 80; inset-inline: 0; bottom: calc(var(--nav-h) + 14px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow-lg); font-weight: 600; max-width: 520px; width: 100%; }
.toast.bad { background: var(--terra-ink); }
.toast.ok { background: var(--accent-ink); }
@media (min-width: 980px) { #toasts { bottom: 20px; } }

/* ---------- inspection runner ---------- */
.runner-top { position: sticky; top: 58px; z-index: 15; background: var(--bg); padding: 8px 0 6px; margin: 0 0 6px; }
@media (min-width: 980px) { .runner-top { top: 58px; } }
.prog { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.saved { font-size: 13px; font-weight: 800; color: var(--accent-ink); display: inline-flex; gap: 4px; align-items: center; }
.saved.pending { color: var(--mid-ink); }
.saved.err { color: var(--terra-ink); }
.q { scroll-margin-top: 170px; }
.q .q-meta { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.q .q-title { font-size: 18px; font-weight: 800; margin: 4px 0 2px; overflow-wrap: anywhere; }
.q .q-ins { font-size: 14px; color: var(--muted); }
.q.answered { border-color: #CDEBDD; }
.q.failed { border-color: #EBC2B5; background: #FFFBF8; }
.q.missing-hl { outline: 3px solid var(--mid); }
.answers { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin-top: 12px; }
.ans { min-height: 56px; border-radius: 16px; border: 2px solid var(--line-2); background: #fff; font-weight: 800; font-size: 16px; cursor: pointer; padding: 6px 8px; color: var(--ink); touch-action: manipulation; }
.ans[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.ans.fail[aria-pressed="true"] { background: var(--terra); border-color: var(--terra); }
.ans.partial[aria-pressed="true"] { background: var(--mid); border-color: var(--mid); color: #2B1B03; }
.na-row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.na-row button { border: 1px dashed var(--line-2); background: transparent; border-radius: 99px; min-height: 40px; padding: 4px 14px; font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer; }
.na-row button[aria-pressed="true"] { background: var(--sunk); color: var(--ink); border-style: solid; }
.q-tools { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.q-tools .btn { flex: 1; min-width: 130px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; background: var(--sunk); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .st { position: absolute; inset-inline: 0; bottom: 0; font-size: 11px; font-weight: 800; padding: 2px 6px; background: rgba(23,63,59,.82); color: #fff; }
.thumb button { position: absolute; top: 4px; inset-inline-end: 4px; width: 28px; height: 28px; border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; }
.crit-banner { display: flex; gap: 10px; align-items: flex-start; background: var(--terra-soft); color: var(--terra-ink); border-radius: 16px; padding: 12px 14px; font-weight: 700; }
.crit-banner svg { width: 24px; height: 24px; flex: none; }
.runner-foot { position: fixed; z-index: 26; inset-inline: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + var(--safe-b)); display: flex; gap: 10px; }
.runner-foot .btn { flex: 1; }
@media (min-width: 980px) { .runner-foot { inset-inline-start: var(--side-w); } }
.scorebig { font-size: 54px; font-weight: 800; line-height: 1; }
.ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; flex: none; }
.ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--card); display: grid; place-items: center; text-align: center; }
.ring b { font-size: 30px; font-weight: 800; line-height: 1; }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-inline-start: 22px; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.ev { position: relative; padding: 4px 0 14px; }
.ev::before { content: ""; position: absolute; inset-inline-start: -20px; top: 9px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.ev.bad::before { background: var(--terra); }
.ev.mid::before { background: var(--mid); }
.ev b { display: block; }
.ev .when { font-size: 13px; color: var(--muted); }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ba .col h4 { margin: 0 0 6px; font-size: 14px; color: var(--muted); }

/* ---------- builder ---------- */
.bsec { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); margin-bottom: 12px; }
.bsec-head { display: flex; gap: 8px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bitem { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--card); min-height: 56px; }
.bitem:first-child { border-top: none; }
.bitem.dragging { opacity: .5; }
.bitem.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
@media (max-width: 640px) {
  .bitem { flex-wrap: wrap; gap: 6px 8px; }
  .bitem > .grow { flex: 1 1 calc(100% - 44px); }
  .bitem .handle { display: none; }
  .bitem .iconbtn { width: 44px; }
  .bitem .iconbtn:first-of-type { margin-inline-start: auto; }
}
.handle { cursor: grab; color: var(--muted); width: 32px; height: 44px; display: grid; place-items: center; touch-action: none; flex: none; }
.issues { background: var(--terra-soft); border-radius: 14px; padding: 10px 14px; color: var(--terra-ink); }
.issues li { margin: 2px 0; }
.warnings { background: var(--mid-soft); border-radius: 14px; padding: 10px 14px; color: var(--mid-ink); }
.opt-row { display: grid; grid-template-columns: 1fr 88px 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
.diff-add { color: var(--accent-ink); } .diff-del { color: var(--terra-ink); text-decoration: line-through; }

/* ---------- calendar ---------- */
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-day { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px; min-height: 120px; }
.cal-day.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.cal-day.closed { background: repeating-linear-gradient(-45deg, #F6EFE3, #F6EFE3 6px, #FBF6EE 6px, #FBF6EE 12px); }
.cal-day h4 { margin: 0 0 6px; font-size: 14px; display: flex; justify-content: space-between; }
.cal-day.drop { outline: 3px dashed var(--accent); }
.visit { display: block; text-decoration: none; color: var(--ink); background: var(--accent-soft); border-radius: 10px; padding: 6px 8px; font-size: 13px; margin-bottom: 6px; border-inline-start: 4px solid var(--accent); cursor: grab; }
.visit.cancelled, .visit.missed { background: var(--sunk); border-color: var(--line-2); text-decoration: line-through; color: var(--muted); }
.visit.done { background: #EEF3F2; border-color: var(--ink-2); }
.visit.surprise { border-color: var(--terra); background: var(--terra-soft); }
.visit.followup { border-color: var(--mid); background: var(--mid-soft); }
@media (max-width: 760px) { .cal-week { grid-template-columns: 1fr; } .cal-day { min-height: auto; } }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-month .cell { background: var(--card); border: 1px solid var(--line); border-radius: 10px; min-height: 64px; padding: 4px; font-size: 12px; }
.cal-month .cell .n { font-weight: 800; }
.cal-month .cell .cnt { display: inline-block; margin-top: 4px; background: var(--accent); color: #fff; border-radius: 99px; padding: 0 7px; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line-2); }
.chart text { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 4px; vertical-align: middle; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 52px; gap: 10px; align-items: center; margin: 6px 0; font-size: 14px; }
.bar-row .bar { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--accent); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 100% -10%, #E9F4EE 0, transparent 60%), var(--bg); }
.auth .box { width: 100%; max-width: 440px; }
.auth .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth .logo svg { width: 52px; height: 52px; border-radius: 16px; }
.auth .lead { color: var(--muted); margin: 4px 0 18px; }
.qr { background: #fff; border-radius: 14px; padding: 12px; border: 1px solid var(--line); display: inline-block; }
.secret { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; background: var(--sunk); padding: 8px 12px; border-radius: 10px; direction: ltr; display: inline-block; word-break: break-all; }

/* ---------- report preview ---------- */
.preview-frame { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: var(--r-sm); background: #EDE6DA; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.note-box { background: var(--sunk); border-radius: 14px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.annot { touch-action: none; max-width: 100%; border-radius: 12px; display: block; margin: 0 auto; background: #000; }
@media print { .side, .bottomnav, .topbar, .fab, .runner-foot, #toasts { display: none !important; } main { padding: 0; } }

/* ---------- visual review fixes (2026-11-22) ---------- */
.fab { inset-inline-start: auto; inset-inline-end: 16px; }
@media (min-width: 980px) { .fab { display: none; } .topbar:not(:has(#netpill *)) { display: none; } }
.list a { text-decoration: none; color: inherit; }
.list a .title { color: var(--ink); }
.list a:hover .title, .list a:focus-visible .title { text-decoration: underline; color: var(--accent-ink); }

/* ---------- accessibility fixes from the automated audit (WCAG AA contrast, 44px touch targets) ---------- */
.topbar { background: var(--bg); backdrop-filter: none; }
.crumbs a, .runner-top a.row { display: inline-flex; align-items: center; min-height: 44px; }
.list > li > a.grow { display: flex; flex-direction: column; justify-content: center; min-height: 44px; }
.pill.ok { color: #086A52; }
.crumbs a { min-width: 44px; justify-content: center; padding-inline: 4px; }
