/*
 * divtodiv portal — next layer.
 * Loaded after portal.css. Same language as divtodiv.com: one core, quiet monochrome,
 * light display type, hairlines, pills. Adds the app shell, sign-in and ⌘K palette,
 * and lifts the existing components onto cards.
 */

:root {
  --bg: #0a0a0b;
  --ink: #f5f5f7;
  --muted: #a1a1a6;
  --subtle: #6e6e73;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --card: rgba(255, 255, 255, 0.028);
  --card-hover: rgba(255, 255, 255, 0.05);
  --ok: #8fd3ae;
  --warn: #e6c36a;
  --danger: #ff7b72;
  --radius: 18px;
  --radius-sm: 12px;
  --side-w: 264px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

body {
  font-size: 16px;
  font-weight: 300;
  letter-spacing: 0.005em;
}

::selection { background: rgba(245, 245, 247, 0.9); color: #0a0a0b; }

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

kbd {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--subtle);
  background: rgba(255, 255, 255, 0.03);
}

/* film grain — the same texture as the website */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 100;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* ---------------------------------------------------------------- brand */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* a tiny version of the core */
.brand__mark {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #c9c9ce 32%, #55555a 70%, #2a2a2e);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.22);
}
.brand__mark::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* ---------------------------------------------------------------- app shell */

.topbar { display: none; }

.topbar--plain {
  display: flex;
  align-items: center;
  padding: max(20px, env(safe-area-inset-top)) clamp(20px, 5vw, 56px) 20px;
}

.shell--app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  min-height: 100vh;
}

.side {
  grid-column: 1;
  grid-row: 1 / span 2;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: max(22px, env(safe-area-inset-top)) 14px 18px;
  border-right: 1px solid var(--line);
  background: rgba(10, 10, 11, 0.55);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
}

.side__top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.side__space {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--subtle);
}

.side__close {
  display: none;
  margin-left: auto;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.side__search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  margin: 24px 0 18px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--subtle);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.side__search:hover { border-color: var(--line-strong); color: var(--muted); }
.side__search kbd { margin-left: auto; }

.side__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 15px;
  font-weight: 300;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.side__link:hover { background: var(--card); color: var(--ink); }
.side__link.is-active {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  font-weight: 400;
}
.side__link.is-active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 11px;
  bottom: 11px;
  width: 2px;
  border-radius: 2px;
  background: var(--ink);
}
.side__link--quiet { font-size: 14px; color: var(--subtle); }

.side__count {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ink);
  color: #0a0a0b;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.side__foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.side__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px 8px 8px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
}
.side__user form { margin: 0; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3a3a3f, #18181b 70%);
  border: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.side__who {
  display: grid;
  min-width: 0;
  flex: 1;
  line-height: 1.3;
}
.side__who b,
.side__who small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side__who b { font-size: 14px; font-weight: 400; }
.side__who small { font-size: 12px; color: var(--subtle); }

.side__logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  transition: color 0.3s, background 0.3s;
}
.side__logout:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }

.side-scrim[hidden] { display: none; }

.shell--app .main {
  grid-column: 2;
  max-width: 1240px;
  padding: clamp(40px, 7vh, 84px) clamp(24px, 4.2vw, 64px) 72px;
}

.shell--app .site-footer {
  grid-column: 2;
  border-top: 0;
  padding: 18px clamp(24px, 4.2vw, 64px) max(28px, env(safe-area-inset-bottom));
  font-size: 12px;
}

/* impersonation: a floating pill, not a bar that shifts the layout */
.impersonation-bar {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 80;
  translate: -50% 0;
  gap: 14px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 6px 6px 6px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(20, 20, 22, 0.9);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  color: var(--muted);
}
.impersonation-bar p { display: inline-flex; align-items: center; gap: 10px; }
.impersonation-bar__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 10px rgba(230, 195, 106, 0.6);
}
.impersonation-bar .btn {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #0a0a0b;
}

/* ---------------------------------------------------------------- page type */

.page-kicker {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--subtle);
}

.page-title {
  margin: 0 0 12px;
  font-size: clamp(32px, 3.4vw, 50px);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -0.038em;
}

.page-lede {
  max-width: 52ch;
  margin: 0 0 40px;
  font-size: 16.5px;
  color: var(--muted);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 48px 0 16px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.16em;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

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

.btn,
button.btn {
  min-height: 44px;
  padding: 0 22px;
  border-color: var(--line-strong);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.01em;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.btn .icon { width: 16px; height: 16px; transition: transform 0.45s var(--ease); }
.btn:hover .icon { transform: translateX(3px); }

/* .btn.btn-primary beats portal.css's `button.btn { background: transparent }` */
.btn.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #0a0a0b;
}
.btn.btn-primary:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: #0a0a0b;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.07);
}

.btn-block { width: 100%; min-height: 52px; font-size: 15px; }

