:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #1c2421;
  --muted: #5f6b66;
  --line: #dde3e0;
  --accent: #0f6e5c;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ed;
  --ok: #1d7a46;
  --ok-soft: #e2f3e8;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --error: #a32020;
  --error-soft: #fbe6e6;
  --info: #2c5d8a;
  --info-soft: #e5eef7;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; }
h2 { font-size: 1.05rem; margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; }

/* Barra superior */
.topbar { display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 600; }
.brand-mark { display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; letter-spacing: .04em; border-radius: 6px; padding: 4px 8px; font-size: .85rem; }
.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 6px; font-weight: 500; }
.mainnav a:hover { color: var(--ink); background: var(--bg); }
.mainnav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.userbox { display: flex; align-items: center; gap: 12px; }
.userbox form { margin: 0; }
.username { color: var(--muted); font-size: .9rem; }
.lang-form select { padding: 4px 6px; font-size: .8rem; width: auto; }

/* Pàgina */
.page { max-width: 1200px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.head-actions form { margin: 0; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.eyebrow a { color: inherit; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card { margin-top: 16px; }
.section-title { font-size: .95rem; margin-bottom: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head .section-title { margin: 0; }
.card > .section-title:not(:first-of-type) { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.empty { color: var(--muted); text-align: center; padding: 24px; }
.notes { white-space: normal; color: var(--muted); margin: 12px 0 0; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* Botons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9c4bf; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #0b5a4b; border-color: #0b5a4b; }
.btn-ghost { background: transparent; }
.btn-link { background: none; border: none; color: var(--accent); padding: 8px 4px; }
.btn-link:hover { text-decoration: underline; }
.btn-sm { padding: 4px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Formularis */
input[type="text"], input[type="search"], input[type="password"], input[type="tel"], input[type="email"],
input[type="date"], input[type="number"], input:not([type]), select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: var(--surface); color: var(--ink);
}
textarea { resize: vertical; }
label { font-weight: 500; font-size: .9rem; }
.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.form-grid > div { display: grid; gap: 4px; align-content: start; }
.form-grid > div[hidden] { display: none; }
.form-grid > div:has(textarea) { grid-column: 1 / -1; }
.form-grid > div:has(input[type="checkbox"]) { grid-template-columns: auto 1fr; align-items: center; column-gap: 8px; }
.form-grid > div:has(input[type="checkbox"]) > input { order: -1; }
.form-grid > div:has(input[type="checkbox"]) > .helptext,
.form-grid > div:has(input[type="checkbox"]) > .errorlist { grid-column: 1 / -1; }
.helptext { color: var(--muted); font-size: .8rem; }
.errorlist { list-style: none; margin: 0; padding: 0; color: var(--error); font-size: .85rem; }
.errorlist-row { color: var(--error); font-size: .8rem; margin-top: 4px; }
.pw-rules { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 2px; color: var(--muted); font-size: .85rem; }
.pw-rules li::before { content: "○"; display: inline-block; width: 1.3em; }
.pw-rules li.is-ok { color: var(--ok); font-weight: 500; }
.pw-rules li.is-ok::before { content: "✓"; }
.pw-match { margin: 2px 0 0; font-size: .85rem; font-weight: 500; }
.pw-match.is-ok { color: var(--ok); }
.pw-match.is-ok::before { content: "✓ "; }
.pw-match.is-error { color: var(--error); }
input.is-ok { border-color: var(--ok); background: var(--ok-soft); }
input.is-error { border-color: var(--error); }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.actions.split { justify-content: space-between; flex-wrap: wrap; }
.actions.split > div { display: flex; gap: 8px; flex-wrap: wrap; }
.searchbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.searchbar input { max-width: 420px; }

/* Taules */
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: #fafbfa; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafcfb; }
.table .num { text-align: right; width: 1%; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .dose { text-align: center; width: 72px; font-variant-numeric: tabular-nums; }
.table .center { text-align: center; }
.table td.mono { white-space: nowrap; }
.table .right { text-align: right; }
.table td form { margin: 0; display: inline; }
.card .table th:first-child, .card .table td:first-child { padding-left: 20px; }
.lines .out-blister td { background: #fbfcfd; color: var(--muted); }
.lines-edit td { padding: 6px 8px; }
.lines-edit .col-med { min-width: 260px; }
.lines-edit .dose select { width: 64px; padding: 6px; text-align: center; }
.lines-edit input[type="text"] { min-width: 120px; }

/* Etiquetes i missatges */
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-info { background: var(--info-soft); color: var(--info); }
.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.msg { padding: 10px 14px; border-radius: 6px; background: var(--info-soft); color: var(--info); }
.hint-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
.msg-success { background: var(--ok-soft); color: var(--ok); }
.msg-error { background: var(--error-soft); color: var(--error); }
.msg-warning { background: var(--warn-soft); color: var(--warn); margin-top: 12px; }
.withdraw-card summary { cursor: pointer; }
.withdraw-card form { margin-top: 12px; }
.withdraw-card ul.helptext { margin: 4px 0 12px; padding-left: 20px; }

/* Historial */
.history { border-top: 1px solid var(--line); padding: 10px 0; }
.history:first-of-type { border-top: none; }
.history summary { cursor: pointer; display: flex; gap: 16px; flex-wrap: wrap; align-items: baseline; }
.history .table-wrap { margin: 12px 0; }

/* Accés */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 32px; }
.auth-card h1 { font-size: 1.35rem; margin-bottom: 6px; }
.auth-card .stack { margin-top: 20px; }
.auth-card .stack > div { display: grid; gap: 4px; }
.auth-brand { margin-bottom: 20px; }
.steps { padding-left: 20px; color: var(--muted); }
.qr { display: block; margin: 12px auto; background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.secret { font-size: .85rem; color: var(--muted); text-align: center; }
.secret code { display: block; margin-top: 6px; word-break: break-all; font-family: var(--mono); color: var(--ink); }

@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  .mainnav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .username { display: none; }
  .page { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .searchbar { flex-wrap: wrap; }
}

/* Superadministrador */
.support-banner { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; padding: 8px 24px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid #ecd9a8; font-size: .9rem; }
.support-banner form { margin: 0; }
.btn-warn { border-color: var(--warn); color: var(--warn); }
.inline-form { display: flex !important; gap: 6px; align-items: center; }
.inline-form input { min-width: 180px; padding: 4px 8px; }
.table.compact td { padding: 6px 12px; font-size: .88rem; }
.auth-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.auth-links form { margin: 0; }

/* Capsa del pacient */
.scanbar label { font-size: 1rem; }
.scanbar-row { display: flex; gap: 8px; margin: 8px 0 4px; }
.scanbar-row input { font-size: 1.05rem; padding: 10px 12px; font-family: var(--mono); }
.stock-row.has-alerts { border-left: 4px solid var(--warn); }
.stock-head { display: flex; gap: 16px; align-items: center; }
.stock-title { flex: 1; min-width: 0; }
.stock-title h2 { font-size: 1rem; }
.stock-title p { margin: 2px 0 0; font-size: .88rem; }
.pill-photo { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.stock-figures { display: flex; gap: 20px; text-align: right; }
.figure { display: block; font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.figure-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stock-row .table-wrap { margin-top: 12px; border-top: 1px solid var(--line); }
.alerts { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; }
.alerts li { padding: 6px 10px; border-radius: 6px; font-size: .9rem; }
.alert-warning { background: var(--warn-soft); color: var(--warn); }
.alert-error { background: var(--error-soft); color: var(--error); }
.text-error { color: var(--error); font-weight: 600; }
.product { display: flex; gap: 16px; align-items: center; }
.product img { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.product h2 { font-size: 1rem; }
.product p { margin: 4px 0 0; }
.box-remove { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.table td.right { white-space: nowrap; }
@media (max-width: 800px) {
  .stock-head, .product { flex-wrap: wrap; }
}
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: .75rem; font-weight: 700; }
.med-cell { display: flex; align-items: center; gap: 10px; }
.pill-thumb { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }

/* SPD */
.tag-error { background: var(--error-soft); color: var(--error); }
.tag:not([class*="tag-"]) { background: var(--bg); color: var(--muted); }
.card.table-wrap > .card-head { padding: 16px 20px 0; }
.period-picker { display: flex; gap: 8px; align-items: center; }
.period-picker input { width: auto; }
.period-picker label { white-space: nowrap; }
ul.plain { margin: 6px 0; padding-left: 18px; }
.table tr.row-error td { background: var(--error-soft); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.timeline li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.timeline li strong { color: var(--muted); }
.timeline li.done { border-color: #b9dcc7; background: var(--ok-soft); color: var(--ink); }
.timeline li.done strong { color: var(--ok); }
.timeline li.current { border-color: var(--warn); background: var(--warn-soft); }
.timeline li.current strong { color: var(--warn); }
.timeline li.cancelled { background: var(--error-soft); border-color: #eab8b8; color: var(--error); }
.deliver-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.deliver-card p { margin: 0; }
.grid-2 + section.card, .grid-2 + .grid-2 { margin-top: 16px; }
form.card > .form-grid + .actions { margin-top: 16px; }

/* Dies concrets i observacions ressaltades */
.hl { display: inline-block; background: #1c2421; color: #fff; font-weight: 700; padding: 0 6px; border-radius: 4px; font-size: .85em; }
.days-cell .weekdays, .days-cell ul { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.days-cell label { display: grid; justify-items: center; font-size: .72rem; font-weight: 500; color: var(--muted); gap: 0; }
.days-cell input { margin: 0; }
.end-cell { min-width: 150px; }
.end-cell select, .end-cell input { width: 100%; }
.end-cell input { margin-top: 4px; }
.end-cell input[hidden] { display: none; }

/* Inspecció */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 6px 6px 0 0; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 12px; }

/* Importació */
.steps-list { margin: 0 0 16px; padding-left: 20px; color: var(--muted); }
.stat-row { display: flex; gap: 32px; flex-wrap: wrap; margin-bottom: 12px; }
.secret-list { margin: 12px 0; }
.scanbar-inline { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.scanbar-inline label { font-weight: 600; }

/* Contrasenya */
.card.narrow { max-width: 520px; }
.card.narrow .stack > div { display: grid; gap: 4px; }
.inline-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.inline-card .section-title { margin-bottom: 4px; }
a.username { text-decoration: none; color: var(--muted); }
a.username:hover { color: var(--accent); text-decoration: underline; }

/* Ajuda */
.help-button { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); color: var(--accent); font-weight: 700; text-decoration: none; background: var(--surface); }
.help-button:hover { background: var(--accent-soft); border-color: var(--accent); }
.auth { display: grid; place-items: center; align-content: center; gap: 12px; }
.auth-help { text-align: center; margin: 0; font-size: .9rem; }
.help-search label { font-weight: 600; font-size: 1rem; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.help-card { text-decoration: none; color: inherit; margin: 0; transition: border-color .15s; }
.help-card:hover { border-color: var(--accent); }
.help-card h2 { font-size: 1rem; color: var(--accent); margin-bottom: 4px; }
.help-card p { margin: 0; font-size: .9rem; }
.help-result { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.help-result:first-of-type { border-top: none; }
.help-result strong { color: var(--accent); }
.help-snippet { color: var(--muted); font-size: .88rem; }
.help-article { max-width: 820px; line-height: 1.6; }
.help-article section { padding: 4px 0 16px; border-bottom: 1px solid var(--line); scroll-margin-top: 80px; }
.help-article section:last-child { border-bottom: none; }
.help-article section:target { background: var(--accent-soft); margin: 0 -20px; padding: 4px 20px 16px; border-radius: 6px; }
.help-article h2 { font-size: 1.1rem; margin: 16px 0 8px; }
.help-article ol, .help-article ul { padding-left: 22px; }
.help-article li { margin-bottom: 4px; }
.help-article code { font-family: var(--mono); background: var(--bg); padding: 1px 6px; border-radius: 4px; }
.help-note { background: var(--info-soft); color: var(--info); padding: 8px 12px; border-radius: 6px; }
.help-pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Suport */
.support-link { text-decoration: none; color: var(--muted); font-weight: 500; padding: 4px 8px; border-radius: 6px; }
.support-link:hover, .support-link[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.help-contact { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.ticket-form { max-width: 760px; }
.ticket-form .stack > div { display: grid; gap: 4px; }
.ticket-form ul { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 4px; }
.ticket-form ul label { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.thread { display: grid; gap: 12px; margin-bottom: 16px; max-width: 820px; }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-right: 15%; }
.bubble.from-support { background: var(--accent-soft); border-color: #b9dcc7; margin: 0 0 0 15%; }
.bubble header { margin-bottom: 6px; font-size: .9rem; }
.bubble-body { white-space: normal; line-height: 1.55; }
.bubble .btn { margin-top: 8px; }
.ticket-form fieldset { border: none; padding: 0; margin: 0; }
.ticket-form legend { font-weight: 500; font-size: .9rem; margin-bottom: 6px; padding: 0; }
.ticket-form fieldset > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.ticket-form fieldset label { display: flex; align-items: center; gap: 8px; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.ticket-form fieldset label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.signature-help { background: var(--info-soft); color: var(--info); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }

/* Resum d'importació */
.issues td { vertical-align: top; }
.issues .where { white-space: nowrap; font-weight: 600; }
.issues-error .where { color: var(--error); }
.issues-warning .where { color: var(--warn); }
.issues .solution { color: var(--ink); background: #fbfcfb; }
.issues-box { margin: 12px 0; }
.issues-box summary { cursor: pointer; padding: 8px 0; }

/* Guia de posada en marxa */
.ob-bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 8px; min-width: 220px; }
.ob-fill { display: block; height: 100%; background: var(--accent); width: 0; }
.ob-0 { width: 0%; }
.ob-1 { width: 1%; }
.ob-2 { width: 2%; }
.ob-3 { width: 3%; }
.ob-4 { width: 4%; }
.ob-5 { width: 5%; }
.ob-6 { width: 6%; }
.ob-7 { width: 7%; }
.ob-8 { width: 8%; }
.ob-9 { width: 9%; }
.ob-10 { width: 10%; }
.ob-11 { width: 11%; }
.ob-12 { width: 12%; }
.ob-13 { width: 13%; }
.ob-14 { width: 14%; }
.ob-15 { width: 15%; }
.ob-16 { width: 16%; }
.ob-17 { width: 17%; }
.ob-18 { width: 18%; }
.ob-19 { width: 19%; }
.ob-20 { width: 20%; }
.ob-21 { width: 21%; }
.ob-22 { width: 22%; }
.ob-23 { width: 23%; }
.ob-24 { width: 24%; }
.ob-25 { width: 25%; }
.ob-26 { width: 26%; }
.ob-27 { width: 27%; }
.ob-28 { width: 28%; }
.ob-29 { width: 29%; }
.ob-30 { width: 30%; }
.ob-31 { width: 31%; }
.ob-32 { width: 32%; }
.ob-33 { width: 33%; }
.ob-34 { width: 34%; }
.ob-35 { width: 35%; }
.ob-36 { width: 36%; }
.ob-37 { width: 37%; }
.ob-38 { width: 38%; }
.ob-39 { width: 39%; }
.ob-40 { width: 40%; }
.ob-41 { width: 41%; }
.ob-42 { width: 42%; }
.ob-43 { width: 43%; }
.ob-44 { width: 44%; }
.ob-45 { width: 45%; }
.ob-46 { width: 46%; }
.ob-47 { width: 47%; }
.ob-48 { width: 48%; }
.ob-49 { width: 49%; }
.ob-50 { width: 50%; }
.ob-51 { width: 51%; }
.ob-52 { width: 52%; }
.ob-53 { width: 53%; }
.ob-54 { width: 54%; }
.ob-55 { width: 55%; }
.ob-56 { width: 56%; }
.ob-57 { width: 57%; }
.ob-58 { width: 58%; }
.ob-59 { width: 59%; }
.ob-60 { width: 60%; }
.ob-61 { width: 61%; }
.ob-62 { width: 62%; }
.ob-63 { width: 63%; }
.ob-64 { width: 64%; }
.ob-65 { width: 65%; }
.ob-66 { width: 66%; }
.ob-67 { width: 67%; }
.ob-68 { width: 68%; }
.ob-69 { width: 69%; }
.ob-70 { width: 70%; }
.ob-71 { width: 71%; }
.ob-72 { width: 72%; }
.ob-73 { width: 73%; }
.ob-74 { width: 74%; }
.ob-75 { width: 75%; }
.ob-76 { width: 76%; }
.ob-77 { width: 77%; }
.ob-78 { width: 78%; }
.ob-79 { width: 79%; }
.ob-80 { width: 80%; }
.ob-81 { width: 81%; }
.ob-82 { width: 82%; }
.ob-83 { width: 83%; }
.ob-84 { width: 84%; }
.ob-85 { width: 85%; }
.ob-86 { width: 86%; }
.ob-87 { width: 87%; }
.ob-88 { width: 88%; }
.ob-89 { width: 89%; }
.ob-90 { width: 90%; }
.ob-91 { width: 91%; }
.ob-92 { width: 92%; }
.ob-93 { width: 93%; }
.ob-94 { width: 94%; }
.ob-95 { width: 95%; }
.ob-96 { width: 96%; }
.ob-97 { width: 97%; }
.ob-98 { width: 98%; }
.ob-99 { width: 99%; }
.ob-100 { width: 100%; }
.ob-next { display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; padding: 14px 16px; background: var(--accent-soft); border-radius: var(--radius); }
.ob-next p { margin: 4px 0 0; }
.ob-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ob-note { color: var(--warn); font-weight: 600; margin: 4px 0 0; }
.ob-steps { list-style: none; margin: 16px 0 0; padding: 0; }
.ob-steps li { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.ob-steps li:first-child { border-top: 0; }
.ob-steps p { margin: 4px 0 0; }
.ob-steps .tag { margin-left: 6px; }
.ob-mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.is-done .ob-mark { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.is-next .ob-mark { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.is-done .ob-body strong { color: var(--muted); }
@media (max-width: 640px) {
  .ob-steps li { grid-template-columns: 32px 1fr; }
  .ob-steps .ob-actions { grid-column: 2; }
}

/* Compliment del decret */
.decree-summary { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; }
.decree-summary strong { font-size: 1.4rem; margin-right: 4px; }
.decree-group { padding: 16px 20px 0; }
.decree-table td { vertical-align: top; }
.nowrap { white-space: nowrap; }
@media print {
  .topbar, .mainnav, .head-actions, .help-button, .messages { display: none !important; }
  .card { break-inside: avoid; border: 0; padding: 0; }
}

/* Grups de pacients */
.group-tag { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; white-space: nowrap; }
.group-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.group-blau { background: #2f6fb5; }
.group-taronja { background: #e07b1f; }
.group-verd { background: #2f9e5b; }
.group-vermell { background: #c43c3c; }
.group-lila { background: #8a5cc2; }
.group-groc { background: #d4a514; }
.group-rosa { background: #d0679d; }
.group-gris { background: #7a8580; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: .9rem; font-weight: 500; }
.chip:hover { border-color: #b9c4bf; }
.chip[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.table .check { width: 1%; }
.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.bulkbar select { width: auto; }

/* Dispensar: nom + PIN + botó en una sola línia */
.dispense-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.dispense-row select { width: auto; min-width: 12rem; }
.dispense-row input[name="pin"], .dispense-row .btn { width: auto; }
.dispense-row input[name="pin"] { width: 5.5rem; letter-spacing: .3em; }

/* Versió de l'aplicació (només administradors) */
.app-version { text-align: center; font-size: .8rem; padding: 1rem 0 1.5rem; }
.app-version a { color: var(--muted, #6b7280); text-decoration: none; }
.app-version a:hover { text-decoration: underline; }
.changelog h3 { font-size: 1rem; margin: 1rem 0 .3rem; }
.changelog ul, .changelog ol { margin: .2rem 0 .4rem 1.2rem; }

/* Medicaments: fusionar repetits i «És aquest?» del lector */
.toolbar-row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin: .75rem 0; }
.duplicates ul.plain li { padding: .35rem 0; border-top: 1px solid rgba(0,0,0,.06); }
.duplicates ul.plain li:first-child { border-top: 0; }
.duplicates .dup-dismiss { display: inline; margin: 0; }
.scan-choices { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.scan-ask { color: var(--warn); }

/* Mode mostrador */
.topbar-counter { justify-content: space-between; }
.counter-table td { vertical-align: middle; }
.counter-done { color: var(--ok); font-size: 1.1rem; }
.narrow-card { max-width: 520px; }
.section-gap { margin-top: 32px; }

/* Demo pública */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.auth-card label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: normal; }
.auth-card label.check input { width: auto; margin-top: 3px; }
.center { text-align: center; }
.demo-banner { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: center; padding: 8px 16px; background: var(--warn-soft); color: var(--warn); font-size: .9rem; border-bottom: 1px solid var(--line); }
.demo-banner form { margin: 0; }
.demo-banner a { color: inherit; font-weight: 600; }
.demo-steps li { margin-bottom: 8px; }

/* Codi d'accés: app, codis d'emergència i ordinadors recordats */
.tf-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.tf-row:first-of-type { border-top: 0; }
.tf-row .tag { margin-left: 6px; }
.tf-row .helptext { margin: 4px 0 0; }
.tf-row form, .tf-row > .btn { flex: none; }
.qr-box { width: 220px; max-width: 100%; margin: 12px 0; background: #fff; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); }
.qr-box svg { display: block; width: 100%; height: auto; }
.secret { font-family: var(--mono); font-size: 1rem; letter-spacing: .05em; word-break: break-all; }
.steps { padding-left: 1.2em; }
.steps li { margin-bottom: 12px; }
.backup-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; list-style: none; padding: 0; margin: 16px 0; max-width: 420px; }
.backup-codes code { font-family: var(--mono); font-size: 1.25rem; letter-spacing: .08em; }
.auth-card .small { font-size: .85rem; margin-top: 4px; }
@media (max-width: 600px) { .tf-row { flex-direction: column; align-items: stretch; } }
.app-nudge { border-left: 4px solid var(--accent); }
.app-nudge-actions { display: flex; gap: 8px; flex: none; align-items: center; }
@media (max-width: 600px) { .app-nudge-actions { flex-wrap: wrap; } }
