/* Panel zdrowia – one stylesheet, no external fonts or scripts (medical data: the page
   talks to nobody but this server). Light and dark follow the system setting.
   Look: quiet and minimal – one typeface (Arimo, a free Arial-style face shipped with the
   panel), neutral greys, hairlines instead of shadows, colour only where it means something. */

@font-face {
  font-family: "Arimo"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/arimo-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
                 U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
                 U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Arimo"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/arimo-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
                 U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
                 U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f3f3f1;
  --ink: #1b1d1f;
  --ink-2: #3a3d40;
  --muted: #6f7275;
  --line: #e6e6e3;
  --line-strong: #d3d3cf;
  --accent: #14695a;
  --accent-hover: #0f5649;
  --accent-ink: #ffffff;
  --accent-soft: #e8f1ee;
  --ok: #1d6b3c;
  --ok-soft: #e9f3ec;
  --warn: #8a5a12;
  --warn-soft: #f8f0e1;
  --bad: #a8322a;
  --bad-soft: #f9ebe9;
  --info: #35558f;
  --info-soft: #ecf0f7;
  --shadow: none;
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar: 236px;
  --font: "Arimo", Arial, "Helvetica Neue", Helvetica, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131414;
    --surface: #1a1b1c;
    --surface-2: #212324;
    --ink: #ececea;
    --ink-2: #cfd0cd;
    --muted: #96989a;
    --line: #2a2c2d;
    --line-strong: #383a3b;
    --accent: #5bb8a3;
    --accent-hover: #74c8b5;
    --accent-ink: #0d1f1b;
    --accent-soft: #1b2e2a;
    --ok: #6cc08b;
    --ok-soft: #18291e;
    --warn: #d9a656;
    --warn-soft: #2d2415;
    --bad: #ec8a81;
    --bad-soft: #321b19;
    --info: #92ade0;
    --info-soft: #1b2232;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #131414;
    --surface: #1a1b1c;
    --surface-2: #212324;
    --ink: #ececea;
    --ink-2: #cfd0cd;
    --muted: #96989a;
    --line: #2a2c2d;
    --line-strong: #383a3b;
    --accent: #5bb8a3;
    --accent-hover: #74c8b5;
    --accent-ink: #0d1f1b;
    --accent-soft: #1b2e2a;
    --ok: #6cc08b;
    --ok-soft: #18291e;
    --warn: #d9a656;
    --warn-soft: #2d2415;
    --bad: #ec8a81;
    --bad-soft: #321b19;
    --info: #92ade0;
    --info-soft: #1b2232;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.012em; text-wrap: balance; }
h1 { font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14.5px; font-weight: 600; }
p { margin: 0 0 8px; }
.icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor;
        stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 20px; height: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* --- layout ------------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 22px 14px;
}
.brand { display: flex; align-items: flex-start; gap: 10px; padding: 2px 10px 22px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none;
              margin-top: 5px; }
.brand-mark .icon { display: none; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.15; letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase;
             letter-spacing: .08em; padding: 22px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 400;
}
.nav a .icon { color: var(--muted); }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--surface); color: var(--ink); font-weight: 600;
                box-shadow: inset 0 0 0 1px var(--line); }
.nav a.active .icon { color: var(--accent); }
.nav .count { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line);
                color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.main { min-width: 0; padding: 36px clamp(16px, 4vw, 56px) 64px; }
.container { max-width: 1180px; margin: 0 auto; }
.container.wide { max-width: 1600px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
             gap: 16px; margin-bottom: 28px; }