.btn-danger { color: var(--danger); border-color: rgba(255, 123, 114, 0.35); }

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

.flash[data-toast] {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  z-index: 90;
  max-width: min(420px, calc(100vw - 36px));
  margin: 0;
  padding: 14px 18px 14px 40px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(20, 20, 22, 0.9);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.45;
  animation: toast-in 0.7s var(--ease);
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
}
.flash[data-toast]::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 20px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 12px rgba(143, 211, 174, 0.6);
}
.flash--err[data-toast]::before {
  background: var(--danger);
  box-shadow: 0 0 12px rgba(255, 123, 114, 0.6);
}
.flash[data-toast].is-leaving { opacity: 0; transform: translateY(-10px); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- cards: stats, tables, empties */

.stats {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
  background: none;
  border: 0;
}

.stat {
  position: relative;
  padding: 18px 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.stat:hover { border-color: var(--line-strong); background: var(--card-hover); }
.stat-label { margin: 0 0 16px; font-size: 10.5px; letter-spacing: 0.15em; }
.stat-value {
  font-size: clamp(30px, 2.5vw, 38px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.stat-value--money { font-size: clamp(22px, 1.9vw, 28px); letter-spacing: -0.02em; }
.stat-value a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.stat:has(a)::after {
  content: "↗";
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 12px;
  color: var(--subtle);
  transition: color 0.3s, transform 0.4s var(--ease);
}
.stat:has(a):hover::after { color: var(--ink); transform: translate(2px, -2px); }

/* overview: the inbox count leads */
.stats--overview .stat:first-child {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  border-color: var(--line-strong);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.table { min-width: 32rem; }
.table th,
.table td { padding: 15px 16px; }
.table th {
  padding-top: 13px;
  padding-bottom: 13px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.15em;
}
.table td { font-size: 15px; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.25s var(--ease); }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.022); }
.table a { font-weight: 400; }
.table a:hover { color: #ffffff; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line-strong); }
.col-select { width: 44px; padding-right: 0 !important; }

.empty {
  margin: 0;
  padding: 40px 24px;
  border: 1px dashed rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.012);
  color: var(--subtle);
  text-align: center;
}

.message-body {
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.block-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 4px 16px;
}
.block-list li:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------- badges & chips */

.badge {
  gap: 7px;
  padding: 3px 10px 3px 9px;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.11em;
  background: rgba(255, 255, 255, 0.03);
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.badge--new::before { box-shadow: 0 0 8px rgba(255, 255, 255, 0.7); }

.chip {
  border-radius: 999px;
}

/* ---------------------------------------------------------------- filters: segmented control */

.filters {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 2px;
  max-width: 100%;
  margin: 0 0 24px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filters a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  white-space: nowrap;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.filters a:hover { color: var(--ink); }
.filters a.is-active { background: var(--ink); color: #0a0a0b; }

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

.field input,
.field textarea,
.field select {
  border-bottom-color: rgba(255, 255, 255, 0.13);
  transition: border-color 0.45s var(--ease), box-shadow 0.45s var(--ease);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-bottom-color: var(--ink);
  box-shadow: 0 1px 0 0 var(--ink);
}
.field label { font-weight: 400; letter-spacing: 0.15em; }

/* floating labels (sign-in screens) */
.field--float {
  padding-top: 20px;
  margin-bottom: 14px;
}
.field--float label {
  top: 36px;
  font-size: 17px;
  font-weight: 300;
  letter-spacing: 0;
  text-transform: none;
  color: var(--subtle);
  pointer-events: none;
  transform-origin: 0 0;
  transition: transform 0.5s var(--ease), color 0.3s, letter-spacing 0.3s;
}
.field--float input:focus + label,
.field--float input:not(:placeholder-shown) + label {
  transform: translateY(-30px) scale(0.68);
  letter-spacing: 0.08em;
  color: var(--muted);
}
.field--float input { font-size: 18px; padding: 12px 0 16px; }

.field--secret input { padding-right: 64px; }
.field__reveal {
  position: absolute;
  right: 0;
  bottom: 22px;
  padding: 4px 0 4px 8px;
  border: 0;
  background: none;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--subtle);
  cursor: pointer;
  transition: color 0.3s;
}
.field__reveal:hover,
.field__reveal[aria-pressed="true"] { color: var(--ink); }

.toggle__track { transition: background 0.3s var(--ease), border-color 0.3s var(--ease); }
.toggle__track::after { transition: transform 0.45s var(--ease), background 0.3s; }

/* ---------------------------------------------------------------- settings & analytics */

.settings-nav {
  top: 28px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.settings-group__link { border-radius: 10px; }
.settings-group__link.is-active { background: rgba(255, 255, 255, 0.07); }

.bar-track { height: 3px; border-radius: 3px; overflow: hidden; }
.bar-fill { border-radius: 3px; background: linear-gradient(90deg, rgba(245, 245, 247, 0.55), var(--ink)); }

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* ---------------------------------------------------------------- ⌘K palette */

.cmdk {
  width: min(560px, calc(100vw - 32px));
  max-height: min(520px, 70vh);
  margin: 14vh auto auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  background: rgba(18, 18, 20, 0.94);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.65);
  color: var(--ink);
}
.cmdk[open] { animation: pop 0.35s var(--ease); }
.cmdk::backdrop {
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.cmdk__field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--subtle);
}
.cmdk__field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  font-size: 17px;
  font-weight: 300;
  color: var(--ink);
}
.cmdk__list {
  max-height: calc(min(520px, 70vh) - 60px);
  overflow-y: auto;
  padding: 8px;
}
.cmdk__list li[hidden] { display: none; }
.cmdk__list a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
}
.cmdk__list a em {
  margin-left: auto;
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--subtle);
}
.cmdk__list a.is-active { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.cmdk__empty { margin: 0; padding: 22px; text-align: center; color: var(--subtle); }

/* ---------------------------------------------------------------- sign-in */

.auth-body { background: var(--bg); }

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(440px, 0.9fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.auth__stage {
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(ellipse 55% 45% at 50% 46%, rgba(255, 255, 255, 0.045), transparent 70%),
    #08080a;
}
.auth__core {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.brand--stage {
  position: absolute;
  top: max(30px, env(safe-area-inset-top));
  left: 40px;
  z-index: 1;
}
.auth__stage-copy {
  position: absolute;
  left: 40px;
  bottom: 60px;
  z-index: 1;
}
.auth__kicker {
  margin: 0 0 16px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--subtle);
}
.auth__motto {
  margin: 0;
  font-size: clamp(30px, 3.3vw, 54px);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -0.045em;
}
.auth__stage-foot {
  position: absolute;
  right: 40px;
  bottom: 30px;
  z-index: 1;
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--subtle);
}

.auth__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px clamp(24px, 5vw, 72px) 96px;
}
.brand--panel { display: none; }
.auth__card {
  width: min(400px, 100%);
  animation: rise 1s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.auth__eyebrow {
  margin: 0 0 18px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--subtle);
}
.auth__title {
  margin: 0 0 12px;
  font-size: clamp(36px, 3.3vw, 50px);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -0.042em;
}
.auth__lede { margin: 0 0 30px; color: var(--muted); }
.auth__form { display: block; }
.auth__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 8px 0 30px;
}
.auth__row .toggle { margin-top: 0; font-size: 14px; }
.auth__link {
  font-size: 14px;
  color: var(--muted);
  transition: color 0.3s;
}
.auth__link:hover { color: var(--ink); }
.auth__link--back { display: block; margin-top: 22px; text-align: center; }
.auth__legal {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(24px, env(safe-area-inset-bottom));
  margin: 0;
  padding: 0 24px;
  text-align: center;
  font-size: 12px;
  color: var(--subtle);
}
.auth .flash {
  margin: 0 0 26px;
  padding: 12px 14px 12px 34px;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: 14px;
}
.auth .flash::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 19px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------------------------------------------------------------- phones & tablets */

