/* Nemo Tracker
   One stylesheet, no build step. Warm paper, ink black (him), a marmalade accent.
   Light and dark are both chosen, not flipped: dark redefines only the tokens. */

:root {
  color-scheme: light dark;

  --paper: #faf5ee;
  --paper-sunk: #f1e8dc;
  --card: #ffffff;
  --ink: #1f1c1b;
  --ink-2: #5c534c;
  --ink-3: #8a8078;
  --line: #e8ded1;
  --line-strong: #d8cbb9;

  --accent: #c2610f;
  --accent-ink: #ffffff;
  --accent-tint: #fbeee0;

  /* Chart colours are validated against the surface they sit on, per mode. */
  --chart-bar: #c2610f;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --good-tint: #e8f4e8;
  --good-ink: #14701b;
  --warn-tint: #fdf1da;
  --warn-ink: #8a5a06;
  --danger-ink: #b0332f;

  --shadow: 0 1px 2px rgba(31, 28, 27, .05), 0 8px 24px -12px rgba(31, 28, 27, .18);
  --radius: 20px;
  --radius-sm: 12px;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif", Georgia, serif;

  --nav-height: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14120f;
    --paper-sunk: #0f0d0b;
    --card: #1e1b19;
    --ink: #f6f1e9;
    --ink-2: #b6aca1;
    --ink-3: #8c8279;
    --line: #2f2b26;
    --line-strong: #423c35;

    --accent: #e9b04c;
    --accent-ink: #201a12;
    --accent-tint: #2b2318;

    --chart-bar: #c9782b;
    --good-tint: #172a19;
    --good-ink: #7fca7f;
    --warn-tint: #2c2413;
    --warn-ink: #f0c66a;
    --danger-ink: #ef8781;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body.has-sheet { overflow: hidden; }

h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ------------------------------------------------------------------ layout */

.view {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 14px calc(var(--nav-height) + var(--safe-bottom) + 24px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-title {
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: -6px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card__title { font-size: 17px; }
.card__sub, .card__hint { font-size: 13px; color: var(--ink-3); }
.card__foot { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }

.view-head { padding: 6px 2px 0; }
.view-title { font-family: var(--font-display); font-size: 30px; letter-spacing: -.01em; }
.view-sub { font-size: 14px; color: var(--ink-3); margin-top: 2px; }

/* -------------------------------------------------------------------- hero */

.hero {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  min-height: 190px;
  display: flex;
  align-items: flex-end;
  box-shadow: var(--shadow);
  background: linear-gradient(160deg, #f6e7d2 0%, #eed9bd 55%, #e6cba7 100%);
}

@media (prefers-color-scheme: dark) {
  /* Lighter than the page, so a black cat still has something to sit against. */
  .hero { background: linear-gradient(160deg, #4a3a2a 0%, #3a2d20 55%, #2c2119 100%); }
}

.hero__media { position: absolute; inset: 0; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hero__portrait {
  position: absolute;
  right: -18px;
  bottom: -46px;
  width: 216px;
  opacity: .97;
}
.hero__portrait svg { width: 100%; height: auto; display: block; }

.hero__text {
  position: relative;
  padding: 20px 18px 18px;
  max-width: 60%;
}

.hero--photo .hero__text {
  max-width: 100%;
  color: #fff;
  width: 100%;
  background: linear-gradient(to top, rgba(12, 10, 9, .82), rgba(12, 10, 9, .35) 55%, rgba(12, 10, 9, 0));
  padding-top: 56px;
}

.hero__eyebrow {
  font-size: 12.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: .8;
}

.hero__name {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -.02em;
  margin: 2px 0 4px;
}

.hero__meta {
  font-size: 13.5px;
  opacity: .82;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------------------------------------------------------- medicine */

.card--medicine { border: 1px solid var(--line); }
.card--medicine.is-flagged {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 3px var(--accent-tint);
}

.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--paper-sunk);
  color: var(--ink-2);
}
.pill--good { background: var(--good-tint); color: var(--good-ink); }
.pill--warn { background: var(--warn-tint); color: var(--warn-ink); }

.dose-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.dose {
  position: relative;
  border-radius: 16px;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  overflow: hidden;
}

.dose__main {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "check label" "check time" "note note";
  align-items: center;
  gap: 0 10px;
  width: 100%;
  border: 0;
  background: none;
  padding: 14px 40px 14px 14px;
  text-align: left;
  min-height: 84px;
}

.dose__check {
  grid-area: check;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-ink);
}

.dose__label { grid-area: label; font-weight: 600; font-size: 15px; }
.dose__time { grid-area: time; font-size: 13px; color: var(--ink-3); }
.dose__state {
  position: absolute;
  right: 12px; bottom: 10px;
  font-size: 12px;
  color: var(--ink-3);
}
.dose__note { grid-area: note; font-size: 12.5px; color: var(--ink-3); padding-top: 6px; }

.dose__more {
  position: absolute;
  top: 6px; right: 4px;
  border: 0;
  background: none;
  color: var(--ink-3);
  padding: 6px;
  border-radius: 10px;
}

.dose.is-given { border-color: var(--good-ink); background: var(--good-tint); }
.dose.is-given .dose__check { background: var(--status-good); border-color: var(--status-good); color: #fff; }
.dose.is-given .dose__state { color: var(--good-ink); font-weight: 600; }

.dose.is-overdue { border-color: var(--status-warning); background: var(--warn-tint); }
.dose.is-overdue .dose__state { color: var(--warn-ink); font-weight: 600; }

.dose.is-skipped { opacity: .72; }
.dose .is-saving { opacity: .5; }

/* ------------------------------------------------------------------ basics */

.basics { display: flex; flex-direction: column; gap: 8px; }

.basics__row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.basic {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: var(--shadow);
}

.basic__emoji { font-size: 20px; line-height: 1.2; }
.basic__label { font-size: 11.5px; color: var(--ink-3); }
.basic__value { font-size: 12.5px; font-weight: 600; }
.basic.is-overdue { border-color: var(--status-serious); }
.basic.is-overdue .basic__value { color: var(--danger-ink); }

/* --------------------------------------------------------------- quick log */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.tile {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform .12s ease, background .12s ease;
}

.tile:active { transform: scale(.96); background: var(--accent-tint); }
.tile__emoji { font-size: 24px; line-height: 1; display: flex; }
.tile__label { font-size: 11.5px; color: var(--ink-2); text-align: center; line-height: 1.25; }
.tile.is-saving { opacity: .55; }
.tile--more { background: var(--card); border-style: dashed; color: var(--ink-3); }

/* ---------------------------------------------------------------- timeline */

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline__row + .timeline__row { border-top: 1px solid var(--line); }

.timeline__button {
  width: 100%;
  border: 0;
  background: none;
  display: grid;
  grid-template-columns: 76px 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 2px;
  text-align: left;
}

.timeline__time {
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.timeline__emoji { font-size: 18px; }
.timeline__body { display: flex; flex-direction: column; min-width: 0; }
.timeline__label { font-size: 14.5px; }
.timeline__value { font-weight: 600; }
.timeline__note {
  font-size: 12.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeline__thumbs { display: flex; gap: 4px; }
.timeline__thumbs img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; }

/* ----------------------------------------------------------------- history */

.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
}
.day-nav__label { text-align: center; }
.day-nav__title { font-family: var(--font-display); font-size: 26px; }
.day-nav__date {
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 12.5px;
  text-align: center;
  padding: 0;
}

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.stat {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
}
.stat__value { font-family: var(--font-display); font-size: 26px; line-height: 1.1; }
.stat__label { font-size: 11.5px; color: var(--ink-3); }
.stat__hint { font-size: 11px; color: var(--ink-3); opacity: .8; margin-top: 2px; }

.chart { display: flex; gap: 8px; align-items: flex-start; }

.chart__axis {
  width: 16px;
  height: 76px;
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: right;
  font-size: 10px;
  color: var(--ink-3);
}

.bars { display: flex; gap: 4px; align-items: flex-end; flex: 1; min-width: 0; }

.bars__col {
  flex: 1;
  border: 0;
  background: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
}

.bars__track {
  width: 100%;
  height: 76px;
  display: flex;
  align-items: flex-end;
  border-radius: 4px;
}

.bars__fill {
  width: 100%;
  background: var(--chart-bar);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}

.bars__tick { font-size: 10px; color: var(--ink-3); }
.bars__col.is-selected .bars__tick { color: var(--ink); font-weight: 700; }
/* The selected day is marked under the column, so an empty bar stays empty. */
.bars__col.is-selected::after {
  content: "";
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}

.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th, .data-table td { text-align: left; padding: 5px 4px; border-bottom: 1px solid var(--line); }
.data-table th { color: var(--ink-3); font-weight: 600; }

.grid-rows { display: flex; flex-direction: column; gap: 6px; }
.grid-row { display: flex; align-items: center; gap: 8px; }
.grid-row__label { font-size: 12px; color: var(--ink-3); width: 62px; flex: none; }
.grid-row__cells { display: flex; gap: 4px; flex: 1; }

.cell {
  flex: 1;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell.is-given { background: var(--status-good); border-color: var(--status-good); color: #fff; }
.cell.is-skipped { background: var(--status-warning); border-color: var(--status-warning); color: #3a2c05; }
.cell.is-missed { background: var(--status-serious); border-color: var(--status-serious); color: #3a1a0c; }
.cell.is-pending { border-style: dashed; }
.cell.is-selected { outline: 2px solid var(--ink); outline-offset: 1px; }

.cell--legend { flex: none; width: 16px; height: 16px; aspect-ratio: auto; }

.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11.5px; color: var(--ink-3); }
.legend__item { display: flex; align-items: center; gap: 4px; }

/* ----------------------------------------------------------------- gallery */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}

.gallery__item {
  border: 0;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--paper-sunk);
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.photo-full {
  width: 100%;
  border-radius: 14px;
  max-height: 46vh;
  object-fit: contain;
  background: var(--paper-sunk);
}

/* ---------------------------------------------------------------- settings */

.profile { display: flex; align-items: center; gap: 14px; }
.profile__photo {
  width: 84px; height: 84px;
  border-radius: 20px;
  overflow: hidden;
  flex: none;
  background: var(--paper-sunk);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.profile__photo img { width: 100%; height: 100%; object-fit: cover; }
.profile__portrait { width: 96px; margin-bottom: -14px; }
.profile__portrait svg { width: 100%; height: auto; display: block; }
.profile__actions { display: flex; flex-direction: column; gap: 8px; flex: 1; }

.med { display: flex; flex-direction: column; gap: 10px; }
.slot-list { display: flex; flex-direction: column; gap: 8px; }
.slot { display: flex; gap: 8px; align-items: center; }
.slot__label { flex: 1; min-width: 0; }

.type-rows { display: flex; flex-direction: column; }
.type-row {
  display: grid;
  grid-template-columns: 26px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.type-row__emoji { font-size: 18px; }
.type-row__label { font-size: 14.5px; }
.type-row .toggle__text { display: none; }

.gap-rows { display: flex; flex-direction: column; gap: 8px; }
.gap-row { display: grid; grid-template-columns: 1fr 92px auto; align-items: center; gap: 8px; }
.gap-row__label { font-size: 14.5px; }
.gap-row__unit { font-size: 12.5px; color: var(--ink-3); }

/* ------------------------------------------------------------------ fields */

.field { display: flex; flex-direction: column; gap: 6px; }
.field--narrow { width: 76px; flex: none; }
.field--grow { flex: 1; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field__hint { font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.field__row { display: flex; gap: 10px; align-items: center; }
.field__row--wrap { flex-wrap: wrap; }

.field__input {
  width: 100%;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;              /* 16px keeps mobile browsers from zooming on focus */
  color: var(--ink);
}
.field__input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field__input--time { width: auto; min-width: 120px; flex: none; }
.field__input--number { width: 92px; }
.field__input--emoji { text-align: center; font-size: 20px; }
textarea.field__input { resize: vertical; min-height: 46px; }

.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.checkbox input { width: 20px; height: 20px; accent-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--ink-2);
}
.chip.is-active { border-color: var(--accent); background: var(--accent-tint); color: var(--accent); font-weight: 600; }

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}
.toggle__text { display: flex; flex-direction: column; }
.toggle__label { font-size: 14.5px; }
.toggle__hint { font-size: 12px; color: var(--ink-3); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track {
  width: 46px; height: 28px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  flex: none;
  transition: background .16s ease;
}
.toggle__track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform .16s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.toggle input:checked + .toggle__track { background: var(--status-good); }
.toggle input:checked + .toggle__track::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ----------------------------------------------------------------- buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  background: var(--paper-sunk);
  color: var(--ink);
  min-height: 46px;
}
.button:disabled { opacity: .55; }
.button--primary { background: var(--accent); color: var(--accent-ink); }
.button--soft { background: var(--card); border-color: var(--line-strong); }
.button--ghost { background: none; }
.button--danger { background: var(--status-critical); color: #fff; }
.button--danger-text { color: var(--danger-ink); }
.button--grow { flex: 1; }

.icon-button {
  border: 0;
  background: none;
  color: var(--ink-2);
  padding: 8px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-button--danger { color: var(--ink-3); }
.icon-button:disabled { opacity: .35; }

.link-button {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 2px 0;
}

/* --------------------------------------------------------------------- nav */

.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 20;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--ink-3);
  font-size: 10.5px;
}
.tab.is-active { color: var(--accent); }
.tab__label { font-weight: 600; }

/* ------------------------------------------------------------------ banner */

.banner {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--warn-tint);
  color: var(--warn-ink);
  font-size: 13px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.banner__action { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; }

/* ------------------------------------------------------------------ sheets */

#overlays { position: relative; z-index: 40; }

.sheet-wrap { position: fixed; inset: 0; }
.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 12, .42);
  opacity: 0;
  transition: opacity .2s ease;
}
.sheet-wrap.is-in .backdrop { opacity: 1; }

.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  margin: 0 auto;
  max-width: 640px;
  max-height: 90vh;
  background: var(--card);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -12px 40px -16px rgba(0, 0, 0, .45);
  transform: translateY(102%);
  transition: transform .24s cubic-bezier(.22, .8, .3, 1);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}
.sheet-wrap.is-in .sheet { transform: translateY(0); }

.sheet__grip {
  width: 40px; height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 8px auto 0;
  flex: none;
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px 4px;
}
.sheet__title { font-size: 19px; font-family: var(--font-display); }
.sheet__subtitle { font-size: 12.5px; color: var(--ink-3); }

.sheet__body {
  padding: 8px 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}

.sheet__message { font-size: 14.5px; color: var(--ink-2); }
.sheet__actions { display: flex; gap: 10px; align-items: center; }
.sheet__actions--stack { flex-direction: column; align-items: stretch; }

.type-list { display: flex; flex-direction: column; }
.type-list__item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 0;
  background: none;
  padding: 12px 2px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.type-list__emoji { font-size: 20px; }
.type-list__label { font-size: 15px; }
.type-list__category { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; width: 76px; height: 76px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.thumb__remove {
  position: absolute;
  top: -6px; right: -6px;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ------------------------------------------------------------------ toasts */

.toasts {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 10px);
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 50;
  padding: 0 14px;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 14px;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
  max-width: 100%;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-in { opacity: 1; transform: translateY(0); }
.toast__text { min-width: 0; }
.toast__action {
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  flex: none;
}
.toast--bad { background: var(--status-critical); color: #fff; }
.toast--bad .toast__action { color: #fff; text-decoration: underline; }

/* ----------------------------------------------------------- empty & load */

.empty { font-size: 14px; color: var(--ink-3); text-align: center; padding: 10px 0; }
.empty--block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 12px;
}
.empty__hint { font-size: 12.5px; opacity: .85; }
.empty__portrait { width: 140px; opacity: .5; }
.empty__portrait svg { width: 100%; height: auto; }

.loading { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
.loading__bar {
  height: 88px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--paper-sunk), var(--card), var(--paper-sunk));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.loading__bar:first-child { height: 190px; }

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18vh 16px 0;
  text-align: center;
}
.lock__title { font-family: var(--font-display); font-size: 30px; }
.lock__hint { font-size: 14px; color: var(--ink-3); }
.lock__form { display: flex; gap: 8px; width: 100%; max-width: 320px; margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.type-rows--hidden { margin-top: 6px; gap: 4px; }
.type-row--hidden { grid-template-columns: 26px 1fr auto; opacity: .75; }
