/* ============================================================
   NEFROS — Components.
   Material Design 3 in its proportions and state layers; the density of a
   clinical tool rather than a consumer app, because a nephrologist needs the
   whole picture without scrolling.
   ============================================================ */

/* ── Cards ──────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 18px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.card-head h3 {
  font: 700 var(--fs-md)/1.2 var(--font-ui);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* One height for everything on a card's action row.
   A .badge is 21 px because it is made to sit inline inside a sentence; put it
   next to a 30 px button and the row reads as ragged. On an action row the
   badge takes the control height like everything else. */
.card-head .actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.card-head .actions > * { height: var(--control-h-sm); }
/* Named explicitly so it outranks .badge.lg, which sets its own 25px for use
   inline in text. On an action row the row wins. */
.card-head .actions > .badge,
.card-head .actions > .badge.lg {
  height: var(--control-h-sm);
  padding: 0 10px;
  font-size: var(--fs-2xs);
}

/* A count badge next to the title is part of the title, not of the row of
   controls; it keeps its inline size and stays glued to the heading. */
.card-head > .badge { flex-shrink: 0; }
.card-head h3 { min-width: 0; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }

.card-foot {
  padding: 11px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
  display: flex;
  gap: 8px;
  align-items: center;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-tight { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ── Buttons ────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--btn-h);
  padding: 0 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: 650 var(--fs-sm) var(--font-ui);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast),
              transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
}

.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: scale(.975); }

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); background: var(--red); }

.btn-ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }

.btn-sm { height: var(--control-h-sm); padding: 0 11px; font-size: var(--fs-xs); }
.btn-lg { height: 46px; padding: 0 22px; font-size: var(--fs-md); }
.btn-block { width: 100%; }

.btn-icon {
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  border: none;
  background: none;
  color: var(--text-2);
  opacity: .5;
  border-radius: var(--radius-sm);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 15px;
  transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
}

.btn-icon:hover { opacity: 1; background: var(--surface-2); color: var(--text); }
.btn-icon.sm { width: var(--control-h-sm); height: var(--control-h-sm); font-size: 13px; }
.btn-icon.danger:hover { color: var(--red); background: var(--red-soft); }

/* Segmented control (language, theme, filters). */
.seg {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.seg button {
  border: none;
  background: none;
  padding: 0 11px;
  height: calc(var(--control-h) - 8px);
  border-radius: 6px;
  color: var(--text-2);
  font: 650 var(--fs-xs) var(--font-ui);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}

.seg button:hover { color: var(--text); }

.seg button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ── Forms ──────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.field label {
  font: 650 var(--fs-xs) var(--font-ui);
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 5px;
}

.field label .req { color: var(--red); }

.field .hint {
  font-size: var(--fs-2xs);
  color: var(--text-3);
}

.field .err { font-size: var(--fs-2xs); color: var(--red); font-weight: 600; }

.input, .select, textarea.input {
  width: 100%;
  height: var(--control-h);
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: 500 var(--fs-sm) var(--font-ui);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

textarea.input {
  height: auto;
  min-height: 84px;
  padding: 9px 11px;
  line-height: 1.55;
  resize: vertical;
}

.input:hover, .select:hover { border-color: var(--border-strong); }

.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.input:disabled, .select:disabled, textarea.input:disabled {
  background: var(--surface-2);
  color: var(--text-3);
  cursor: not-allowed;
}

.input.is-error, .select.is-error { border-color: var(--red); }
.input::placeholder { color: var(--text-3); }

.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23888'%3E%3Cpath d='M4.5 6.5 8 10l3.5-3.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 16px;
  cursor: pointer;
}

.field-row { display: grid; gap: 12px; }
.field-row.c2 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.field-row.c3 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.field-row.c4 { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }

/* A value with its unit glued to the input, so the doctor never types "mg/dL". */
.input-unit { position: relative; }
.input-unit .input { padding-right: 52px; }

.input-unit .unit {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--fs-2xs);
  color: var(--text-3);
  pointer-events: none;
  font-weight: 600;
}

/* ── Checkboxes, toggles, chips ─────────────────────────── */

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--fs-sm);
  user-select: none;
  padding: 4px 0;
}

