/* The dashboard's one stylesheet (docs/SPEC.md §20.2): no inline styles,
   since the content-security policy allows the page's own origin only.
   Phone first: reception opens it on the phone it uses for WhatsApp. */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1d1d1b;
  --muted: #5f5f5a;
  --line: #deded8;
  --accent: #0b6b57;
  --accent-text: #ffffff;
  --warn: #8a4b00;
  --warn-bg: #fff4e5;
  --del: #8c1d18;
  --del-bg: #fdecea;
  --ins: #0f5132;
  --ins-bg: #e3f4ea;
  --radius: 8px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --surface: #20201e;
    --text: #ecece8;
    --muted: #a6a69f;
    --line: #34342f;
    --accent: #4cc3a5;
    --accent-text: #0d1f1a;
    --warn: #ffc27a;
    --warn-bg: #2e2416;
    --del: #ffb4ab;
    --del-bg: #3b1d1b;
    --ins: #9be3b8;
    --ins-bg: #15301f;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 16px 0; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 960px; margin: 0 auto; }
.brand { margin: 0; display: flex; flex-direction: column; }
.brand .clinic { font-weight: 600; }
.brand .product { color: var(--muted); font-size: 0.875rem; }
.lang { text-transform: uppercase; font-weight: 600; text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 16px; max-width: 960px; margin: 8px auto 0; }
.top nav a { padding: 8px 0; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; }
.top nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.top nav form { margin-left: auto; }

