/* Reusable pieces: buttons, fields, cards, pills, tables, modals, toasts */

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 9px 16px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  color: var(--ink-800);
  background: var(--paper-50);
  box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow-xs);
  transition: transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast);
}

.btn:hover:not(:disabled) {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--border-strong), var(--shadow-sm);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn--primary {
  color: var(--accent-ink);
  background: linear-gradient(178deg, var(--green-400), var(--green-500));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 1px 2px rgba(6, 37, 27, 0.2),
    0 6px 16px -6px rgba(22, 160, 90, 0.6);
}

.btn--primary:hover:not(:disabled) {
  background: linear-gradient(178deg, #43e08c, var(--green-400));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 4px rgba(6, 37, 27, 0.2),
    0 12px 26px -8px rgba(22, 160, 90, 0.65);
}

.btn--danger {
  color: #fff;
  background: linear-gradient(178deg, #cf4a34, var(--brick-500));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 6px 16px -8px rgba(158, 48, 29, 0.7);
}

.btn--ghost {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border);
}

.btn--ghost:hover:not(:disabled) {
  background: rgba(20, 32, 27, 0.04);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.btn--on-chrome {
  color: var(--fg-on-chrome);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.btn--on-chrome:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.btn--lg {
  padding: 14px 26px;
  font-size: var(--fs-lg);
  border-radius: var(--r-md);
}

.btn--sm {
  padding: 6px 11px;
  font-size: var(--fs-xs);
  border-radius: var(--r-xs);
}

.btn--block {
  width: 100%;
}

/* Sheen sweep on the primary CTA */
.btn--primary::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(#000, #000);
}

.btn--primary:hover:not(:disabled)::after {
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255, 255, 255, 0.45) 50%,
    transparent 70%
  );
  animation: sheen 900ms var(--ease-out);
}

/* ============================================================
   Cards & surfaces
   ============================================================ */

.card {
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm);
  padding: var(--s-6);
}

.card--flush {
  padding: 0;
  overflow: hidden;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}

.card__title {
  font-size: var(--fs-lg);
  font-variation-settings: 'opsz' 34;
}

.card__note {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  line-height: 1.5;
}

/* ============================================================
   Fields
   ============================================================ */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.field__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-700);
}

.field__hint {
  font-size: var(--fs-xs);
  color: var(--fg-muted);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-radius: var(--r-sm);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--border-strong);
  font-size: var(--fs-md);
  color: var(--fg);
  transition: box-shadow var(--dur-fast) var(--ease-out);
  outline: none;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--fg-subtle);
}

.input:focus,
.textarea:focus,
.select:focus {
  box-shadow: inset 0 0 0 1.5px var(--accent), var(--glow-accent);
}

.textarea {
  resize: vertical;
  min-height: 132px;
  line-height: 1.6;
}

.select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%236B7C74' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.input--mono {
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

/* Search field with a leading glyph */
.search {
  position: relative;
  flex: 1 1 200px;
  min-width: 170px;
}

.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--fg-subtle);
  pointer-events: none;
}

.search .input {
  padding-left: 36px;
  font-size: var(--fs-sm);
}

/* ============================================================
   Pills, chips, badges
   ============================================================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: rgba(20, 32, 27, 0.06);
  color: var(--ink-600);
}

.chip--ok {
  background: rgba(31, 191, 107, 0.14);
  color: var(--forest-600);
}

.chip--warn {
  background: var(--amber-100);
  color: var(--amber-600);
}

.chip--bad {
  background: var(--brick-100);
  color: var(--brick-600);
}

.chip--live {
  background: rgba(31, 191, 107, 0.14);
  color: var(--forest-600);
}

.chip__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  background: currentColor;
  flex-shrink: 0;
}

.chip--live .chip__dot {
  background: var(--green-500);
  animation: pulse-ring 1.8s var(--ease-out) infinite;
}

/* Placeholder tokens the user clicks to insert */
.token {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  padding: 5px 10px;
  border-radius: var(--r-xs);
  color: var(--forest-600);
  background: rgba(31, 191, 107, 0.10);
  box-shadow: inset 0 0 0 1px rgba(31, 191, 107, 0.28);
  transition: all var(--dur-fast) var(--ease-out);
}

