/* Nexus UI — the Keez idiom from docs/referinte/macheta-cerinte.html:
   dark brand top bar, module sidebar with counters, coloured stat tiles,
   dense tables with status pills, one primary action top-right.
   Tokens are lifted from the mockup so the two look like the same product. */

:root {
  --f-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --f-disp: "Source Serif 4", Georgia, "Times New Roman", serif;
  --ground: #f6f8f6; --surface: #ffffff; --surface-2: #eef3ef; --surface-3: #e6ece8;
  --ink: #14211d; --ink-2: #3d4d47; --muted: #6b7a74; --line: #d7e1db; --line-2: #c3d1c9;
  --brand-bg: #14392a; --brand-fg: #eaf4ee;
  --accent: #1c5c44; --accent-soft: #e3f0e9; --accent-line: #a9cfbc;
  --rose: #b62b56; --rose-soft: #fbe6ec; --rose-line: #e9b6c6;
  --amber: #94660c; --amber-soft: #faf0d9; --amber-line: #e3c98c;
  --blue: #255a83; --blue-soft: #e3edf6; --blue-line: #aec9de;
  --purple: #6b5b95;
  --r: 10px;
  --shadow: 0 1px 2px rgba(20,57,42,.06), 0 6px 18px -10px rgba(20,57,42,.22);
  color-scheme: light;
}
/* Dark mode is a choice, never the default (Dragoș prefers light; the toggle in
   the header stores the choice in the browser). */
