:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --brand: #0f6b5c; --brand-2: #e6f2ef; --danger: #b42318; --warn: #b54708; --ok: #067647;
  --chart: #0b8a72; --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: Vazirmatn, "Vazir", Tahoma, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151c; --card: #191f29; --text: #e7eaf0; --muted: #98a2b3; --line: #2a3240;
          --brand: #3fb59f; --brand-2: #17312c; --chart: #22a58c; --danger: #f97066; --warn: #fdb022; --ok: #47cd89; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.7; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } nav.side { position: static; } }
nav.side { background: var(--card); border-inline-start: 1px solid var(--line); padding: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
nav.side h1 { font-size: 18px; margin: 0 0 4px; color: var(--brand); }
nav.side .who { color: var(--muted); font-size: 13px; margin-bottom: 12px; word-break: break-all; }
nav.side .group { margin: 14px 0 4px; color: var(--muted); font-size: 12px; }
nav.side a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--text); }
nav.side a.active, nav.side a:hover { background: var(--brand-2); color: var(--brand); }
main { padding: 24px; max-width: 1100px; width: 100%; }
h2 { margin: 0 0 16px; font-size: 20px; }
h3 { margin: 0 0 10px; font-size: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 180px; }
.row > .shrink { flex: 0 0 auto; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
textarea { min-height: 110px; resize: vertical; }
input[type=checkbox] { width: auto; vertical-align: middle; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.ltr { direction: ltr; text-align: left; }
button { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; white-space: nowrap; }
button.secondary { background: transparent; color: var(--brand); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.small { padding: 3px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: normal; font-size: 13px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.badge { display: inline-block; padding: 0 8px; border-radius: 99px; font-size: 12px; background: var(--brand-2); color: var(--brand); }
.badge.off { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.badge.bad { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.badge.warn { background: transparent; color: var(--warn); border: 1px solid var(--warn); }
.toast { position: fixed; bottom: 20px; inset-inline-start: 20px; padding: 10px 16px; border-radius: 8px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); z-index: 9; max-width: 80vw; }
.toast.error { background: var(--danger); color: #fff; }
.login { max-width: 380px; margin: 12vh auto; }
.answer { white-space: pre-wrap; background: var(--brand-2); padding: 10px; border-radius: 8px; }
.pre { white-space: pre-wrap; }
.days td input { min-width: 90px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Analytics (D40): one series per chart in the validated --chart color;
   recessive axes; values as text, never color alone. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.tile .big { font-size: 28px; font-weight: 600; }
.small { font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }
.chart svg { width: 100%; height: auto; display: block; }
.bar { fill: var(--chart); }
.bar:hover { fill: var(--brand); }
.axis { stroke: var(--line); stroke-width: 1; }
.tick, .val { fill: var(--muted); font-size: 11px; }
.val { fill: var(--text); }
table.ranked td { border-bottom: 0; padding: 4px 8px; }
table.ranked .barcell { width: 55%; }
table.ranked .barcell svg { width: 100%; height: 12px; display: block; }
table.ranked .num { text-align: end; white-space: nowrap; }
.filters { margin-bottom: 12px; }

/* Voice (M9): the persistent fallback banner and one block per profile. */
.banner { border-color: var(--warn); border-inline-start: 4px solid var(--warn); }
.profile { padding: 8px 0 12px; border-bottom: 1px solid var(--line); }
.profile:last-child { border-bottom: 0; }
.profile table { margin-top: 6px; }
pre.ltr { white-space: pre-wrap; overflow-x: auto; font-size: 12px; background: var(--brand-2); padding: 8px; border-radius: 6px; }