.token:hover {
  background: var(--green-500);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px var(--green-500);
  transform: translateY(-1px);
}

.token:active {
  transform: translateY(0) scale(0.96);
}

/* Spin group — a different kind of insert from the column chips, so it reads
   as its own thing rather than another spreadsheet header. */
.token--spin {
  color: var(--amber-600);
  background: var(--amber-100);
  box-shadow: inset 0 0 0 1px rgba(191, 138, 31, 0.3);
}

.token--spin:hover {
  color: var(--accent-ink);
  background: var(--amber-500);
  box-shadow: inset 0 0 0 1px var(--amber-500);
}

/* A spin group is a different kind of thing from a column placeholder — it
 * varies the wording rather than filling in data, so it gets its own colour. */
.token--spin {
  color: var(--clay-600);
  background: rgba(194, 65, 12, 0.09);
  box-shadow: inset 0 0 0 1px rgba(194, 65, 12, 0.26);
}

.token--spin:hover {
  background: var(--clay-500);
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--clay-500);
}

.token-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
}

/* Visually separate the spin chip from the run of column chips */
.token--spin {
  margin-left: var(--s-2);
  position: relative;
}

.token--spin::before {
  content: '';
  position: absolute;
  left: calc(var(--s-2) * -1 - 1px);
  top: 15%;
  bottom: 15%;
  width: 1px;
  background: var(--border-strong);
}

/* ============================================================
   Connection status pill (topbar)
   ============================================================ */

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 13px 6px 10px;
  border-radius: var(--r-full);
  background: var(--paper-50);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.status__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--fg-subtle);
  flex-shrink: 0;
  transition: background var(--dur);
}

.status[data-state='connected'] .status__dot {
  background: var(--green-500);
  animation: pulse-ring 2.2s var(--ease-out) infinite;
}

.status[data-state='qr'] .status__dot {
  background: var(--amber-500);
}

.status[data-state='disconnected'] .status__dot {
  background: var(--brick-500);
}

/* Cut off by WhatsApp — nothing is retrying, so it must not look like a blip. */
.status[data-state='blocked'] .status__dot {
  background: var(--brick-500);
  animation: pulse-ring 1.4s var(--ease-out) infinite;
}

/* Blocked reads as an alarm, not a transient state — nothing is retrying. */
.status[data-state='blocked'] {
  background: var(--brick-100);
  box-shadow: inset 0 0 0 1px rgba(158, 48, 29, 0.35);
  color: var(--brick-600);
}

.status[data-state='blocked'] .status__dot {
  background: var(--brick-500);
  animation: pulse-alarm 1.6s var(--ease-out) infinite;
}

@keyframes pulse-alarm {
  0% {
    box-shadow: 0 0 0 0 rgba(188, 59, 38, 0.6);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(188, 59, 38, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(188, 59, 38, 0);
  }
}

.status__phone {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--fg-muted);
  font-size: var(--fs-xs);
}

/* ============================================================
   Stat tiles
   ============================================================ */

.stats {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

.stat {
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--border);
  animation: rise var(--dur) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.stat__val {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 40;
  font-size: var(--fs-2xl);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum' 1;
}

.stat__lbl {
  font-size: var(--fs-xs);
  color: var(--fg-muted);
  margin-top: var(--s-2);
  line-height: 1.3;
}

.stat--ok .stat__val {
  color: var(--forest-600);
}

.stat--bad .stat__val {
  color: var(--brick-500);
}

.stat--warn .stat__val {
  color: var(--amber-600);
}

/* Compact variant used on the dark counter column */
.stat--chrome {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px var(--border-chrome);
  padding: var(--s-3);
}

.stat--chrome .stat__val {
  font-size: var(--fs-xl);
  color: var(--fg-on-chrome);
}

.stat--chrome .stat__lbl {
  color: var(--fg-on-chrome-muted);
  margin-top: 4px;
}

/* ============================================================
   Progress
   ============================================================ */

.progress {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.progress__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--fs-xs);
  color: var(--fg-on-chrome-muted);
}

