/* ============================ design tokens ============================ */
:root {
  --bg: #0b1014;
  --bg-soft: #10171c;
  --surface: #141d23;
  --surface-2: #19242b;
  --surface-3: #1f2d35;
  --line: #24333c;
  --line-soft: #1b272e;

  --text: #e8f0f4;
  --text-dim: #9db0bb;
  --text-faint: #6b7f8b;

  --accent: #25d366;
  --accent-dim: #1ea952;
  --accent-ink: #052912;
  --accent-glow: rgba(37, 211, 102, 0.18);

  --danger: #ff5a52;
  --danger-soft: rgba(255, 90, 82, 0.14);
  --warn: #ffb02e;
  --warn-soft: rgba(255, 176, 46, 0.14);
  --info: #4aa8ff;
  --info-soft: rgba(74, 168, 255, 0.14);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --fast: 140ms var(--ease);
  --med: 240ms var(--ease);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(37, 211, 102, 0.07), transparent 60%),
    radial-gradient(900px 460px at 92% 4%, rgba(74, 168, 255, 0.05), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter var', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-glow);
}

/* ============================== primitives ============================= */
.hidden {
  display: none !important;
}

.spacer {
  flex: 1;
}

.muted {
  color: var(--text-dim);
}

.faint {
  color: var(--text-faint);
}

.small {
  font-size: 12.5px;
}

.mono {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;
  font-size: 12px;
}

.nowrap {
  white-space: nowrap;
}

.center {
  text-align: center;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 21px;
}

h2 {
  font-size: 15.5px;
}

h3 {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

a {
  color: var(--accent);
}

.error-text {
  color: var(--danger);
  min-height: 18px;
  font-size: 13px;
}

.warn-text {
  color: var(--warn);
  font-size: 13px;
}

/* animations */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 var(--accent-glow);
  }
  70% {
    box-shadow: 0 0 0 8px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ================================ login =============================== */
.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  animation: fade-up var(--med) both;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 22px;
}

.login-hint {
  margin: 18px 0 0;
  font-size: 12.5px;
  color: var(--text-faint);
  text-align: center;
}

/* =============================== app chrome =========================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 22px;
  background: rgba(16, 23, 28, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--accent), var(--accent-dim));
  color: var(--accent-ink);
  flex: none;
}

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

.tabs {
  position: sticky;
  top: 56px;
  z-index: 20;
  display: flex;
  gap: 2px;
  padding: 0 14px;
  background: rgba(11, 16, 20, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 14px;
  background: none;
  border: 0;
  color: var(--text-faint);
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--fast);
}

.tab svg {
  width: 15px;
  height: 15px;
  opacity: 0.85;
}

.tab::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--med);
}

.tab:hover {
  color: var(--text-dim);
}

.tab.active {
  color: var(--text);
}

.tab.active::after {
  transform: scaleX(1);
}

.tab-badge {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 650;
  text-align: center;
}

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px;
}

@media (max-width: 640px) {
  .wrap {
    padding: 14px;
  }
  .topbar {
    padding: 10px 14px;
  }
}

.panel {
  display: none;
}

.panel.active {
  display: block;
  animation: fade-up var(--med) both;
}

/* ================================ cards =============================== */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-sub {
  margin: -8px 0 14px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.grid {
  display: grid;
  gap: 16px;
}

.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}

.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.row {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.span-all {
  grid-column: 1 / -1;
}

/* =============================== stat tiles =========================== */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
}

.tile {
  position: relative;
  padding: 13px 14px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  transition: border-color var(--fast), transform var(--fast);
}

.tile:hover {
  border-color: var(--line);
  transform: translateY(-1px);
}

.tile-label {
  display: block;
  font-size: 11.5px;
  color: var(--text-faint);
  font-weight: 550;
  letter-spacing: 0.02em;
}

.tile-value {
  display: block;
  margin-top: 3px;
  font-size: 25px;
  font-weight: 680;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.tile-value.sm {
  font-size: 19px;
}

.tile-foot {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-faint);
}

.tile.ok .tile-value {
  color: var(--accent);
}
.tile.warn .tile-value {
  color: var(--warn);
}
.tile.bad .tile-value {
  color: var(--danger);
}

/* ================================ pills =============================== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 620;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.pill.ok {
  background: var(--accent-glow);
  color: var(--accent);
}
.pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill.bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.pill.ok .dot {
  animation: pulse-ring 2.4s infinite;
}

/* =============================== controls ============================= */
label {
  display: block;
  margin: 0 0 5px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-dim);
}