.check input { position: absolute; opacity: 0; width: 0; height: 0; }

.check .box {
  width: 19px;
  height: 19px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--surface);
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast) var(--ease);
  color: transparent;
  font-size: 12px;
}

.check:hover .box { border-color: var(--primary); }

.check input:checked + .box {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
}

.check input:focus-visible + .box { box-shadow: var(--ring); }
.check input:checked + .box { transform: scale(1.04); }

/* Toggle. */
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: var(--fs-sm); }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle .track {
  width: 40px;
  height: 23px;
  border-radius: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  position: relative;
  flex-shrink: 0;
  transition: background var(--t-base), border-color var(--t-base);
}

.toggle .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base) var(--ease);
}

.toggle input:checked + .track { background: var(--primary); border-color: var(--primary); }
.toggle input:checked + .track::after { transform: translateX(17px); }
.toggle input:focus-visible + .track { box-shadow: var(--ring); }

/* Selectable chips: the fastest control on the consultation screen.
   One tap, no dialog, no dropdown. */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 31px;
  padding: 0 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font: 600 var(--fs-xs) var(--font-ui);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), transform var(--t-fast) var(--ease);
}

.chip:hover { border-color: var(--primary-border); background: var(--primary-softer); color: var(--text); }
.chip:active { transform: scale(.96); }

.chip.is-on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
  font-weight: 700;
}

/* A red-flag symptom that is ticked turns red, not teal: the colour is the
   information, and it must not be lost among forty other selected chips. */