.page-head .sub { color: var(--muted); margin-top: 6px; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.crumbs a { color: var(--muted); }

/* --- surfaces ------------------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        margin-bottom: 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
             padding: 18px 20px 12px; }
.card-head .hint { color: var(--muted); font-size: 12.5px; }
.card-body { padding: 0 20px 20px; }
.card-body.flush { padding: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px;
          align-items: start; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }

/* key numbers: one quiet strip, no icon tiles */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 28px;
         background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat { padding: 16px 20px; display: flex; gap: 12px; align-items: center; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stats .stat-icon { display: none; }
.stat-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
             background: var(--surface-2); color: var(--muted); flex: none; }
.stat-value { font-size: 26px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat.tone-bad .stat-value { color: var(--bad); }
.stat.tone-warn .stat-value { color: var(--warn); }
.stat.tone-accent .stat-value { color: var(--accent); }

/* --- lists ---------------------------------------------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 20px;
       border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; }
.row-meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 2px 12px; }
.row-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.row-side .icon { color: var(--muted); }
a.row { color: inherit; }
a.row:hover { background: var(--surface-2); text-decoration: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
          background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-size: 13px;
          border: 1px solid var(--line); }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .icon { width: 26px; height: 26px; color: var(--ok); margin-bottom: 6px; }

/* --- badges and buttons ----------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px;
         font-size: 12px; font-weight: 600; background: transparent; color: var(--muted);
         border: 1px solid var(--line-strong); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.block, .badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.count { min-width: 20px; height: 19px; padding: 0 6px; border-radius: 999px; font-size: 11.5px;
         font-weight: 700; display: inline-grid; place-items: center; background: var(--bad);
         color: #fff; }
.count.soft { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); }

button, .btn {
  font: inherit; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center;
  justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
button:hover, .btn:hover { background: var(--surface-2); text-decoration: none; }
button.primary, .btn.primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
button.primary:hover, .btn.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
button.danger, .btn.danger { color: var(--bad); }
button.danger:hover { background: var(--bad-soft); border-color: transparent; }
button.ghost, .btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
button.ghost:hover, .btn.ghost:hover { color: var(--ink); }
button.small, .btn.small { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .55; cursor: not-allowed; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
label { font-size: 13px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 4px; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-row input[type=text], .form-row input:not([type]) { flex: 1 1 260px; }
form.inline { display: inline; }
.check-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

/* --- notices ---------------------------------------------------------------------------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm);
         margin-bottom: 16px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.note { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; margin: 6px 0; }
.note.block { background: var(--bad-soft); color: var(--bad); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.info { background: var(--info-soft); color: var(--info); }
.muted { color: var(--muted); font-size: 13px; }

/* --- tables ----------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 11px 20px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
     border-top: 0; border-bottom: 1px solid var(--line); background: transparent; padding-top: 6px; }
tr:first-child + tr td { border-top: 0; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.out td.val { color: var(--bad); font-weight: 600; }

/* --- person page ------------------------------------------------------------------------ */
.person-head { display: flex; gap: 16px; align-items: center; }
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line);
        margin: -8px 0 24px; scrollbar-width: none; }
.tabs a { padding: 10px 12px; color: var(--muted); font-weight: 400; border-bottom: 2px solid transparent;
          white-space: nowrap; font-size: 14px; }
.tabs a:hover { color: var(--ink); text-decoration: none; border-bottom-color: var(--line-strong); }
.section { scroll-margin-top: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 11px; border-radius: 8px; background: transparent; border: 1px solid var(--line-strong);
        font-size: 13.5px; }
.chip b { font-weight: 600; }
.state-overdue { color: var(--bad); }
.state-soon { color: var(--warn); }
.copy-field { display: flex; gap: 8px; }
.copy-field input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
                    font-size: 12.5px; }
.result-cat { padding: 14px 20px 4px; color: var(--muted); font-size: 11.5px; font-weight: 600;
              text-transform: uppercase; letter-spacing: .07em; border-top: 1px solid var(--line); }
.result-cat:first-child { border-top: 0; }
.trend { font-size: 12px; color: var(--muted); white-space: nowrap; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13.5px; }
details.more[open] summary { margin-bottom: 8px; }
.steps { margin: 6px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 13.5px; }