main { max-width: 960px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 8px 0 16px; }
h2 { font-size: 1.125rem; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

button, .button {
  font: inherit; cursor: pointer; border-radius: var(--radius);
  padding: 10px 16px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text);
}
button.quiet { background: transparent; color: var(--accent); }
button.link { background: none; border: none; padding: 8px 0; color: var(--muted); }
input[type="text"] {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); width: 100%; max-width: 320px;
}
label { display: block; font-weight: 600; margin-bottom: 4px; }
form.inline { display: inline; }
.stack > * + * { margin-top: 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card.generated { border-style: dashed; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); margin-left: 8px; vertical-align: middle; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
pre.body { white-space: pre-wrap; word-wrap: break-word; font: inherit; margin: 0; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; }
.rows .meta { color: var(--muted); font-size: 0.875rem; }
.rows .row-actions { margin-top: 8px; }

.columns { display: grid; gap: 16px; }
@media (min-width: 840px) { .columns { grid-template-columns: 3fr 2fr; align-items: start; } }

.qr { display: block; width: 100%; max-width: 280px; height: auto; background: #ffffff; padding: 12px; border-radius: var(--radius); }
.pager { display: flex; justify-content: flex-end; margin-top: 8px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
.question { white-space: pre-wrap; word-wrap: break-word; margin: 4px 0; }
.pager a + a { margin-left: 16px; }

/* A line diff (diff.go): one block per line, the marks drawn here so a copy
   of the text carries none, and colour never the only sign of a change. */
.diff { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 0; margin: 0 0 12px; overflow-wrap: anywhere; }
.diff > * { display: block; white-space: pre-wrap; min-height: 1.5em; padding: 0 12px 0 2.25em; text-indent: -1.25em; text-decoration: none; }
.diff > *::before { display: inline-block; width: 1.25em; text-indent: 0; }
.diff > span::before { content: " "; }
.diff del { background: var(--del-bg); color: var(--del); }
.diff del::before { content: "−"; font-weight: 600; }
.diff ins { background: var(--ins-bg); color: var(--ins); }
.diff ins::before { content: "+"; font-weight: 600; }
.diff .gap { color: var(--muted); font-style: italic; font-size: 0.875rem; padding-top: 4px; padding-bottom: 4px; }
.diff .gap::before { content: "⋯"; }

/* The knowledge editor (docs/SPEC.md §20.3): a field per section, phone first. */
a.button { display: inline-block; text-decoration: none; }
textarea {
  font: inherit; line-height: 1.5; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); width: 100%; resize: vertical; min-height: 6em;
}
textarea:focus-visible, input[type="text"]:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
textarea[aria-invalid="true"], input[aria-invalid="true"] { border-color: var(--del); }
.editor input[type="text"] { max-width: 100%; }
fieldset.card { margin: 0 0 12px; min-width: 0; }
fieldset.card > * + * { margin-top: 8px; }
fieldset.card > label { margin-top: 12px; }
legend { font-weight: 600; padding: 0 4px; margin-left: -4px; }
.facts { font-size: 0.875rem; color: var(--warn); margin: 0; }
.problem { color: var(--del); font-weight: 600; }
.problem p { margin: 4px 0 0; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: normal; margin-top: 12px; }
label.check input { width: 1.25em; height: 1.25em; margin: 0; }
fieldset.removed { opacity: 0.6; }
fieldset.new { border-style: dashed; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 16px 0; }
.preview { margin-bottom: 24px; }
.notice.done { background: var(--ins-bg); color: var(--ins); }
.notice ul { margin: 4px 0 0; padding-left: 20px; }
.notice p:last-child { margin-bottom: 0; }
pre.text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 8px 0 12px; }
details > summary { cursor: pointer; color: var(--accent); padding: 8px 0; }
.card.moved h3 { margin-top: 16px; }
.versions details { margin-top: 8px; }
.versions .diff { margin-top: 8px; }

/* Pregled and the patients (docs/SPEC.md §20.1): a status as a chip, never colour alone
   (its word is in it), the week as a small table, a staff row naming another clinic's
   patient set apart. Sections stacked in one column are spaced by .sections, which only
   these pages use: on Znanje the two sections are a grid's columns and must stay level. */
.sections > section + section { margin-top: 28px; }
h4 { font-size: 0.9375rem; margin: 12px 0 6px; color: var(--muted); }
.columns.even { grid-template-columns: 1fr; }
@media (min-width: 840px) { .columns.even { grid-template-columns: 1fr 1fr; } }
.rows.compact > li { padding: 8px 12px; margin-bottom: 6px; }
.chip { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.status_requested, .chip.send_held, .chip.send_queued { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.status_confirmed, .chip.status_reminded, .chip.status_completed { background: var(--ins-bg); color: var(--ins); border-color: transparent; }
.chip.status_no_show, .chip.send_failed { background: var(--del-bg); color: var(--del); border-color: transparent; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0; }
.file { font-style: italic; margin: 4px 0; }
.rows > li.mixed { background: transparent; border-style: dashed; }
.patient { overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table.stats { border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 100%; margin-bottom: 8px; }
table.stats th, table.stats td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
table.stats th[scope="row"] { text-align: left; font-weight: normal; }
table.stats thead th { font-weight: 600; }
table.stats thead th span { display: block; font-weight: normal; }
table.stats tr:last-child > * { border-bottom: none; }
form.search { margin: 0 0 12px; }
.search-row { display: flex; gap: 8px; max-width: 480px; }
input[type="search"] {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); flex: 1; min-width: 0;
}
input[type="search"]:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* A patient's page: the conversation as two sides, buttons and lists as the words they
   carried, the relay's log and the reminders under each booking. */
.who h2 { margin-bottom: 8px; }
.facts-list { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 12px; }
.facts-list dt { color: var(--muted); }
.facts-list dd { margin: 0; overflow-wrap: anywhere; }
.convo { list-style: none; margin: 0; padding: 0; }
.convo > li { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin: 0 0 8px; max-width: 92%; background: var(--surface); }
.convo > li.out { margin-left: auto; background: var(--ins-bg); border-color: transparent; }
.convo .meta { color: var(--muted); font-size: 0.8125rem; }
.buttons { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.button-text { display: inline-block; border: 1px solid var(--accent); color: var(--accent); border-radius: var(--radius); padding: 2px 10px; font-size: 0.875rem; }
.list-rows { margin: 4px 0 0; padding-left: 20px; font-size: 0.875rem; }
.list-title { margin: 6px 0 0; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
ul.log { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); font-size: 0.875rem; color: var(--muted); }
ul.log li + li { margin-top: 2px; }
.filters { display: flex; gap: 16px; margin: 0 0 12px; }
.filters a { text-decoration: none; padding: 4px 0; border-bottom: 3px solid transparent; color: var(--muted); }
.filters a[aria-current="true"] { color: var(--text); border-bottom-color: var(--accent); }
.chip.attention { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

/* Termini (docs/SPEC.md §20.1): the week's pager on the left, under its heading, and the
   filter as two selects and a button that wrap on a phone. */
.pager.start { justify-content: flex-start; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 12px; }
.pager.start a + a { margin-left: 0; }
form.filter-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 0 0 20px; }
form.filter-form > div { min-width: 0; flex: 0 1 240px; }
select {
  font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); width: 100%;
}
select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Postavke (docs/SPEC.md §20.1): sentences as a plain list, the doctors, the entry links and
   the calendars as tiles that stack on a phone, a link or a calendar id wrapped anywhere. */
ul.sentences { margin: 0; padding-left: 20px; }
ul.sentences li + li { margin-top: 6px; }
ul.plain { list-style: none; margin: 0; padding: 0; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tiles > .card { margin-bottom: 0; }
.url { overflow-wrap: anywhere; font-size: 0.875rem; }
.qr.small { max-width: 200px; margin-top: 8px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125rem; overflow-wrap: anywhere; }
ul.busy li + li { margin-top: 2px; }
ul.busy .day { display: inline-block; min-width: 6.5em; color: var(--muted); }
.sections > p.notice { margin-top: 28px; }