.chip.is-on.is-flag { background: var(--red); border-color: var(--red); color: #fff; }

/* Explicitly denied: clinically different from "not asked". */
.chip.is-off {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.chip-group { margin-bottom: 14px; }

.chip-group-lbl {
  font: 700 var(--fs-micro) var(--font-ui);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip-group-lbl::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Three-state answer (Yes / No / Not sure) — the form's own grid. */
.tri { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; }

.tri button {
  border: none;
  background: none;
  height: 26px;
  padding: 0 10px;
  border-radius: 5px;
  font: 650 var(--fs-2xs) var(--font-ui);
  color: var(--text-3);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}

.tri button:hover { color: var(--text); }
.tri button.on-yes { background: var(--red-soft); color: var(--red); font-weight: 700; }
.tri button.on-no { background: var(--green-soft); color: var(--green); font-weight: 700; }
.tri button.on-unsure { background: var(--surface); color: var(--text-2); font-weight: 700; box-shadow: var(--shadow-sm); }

/* ── Record layout: the PEDCAM sidebar, applied to one record ──
 *
 * Eleven sections do not fit on a horizontal strip, and a strip that scrolls
 * hides half the record behind an affordance nobody looks for. So the record
 * gets its own rail, built from the SAME vocabulary as the main sidebar --
 * .nav-section, .nav-item, .nav-icon, .nav-badge -- grouped the same way, so
 * there is one navigation idiom in the product rather than two.
 *
 * Below 1100px the same markup reflows into a scrollable strip, because a
 * tablet in portrait has no 212px to spare on the side.
 */

.record {
  display: grid;
  /* The rail takes only what it needs and stays hard against the left edge, so
     the record itself gets the rest of the width. */
  grid-template-columns: 204px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

/* No card around the rail: it is navigation, not content, and a panel here just
   competes with the cards it sits beside. */
.record-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  /* Sticks to the top of the scroll port, just under the patient bar. */
  top: 0;
  /* 12px on the left is what .nav-item.active::before hangs its rail off. */
  padding: 6px 12px 10px;
  /* Opaque, or the record scrolls visibly underneath it. */
  background: var(--bg);
  z-index: 5;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* The rail's own section headers sit tighter than the sidebar's. */
.record-nav .nav-section { padding: 11px 10px 4px; }
.record-nav .nav-section:first-child { padding-top: 4px; }

/* A section holding something that needs attention says so on the rail, so it
   does not take opening the tab to find out. */
.record-nav .nav-badge.is-alert { background: var(--red); color: #fff; }

/* A label that outgrows the rail is truncated, never wrapped onto a second line:
   a two-line item breaks the rhythm of the whole strip. The title attribute on
   the button keeps the full text reachable. */
.record-nav .nav-item > span:not(.nav-badge) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* An action at the foot of the rail is not one of the sections: it gets a rule
   above it and reads in the accent colour, so it cannot be mistaken for one. */
.record-nav .nav-action {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--primary);
}

.record-nav .nav-action:hover { background: var(--primary-soft); }
.record-nav .nav-action.active::before { display: none; }

@media (max-width: 1100px) {
  .record-nav .nav-action { margin-top: 0; padding-top: 9px; border-top: none; }
}

.record-body { min-width: 0; }

/* ── Narrow: the same rail becomes a scrollable strip ───── */

@media (max-width: 1100px) {
  .record { display: block; }

  .record-nav {
    flex-direction: row;
    position: relative;
    top: auto;
    overflow-x: auto;
    scrollbar-width: none;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin-bottom: 18px;
  }

  .record-nav::-webkit-scrollbar { display: none; }

  /* Section headers only make sense stacked. */
  .record-nav .nav-section { display: none; }

  .record-nav .nav-item {
    width: auto;
    white-space: nowrap;
    border-radius: 0;
    padding: 9px 13px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
  }

  .record-nav .nav-item:hover { transform: none; background: none; }

  .record-nav .nav-item.active {
    background: none;
    border-bottom-color: var(--primary);
  }

  .record-nav .nav-item.active::before { display: none; }
  .record-nav .nav-badge { margin-left: 0; }
}

/* ── Scrollable strips (reports, settings, the narrow rail) ── */

.tabs-scroll {
  position: relative;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

/* No `scroll-behavior: smooth` here on purpose: in some engines it makes every
   programmatic scroll (scrollBy, scrollTo, scrollIntoView) a silent no-op, which
   left the arrows inert. enhanceTabs() animates with rAF instead. */
.tabs-scroll .tabs,
.tabs-scroll .record-nav {
  margin-bottom: 0;
  border-bottom: none;
}

/* The fade sits above the strip but must never swallow a click. */
.tabs-scroll::before,
.tabs-scroll::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 1px;
  width: 44px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-base);
  z-index: 2;
}

.tabs-scroll::before { left: 0; background: linear-gradient(to right, var(--bg) 20%, transparent); }
.tabs-scroll::after { right: 0; background: linear-gradient(to left, var(--bg) 20%, transparent); }
.tabs-scroll.can-left::before { opacity: 1; }
.tabs-scroll.can-right::after { opacity: 1; }

.tabs-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: none;
  place-items: center;
  cursor: pointer;
  z-index: 3;
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  transition: background var(--t-fast), color var(--t-fast);
}

.tabs-nav:hover { background: var(--primary-soft); color: var(--primary); }
.tabs-nav.left { left: 0; }
.tabs-nav.right { right: 0; }
.tabs-scroll.can-left .tabs-nav.left { display: grid; }
.tabs-scroll.can-right .tabs-nav.right { display: grid; }
.tabs-scroll.can-left .tabs, .tabs-scroll.can-left .record-nav { padding-left: 30px; }
.tabs-scroll.can-right .tabs, .tabs-scroll.can-right .record-nav { padding-right: 30px; }

/* A touch screen has no hover and the user can simply swipe: the chevrons are
   dead weight there, but the fade still says there is more. */
@media (hover: none) {
  .tabs-nav { display: none !important; }
  .tabs-scroll.can-left .tabs, .tabs-scroll.can-right .tabs,
  .tabs-scroll.can-left .record-nav, .tabs-scroll.can-right .record-nav { padding-left: 0; padding-right: 0; }
}

/* The vertical rail needs none of that.
 *
 * `display: contents` matters more than it looks: enhanceTabs() wraps the rail
 * in .tabs-scroll for the narrow layout, and that wrapper became the grid item.
 * A sticky element can only stick inside its containing block, so the rail stuck
 * for exactly the wrapper's own height and then scrolled away. Taking the
 * wrapper out of layout makes .record-nav the grid item again, and it sticks
 * against the full height of the record.
 */
@media (min-width: 1101px) {
  .record .tabs-scroll { display: contents; }
  .record .tabs-nav { display: none !important; }
}

/* ── Breadcrumb ─────────────────────────────────────────── */

.crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: var(--fs-xs);
}

.crumb {
  color: var(--text-3);
  text-decoration: none;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

a.crumb:hover { background: var(--surface-2); color: var(--primary); }
.crumb.is-current { color: var(--text); font-weight: 650; }
.crumb-sep { font-size: 9px; color: var(--text-3); opacity: .6; }

/* ── Clinical note fields ───────────────────────────────── */
/*
 * A consultation note is the one thing on screen that must never feel cramped.
 * These run the full width of the body column, start tall, and grow with what
 * is typed, so the doctor never writes inside a letterbox.
 */

.note-block { margin-bottom: 16px; }

.note-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
}

.note-head h3 {
  font: 700 var(--fs-sm) var(--font-ui);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
}

/* A field label heading a note block reads like the h3 version of it: the
   toolbar sits on the same line either way. */
.note-head label {
  font: 700 var(--fs-sm) var(--font-ui);
  margin: 0;
  color: var(--text);
}

.note-head .spacer { flex: 1; }

.note-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  order: -1;
  display: none;
}