.field {
  margin-bottom: 14px;
}

.field-hint {
  margin: 5px 0 0;
  font-size: 11.5px;
  color: var(--text-faint);
}

input,
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: #0c1317;
  color: var(--text);
  font: inherit;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #2f414c;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type='checkbox'],
input[type='radio'] {
  width: auto;
}

input[type='file'] {
  padding: 7px 9px;
  color: var(--text-dim);
  font-size: 13px;
}

input[type='file']::file-selector-button {
  margin-right: 10px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

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

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%),
    linear-gradient(135deg, var(--text-faint) 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 11px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

select[multiple] {
  background-image: none;
  padding-right: 11px;
  min-height: 116px;
}

select[multiple] option {
  padding: 5px 7px;
  border-radius: 5px;
}

.inline-w {
  width: auto;
  min-width: 92px;
  flex: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* toggle switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch .track {
  position: relative;
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  flex: none;
  transition: background var(--med), border-color var(--med);
}

.switch .track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: transform var(--med), background var(--med);
}

.switch input:checked + .track {
  background: var(--accent-glow);
  border-color: var(--accent-dim);
}

.switch input:checked + .track::after {
  transform: translateX(17px);
  background: var(--accent);
}

.switch input:focus-visible + .track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch:has(input:checked) {
  color: var(--text);
}

/* checkbox */
.check {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--line);
  background: #0c1317;
  cursor: pointer;
  position: relative;
  transition: background var(--fast), border-color var(--fast);
  vertical-align: middle;
}

.check:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.check:checked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: no-repeat center/10px 10px
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23052912' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
}

/* radio card */
.choice {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
}

.choice:hover {
  border-color: #2f414c;
  transform: translateY(-1px);
}

.choice input {
  margin-top: 3px;
  accent-color: var(--accent);
  flex: none;
}

.choice:has(input:checked) {
  border-color: var(--accent-dim);
  background: linear-gradient(180deg, var(--accent-glow), transparent 70%), var(--surface-2);
}

.choice strong {
  display: block;
  font-size: 13.5px;
  font-weight: 620;
}

.choice span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-faint);
}

/* ================================ buttons ============================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 570;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--fast), border-color var(--fast), transform var(--fast), opacity var(--fast);
}

.btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.btn:hover {
  background: #24333c;
  border-color: #334752;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 660;
}

.btn.primary:hover {
  filter: brightness(1.07);
}

.btn.danger {
  background: transparent;
  border-color: rgba(255, 90, 82, 0.35);
  color: var(--danger);
}

.btn.danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}

.btn.ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}

.btn.sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.busy {
  color: transparent !important;
  pointer-events: none;
  position: relative;
}

.btn.busy::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  animation: spin 0.6s linear infinite;
}

.btn.primary.busy::after {
  border-color: rgba(5, 41, 18, 0.3);
  border-top-color: var(--accent-ink);
}

.link-btn {
  border: 0;
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: color var(--fast), background var(--fast);
}

.link-btn:hover {
  color: var(--text);
  background: var(--surface-3);
}

.link-btn.danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ================================= QR ================================ */
.qr-wrap {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 6px 0 2px;
}

.qr-frame {
  padding: 12px;
  background: #fff;
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  line-height: 0;
}

.qr-frame img {
  width: 240px;
  height: 240px;
  display: block;
  image-rendering: pixelated;
}

.qr-steps {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--text-dim);
  max-width: 330px;
}

.qr-steps li + li {
  margin-top: 3px;
}


/* ============================== progress ============================== */
.bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.bar > i {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--pct, 0) * 1%);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 600ms var(--ease);
}

.bar.full > i {
  background: linear-gradient(90deg, var(--accent), #7bffb0);
}

/* =============================== tables =============================== */
.table-wrap {
  overflow-x: auto;
  margin: 0 -18px -18px;
  padding: 0 18px 4px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 9px 11px;
  background: var(--bg-soft);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--fast);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.022);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.num {
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 30px 12px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

.thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 9px;
  background: var(--surface-3);
  display: block;
}

.thumb-none {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  line-height: 1.1;
}