.progress__meta b {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--green-300);
}

.progress__track {
  position: relative;
  height: 8px;
  border-radius: var(--r-full);
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  width: 0;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--green-600), var(--green-300));
  transition: width var(--dur-slow) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.progress__fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.5) 50%, transparent 80%);
  animation: sheen 1.8s var(--ease-in-out) infinite;
}

.progress[data-idle='true'] .progress__fill::after {
  display: none;
}

/* ============================================================
   Tables
   ============================================================ */

.table-wrap {
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--border);
  background: #fff;
}

.table-scroll {
  max-height: 360px;
  overflow: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

table.data th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 10px 14px;
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  background: var(--paper-100);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

/* One line per row keeps a long list scannable; the wrapper scrolls sideways. */
table.data td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-700);
  vertical-align: middle;
  white-space: nowrap;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
}

table.data tbody tr:last-child td {
  border-bottom: none;
}

table.data tbody tr {
  transition: background var(--dur-fast);
}

table.data tbody tr:hover {
  background: var(--paper-100);
}

table.data tbody tr[data-excluded='true'] td {
  opacity: 0.4;
  text-decoration: line-through;
  text-decoration-color: var(--fg-subtle);
}

table.data tbody tr[data-invalid='true'] .cell-phone {
  color: var(--brick-500);
}

.cell-phone {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  white-space: nowrap;
}

/* Wide sheets scroll sideways, so the include/exclude control is pinned —
 * it must never be the thing that scrolls out of reach. */
.cell-actions {
  width: 44px;
  text-align: right;
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -1px 0 0 var(--border);
}

table.data th.cell-actions {
  background: var(--paper-100);
  z-index: 2;
}

table.data tbody tr:hover .cell-actions {
  background: var(--paper-100);
}

.row-toggle {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-xs);
  color: var(--fg-subtle);
  transition: all var(--dur-fast);
}

.row-toggle:hover {
  background: rgba(20, 32, 27, 0.07);
  color: var(--ink-700);
}

.row-toggle svg {
  width: 14px;
  height: 14px;
}

/* Per-row send state dot */
.row-state {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

.row-state[data-s='sent'] {
  background: rgba(31, 191, 107, 0.18);
  color: var(--forest-600);
}

.row-state[data-s='failed'] {
  background: var(--brick-100);
  color: var(--brick-600);
}

.row-state[data-s='pending'] {
  background: rgba(20, 32, 27, 0.07);
  color: var(--fg-subtle);
}

.row-state[data-s='sending'] {
  background: rgba(217, 148, 17, 0.18);
  color: var(--amber-600);
}

.row-state svg {
  width: 11px;
  height: 11px;
}

.row-state[data-s='sending'] svg {
  animation: spin 1s linear infinite;
}

/* ============================================================
   Banners
   ============================================================ */

.banner {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  background: var(--paper-50);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  animation: rise var(--dur) var(--ease-out) both;
}

.banner__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  background: rgba(20, 32, 27, 0.06);
}

.banner__icon svg {
  width: 17px;
  height: 17px;
}

.banner__body {
  flex: 1;
  min-width: 0;
}

.banner__title {
  font-size: var(--fs-sm);
  font-weight: 700;
}

.banner__text {
  font-size: var(--fs-xs);
  color: var(--fg-muted);
  margin-top: 2px;
  line-height: 1.45;
}

.banner__actions {
  display: flex;
  gap: var(--s-2);
  flex-shrink: 0;
}

.banner--warn {
  background: var(--amber-100);
  box-shadow: inset 0 0 0 1px rgba(176, 119, 12, 0.28);
}

.banner--warn .banner__icon {
  background: rgba(176, 119, 12, 0.16);
  color: var(--amber-600);
}

.banner--info {
  background: var(--clay-100);
  box-shadow: inset 0 0 0 1px rgba(166, 52, 10, 0.22);
}

.banner--info .banner__icon {
  background: rgba(166, 52, 10, 0.14);
  color: var(--clay-600);
}