textarea.grow {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  overflow: hidden;
  line-height: 1.65;
  font-size: var(--fs-base);
  padding: 12px 14px;
}

textarea.grow.tall { min-height: 190px; }

/* A section jumped to from the index flashes, so the eye lands on it. */
.is-targeted {
  animation: target-flash 700ms var(--ease);
}

@keyframes target-flash {
  0%   { box-shadow: 0 0 0 3px var(--primary-soft); }
  100% { box-shadow: 0 0 0 3px transparent; }
}

/* Anchored sections must clear the sticky rail when jumped to. */
.consult-section { scroll-margin-top: 14px; }

/* ── Free-text chip entry ───────────────────────────────── */

.chip-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 31px;
  padding: 0 10px;
  border-radius: 16px;
  border: 1px dashed var(--border-strong);
  background: none;
  color: var(--text-3);
  font: 600 var(--fs-xs) var(--font-ui);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}

.chip-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-softer); }

.chip-input {
  height: 31px;
  padding: 0 11px;
  border-radius: 16px;
  border: 1px solid var(--primary);
  background: var(--surface);
  color: var(--text);
  font: 600 var(--fs-xs) var(--font-ui);
  width: 210px;
  box-shadow: var(--ring);
}

/* A symptom the doctor typed is marked, so it reads as their words and not as
   something the catalogue offered. */
.chip.is-custom { border-style: dashed; }
.chip.is-custom.is-on { border-style: solid; }

/* ── Orders placed from inside the consultation ─────────── */

.order-empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-sm);
}

.order-empty i { font-size: 22px; opacity: .4; display: block; margin-bottom: 7px; }

/* ── Badges and pills ───────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 8px;
  border-radius: 6px;
  font: 700 var(--fs-micro) var(--font-ui);
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}

.badge.green  { background: var(--green-soft); color: var(--green); }
.badge.amber  { background: var(--amber-soft); color: var(--amber); }
.badge.red    { background: var(--red-soft); color: var(--red); }
.badge.indigo { background: var(--indigo-soft); color: var(--indigo); }
.badge.teal   { background: var(--primary-soft); color: var(--primary); }
.badge.lg     { height: 25px; font-size: var(--fs-2xs); padding: 0 10px; }

/* A badge standing IN a row of buttons has to be as tall as they are, or the
   row reads as ragged. .badge on its own is for inline use inside text. */
.badge-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: 700 var(--fs-xs) var(--font-ui);
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}