:root[data-theme="dark"] {
  --ground: #0d1512; --surface: #151f1b; --surface-2: #1b2924; --surface-3: #22322c;
  --ink: #e7efeb; --ink-2: #b6c6bf; --muted: #8a9a93; --line: #2a3b34; --line-2: #374b43;
  --brand-bg: #0f2b20; --brand-fg: #dcece3;
  --accent: #7cc7a3; --accent-soft: #17332a; --accent-line: #2f5b48;
  --rose: #f08bab; --rose-soft: #361a24; --rose-line: #5e2c3d;
  --amber: #e0b464; --amber-soft: #31270f; --amber-line: #57431a;
  --blue: #8ebde3; --blue-soft: #152736; --blue-line: #2b4459;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px -12px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Text size. 14px was the original scale; on a laptop (Dragoș, Sept 2026) the
   writing was too small, so every size in this file is in rem and the root
   grows a step on wider screens. Print keeps the original scale. */
html { font-family: var(--f-ui); font-size: 14px; color: var(--ink); background: var(--ground); }
@media (min-width: 900px) { html { font-size: 15.5px; } }
@media print { html { font-size: 14px; } }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--f-disp); font-weight: 600; margin: 0; }
h1 { font-size: 1.429rem; }
h2 { font-size: 1.143rem; }
.sub { color: var(--muted); font-size: 0.893rem; margin-top: 3px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Shell */
.app-top { background: var(--brand-bg); color: var(--brand-fg); display: flex; align-items: center;
  justify-content: space-between; padding: 10px 16px; gap: 12px; }
.app-top .brand { font-family: var(--f-disp); font-size: 1.214rem; letter-spacing: .2px; color: var(--brand-fg); display: inline-flex; align-items: center; gap: 10px; }
.app-top .brand:hover { text-decoration: none; }
.app-top .brand-logo { height: 34px; width: auto; display: block; }
.app-top .brand-sep { opacity: .55; }
.app-top .who { font-size: 0.893rem; display: flex; align-items: center; gap: 10px; }
.app-top .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-line); color: var(--brand-bg);
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.786rem; font-weight: 700; }
.app-top .env { font-family: var(--f-mono); font-size: 0.714rem; background: var(--amber); color: #fff; border-radius: 4px; padding: 1px 6px; }
.app-top form { display: inline; }
.app-top button.link { background: none; border: 0; color: var(--brand-fg); opacity: .8; cursor: pointer; font: inherit; font-size: 0.857rem; padding: 0; }
.app-top button.link:hover { opacity: 1; text-decoration: underline; }
.app-body { display: grid; grid-template-columns: 196px minmax(0, 1fr); flex: 1; }
.app-side { background: var(--surface-2); border-right: 1px solid var(--line); padding: 8px 0; }
.app-side .sect { font-size: 0.679rem; letter-spacing: .9px; text-transform: uppercase; color: var(--muted); padding: 12px 14px 5px; }
.app-side a { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-left: 3px solid transparent;
  padding: 8px 14px; font-size: 0.893rem; color: var(--ink-2); white-space: nowrap; }
.app-side a:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.app-side a.on { background: var(--surface); border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
.app-side .badge { font-family: var(--f-mono); font-size: 0.714rem; background: var(--rose); color: #fff; border-radius: 9px; padding: 1px 6px; line-height: 1.5; }
.app-main { padding: 16px 18px 22px; min-width: 0; }
.app-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.786rem; padding: 8px 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Components */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.card + .card { margin-top: 12px; }
.btn { font: inherit; font-size: 0.893rem; font-weight: 600; border-radius: 7px; padding: 8px 14px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn.primary:hover { filter: brightness(.95); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.big { font-size: 1.071rem; padding: 14px 18px; width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.pill { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 11px; white-space: nowrap; }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.bad { background: var(--rose-soft); color: var(--rose); }
.pill.neutral { background: var(--surface-3); color: var(--muted); }
.pill.info { background: var(--blue-soft); color: var(--blue); }
.code { font-family: var(--f-mono); font-size: 0.786rem; background: var(--surface-3); border-radius: 4px; padding: 1px 6px; }
.alert { display: flex; gap: 9px; align-items: flex-start; border-radius: 8px; padding: 10px 12px; font-size: 0.893rem; margin-bottom: 12px; border: 1px solid; }
.alert.bad { background: var(--rose-soft); border-color: var(--rose-line); color: var(--rose); }
.alert.ok { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.alert.warn { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.alert strong { display: block; margin-bottom: 2px; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
.tile { border-radius: 8px; overflow: hidden; border: 1px solid var(--line); color: inherit; }
.tile:hover { text-decoration: none; box-shadow: var(--shadow); }
.tile .t-h { padding: 7px 11px; font-size: 0.821rem; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 6px; }
.tile .t-v { padding: 10px 11px; background: var(--surface); font-family: var(--f-mono); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.tile .t-v small { font-size: 0.786rem; color: var(--muted); font-family: var(--f-ui); margin-left: 3px; }
.tile.a .t-h { background: #b8860b; }
.tile.g .t-h { background: #2d7a5f; }
.tile.b .t-h { background: #3c7fae; }
.tile.p .t-h { background: #6b5b95; }
.tile.r .t-h { background: #b62b56; }
.tile.n .t-h { background: #4d5d57; }

.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 0.929rem; }
table.t th { text-align: left; font-size: 0.75rem; letter-spacing: .7px; text-transform: uppercase; color: var(--muted); font-weight: 600;
  padding: 8px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; background: var(--surface-2); }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tbody tr:hover td { background: var(--surface-2); }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t td.mono, table.t td .mono { font-family: var(--f-mono); font-size: 0.893rem; font-variant-numeric: tabular-nums; }
table.t tfoot td { font-family: var(--f-mono); font-size: 0.857rem; color: var(--ink-2); border-top: 1px solid var(--line-2); }
table.t a.row-link { color: inherit; font-weight: 600; }
.empty { color: var(--muted); font-size: 0.929rem; padding: 18px; text-align: center; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.75rem; letter-spacing: .7px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { font: inherit; font-size: 1rem; padding: 9px 10px; border: 1px solid var(--line-2);
  border-radius: 7px; background: var(--surface); color: var(--ink); width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.field .hint { font-size: 0.821rem; color: var(--muted); }
.field.wide { grid-column: 1 / -1; }
.counter-preview { font-family: var(--f-mono); font-size: 1.857rem; padding: 6px 0; color: var(--accent); }
.counter-preview small { font-family: var(--f-ui); font-size: 0.857rem; color: var(--muted); }
.errorlist { color: var(--rose); font-size: 0.857rem; margin: 0; padding-left: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input, .filters select { font: inherit; font-size: 0.929rem; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface); color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; }
.seg a { padding: 7px 12px; font-size: 0.893rem; color: var(--ink-2); }
.seg a.on { background: var(--brand-bg); color: var(--brand-fg); }
.seg a:hover { text-decoration: none; }

/* Two-column page: content + side panel */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-2); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 12px; font-size: 0.893rem; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 0.929rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Login */
.login-wrap { flex: 1; display: grid; place-items: center; padding: 24px; background: var(--ground); }
.login-card { width: 100%; max-width: 360px; }
.login-card .brand { font-family: var(--f-disp); font-size: 1.714rem; color: var(--accent); margin-bottom: 2px; }

/* Meter (self-monitoring) */
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.meter.warn > span { background: var(--amber); }
.meter.bad > span { background: var(--rose); }

/* Phone: the therapist records standing up, between appointments. */
@media (max-width: 760px) {
  .app-body { grid-template-columns: 1fr; }
  .app-side { display: flex; overflow-x: auto; padding: 4px 6px; gap: 2px; border-right: 0; border-bottom: 1px solid var(--line); }
  .app-side .sect { display: none; }
  .app-side a { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 10px; }
  .app-side a.on { border-bottom-color: var(--accent); background: transparent; }
  .app-main { padding: 12px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > * { min-width: 0; }  /* a wide table scrolls inside its card, it never widens the column (pontaj, 17 Sept 2026) */
  .form-grid { grid-template-columns: 1fr; }
  table.t { font-size: 0.964rem; }
  table.t td, table.t th { padding: 10px 8px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field input, .field select, .field textarea { font-size: 1.143rem; padding: 12px; } /* no zoom on iOS */
  .hide-phone { display: none; }
}
.htmx-request .btn.primary { opacity: .6; }


/* Header: theme toggle + account switcher */
.theme-btn { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: var(--brand-fg); border-radius: 20px; padding: 3px 10px; font: inherit; font-size: 0.857rem; cursor: pointer; }
.theme-btn:hover { background: rgba(255,255,255,.18); }
details.acct { position: relative; }
details.acct summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
details.acct summary::-webkit-details-marker { display: none; }
details.acct .caret { opacity: .7; font-size: 0.714rem; }
.acct-menu { position: absolute; right: 0; top: 34px; background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); min-width: 240px; padding: 6px; z-index: 50; }
.acct-menu form { display: block; }
.acct-menu button, .acct-menu a { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; font: inherit; font-size: 0.929rem; color: var(--ink); border-radius: 7px; cursor: pointer; }
.acct-menu button:hover, .acct-menu a:hover { background: var(--surface-2); text-decoration: none; }
.acct-menu small { color: var(--muted); margin-left: auto; }
.acct-menu .avatar { background: var(--accent-soft); color: var(--accent); }
.acct-menu a { border-top: 1px solid var(--line); border-radius: 0; margin-top: 4px; }

/* Funnel */
.funnel { display: flex; flex-direction: column; gap: 5px; align-items: center; padding: 4px 0 2px; }
.fstage { position: relative; border-radius: 3px; padding: 11px 26px; color: #fff; clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 14px 100%);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-height: 54px; }
.fstage .fs-num { font-family: var(--f-mono); font-size: 1.571rem; font-weight: 600; line-height: 1; flex: none; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.fstage .fs-l { display: flex; flex-direction: column; line-height: 1.3; flex: none; min-width: 186px; }
.fstage .fs-n { font-size: 0.964rem; font-weight: 700; letter-spacing: .2px; }
.fstage .fs-c { font-size: 0.786rem; opacity: .82; }
.fstage .fs-chips { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; min-width: 0; }
.lchip { font-size: 0.786rem; font-weight: 600; background: rgba(255,255,255,.92); color: #14392a; border-radius: 11px; padding: 3px 9px; white-space: nowrap; }
.lchip:hover { background: #fff; text-decoration: none; }
.lchip.more { background: rgba(255,255,255,.22); color: #fff; }
.fdrop { font-size: 0.821rem; color: var(--muted); padding: 0; line-height: 1; }

/* Pipeline (kanban) */
.kan { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 9px; overflow-x: auto; padding-bottom: 6px; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-width: 150px; min-height: 120px; }
.kcol.over { outline: 2px dashed var(--accent); }
.kcol h5 { font-size: 0.714rem; letter-spacing: .7px; text-transform: uppercase; color: var(--muted); margin: 0 0 7px; display: flex; justify-content: space-between; font-weight: 700; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 7px 9px; margin-bottom: 6px; position: relative; cursor: grab; }
.kcard.drag { opacity: .5; }
.kcard.cold { border-left-color: var(--amber); }
.kcard .kn { font-size: 0.857rem; font-weight: 600; color: var(--ink); display: block; }
.kcard .ks { font-size: 0.75rem; color: var(--muted); margin-top: 2px; display: block; }
.kcard .kmove { display: flex; gap: 3px; margin-top: 5px; }
.kcard .kmove button { font: inherit; font-size: 0.786rem; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 4px; padding: 1px 7px; cursor: pointer; }
.kcard .kmove button.lost { margin-left: auto; color: var(--rose); }

/* Calendar (week grid) */
.calwrap { border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.calhead { display: grid; grid-template-columns: 48px repeat(var(--cols), minmax(120px, 1fr)); background: var(--brand-bg); color: var(--brand-fg); min-width: 700px; }
.calhead .ch { padding: 6px 8px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .5px; display: flex; gap: 6px; align-items: baseline; border-left: 1px solid rgba(255,255,255,.12); }
.calhead .ch strong { font-size: 1.071rem; font-family: var(--f-disp); }
.calhead .ch.today { background: rgba(255,255,255,.14); }
.calgrid { display: grid; grid-template-columns: 48px repeat(var(--cols), minmax(120px, 1fr)); position: relative; min-width: 700px; }
.ctimes div { font-family: var(--f-mono); font-size: 0.714rem; color: var(--muted); text-align: right; padding: 2px 6px 0 0; border-top: 1px solid var(--line); background: var(--surface-2); }
.ccol { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-repeat: repeat-y; }
.ccol.today { background-color: var(--accent-soft); }
.cnow { position: absolute; left: 0; right: 0; height: 2px; background: var(--rose); z-index: 3; }
.cnow::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--rose); }
.cev { position: absolute; border-radius: 5px; padding: 3px 6px; font-size: 0.75rem; line-height: 1.2; overflow: hidden; border-left: 3px solid; color: inherit; z-index: 2; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.cev:hover { text-decoration: none; z-index: 4; box-shadow: var(--shadow); }
.cev b { display: block; font-size: 0.786rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cev i { display: block; font-style: normal; font-size: 0.714rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cev.tr { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.cev.md { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.cev.nt { background: #efeaf7; border-color: #6b5b95; color: #5a4a85; }
:root[data-theme="dark"] .cev.nt { background: #241e33; color: #b9a9dd; }
.cev.warn { background: var(--rose-soft); border-color: var(--rose); color: var(--rose); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.857rem; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border-left: 3px solid; }
.legend i.tr { background: var(--accent-soft); border-color: var(--accent); }
.legend i.md { background: var(--blue-soft); border-color: var(--blue); }
.legend i.nt { background: #efeaf7; border-color: #6b5b95; }
.legend i.warn { background: var(--rose-soft); border-color: var(--rose); }

/* Clinic map */
/* v0.8.1: the whole map fits one laptop screen — rows share a fixed height instead of 34 px each. */
.cmap { display: grid; grid-template-columns: repeat(var(--w), minmax(0, 1fr)); grid-template-rows: repeat(var(--h), minmax(0, 1fr)); height: clamp(280px, 56vh, 540px); gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.croom { background: var(--surface); border: 2px solid var(--c); border-radius: 8px; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; color: var(--ink); min-width: 0; overflow: hidden; position: relative; }
.croom::before { content: ""; position: absolute; inset: 0; background: var(--c); opacity: .09; }
.croom:hover { text-decoration: none; box-shadow: var(--shadow); }
.croom .cr-code { font-family: var(--f-mono); font-size: 0.75rem; color: var(--c); font-weight: 700; }
.croom .cr-name { font-family: var(--f-disp); font-size: 1.071rem; font-weight: 600; }
.croom .cr-now { font-size: 0.786rem; color: var(--muted); margin-top: auto; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.doc-body { font-size: 1.071rem; line-height: 1.6; max-width: 80ch; }
@media print { .app-top, .app-side, .app-foot, .page-head .actions { display: none !important; } .app-body { grid-template-columns: 1fr; } .card { border: 0; } }
@media (max-width: 760px) { .kan { grid-template-columns: repeat(7, 200px); } .fstage .fs-l { min-width: 120px; } .cmap { height: 60vh; } .croom .cr-name { font-size: 0.857rem; } }

/* v0.3 — role colours (13 Sept 2026): red doctors/specialists, green
   therapists, pink internal (administrator, reception). */
:root { --role-medic: #b62b56; --role-medic-soft: #fbe6ec; --role-terapeut: #1c7a4f; --role-terapeut-soft: #e0f3e8; --role-intern: #b03a86; --role-intern-soft: #f9e4f1; }
:root[data-theme="dark"] { --role-medic: #f08bab; --role-medic-soft: #3a1a26; --role-terapeut: #7cd4a4; --role-terapeut-soft: #17332a; --role-intern: #e79ad0; --role-intern-soft: #35203a; }
.pill.role-medic, .avatar.role-medic { background: var(--role-medic-soft); color: var(--role-medic); }
.pill.role-terapeut, .avatar.role-terapeut { background: var(--role-terapeut-soft); color: var(--role-terapeut); }
.pill.role-intern, .avatar.role-intern { background: var(--role-intern-soft); color: var(--role-intern); }
.app-top .avatar.role-medic, .app-top .avatar.role-terapeut, .app-top .avatar.role-intern { background: var(--surface); }
table.t .avatar { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; font-size: 0.679rem; font-weight: 700; margin-right: 6px; vertical-align: middle; }
tr.muted td { color: var(--muted); }

/* Staff chips (parallel day view) */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 0.857rem; padding: 4px 10px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; user-select: none; }
.chip input { margin: 0; accent-color: currentColor; }
.chip.on { border-color: currentColor; }
.chip.role-medic { color: var(--role-medic); } .chip.role-medic.on { background: var(--role-medic-soft); }
.chip.role-terapeut { color: var(--role-terapeut); } .chip.role-terapeut.on { background: var(--role-terapeut-soft); }
.chip.role-intern { color: var(--role-intern); }
.calhead .ch a { color: inherit; display: flex; gap: 6px; align-items: baseline; }
.calhead .ch .pill { text-transform: none; letter-spacing: 0; }

/* Month grid */
.month { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mhead { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--brand-bg); color: var(--brand-fg); font-size: 0.75rem; text-transform: uppercase; letter-spacing: .5px; }
.mhead div { padding: 6px 8px; border-left: 1px solid rgba(255,255,255,.12); }
.mrow { display: grid; grid-template-columns: repeat(7, 1fr); min-height: 96px; border-top: 1px solid var(--line); }
.mcell { border-left: 1px solid var(--line); padding: 4px 5px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mcell.out { background: var(--surface-2); color: var(--muted); }
.mcell.today { background: var(--accent-soft); }
.mday { font-family: var(--f-disp); font-size: 0.929rem; font-weight: 600; color: inherit; align-self: flex-start; }
.mday small { font-family: var(--f-mono); font-weight: 400; color: var(--muted); font-size: 0.714rem; }
.mcell.today .mday { color: var(--accent); }
.mev { display: block; font-size: 0.75rem; padding: 1px 5px; border-radius: 4px; border-left: 3px solid; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit; }
.mev b { font-family: var(--f-mono); font-weight: 600; font-size: 0.714rem; }
.mev.tr { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.mev.md { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.mev.nt { background: #efeaf7; border-color: #6b5b95; color: #5a4a85; }
:root[data-theme="dark"] .mev.nt { background: #241e33; color: #b9a9dd; }
.mmore { font-size: 0.75rem; color: var(--muted); }
@media (max-width: 760px) { .mrow { min-height: 60px; } .mev { font-size: 0.643rem; } }

/* Date range picker (presets + custom), like Meta Business Suite */
.drange { position: relative; }
.drange > summary { list-style: none; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.drange > summary::-webkit-details-marker { display: none; }
.drange-pop { position: absolute; z-index: 40; top: 38px; left: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 10px; display: flex; gap: 14px; min-width: 420px; }
.drange-presets { display: flex; flex-direction: column; gap: 2px; min-width: 150px; border-right: 1px solid var(--line); padding-right: 10px; }
.drange-presets a { padding: 6px 8px; border-radius: 6px; font-size: 0.893rem; color: var(--ink-2); }
.drange-presets a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.drange-custom { display: flex; flex-direction: column; gap: 8px; }
.drange-custom label { font-size: 0.786rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.drange-custom input { font: inherit; font-size: 0.929rem; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface); color: var(--ink); }
@media (max-width: 760px) { .drange-pop { min-width: 0; flex-direction: column; left: -8px; right: -8px; } .drange-presets { border-right: 0; padding-right: 0; } }

/* ANEXĂ print */
.anexa p { margin: 4px 0; }
@media print { .noprint { display: none !important; } .anexa { font-size: 0.857rem; } body { background: #fff; } }
.errorlist { color: var(--rose); font-size: 0.857rem; margin: 4px 0 0; padding-left: 16px; }
.field .errorlist { list-style: disc; }
table.t td .errorlist { padding-left: 0; list-style: none; }

/* v0.4 — 24 h calendar that scrolls, drag & drop, context menu */
.calwrap { max-height: 72vh; overflow: auto; position: relative; }
.calhead { position: sticky; top: 0; z-index: 5; }
.cev { cursor: grab; touch-action: none; user-select: none; }
.cev.dragging { opacity: .85; cursor: grabbing; z-index: 6; box-shadow: var(--shadow); }
.ctx { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; min-width: 220px; display: flex; flex-direction: column; }
.ctx[hidden] { display: none; }  /* `hidden` loses to display:flex — the menu stayed on screen over the quick-add popover (18 Sept 2026) */
.ctx button { font: inherit; font-size: 0.929rem; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 6px; color: var(--ink); cursor: pointer; }
.ctx button:hover { background: var(--surface-2); }
.ctx button.danger { color: var(--rose); }
.ctx button.danger:hover { background: var(--rose-soft); }

/* Conectori (15 Sept 2026): logo + title + status, an on/off switch instead of
   a lone checkbox; cards top-aligned in the grid. */
.cgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.cgrid > .card { margin-top: 0; }
@media (max-width: 1100px) { .cgrid { grid-template-columns: 1fr; } }
.chead { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.clogo { width: 40px; height: 40px; border-radius: 10px; flex: none; object-fit: contain; }
.ctitle { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ctitle h2 { margin: 0; font-size: 1.214rem; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex: none; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--line); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { left: 18px; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch .lbl { font-size: 0.857rem; color: var(--muted); min-width: 34px; }

/* Calendar like Google Calendar (v0.4.1): the grid takes the rest of the
   window and is the only scroll; toolbar compact; iCal in a popover; the
   quick-booking popover next to the click. */
.calcard { padding-bottom: 10px; }
.calbar { display: flex; align-items: flex-start; gap: 8px; }
.calbar .filters { flex: 1; margin-bottom: 8px; }
.calwrap { max-height: none; }
.cev { cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.cev:focus-visible { outline: 2px solid var(--accent); }
.icalbox { position: relative; flex: none; margin-top: 2px; }
.icalbox > summary { list-style: none; cursor: pointer; }
.icalbox > summary::-webkit-details-marker { display: none; }
.icalpanel { position: absolute; right: 0; top: 40px; z-index: 30; width: min(560px, 92vw); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 14px; }
.icalrow { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.929rem; }
.icalact { display: flex; gap: 6px; flex: none; }
.icalact form { display: inline; }
.icalnew { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.icalnew input[type=text] { font: inherit; font-size: 0.929rem; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface); color: var(--ink); }
.qadd { position: fixed; z-index: 40; width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.22); padding: 12px 14px; }
.qadd form { display: flex; flex-direction: column; gap: 8px; }
.qa-head { display: flex; justify-content: space-between; align-items: center; }
.qa-x { border: 0; background: none; font-size: 1.429rem; cursor: pointer; color: var(--muted); line-height: 1; }
.qadd input, .qadd select { font: inherit; font-size: 0.929rem; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface); color: var(--ink); width: 100%; box-sizing: border-box; }
.qa-row { display: flex; gap: 6px; }
.qa-row > * { min-width: 0; }
.qa-patient { position: relative; }
.qa-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 2; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.15); max-height: 220px; overflow: auto; }
.qa-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; cursor: pointer; font: inherit; font-size: 0.929rem; color: var(--ink); }
.qa-results button:hover { background: var(--surface-3); }
.qa-results button span { display: block; font-size: 0.821rem; color: var(--muted); }
.qa-results .qa-new { color: var(--accent); font-weight: 600; border-top: 1px solid var(--line); }
.qa-procs { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.893rem; }
.qa-procs label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.qa-procs input { width: auto; }
.qa-err { color: var(--rose); font-size: 0.893rem; }
.qa-foot { display: flex; justify-content: space-between; align-items: center; }
.qa-more { font-size: 0.893rem; }
.clogo.wide { width: auto; max-width: 72px; border-radius: 6px; }
.cgrid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card.soon { opacity: .78; }
.card.soon .switch { cursor: not-allowed; }
.card.soon input[disabled] { background: var(--surface-3); color: var(--muted); }

/* Pâlnie board (v0.5): pannable, zoomable canvas of stage bands with lead cards */
.boardcard { display: flex; flex-direction: column; }
.boardcard .filters { margin-bottom: 8px; }
.bsep { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
.bzoom { display: inline-flex; gap: 4px; align-items: center; }
.bzoom .btn { padding: 4px 9px; }
.bzoom .muted { font-family: var(--f-mono); font-size: 0.821rem; min-width: 40px; text-align: right; }
.board { position: relative; flex: none; min-height: 360px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; cursor: grab; user-select: none; touch-action: none;
  background-color: var(--bg); background-image: radial-gradient(var(--line-2) 1px, transparent 1px); background-size: 22px 22px; }
.board.panning { cursor: grabbing; }
.bworld { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.board.moving .bworld { will-change: transform; }  /* GPU layer only while zooming/panning; dropped after, so text re-rasterises crisp */
.bhint { position: absolute; left: 10px; bottom: 8px; font-size: 0.821rem; pointer-events: none; background: var(--surface); padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); opacity: .9; }
.bempty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.bempty[hidden] { display: none; }
.bband { position: absolute; border-radius: 4px; color: #fff; clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 100%, 18px 100%); transition: outline-color .12s; outline: 3px solid transparent; }
.bband.pocket { clip-path: none; border-radius: 8px; }
.bband.over { outline-color: var(--amber); filter: brightness(1.08); }
.bb-head { position: absolute; left: 30px; top: 12px; right: 30px; display: flex; align-items: baseline; gap: 14px; pointer-events: none; }
.bb-l { display: flex; flex-direction: column; line-height: 1.25; min-width: 150px; }
.bb-l b { font-size: 1.071rem; letter-spacing: .2px; }
.bb-l span { font-size: 0.786rem; opacity: .82; }
.bb-n { font-family: var(--f-mono); font-size: 1.714rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.bb-here { font-size: 0.821rem; opacity: .85; }
.bb-tab { margin-left: auto; font-size: 0.821rem; color: #fff; opacity: .85; text-decoration: underline; pointer-events: auto; }
.bb-arrow { position: absolute; font-size: 1.143rem; color: var(--muted); }
.bcard { position: absolute; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 5px 8px; box-sizing: border-box; overflow: hidden; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.bcard.cold { border-left-color: var(--amber); }
.bcard.dragging { z-index: 5; box-shadow: 0 8px 22px rgba(0,0,0,.28); transform: scale(1.04); cursor: grabbing; }
.bcard .bc-n { font-size: 0.893rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.bcard .bc-s { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Quick panel over the lead lists (v0.7): edit the primary data, add a note,
   move the stage — without leaving the table / pipeline / board. */
.qbtn { font: inherit; font-size: 0.929rem; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.qbtn:hover { border-color: var(--accent); color: var(--accent); }
.kcard[data-quick] { cursor: pointer; }
.board .bcard .bc-n:hover { text-decoration: underline; }
dialog.qlead { border: 0; padding: 0; background: transparent; max-width: none; width: min(860px, calc(100vw - 32px)); }
dialog.qlead::backdrop { background: rgba(10, 20, 16, .55); backdrop-filter: blur(2px); }
.qlead-in { position: relative; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 18px 20px 16px; max-height: calc(100vh - 48px); overflow: auto; }
.qlead-x { position: absolute; top: 8px; right: 10px; font: inherit; font-size: 1.429rem; line-height: 1; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.ql-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; padding-right: 24px; }
.ql-name { font-family: var(--f-disp); font-size: 1.429rem; font-weight: 600; }
.ql-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ql-grid { grid-template-columns: repeat(3, 1fr); }
.ql-grid .field input, .ql-grid .field select, .ql-grid .field textarea, .ql-note .field input, .ql-note .field select, .ql-note .field textarea { padding: 6px 8px; font-size: 0.929rem; }
.ql-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.ql-two { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ql-two h3, .qlead-in h3 { font-size: 0.857rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 6px; }
.ql-stages { display: flex; flex-wrap: wrap; gap: 4px; }
.ql-stages .btn { padding: 4px 8px; font-size: 0.857rem; }
.ql-stages .btn.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.ql-int td { padding: 4px 6px; font-size: 0.893rem; }
.ql-saved { margin-bottom: 8px; }
@media (max-width: 720px) { .ql-grid { grid-template-columns: 1fr 1fr; } .ql-two { grid-template-columns: 1fr; } }
/* Keez card (v0.7): one row per company. */
/* Terapeuți și comisioane (v0.8.2) */
table.t th.right { text-align: right; }  /* header over a number column sits on the numbers */
table.t.numcols th.right, table.t.numcols td.right { width: 1%; white-space: nowrap; padding-left: 18px; }  /* numbers packed on the right, the text column takes the room */
table.t tfoot tr.total td { font-weight: 600; background: var(--surface-2, var(--surface)); border-top: 2px solid var(--line-2); }
.warn-text { color: var(--amber); }
details.therapist { margin-top: 12px; }
details.therapist summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
details.therapist summary::-webkit-details-marker { display: none; }
details.therapist summary .caret { margin-left: auto; opacity: .6; font-size: 0.786rem; }
details.therapist[open] summary .caret { transform: rotate(180deg); }
table.t.small td, table.t.small th { padding: 6px 10px; font-size: 0.893rem; }
table.t.rows tr.noprice td { color: var(--amber); }
.comm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 12px; }
.comm-grid label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.929rem; text-transform: none; letter-spacing: 0; font-weight: 500; }
.comm-grid input { width: 72px; text-align: right; }
.kzrow { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.kzrow.off { opacity: .65; }
.kzrow .kzacts { display: flex; gap: 6px; }
.kzrow .kzacts .btn { padding: 5px 9px; font-size: 0.857rem; }

/* Checkbox groups in forms (v0.8.1): Django's CheckboxSelectMultiple rendered as
   chips — the box sits next to its own text, a ticked chip is filled, and the
   whole chip is the tap target (the boxes used to sit at the far right,
   unreadable which was which — Micha, 17 Sept 2026). */
.field > div[id^="id_"] { display: flex; flex-wrap: wrap; gap: 6px; }
.field > div[id^="id_"] > div { display: contents; }
.field > div[id^="id_"] label { display: inline-flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0;
  font-size: 0.929rem; font-weight: 500; color: var(--ink); border: 1px solid var(--line-2); border-radius: 18px; padding: 7px 12px 7px 9px;
  background: var(--surface); cursor: pointer; user-select: none; }
.field > div[id^="id_"] label:hover { border-color: var(--accent-line); }
.field > div[id^="id_"] label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.field > div[id^="id_"] input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }

/* ---------------------------------------------------------------------------
   Phone layout (v0.8, 17 Sept 2026). ONE app, one set of pages: below 760 px
   the same screens rearrange — nav strip pinned to the top, one column, cards
   scroll sideways instead of the page, thumb-sized controls, 16 px inputs so
   iOS does not zoom. Nothing here applies to a desktop window, by construction.
   --------------------------------------------------------------------------- */
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }
  .app-body { grid-template-rows: auto 1fr; align-content: start; }  /* a short page must not stretch the nav strip */
  .app-top { padding: 8px 12px; gap: 8px; position: sticky; top: 0; z-index: 30; }
  .app-top .brand { font-size: 1.071rem; white-space: nowrap; }
  .app-top .who { gap: 6px; }
  .app-top .env { display: none; }
  .hide-phone { display: none; }
  .acct-menu { right: 0; left: auto; max-width: calc(100vw - 16px); }
  /* the nav strip: pinned under the top bar, scrolls sideways, current item centred by the script in base.html */
  .app-side { position: sticky; top: 42px; z-index: 29; background: var(--surface-2); padding: 0 6px; gap: 0;
    scrollbar-width: none; -ms-overflow-style: none; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
  .app-side::-webkit-scrollbar { display: none; }
  .app-side a { padding: 11px 11px; font-size: 0.929rem; flex: none; }
  .app-side .badge { font-size: 0.679rem; }
  .app-main { padding: 12px 12px 28px; max-width: 100vw; }
  .app-foot { font-size: 0.75rem; padding: 8px 12px; }
  h1 { font-size: 1.286rem; overflow-wrap: anywhere; }
  .page-head { gap: 8px; margin-bottom: 10px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; text-align: center; }
  .btn { padding: 10px 14px; font-size: 0.964rem; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .seg a { padding: 10px 12px; font-size: 0.929rem; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .tile .t-v { font-size: 1.357rem; padding: 8px 10px; }
  /* cards scroll sideways when their content is wider (tables), the page never does */
  .card { overflow-x: auto; max-width: 100%; padding: 12px; }
  .sub, .alert, .kv dd { overflow-wrap: anywhere; }
  /* tables keep their natural width and the card scrolls sideways; long cells are cut with an ellipsis */
  table.t { font-size: 0.929rem; }
  table.t th, table.t td { padding: 9px 8px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
  .filters { gap: 6px; }
  .filters input:not([type=checkbox]):not([type=radio]), .filters select { font-size: 1.143rem; padding: 9px 10px; min-height: 42px; flex: 1 1 140px; }
  .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea,
  .qadd input:not([type=checkbox]):not([type=radio]), .qadd select, .icalnew input[type=text] { font-size: 1.143rem; padding: 10px 10px; }
  .field label, .filters label { font-size: 0.857rem; }
  .field input[type=checkbox], .qa-procs input { width: 20px; height: 20px; }
  .chip { padding: 7px 12px; font-size: 0.929rem; }
  .chip input { width: 16px; height: 16px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 6px; }
  .tabs a { padding: 10px 12px; font-size: 0.929rem; }
  .alert { font-size: 0.929rem; }
  /* leads */
  .kan { grid-template-columns: repeat(7, 240px); gap: 8px; }
  .kcard .kmove button { padding: 6px 10px; font-size: 0.929rem; }
  .qbtn { padding: 8px 12px; font-size: 1.071rem; }
  .ql-grid { grid-template-columns: 1fr; }
  .ql-two { grid-template-columns: 1fr; }
  .ql-head { flex-direction: column; }
  .ql-acts { justify-content: flex-start; }
  .ql-name { font-size: 1.286rem; }
  .qlead-in { padding: 14px 12px 12px; max-height: calc(100dvh - 24px); }
  dialog.qlead { width: calc(100vw - 16px); }
  .bhint { display: none; }
  .board { min-height: 60vh; }
  /* calendar */
  .calbar { flex-wrap: wrap; }
  .calbar .filters { flex: 1 1 100%; }
  .calwrap { max-height: none; }
  .calhead, .calgrid { min-width: 560px; }
  .calhead { grid-template-columns: 40px repeat(var(--cols), minmax(96px, 1fr)); }
  .calgrid { grid-template-columns: 40px repeat(var(--cols), minmax(96px, 1fr)); }
  .icalpanel { width: calc(100vw - 24px); right: -6px; }
  .qadd { left: 8px !important; right: 8px; width: auto; top: 12px !important; max-height: calc(100dvh - 24px); overflow: auto; }
  .mrow { min-height: 64px; }
  /* connectors */
  .cgrid { grid-template-columns: 1fr; }
  .chead { flex-wrap: wrap; }
  .kzrow { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 420px) {
  .tiles { gap: 6px; }
  .app-top .brand { font-size: 1rem; }
  .theme-btn { display: none; }
}
/* Jurnal (v0.8.1): tick rows to undo them; undone rows fade; undo/redo rows carry „Refă”. */
.undo-bar { display: flex; gap: 8px; align-items: center; }
table.journal tr.undone td { opacity: .55; }
table.journal tr.undone td:last-child { opacity: 1; }
table.journal.selecting tbody tr:has(input.sel) { cursor: pointer; }
table.journal.selecting tbody tr:has(input.sel:checked) td { background: var(--accent-soft); }
table.journal .sel-col { width: 28px; }
table.journal input.sel { width: 16px; height: 16px; accent-color: var(--accent); }
/* Pontaj (v0.8.1): planned appointments with one-tap outcomes. */
table.planned tr.future td { opacity: .8; }
.pl-acts { display: inline-flex; gap: 4px; flex-wrap: wrap; max-width: 260px; }
.pl-acts .btn { padding: 5px 8px; font-size: 0.857rem; }
.pl-acts .btn.ok { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* Menu button: a details/summary dropdown of actions (documents: „Scrie un document”). */
details.menu-btn { position: relative; display: inline-block; }
details.menu-btn summary { list-style: none; }
details.menu-btn summary::-webkit-details-marker { display: none; }
details.menu-btn .menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); min-width: 260px; padding: 6px; z-index: 50; }
details.menu-btn .menu form { display: block; }
details.menu-btn .menu button { display: block; width: 100%; text-align: left; font: inherit; font-size: .93rem; background: none; border: 0; padding: 8px 10px; border-radius: 7px; color: var(--ink); cursor: pointer; }
details.menu-btn .menu button:hover { background: var(--surface-2); }

/* The document-shaped page (v0.10): what the doctor edits looks like what
   prints — letterhead, A4 width, sections in printed order. */
.docpage { background: #fff; color: #111; max-width: 210mm; margin: 0 auto; padding: 16mm 18mm 20mm; border: 1px solid var(--line-2); box-shadow: var(--shadow); font-family: "DejaVu Sans", "Liberation Sans", Arial, sans-serif; font-size: .93rem; line-height: 1.4; }
:root[data-theme="dark"] .docpage { background: #fff; color: #111; }
.docpage .doc-lh { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #999; padding-bottom: 8px; margin-bottom: 12px; }
.docpage .doc-lh img { height: 54px; }
.docpage .doc-lh .co { text-align: right; font-size: .8rem; color: #333; line-height: 1.3; }
.docpage .doc-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; padding: 8px 10px; background: var(--surface-2); color: var(--ink); border-radius: 8px; font-size: .86rem; }
.docpage .doc-meta label { display: flex; align-items: center; gap: 8px; }
.docpage .doc-meta input { font: inherit; padding: 4px 8px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); color: var(--ink); }
.docpage .doc-title { font-family: inherit; text-align: center; font-size: 1.15rem; letter-spacing: .5px; font-weight: 700; margin: 0 0 14px; }
.docpage table.doc-hdr, .docpage table.doc-kv, .docpage table.doc-grid { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.docpage table.doc-hdr td, .docpage table.doc-kv td { border: 1px solid #444; padding: 6px 8px; vertical-align: top; }
.docpage td.l { font-weight: 700; background: #f3f3f3; width: 22%; }
.docpage table.doc-kv td.l { width: 26%; }
.docpage td input, .docpage td select { font: inherit; width: 100%; border: 0; border-bottom: 1px dashed #bbb; background: transparent; padding: 2px 0; color: #111; }
.docpage td input:focus, .docpage td select:focus { outline: none; border-bottom-color: var(--accent); background: #f6fbf8; }
.docpage table.doc-grid th, .docpage table.doc-grid td { border: 1px solid #444; padding: 4px 6px; text-align: left; vertical-align: top; font-size: .88rem; }
.docpage table.doc-grid th { background: #f3f3f3; }
.docpage table.doc-grid td .btn.sm { padding: 2px 6px; font-size: .75rem; }
.docpage .doc-sec { margin-bottom: 14px; }
.docpage .doc-sec h3 { font-family: inherit; font-size: 1rem; text-transform: uppercase; letter-spacing: .4px; margin: 14px 0 6px; }
.docpage .anthro { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 16px; }
.docpage .anthro label { display: flex; align-items: center; gap: 6px; font-size: .88rem; }
.docpage .anthro label span { min-width: 120px; }
.docpage .days .day { border: 1px solid #ccc; border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; }
.docpage .days h4 { margin: 0 0 4px; font-size: .95rem; }
.docpage .meal { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: start; margin: 2px 0; font-size: .9rem; }
.docpage .meal span { font-weight: 700; padding-top: 4px; }
.docpage .meal textarea { font: inherit; width: 100%; border: 1px solid #ddd; border-radius: 4px; padding: 3px 6px; resize: none; overflow: hidden; color: #111; background: #fff; }
.docpage .doc-sig { margin-top: 34px; text-align: right; }
.docpage .doc-sig .n { font-weight: 700; }
.docpage .doc-sig .l { font-size: .86rem; color: #333; }
.docpage .ql-host { min-height: 60px; }
.docpage .ql-host.tall { min-height: 220px; }
.docpage .ql-toolbar.ql-snow { border-color: #ddd; border-radius: 6px 6px 0 0; background: #fafafa; }
.docpage .ql-container.ql-snow { border-color: #ddd; border-radius: 0 0 6px 6px; font: inherit; }
.docpage .ql-editor { min-height: 60px; padding: 8px 10px; }
.docpage .ql-host.tall .ql-editor { min-height: 220px; }
.docpage .ql-editor img { max-width: 100%; }
.warn-text { color: var(--amber); }
@media (max-width: 760px) { .docpage { padding: 12px; } .docpage .anthro { grid-template-columns: 1fr; } .docpage .doc-lh img { height: 40px; } }

/* Dashboard: „Necesită atenția ta” in groups, each explained, each row with its action. */
.att-group { margin-top: 12px; }
.att-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .9rem; margin-bottom: 4px; }
.att-head .muted { flex: 1 1 260px; }
table.t.att td { padding-top: 5px; padding-bottom: 5px; }
.btn.sm { padding: 4px 10px; font-size: .82rem; white-space: nowrap; }
/* An interaction reverted from Jurnal stays in the thread, crossed out. */
tr.undone td { text-decoration: line-through; color: var(--muted); }
tr.undone td .pill { text-decoration: none; }
/* Import review: one decision per line. */
label.choice { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-weight: 400; cursor: pointer; }
label.choice:hover { background: var(--surface-2); }
label.choice input { margin: 0; }
/* Rendered HTML of an imported Google Doc / a Nexus document's rich block. */
.rich img { max-width: 100%; height: auto; }
.rich table { border-collapse: collapse; margin: 8px 0; }
.rich td, .rich th { border: 1px solid var(--line-2); padding: 4px 8px; vertical-align: top; }
.rich p { margin: 0 0 6px; }

/* Phone: „Necesită atenția ta” rows stack — name and when on the first line,
   the detail under it, the action button full width (17 Sept 2026, after the
   larger scale pushed the four-column row off the screen). */
@media (max-width: 760px) {
  table.t.att, table.t.att tbody { display: block; }
  table.t.att tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.t.att td { display: block; border: 0; padding: 0; white-space: normal; max-width: none; overflow: visible; }
  table.t.att td:nth-child(1) { grid-column: 1; grid-row: 1; }
  table.t.att td:nth-child(3) { grid-column: 2; grid-row: 1; text-align: right; }
  table.t.att td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  table.t.att td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; text-align: left; margin-top: 4px; }
  table.t.att td:nth-child(4) .btn { width: 100%; }
  .att-head { font-size: .95rem; }
  .att-head .muted { flex-basis: 100%; }
}
/* Phone: the pontaj „Programate” rows stack — time · patient · who on one
   line, the procedures under it, the counter, then the four outcomes in a
   2×2 grid (the buttons used to pile up in a 220 px cell). */
@media (max-width: 760px) {
  table.t.planned, table.t.planned tbody { display: block; }
  table.t.planned thead { display: none; }
  table.t.planned tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center;
    grid-template-areas: "date date date" "time pat who" "what what what" "num num num" "do do do"; }
  table.t.planned td { display: block; border: 0; padding: 0; white-space: normal; max-width: none; overflow: visible; }
  table.t.planned td.pl-date { grid-area: date; font-size: .8rem; color: var(--muted); }
  table.t.planned td.pl-time { grid-area: time; }
  table.t.planned td.pl-pat { grid-area: pat; }
  table.t.planned td.pl-who { grid-area: who; text-align: right; }
  table.t.planned td.pl-what { grid-area: what; }
  table.t.planned td.pl-num { grid-area: num; font-size: .9rem; }
  table.t.planned td.pl-do { grid-area: do; margin-top: 4px; }
  table.t.planned tr:hover td, table.t.att tr:hover td { background: transparent; }
  .pl-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-width: none; width: 100%; }
  .pl-acts .btn { padding: 8px 6px; font-size: .9rem; min-height: 40px; }
}
/* Phone: import review choices and the document header table stack. */
@media (max-width: 760px) {
  label.choice { flex-wrap: wrap; }
  label.choice .muted { flex-basis: 100%; padding-left: 24px; }
  .docpage table.doc-hdr, .docpage table.doc-hdr tbody { display: block; }
  .docpage table.doc-hdr tr { display: grid; grid-template-columns: 1fr 1fr; }
  .docpage table.doc-hdr td { display: block; width: auto; }
  .docpage table.doc-hdr td.l { width: auto; }
  .docpage .doc-lh .co { font-size: .7rem; }
  .docpage .doc-meta label { flex: 1 1 100%; }
  .docpage .doc-meta input { flex: 1; }
}