/* The build this install is running is known-bad. Louder than warn and info on
   purpose — it is the one banner that must not be scrolled past. Same vocabulary,
   turned up: a full-strength ring instead of a tinted one, and a solid icon chip
   where the others are washed. */
.banner--critical {
  background: var(--brick-100);
  box-shadow: inset 0 0 0 1.5px var(--brick-500), 0 8px 20px -12px rgba(158, 48, 29, 0.75);
}

.banner--critical .banner__icon {
  background: var(--brick-500);
  color: #fff;
}

.banner--critical .banner__title {
  color: var(--brick-600);
}

/* A second line under the banner text, for the reason something can't happen
   yet ("finish your current send first"). Quieter than the text above it — it
   is a condition, not the message. */
.banner__note {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-600);
  margin-top: 6px;
  line-height: 1.45;
}

/* ============================================================
   Meter — a progress bar on paper, for the one-click update

   Distinct from `.progress`, which is drawn for the dark counter column. This
   one lives inside a banner or a modal, and it has to be able to say "something
   is happening" when the server cannot say how far along it is.
   ============================================================ */

.meter {
  position: relative;
  height: 6px;
  border-radius: var(--r-full);
  background: rgba(20, 32, 27, 0.12);
  overflow: hidden;
}

.meter__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--green-500);
  transition: width var(--dur) var(--ease-out);
}

/* No percentage from the server — a bar frozen at 0 reads as stuck, so it
   paces instead of pretending to know. */
.meter[data-unknown='true'] .meter__fill {
  width: 34%;
  transition: none;
  animation: meter-drift 1.5s var(--ease-in-out) infinite;
}

@keyframes meter-drift {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(330%);
  }
}

.banner__meter {
  margin-top: var(--s-3);
}

.banner--info .meter__fill {
  background: var(--clay-500);
}

.banner--critical .meter__fill {
  background: var(--brick-500);
}

/* The restart screen's bar carries the whole "it is still working" message. */
.modal > .meter {
  margin-top: var(--s-6);
}

/* ============================================================
   Modals
   ============================================================ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--s-6);
  background: rgba(6, 37, 27, 0.62);
  backdrop-filter: blur(10px);
  animation: fade var(--dur) var(--ease-out) both;
}

.modal {
  width: 100%;
  max-width: 480px;
  padding: var(--s-8);
  border-radius: var(--r-xl);
  background: var(--paper-100);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  animation: modal-in var(--dur-slow) var(--ease-spring) both;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal__mark {
  width: 44px;
  height: 44px;
  margin-bottom: var(--s-5);
}

.modal__title {
  font-size: var(--fs-2xl);
  font-variation-settings: 'opsz' 72;
  letter-spacing: -0.025em;
  margin-bottom: var(--s-3);
}

.modal__text {
  font-size: var(--fs-md);
  color: var(--ink-600);
  line-height: 1.6;
}

.modal__text + .modal__text {
  margin-top: var(--s-3);
}

.modal__foot {
  margin-top: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3);
  margin: var(--s-5) 0 0;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 0 0 1px var(--border);
  cursor: pointer;
  font-size: var(--fs-sm);
  line-height: 1.45;
  transition: box-shadow var(--dur-fast);
}

.check:hover {
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.check input {
  appearance: none;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  border-radius: var(--r-xs);
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--border-strong);
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.check input:checked {
  background: var(--green-500);
  box-shadow: inset 0 0 0 1.5px var(--green-500);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1.5' fill='none' stroke='%23042414' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.check__note {
  display: block;
  margin-top: 2px;
  color: var(--ink-600);
  font-size: var(--fs-xs);
  line-height: 1.45;
}

/* An explicit custom number overrides the toggle, so the toggle recedes rather
   than vanishing — a control that disappears reads as a bug. */
.check--muted {
  opacity: 0.45;
  cursor: not-allowed;
}

.check--muted input {
  cursor: not-allowed;
}

.limits__advanced {
  margin-top: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.limits__warn {
  margin-top: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm);
  background: var(--amber-100);
  color: var(--amber-600);
  font-size: var(--fs-sm);
  line-height: 1.5;
  animation: rise var(--dur-fast) var(--ease-out) both;
}