.badge-control.green { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.badge-control.amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
.badge-control.red { background: var(--red-soft); color: var(--red); border-color: var(--red); }

/* Everything on an actions row shares one height, whatever it is. */
.view-head-actions > * { height: var(--control-h); }
.view-head-actions .input,
.view-head-actions .select { height: var(--control-h); }

/* Risk pills use the shared ramp, so a colour means the same thing everywhere. */
.risk-low       { background: var(--risk-low-bg); color: var(--risk-low); }
.risk-moderate  { background: var(--risk-moderate-bg); color: var(--risk-moderate); }
.risk-high      { background: var(--risk-high-bg); color: var(--risk-high); }
.risk-very_high { background: var(--risk-very-high-bg); color: var(--risk-very-high); }

/* A CKD stage badge, monospaced so G3a and G5 occupy the same width. */
.stage {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 23px;
  padding: 0 7px;
  border-radius: 6px;
  font: 800 var(--fs-2xs) var(--font-mono);
  letter-spacing: .02em;
}

/* ── Statistic tiles ────────────────────────────────────── */

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base);
}

a.stat, .stat.is-link { cursor: pointer; text-decoration: none; color: inherit; display: block; }
a.stat:hover, .stat.is-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-lbl {
  font: 650 var(--fs-2xs) var(--font-ui);
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}

.stat-lbl i { font-size: 14px; }