/* --- upload ----------------------------------------------------------------------------- */
.person-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.person-pick label { display: flex; align-items: center; gap: 10px; padding: 12px; cursor: pointer;
                     border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--ink);
                     font-size: 14px; font-weight: 600; background: var(--surface); }
.person-pick input { accent-color: var(--accent); }
.person-pick label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.dropzone { position: relative; display: block; border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
            padding: 40px 20px; text-align: center; background: var(--surface); cursor: pointer;
            transition: border-color .15s, background .15s; color: var(--ink); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .icon { width: 30px; height: 30px; color: var(--muted); margin-bottom: 6px; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dz-title { font-weight: 600; font-size: 16px; }
.dz-files { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px;
            justify-content: center; }
.dz-files li { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--surface);
               border: 1px solid var(--line); }
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 4px;
            border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pipeline div { padding: 12px 14px; font-size: 13px; color: var(--muted); border-left: 1px solid var(--line); }
.pipeline div:first-child { border-left: 0; }
.pipeline b { display: block; color: var(--ink); font-size: 13.5px; font-weight: 600; margin-bottom: 2px; }
.job-state { display: inline-flex; align-items: center; gap: 6px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong);
           border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* --- document review -------------------------------------------------------------------- */
.review { display: grid; grid-template-columns: minmax(360px, 44%) minmax(0, 1fr); gap: 20px; align-items: start; }
.viewer { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding: 12px; }
.viewer figure { margin: 0 0 12px; }
.viewer figcaption { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.viewer img { width: 100%; display: block; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.value-item { padding: 16px 20px; border-top: 1px solid var(--line); }
.value-item:first-child { border-top: 0; }
.value-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.value-name { font-weight: 600; }
.value-big { font-size: 20px; font-weight: 600; white-space: nowrap; }
.value-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.fragment { width: 100%; display: block; margin-top: 10px; border: 1px solid var(--line); border-radius: 6px;
            background: #fff; }
.corr { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 10px; margin-top: 10px; }
.corr .wide { grid-column: span 2; }
.sticky-actions { position: sticky; top: 0; z-index: 2; background: var(--surface);
                  border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }

/* --- small screens ---------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat:nth-child(3) { border-left: 0; }
  .stats .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .grid-2 { grid-template-columns: 1fr; }
  .review { grid-template-columns: 1fr; }
  .viewer { position: static; max-height: 60vh; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
             padding: 12px 14px; gap: 6px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 8px 0 2px; }
  .brand-sub, .nav-label, .sidebar-foot { display: none; }
  .nav { flex-direction: row; overflow-x: auto; width: 100%; gap: 4px; scrollbar-width: none; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .main { padding: 22px 16px 50px; }
  h1 { font-size: 23px; }
  .pipeline { grid-template-columns: 1fr 1fr; }
  .pipeline div:nth-child(3) { border-left: 0; }
  .pipeline div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .corr { grid-template-columns: 1fr 1fr; }
  th, td { padding: 9px 14px; }
  .row { padding: 12px 16px; }
}
@media (max-width: 520px) {
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 22px; }
  .row { flex-wrap: wrap; }
  .row-side { width: 100%; justify-content: flex-start; padding-left: 48px; }
}

/* --- spacing helpers ----------------------------------------------------------------- */
.mt { margin-top: 18px; }
.mt-s { margin-top: 10px; }
.mb-s { margin-bottom: 8px; }
.card-head.flush-x { padding: 18px 0 10px; }
.card-head.flush-x:first-of-type { padding-top: 16px; }
.list.bordered { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.row.tight { padding: 10px 12px; }
.row > .stat-icon { width: 30px; height: 30px; background: transparent; border: 1px solid var(--line); }
.stat-icon.tone-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em;
       background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
/* grid children may shrink below their content (wide tables scroll inside .table-wrap) */
.grid-2 > *, .review > *, .main, .container { min-width: 0; }
@media (max-width: 520px) { .card-head .hint { display: none; } }
.person-pick label:has(input:checked) .avatar { background: var(--ink); color: var(--surface); }
.card-head { flex-wrap: wrap; }
.corr > * , .field { min-width: 0; }
.field select, .field input { width: 100%; }

/* --- small trend charts (person card) --------------------------------------------------- */
.spark { display: block; overflow: visible; }
.spark .band { fill: var(--accent-soft); }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round;
                  stroke-linecap: round; }
.spark circle { fill: var(--accent); }
.spark.out circle { fill: var(--bad); }
.spark { margin-bottom: 2px; }
td.trend { min-width: 170px; }

/* --- chat ---------------------------------------------------------------------------------- */
.chat { display: flex; flex-direction: column; min-height: 60vh; }
.chat-log { flex: 1; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 760px; padding: 12px 15px; border-radius: 12px; background: var(--surface);
       border: 1px solid var(--line); }
.msg.user { align-self: flex-end; background: var(--surface-2); border-color: transparent; }
.msg-who { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.msg-body p { margin: 0 0 8px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body ul { margin: 4px 0 8px; padding-left: 20px; }
.msg-body table { margin: 6px 0; background: var(--surface); border-radius: 8px; }
.msg-body th, .msg-body td { padding: 6px 10px; }
.msg .btn { margin-top: 8px; }
.chat-form { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line);
             position: sticky; bottom: 0; background: var(--surface);
             border-radius: 0 0 var(--radius) var(--radius); }
.chat-form textarea { flex: 1; resize: vertical; min-height: 46px; }
.chips-center { justify-content: center; }
/* forms adapt to the width of their card (narrow side column, phone) */
.corr { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* --- login, sidebar foot ----------------------------------------------------------------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { width: 100%; max-width: 380px; }
.login-brand { justify-content: center; padding-bottom: 20px; }
.login-card { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 22px; }
.sidebar-foot { flex-direction: column; align-items: stretch; gap: 6px; }
.sidebar-foot a { display: flex; align-items: center; gap: 8px; color: var(--ink-2); padding: 6px 4px;
                  border-radius: var(--radius-sm); }
.sidebar-foot a.active { color: var(--accent); }
.sidebar-foot form button { width: 100%; justify-content: flex-start; padding-left: 4px; }
@media (max-width: 860px) {
  .sidebar-foot { display: flex; flex-direction: row; align-items: center; border-top: 0;
                  padding: 0; margin: 0 0 0 auto; }
  .sidebar-foot form button { width: auto; }
}

/* Info tables that turn into cards on phones (td data-label="…") */
table.stack td:first-child { min-width: 150px; }
@media (max-width: 700px) {
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr:first-child { display: none; }
  table.stack tr { padding: 10px 0; border-top: 1px solid var(--line); }
  table.stack td { border: 0; padding: 3px 18px; text-align: left; }
  table.stack td[data-label]:not(:first-child)::before { content: attr(data-label); display: block;
    color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase;
    letter-spacing: .03em; }
}
table.stack td.num { white-space: normal; }
@media (max-width: 700px) { table.stack td:empty { display: none; } }

/* --- ask the assistant (dashboard) ----------------------------------------------------- */
.ask { padding: 18px 20px 20px; }
.ask-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
            flex-wrap: wrap; margin-bottom: 12px; }
.ask-form { display: flex; gap: 10px; align-items: stretch; }
.ask-form textarea { flex: 1; resize: vertical; min-height: 48px; }
.ask-form select { flex: 0 0 auto; }
.ask .chips { margin-top: 12px; }
.ask .chip { color: var(--ink-2); background: var(--surface); cursor: pointer; font: inherit; font-size: 13px;
             font-weight: 400; }
.ask .chip:hover { border-color: var(--ink-2); }
@media (max-width: 640px) { .ask-form { flex-direction: column; } }