.error-text {
  font-size: var(--fs-sm);
  color: var(--brick-600);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm);
  background: var(--brick-100);
  animation: rise var(--dur-fast) var(--ease-out) both;
}

/* License status, as a receipt-style pair list */
.lic {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-2) var(--s-4);
  margin-top: var(--s-5);
  padding: var(--s-4);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: var(--fs-sm);
}

.lic dt {
  color: var(--fg-muted);
  white-space: nowrap;
}

.lic dd {
  text-align: right;
  font-weight: 600;
  color: var(--ink-700);
  overflow-wrap: anywhere;
}

/* ============================================================
   Toasts
   ============================================================ */

.toasts {
  position: fixed;
  bottom: var(--s-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 11px 18px;
  /* A refusal is quoted from the server verbatim and can be a full sentence, so
     this has to survive being longer than a few words. */
  max-width: min(560px, calc(100vw - 2 * var(--s-6)));
  line-height: 1.4;
  border-radius: var(--r-full);
  background: var(--forest-900);
  color: var(--fg-on-chrome);
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in var(--dur-slow) var(--ease-spring) both;
}

.toast.is-out {
  animation: toast-out var(--dur) var(--ease-out) both;
}

.toast svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.toast--ok svg {
  color: var(--green-400);
}

.toast--bad svg {
  color: #ff8a72;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}

/* ============================================================
   Empty states
   ============================================================ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--s-3);
  padding: var(--s-9) var(--s-6);
  color: var(--fg-muted);
}

.empty svg {
  width: 42px;
  height: 42px;
  color: var(--paper-500);
}

.empty__title {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 36;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--ink-700);
}

.empty__text {
  font-size: var(--fs-sm);
  max-width: 34ch;
  line-height: 1.5;
}

/* ============================================================
   Sheet — a full modal that holds a screen, not a question
   ============================================================ */

.modal--wide {
  max-width: 940px;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 900px);
  overflow: hidden;
}

.sheet__head {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sheet__mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.sheet__titles {
  flex: 1;
  min-width: 0;
}

.sheet__title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-variation-settings: 'opsz' 48;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.sheet__sub {
  font-size: var(--fs-xs);
  color: var(--fg-muted);
  margin-top: 2px;
}

.sheet__close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  transition: all var(--dur-fast);
}

.sheet__close:hover {
  background: rgba(20, 32, 27, 0.07);
  color: var(--ink-700);
}

.sheet__close svg {
  width: 16px;
  height: 16px;
}

.sheet__body {
  padding: var(--s-5) var(--s-6) var(--s-6);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.sheet__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}

/* The history tables carry the screen, so they get more room than the
   in-page tables the 360px default was sized for. */
.table-scroll--tall {
  max-height: min(52vh, 520px);
}

.row--clickable {
  cursor: pointer;
}

.cell-sub {
  font-size: var(--fs-xs);
  color: var(--fg-muted);
}

/* The one column worth reading in full — everything else stays one line.
   Qualified past `table.data td`, which clamps every cell to one line. */
table.data td.cell-msg {
  max-width: 420px;
  white-space: normal;
  text-overflow: clip;
  line-height: 1.45;
}

/* Row actions sit side by side; .row-toggle is a grid, so it needs a flex
   parent or two buttons stack into a two-line row. */
.cell-tools {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

table.data td.cell-actions--pair,
table.data th.cell-actions--pair {
  width: 72px;
}

.tally b {
  font-weight: 700;
}

.tally--ok {
  color: var(--forest-600);
}

.tally--bad {
  color: var(--brick-600);
}

.quote {
  padding: var(--s-4);
  border-radius: var(--r-sm);
  background: var(--paper-100);
  box-shadow: inset 0 0 0 1px var(--border);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--ink-700);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 160px;
  overflow-y: auto;
}

.empty__icon svg {
  width: 42px;
  height: 42px;
  color: var(--paper-500);
}

/* A card head with more than one action needs them grouped, not wrapped. */
.card__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}