.stat-val {
  font: 800 30px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat-sub { font-size: var(--fs-2xs); color: var(--text-3); margin-top: 6px; }
.stat.accent-red .stat-val { color: var(--red); }
.stat.accent-amber .stat-val { color: var(--amber); }
.stat.accent-teal .stat-val { color: var(--primary); }
.stat.accent-indigo .stat-val { color: var(--indigo); }

/* A clinical metric with its trend: the unit of the patient header strip. */
.metric {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  background: var(--surface);
  min-width: 108px;
}

.metric-lbl {
  font: 650 var(--fs-micro) var(--font-ui);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.metric-val {
  font: 750 var(--fs-md) var(--font-mono);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 3px;
}

.metric-unit { font-size: var(--fs-micro); color: var(--text-3); font-weight: 600; }
.metric.flag-high .metric-val, .metric.flag-critical_high .metric-val { color: var(--flag-high); }
.metric.flag-low .metric-val, .metric.flag-critical_low .metric-val { color: var(--flag-low); }

.metric.flag-critical_high, .metric.flag-critical_low {
  border-color: var(--risk-crit);
  background: var(--risk-crit-bg);
}

.delta { font-size: var(--fs-micro); font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.delta.up { color: var(--red); }
.delta.down { color: var(--indigo); }
.delta.good { color: var(--green); }
.delta.flat { color: var(--text-3); }

/* ── Tables ─────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

table.tbl th {
  text-align: left;
  font: 700 var(--fs-micro) var(--font-ui);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

table.tbl th.sortable { cursor: pointer; user-select: none; }
table.tbl th.sortable:hover { color: var(--text); }

table.tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.tbl tbody tr { transition: background var(--t-fast); }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr.is-clickable { cursor: pointer; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.num, table.tbl th.num { text-align: right; }
table.tbl .row-actions { display: flex; gap: 2px; justify-content: flex-end; }

/* The scan itself, shown under the report rather than only linked. Bounded so
   a 4 000 px photograph of a plate does not take over the dialogue. */
.img-attachment {
  display: block;
  max-width: 100%;
  max-height: 420px;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  object-fit: contain;
}

/* A row whose patient needs attention gets a rail, not a wash: a fully tinted
   row makes the text harder to read, which is the opposite of the point. */
tr.rail-red    td:first-child { box-shadow: inset 3px 0 0 var(--red); }
tr.rail-amber  td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
tr.rail-teal   td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

/* ── Lists ──────────────────────────────────────────────── */

.list { display: flex; flex-direction: column; }

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--surface-2); }
.list-item.is-clickable { cursor: pointer; }
.list-main { flex: 1; min-width: 0; }

.list-title {
  font: 650 var(--fs-sm) var(--font-ui);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-sub {
  font-size: var(--fs-2xs);
  color: var(--text-3);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

/* ── Alerts ─────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  border: 1px solid transparent;
}

.alert i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 700; }
.alert-detail { font-size: var(--fs-2xs); opacity: .85; margin-top: 2px; }

.alert-info     { background: var(--primary-softer); color: var(--text); border-color: var(--primary-border); }
.alert-warning  { background: var(--amber-soft); color: var(--text); border-color: var(--amber); }
.alert-danger   { background: var(--red-soft); color: var(--text); border-color: var(--red); }
.alert-error    { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.alert-success  { background: var(--green-soft); color: var(--green); border-color: var(--green); }

/* A critical alert breathes. It is the only animation in the app that loops,
   and it is reserved for a value that needs a decision now. */
.alert-critical {
  background: var(--risk-crit-bg);
  color: var(--text);
  border-color: var(--risk-crit);
  border-left-width: 4px;
}

.alert-critical i { color: var(--risk-crit); animation: pulse-soft 2s ease-in-out infinite; }

.alert-stack [data-more-alerts] { width: 100%; justify-content: center; }
.alert-stack .alert-more { animation: fade-up var(--t-base) var(--ease); }

/* ── KDIGO heat map ─────────────────────────────────────── */
/* The grid from the guideline, drawn with the practice's own patients in it. */

.heatmap { display: inline-block; font-size: var(--fs-2xs); }

.heatmap table { border-collapse: separate; border-spacing: 3px; }

.heatmap th {
  font: 700 var(--fs-micro) var(--font-ui);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 6px;
  text-align: center;
  white-space: nowrap;
}

.heatmap th.rowhead { text-align: right; }

.heatmap td {
  width: 62px;
  height: 42px;
  border-radius: 7px;
  text-align: center;
  font: 800 var(--fs-sm) var(--font-mono);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
  position: relative;
}

.heatmap td:hover { transform: scale(1.06); box-shadow: var(--shadow-md); z-index: 2; }
.heatmap td.cell-low       { background: var(--risk-low-bg); color: var(--risk-low); }
.heatmap td.cell-moderate  { background: var(--risk-moderate-bg); color: var(--risk-moderate); }
.heatmap td.cell-high      { background: var(--risk-high-bg); color: var(--risk-high); }
.heatmap td.cell-very_high { background: var(--risk-very-high-bg); color: var(--risk-very-high); }
.heatmap td.is-empty { opacity: .38; cursor: default; }
.heatmap td.is-empty:hover { transform: none; box-shadow: none; }

/* Where this patient sits on the grid. */
.heatmap td.is-here { outline: 2.5px solid var(--text); outline-offset: 1px; }

.heatmap-legend {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  font-size: var(--fs-micro);
  color: var(--text-3);
  flex-wrap: wrap;
}

.heatmap-legend span { display: inline-flex; align-items: center; gap: 5px; }

.heatmap-legend i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: inline-block;
}

/* ── Charts (inline SVG, no library) ────────────────────── */

.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-lbl { fill: var(--text-3); font-size: 10px; font-family: var(--font-ui); font-weight: 600; }
.chart .series-line { fill: none; stroke: var(--primary); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-area { fill: var(--primary); opacity: .09; }
.chart .point { fill: var(--surface); stroke: var(--primary); stroke-width: 2; }
.chart .point.flag-high, .chart .point.flag-critical_high { stroke: var(--red); fill: var(--red); }
.chart .point.flag-low, .chart .point.flag-critical_low { stroke: var(--indigo); fill: var(--indigo); }
.chart .ref-band { fill: var(--green); opacity: .07; }
.chart .ref-line { stroke: var(--green); stroke-width: 1; stroke-dasharray: 3 3; opacity: .5; }
.chart .trend-line { stroke: var(--amber); stroke-width: 1.5; stroke-dasharray: 5 4; fill: none; }

/* eGFR chart: the CKD stage bands behind the line, so the reader sees the
   patient cross from G3a into G3b rather than having to work it out. */
.chart .band-g1  { fill: var(--risk-low); opacity: .07; }
.chart .band-g2  { fill: var(--risk-low); opacity: .11; }
.chart .band-g3a { fill: var(--risk-moderate); opacity: .11; }
.chart .band-g3b { fill: var(--risk-high); opacity: .11; }
.chart .band-g4  { fill: var(--risk-very-high); opacity: .11; }
.chart .band-g5  { fill: var(--risk-crit); opacity: .13; }
.chart .band-lbl { fill: var(--text-3); font-size: 9px; font-family: var(--font-mono); font-weight: 700; opacity: .75; }

.sparkline { height: 26px; width: 74px; display: block; overflow: visible; }
.sparkline path { fill: none; stroke: var(--primary); stroke-width: 1.75; stroke-linejoin: round; }
.sparkline.worse path { stroke: var(--red); }
.sparkline.better path { stroke: var(--green); }

/* Simple horizontal bar, for distributions. */
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 44px 1fr 38px; gap: 9px; align-items: center; font-size: var(--fs-2xs); }
.bar-track { height: 9px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }

.bar-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--primary);
  transition: width var(--t-slow) var(--ease);
}

