:root {
  --ink: #16191f;
  --ink-2: #3a3f47;
  --muted: #71777f;
  --faint: #9aa0a7;
  --paper: #f7f5f0;
  --panel: #ffffff;
  --panel-2: #fbfaf7;
  --line: #e7e3da;
  --line-2: #efece4;
  --sidebar: #14181e;
  --sidebar-2: #1b2027;
  --sidebar-3: #232a33;
  --sidebar-line: #2b323c;
  --on-dark: #e9ecef;
  --on-dark-mute: #8b929b;

  --accent: #df5f23;
  --accent-soft: #fbe7da;
  --accent-ink: #b14613;

  --ok: #2f7d54;   --ok-bg: #e6f1ea;
  --est: #2b6aa0;  --est-bg: #e4eef6;
  --stale: #b07419;--stale-bg: #f6edda;
  --miss: #b23b3b; --miss-bg: #f6e6e4;

  --good: #2f7d54; --warn: #b07419; --bad: #b23b3b; --neutral: #5b626b;

  --r: 9px;
  --r-sm: 6px;
  --shadow: 0 1px 2px rgba(20,24,30,.04), 0 4px 14px rgba(20,24,30,.05);
  --shadow-lg: 0 8px 30px rgba(20,24,30,.12);
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

html.dark {
  --ink: #e8eaf0;
  --ink-2: #c8cbd6;
  --muted: #8b92a8;
  --faint: #6b728a;
  --paper: #0f1117;
  --panel: #1a1d27;
  --panel-2: #222633;
  --line: #2d3348;
  --line-2: #262b40;
  --sidebar: #0a0c12;
  --sidebar-2: #12151e;
  --sidebar-3: #1a1f2a;
  --sidebar-line: #1e2332;
  --on-dark: #e9ecef;
  --on-dark-mute: #6b728a;

  --accent: #df5f23;
  --accent-soft: #2a1a10;
  --accent-ink: #e87a3e;

  --ok: #3ecf8e;   --ok-bg: #0c261b;
  --est: #5b9fd4;  --est-bg: #0c1c2e;
  --stale: #f5a623;--stale-bg: #2a1c08;
  --miss: #ef5b5b; --miss-bg: #2a0e0e;

  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); }

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-size: 1.6rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.brand h1 {
  font-size: 1.4rem;
  font-weight: 600;
}

.status-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.account-switcher {
  position: relative;
}

.btn-account-menu {
  font-family: inherit;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  max-width: 280px;
}

.btn-account-menu:hover {
  background: var(--panel-2);
}