.clip {
  max-width: 380px;
  max-height: 42px;
  overflow: hidden;
  color: var(--text-dim);
  font-size: 12.5px;
  white-space: pre-wrap;
  mask-image: linear-gradient(180deg, #000 60%, transparent);
}

.cell-title {
  font-weight: 570;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

/* ============================== timeline ============================== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 340px;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px;
}

.tl-item {
  display: grid;
  grid-template-columns: 58px 34px 1fr;
  gap: 10px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 9px;
  transition: background var(--fast);
}

.tl-item:hover {
  background: var(--surface-2);
}

.tl-item.next {
  background: linear-gradient(90deg, var(--accent-glow), transparent);
}

.tl-time {
  font-size: 12px;
  font-weight: 620;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.tl-item.next .tl-time {
  color: var(--accent);
}

.tl-thumb {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--surface-3);
}

.tl-body {
  min-width: 0;
}

.tl-name {
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tl-to {
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================ chat preview ============================ */
.preview-phone {
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: #0a1115 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='36' height='36'><circle cx='4' cy='4' r='1' fill='%2318242b'/></svg>");
  padding: 14px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.bubble {
  align-self: flex-end;
  max-width: 300px;
  background: #075e54;
  background: linear-gradient(180deg, #0b6b5f, #075044);
  border-radius: 12px 12px 3px 12px;
  padding: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.bubble img {
  width: 100%;
  max-height: 210px;
  object-fit: cover;
  border-radius: 9px;
  display: block;
}

.bubble-text {
  padding: 6px 7px 3px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: #eaf5ef;
}

.bubble-text b {
  font-weight: 700;
}

.bubble-text i {
  font-style: italic;
}

.bubble-text s {
  text-decoration: line-through;
}

.bubble-text code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
}

.bubble-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  padding: 0 7px 4px;
  font-size: 10.5px;
  color: rgba(234, 245, 239, 0.6);
}

.bubble-meta svg {
  width: 14px;
  height: 14px;
}

.count-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 6px;
}

/* =============================== toasts =============================== */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 460px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(31, 45, 53, 0.97);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  backdrop-filter: blur(8px);
  animation: fade-up 200ms var(--ease) both;
  max-width: 100%;
}

.toast.out {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 200ms, transform 200ms;
}

.toast.bad {
  border-color: rgba(255, 90, 82, 0.5);
  color: #ffd9d7;
}

.toast.ok .icon {
  color: var(--accent);
}

.toast .icon {
  flex: none;
  display: grid;
  place-items: center;
}

.toast .icon svg {
  width: 16px;
  height: 16px;
}

/* ================================ modal =============================== */
dialog.modal {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(92vw, 400px);
  box-shadow: var(--shadow-lg);
}

dialog.modal::backdrop {
  background: rgba(4, 8, 10, 0.66);
  backdrop-filter: blur(3px);
}

.modal-body {
  padding: 20px;
}

.modal-body h2 {
  margin-bottom: 7px;
}

.modal-body p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13.5px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-soft);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ============================== utilities ============================= */
.notice {
  display: flex;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--r);
  font-size: 12.5px;
  line-height: 1.5;
  border: 1px solid transparent;
}

.notice svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
}

.notice.warn {
  background: var(--warn-soft);
  border-color: rgba(255, 176, 46, 0.28);
  color: #ffdca6;
}

.notice.info {
  background: var(--info-soft);
  border-color: rgba(74, 168, 255, 0.25);
  color: #c4e2ff;
}

.notice ul {
  margin: 4px 0 0;
  padding-left: 17px;
}

.search {
  position: relative;
  flex: 1;
  min-width: 150px;
  max-width: 260px;
}

.search input {
  padding-left: 32px;
}

.search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-faint);
  pointer-events: none;
}

.sticky-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 13px 0 0;
  margin-top: 4px;
  background: linear-gradient(180deg, transparent, var(--bg-soft) 45%);
}

/* small helpers used by the markup */
.m0 {
  margin: 0;
}

.mt {
  margin-top: 16px;
}

.block {
  width: 100%;
}

.tiles + .stack:empty,
.stack:empty {
  display: none;
}

.grid + .grid,
.tiles + .grid,
.tiles + .stack:not(:empty) {
  margin-top: 16px;
}

/* keep the tab bar under the header on short screens too */
@media (max-width: 760px) {
  .tabs {
    top: 52px;
  }
  .tab {
    padding: 12px 10px;
  }
  .tab svg {
    display: none;
  }
  .clip {
    max-width: 200px;
  }
  .bubble {
    max-width: 100%;
  }
  .tile-value {
    font-size: 22px;
  }
}