.bar-row .num { text-align: right; color: var(--text-2); font-weight: 700; }

/* ── Timeline ───────────────────────────────────────────── */

.timeline { position: relative; padding-left: 26px; }

.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.tl-item { position: relative; padding: 9px 0 9px 4px; }

.tl-item::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 15px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--primary);
}

.tl-item.type-lab::before { border-color: var(--indigo); }
.tl-item.type-imaging::before { border-color: var(--teal); }
.tl-item.type-medication::before { border-color: var(--amber); }
.tl-item.type-procedure::before { border-color: var(--red); }
.tl-item.type-document::before { border-color: var(--text-3); }
.tl-date { font-size: var(--fs-micro); color: var(--text-3); font-weight: 650; }
.tl-title { font-size: var(--fs-sm); font-weight: 600; margin-top: 1px; }

/* ── Modals ─────────────────────────────────────────────── */

.modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 26, .5);
  display: grid;
  place-items: center;
  z-index: 500;
  padding: 20px;
  animation: fade-up var(--t-base) var(--ease);
  overflow-y: auto;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: pop var(--t-slow) var(--ease);
}

.modal.wide { max-width: 860px; }
.modal.narrow { max-width: 420px; }

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-head h3 { font: 700 var(--fs-lg) var(--font-ui); margin: 0; flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }

.modal-foot {
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  flex-shrink: 0;
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Toasts ─────────────────────────────────────────────── */

.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 900;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font: 600 var(--fs-sm) var(--font-ui);
  display: flex;
  align-items: center;
  gap: 9px;
  animation: pop var(--t-slow) var(--ease);
  pointer-events: auto;
  max-width: 400px;
}

.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
[data-theme="dark"] .toast { background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); }

/* ── Empty and loading states ───────────────────────────── */

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
}

.empty i { font-size: 34px; opacity: .35; display: block; margin-bottom: 11px; }
.empty p { margin: 0 0 14px; font-size: var(--fs-sm); }

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--radius-sm);
  height: 15px;
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Autosave and completeness ──────────────────────────── */

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-2xs);
  color: var(--text-3);
  font-weight: 600;
}

.save-state.is-saving { color: var(--amber); }
.save-state.is-saved { color: var(--green); }
.save-state.is-error { color: var(--red); }

/* The completeness ring: how much of this consultation has been filled in. */
.completeness { display: inline-flex; align-items: center; gap: 8px; }
.completeness svg { transform: rotate(-90deg); }
.completeness .ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 3.5; }

.completeness .ring-fg {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--t-slow) var(--ease);
}

.completeness.is-full .ring-fg { stroke: var(--green); }
.completeness-lbl { font: 700 var(--fs-2xs) var(--font-mono); color: var(--text-2); }

/* ── Dictation ──────────────────────────────────────────── */

.dictate-btn.is-live {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  animation: pulse-soft 1.4s ease-in-out infinite;
}

/* ── Quick templates ────────────────────────────────────── */

.tpl-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 7px; }