.account-menu-label {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.account-menu-email {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.account-menu-chevron {
  color: var(--muted);
  font-size: 0.7rem;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 300px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  z-index: 100;
  overflow: hidden;
}

.account-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.account-option:hover {
  background: var(--panel-2);
}

.account-option.active {
  background: var(--accent-soft);
}

.account-option-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-option-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.account-option-check {
  color: var(--accent);
  font-weight: 700;
}

.account-option-remove {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(239, 91, 91, 0.35);
  background: rgba(239, 91, 91, 0.1);
  color: var(--miss);
  cursor: pointer;
}

.account-option-remove:hover {
  background: rgba(239, 91, 91, 0.2);
}

.account-dropdown-footer {
  border-top: 1px solid var(--line);
  padding: 8px;
}

.account-dropdown-footer .btn {
  width: 100%;
  justify-content: center;
}

.pill {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel);
  white-space: nowrap;
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.pill-on {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: transparent;
}

.pill-live {
  background: var(--est-bg);
  color: var(--est);
  border-color: transparent;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.btn {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: .12s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover:not(:disabled) { border-color: var(--ink-2); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: #c9521a; border-color: #c9521a; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-ghost:hover:not(:disabled) { background: #00000008; color: var(--ink); }

.btn-sm { padding: 4px 9px; font-size: 11.5px; }

.btn-danger {
  border-color: rgba(178, 59, 59, 0.4);
  color: var(--miss);
}
.btn-danger:hover:not(:disabled) { background: rgba(178, 59, 59, 0.08); border-color: var(--miss); }

.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.message {
  font-size: 12.5px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
}
.message.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.message.err { border-color: var(--miss); color: var(--miss); background: var(--miss-bg); }

.seg {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 0;
}

.seg-b {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 9px 12px;
  margin-bottom: -1px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color .12s;
}

.seg-b:hover { color: var(--ink); }
.seg-b.on { color: var(--ink); border-bottom-color: var(--accent); }

.seg-count {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 1px 6px;
  border-radius: 999px;
}

.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  margin-bottom: 4px;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
  flex: 1;
  min-width: 160px;
  transition: border-color .12s;
}

.searchbox:hover { border-color: var(--ink-2); }

.searchbox input {
  border: 0;
  outline: 0;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: var(--ink);
  flex: 1;
  min-width: 0;
}

.scroll-sentinel {
  height: 1px;
  width: 100%;
}

.email-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.star-icon {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}

.star-icon.starred {
  color: var(--warn);
}

.star-icon:hover {
  color: var(--warn);
}

.detail-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-reply {
  border-color: rgba(223, 95, 35, 0.4);
  color: var(--accent-ink);
}
.btn-reply:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.attachments-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.attachments-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.attachments-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.attachments-list a {
  color: var(--accent);
  text-decoration: none;
}

.attachments-list a:hover {
  text-decoration: underline;
}

.attachment-size {
  color: var(--muted);
  font-size: 0.8rem;
}

.contact-detail-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.label-card {
  cursor: default;
}

.label-card:hover {
  background: var(--panel);
}

@media (max-width: 600px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-bar .pill:not(.pill-live) {
    display: none;
  }

  .seg {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .email-card {
    padding: 12px;
  }

  .app {
    padding: 16px 12px 32px;
  }

  .detail-actions {
    width: 100%;
  }
}

@media (max-width: 400px) {
  .email-snippet {
    display: none;
  }

  .brand h1 {
    font-size: 1.15rem;
  }

  .email-subject {
    font-size: 0.88rem;
  }
}

.email-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

.email-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}

.email-card:hover { border-color: var(--ink-2); }
.email-card.new {
  border-color: var(--accent);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.email-from {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-ink);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-subject {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.email-snippet {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-date {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.view { display: none; }
.view.active { display: block; }

.hidden { display: none !important; }

.email-card.clickable {
  cursor: pointer;
}

.email-card.clickable:hover {
  background: var(--panel-2);
}

.email-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.inbox-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.chip {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: all .12s;
}

.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.email-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.thread-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.thread-message {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  background: var(--panel);
  animation: fadeIn 0.2s ease-out;
}

.thread-message.thread-sent {
  border-color: var(--ok-bg);
  background: var(--ok-bg);
}

.thread-message-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.thread-date {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 8px;
  font-weight: 400;
}

.thread-message-to {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.email-detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.detail-subject {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.detail-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-body-host {
  margin-top: 4px;
}

.detail-body-frame {
  width: 100%;
  min-height: 200px;
  max-height: 1200px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
}

.detail-body-text {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink);
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.detail-body-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.detail-body-text a:hover {
  color: var(--accent-ink);
}

.detail-body-text.muted {
  color: var(--muted);
  font-style: italic;
}

.body-toggle {
  margin: 10px 0 8px;
}

.compose-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.field input,
.field textarea {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.field textarea {
  resize: vertical;
  min-height: 160px;
}

.compose-actions,
.drafts-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.drafts-toolbar {
  margin-bottom: 12px;
}

.contact-search {
  flex: 1;
  min-width: 160px;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: background 0.15s;
}

.contact-card:hover {
  background: var(--panel-2);
}

.contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: var(--mono);
  flex-shrink: 0;
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.contact-email {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-meta {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
}

.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 8px;
}

.contact-chip:hover {
  background: var(--panel-2);
}

.contact-detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  margin: 12px 0;
}

.hidden {
  display: none !important;
}

.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--paper);
}

.login-view.hidden { display: none; }

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header .logo {
  font-size: 2rem;
  margin: 0 auto 12px;
}

.login-header h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form.hidden { display: none; }

.btn-login {
  width: 100%;
  justify-content: center;
  padding: 11px 16px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

.login-error {
  background: rgba(239, 91, 91, 0.1);
  border: 1px solid rgba(239, 91, 91, 0.3);
  color: var(--miss);
  padding: 10px 14px;
  border-radius: var(--r);
  font-size: 0.85rem;
}

.login-error.hidden { display: none; }

.login-success {
  text-align: center;
  color: var(--ok);
  padding: 16px;
}

.login-toggle {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.login-toggle a {
  color: var(--accent);
  cursor: pointer;
}

#btn-logout {
  margin-left: auto;
}

/* ── Loading Skeleton ── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--line) 25%, var(--line-2) 37%, var(--line) 63%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}

.skeleton-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.skeleton-line {
  height: 12px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, var(--line) 25%, var(--line-2) 37%, var(--line) 63%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-line:last-child { margin-bottom: 0; }

.skeleton-line.w60 { width: 60%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w30 { width: 30%; }

/* ── Spin loader for detail views ── */
.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--muted);
  gap: 10px;
  font-size: 13px;
}

.spinner::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Empty state ── */
.empty-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.5;
  display: block;
}

/* ── Transition helpers ── */
.fade-in {
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Brain Utilities ── */
.lbl {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--faint);
}

.num { font-variant-numeric: tabular-nums; }
.clik { cursor: pointer; transition: .12s; }

.sec-h {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sec-h h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 600;
  letter-spacing: -.01em;
}

.hairline {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}

/* ── Button loading state ── */
.btn.loading {
  position: relative;
  color: transparent !important;
}
.btn.loading::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--muted);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-primary.loading::after {
  border-color: rgba(255,255,255,0.4);
  border-top-color: #fff;
}

/* ── Smooth transitions for theme switch ── */
html.dark,
html:not(.dark) {
  transition: background .2s, color .2s;
}
html.dark *,
html:not(.dark) * {
  transition: background .15s, border-color .15s, box-shadow .15s;
}