@media (max-width: 900px) {
  .shell--app { display: block; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: max(12px, env(safe-area-inset-top)) 16px 12px 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(10, 10, 11, 0.72);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }
  .topbar__menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
  }

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(86vw, 320px);
    background: #0d0d0f;
    transform: translateX(-102%);
    transition: transform 0.5s var(--ease);
    box-shadow: 30px 0 80px rgba(0, 0, 0, 0.5);
  }
  .side.is-open { transform: none; }
  .side__close { display: inline-flex; }
  .side__search kbd { display: none; }

  .side-scrim {
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    animation: fade 0.4s var(--ease);
  }
  @keyframes fade { from { opacity: 0; } }

  .shell--app .main { padding: 32px 20px 64px; }
  .shell--app .site-footer { padding-inline: 20px; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 16px 14px 18px; }

  .filters { margin: 0 0 20px; padding: 4px; }
  .filters a { min-height: 36px; padding: 0 12px; }

  /* phones: the core alone up top — the form below carries the words */
  .auth { grid-template-columns: 1fr; grid-template-rows: minmax(220px, 32vh) auto; }
  .auth__stage { border-right: 0; border-bottom: 1px solid var(--line); }
  .brand--stage { top: max(20px, env(safe-area-inset-top)); left: 22px; }
  .auth__stage-copy,
  .auth__stage-foot { display: none; }
  .auth__panel { justify-content: flex-start; padding: 36px 22px 32px; }
  .auth__legal { position: static; margin-top: 40px; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------- print & motion */

@media print {
  .side, .topbar, .grain, .site-footer, .side-scrim, .cmdk { display: none !important; }
  .shell--app { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .flash[data-toast], .cmdk[open], .auth__card, .side-scrim { animation: none; }
  .side { transition: none; }
}