.tpl-chip {
  height: 25px;
  padding: 0 10px;
  border-radius: 13px;
  border: 1px dashed var(--border-strong);
  background: none;
  color: var(--text-3);
  font: 600 var(--fs-micro) var(--font-ui);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.tpl-chip:hover {
  background: var(--primary-softer);
  color: var(--primary);
  border-color: var(--primary-border);
  border-style: solid;
}

/* ── AI panel ───────────────────────────────────────────── */
/* Deliberately marked as machine output: a dashed border and a standing notice,
   so an AI draft can never be mistaken for something a clinician wrote. */

.ai-panel {
  border: 1px dashed var(--indigo);
  background: var(--indigo-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.ai-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 700 var(--fs-xs) var(--font-ui);
  color: var(--indigo);
  margin-bottom: 9px;
}

.ai-notice {
  font-size: var(--fs-micro);
  color: var(--text-2);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-output {
  white-space: pre-wrap;
  font-size: var(--fs-sm);
  line-height: 1.6;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
  max-height: 340px;
  overflow-y: auto;
}

.ai-actions { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; align-items: center; }

/* ── Utilities ──────────────────────────────────────────── */

.muted { color: var(--text-3); }
.small { font-size: var(--fs-2xs); }
.bold { font-weight: 700; }
.nowrap { white-space: nowrap; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-primary { color: var(--primary); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.section-title {
  font: 700 var(--fs-micro) var(--font-ui);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 20px 0 9px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.section-title:first-child { margin-top: 0; }

.kv { display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: 7px 14px; font-size: var(--fs-sm); }
.kv dt { color: var(--text-3); font-weight: 600; font-size: var(--fs-xs); }
.kv dd { margin: 0; }

/* ── Print ──────────────────────────────────────────────── */

@media print {
  .sidebar, .topbar, .view-head-actions, .btn, .tabs, .toasts, .patient-bar-stats { display: none !important; }
  .app { display: block; height: auto; }
  .content { overflow: visible; padding: 0; height: auto; }
  body { background: #fff; overflow: visible; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
}

/* ── Laboratory flow diagram ────────────────────────────── */
/*
 * The module showed a table with no hint of where the rows came from. The flow
 * is now on the page: ordered at a consultation, pending, resulted, and into
 * the record. The two stages that hold rows carry a live count and filter the
 * list when clicked.
 */

.lab-flow {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-wrap: wrap;
}

.lab-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: var(--fs-xs);
  color: var(--text-2);
  flex: 1;
  min-width: 150px;
}

.lab-step i { font-size: 15px; color: var(--primary); flex-shrink: 0; }
.lab-step span { flex: 1; }

.lab-step b {
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--fs-2xs);
  line-height: 18px;
  text-align: center;
  color: var(--text);
}

.lab-step.is-clickable {
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.lab-step.is-clickable:hover {
  border-color: var(--primary);
  background: var(--primary-softer);
  color: var(--text);
}

.lab-arrow { color: var(--text-3); align-self: center; font-size: 12px; }

@media (max-width: 860px) {
  .lab-arrow { display: none; }
  .lab-step { min-width: 100%; }
}

/* ── Field tools ────────────────────────────────────────── */
/*
 * Dictate, copy, paste and clear. Quiet on purpose: bare icons at low opacity
 * that come up on hover, so seven of these on one screen do not compete with
 * the writing they belong to.
 */

.note-tools {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.note-tools .btn-icon {
  opacity: .32;
  width: 28px;
  height: 28px;
  font-size: 13px;
}

.note-tools .btn-icon:hover { opacity: 1; }
.note-tools .btn-icon.danger:hover { color: var(--red); background: var(--red-soft); }

/* The whole card lifts its tools a little when the pointer is anywhere on it,
   so they are findable without being loud. Inside a modal there is no card, so
   the dialogue itself plays that part. */
.card:hover .note-tools .btn-icon,
.modal:hover .note-tools .btn-icon,
.note-head:hover .note-tools .btn-icon { opacity: .55; }
.card:hover .note-tools .btn-icon:hover,
.modal:hover .note-tools .btn-icon:hover,
.note-head:hover .note-tools .btn-icon:hover { opacity: 1; }

/* A toolbar on a card's action row keeps its own compact size. */
.card-head .actions > .note-tools { height: auto; }

/* Recording is the one state that must be unmistakable. */
.note-tools .dictate-btn.is-live {
  opacity: 1 !important;
  background: var(--red);
  color: #fff;
  animation: pulse-soft 1.4s ease-in-out infinite;
}

.toast-undo {
  background: none;
  border: 1px solid rgba(255, 255, 255, .35);
  color: inherit;
  font: 650 var(--fs-2xs) var(--font-ui);
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-left: 4px;
}

.toast-undo:hover { background: rgba(255, 255, 255, .15); }
[data-theme="dark"] .toast-undo { border-color: var(--border-strong); }
