/* Shared palette: warm neutral surfaces, forest actions, amber alarms. */
:root {
  --bg: #f7f8f5;
  --bg-elev: #ffffff;
  --bg-hover: #edf1eb;
  --line: #e0e5dd;
  --text: #242d27;
  --muted: #5b685f;
  --faint: #68766c;
  --accent: #30634b;
  --accent-text: #ffffff;
  --danger: #b44136;
  --ok: #30634b;
  --ring: #528364;
  --alarm: #8a641c;
  --tint: #eef3e9;
  --shadow: 0 2px 5px #24312704;
  --radius: 16px;
  --radius-sm: 9px;
  --font-display: "Inter", Avenir Next, sans-serif;
  --font-ui: "Inter", Avenir Next, "Segoe UI", sans-serif;
  --font-mono: "DM Mono", ui-monospace, Menlo, monospace;
  --type-caption: 0.75rem;
  --type-meta: 0.8125rem;
  --type-body: 0.875rem;
  --type-input: 1rem;
  --type-section: 1.125rem;
  --type-dialog: 1.25rem;
  --type-page: 1.75rem;
  --dur: 140ms;
  --ease: ease;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #181b19;
  --bg-elev: #202521;
  --bg-hover: #2a322b;
  --line: #354037;
  --text: #edf1e9;
  --muted: #aab7ac;
  --faint: #9daa9f;
  --accent: #b5d4a6;
  --accent-text: #1d3325;
  --danger: #ff9b8f;
  --ok: #b5d4a6;
  --ring: #b5d4a6;
  --alarm: #e4c47f;
  --tint: #293429;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}
html,
body {
  min-height: 100%;
}
html {
  background: var(--bg);
}
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--accent);
  color: var(--accent-text);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 20;
  font-weight: 600;
}
.skip:focus {
  top: 12px;
}

.hidden,
[hidden] {
  display: none !important;
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 4rem;
}
.wrap:has(#app-screen:not(.hidden)) {
  width: min(1440px, calc(100% - 4rem));
}

.app-shell {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
  padding-top: 2.5rem;
}
.app-nav {
  position: sticky;
  top: 1rem;
}
.app-nav-label {
  margin: 1.15rem 0 0.35rem;
  font-size: var(--type-caption);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.app-nav-label:first-child {
  margin-top: 0;
}
.app-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.app-main {
  min-width: 0;
}
.tab-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin: 0 0 1rem;
}
.tab-head h2 {
  font-family: var(--font-display);
  font-size: var(--type-page);
  font-weight: 620;
  letter-spacing: -0.045em;
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.6rem;
}
.dash-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-height: 7.5rem;
  padding: 1.1rem 1.15rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 500;
  text-align: left;
  box-shadow: none;
}
.dash-kicker {
  font-size: var(--type-caption);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.dash-card strong {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 620;
  letter-spacing: -0.045em;
}
.dash-card span {
  color: var(--muted);
  font-size: var(--type-meta);
  font-weight: 500;
}
.dash-card:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.auth-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}
.auth-legal a {
  color: var(--muted);
}
.auth-legal a:hover {
  color: var(--text);
}
.danger-panel h2 {
  color: var(--danger);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 52px;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
}
a.brand-lockup:hover {
  opacity: 0.82;
}
.brand-mark {
  display: block;
  flex-shrink: 0;
  width: 1.05rem;
  height: 1.05rem;
  background: var(--text);
  -webkit-mask: url("/stoop-mark.svg") center / contain no-repeat;
  mask: url("/stoop-mark.svg") center / contain no-repeat;
}
.mark {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.045em;
}
.mark em {
  font-style: normal;
  font-weight: 450;
  color: var(--text);
}
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: var(--type-meta);
  font-weight: 500;
}
.status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 18%, transparent);
}
.status-dot.bad::before {
  background: var(--danger);
  box-shadow: none;
}

.user-bar {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}
.user-email {
  color: var(--muted);
  font-size: var(--type-meta);
}
.user-ecosystem {
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--type-body);
  font-style: normal;
  cursor: pointer;
}

.gate {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  align-items: center;
  padding-top: 3.5rem;
}

.clock-block {
  min-height: 220px;
}
.clock {
  display: flex;
  align-items: flex-start;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: clamp(4.2rem, 12vw, 7.2rem);
  font-weight: 620;
  letter-spacing: -0.055em;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}
.clock-hh,
.clock-mm {
  min-width: 2.05ch;
  text-align: center;
  letter-spacing: 0.04em;
}
.clock-colon {
  display: inline-block;
  width: 0.38em;
  margin: 0 0.38em;
  text-align: center;
  letter-spacing: 0;
  color: var(--accent);
  opacity: 0.9;
  animation: colon-live 1s steps(1, end) infinite;
}
.clock-ss {
  margin-left: 0.7em;
  padding-top: 0.22em;
  min-width: 1.8em;
  font-family: var(--font-mono);
  font-size: 0.34em;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--faint);
  line-height: 1;
}
@keyframes colon-live {
  0%,
  49% {
    opacity: 0.95;
  }
  50%,
  100% {
    opacity: 0.22;
  }
}
.lede {
  margin-top: 1.25rem;
  max-width: 28rem;
  color: var(--muted);
  font-size: var(--type-input);
}
.manual {
  margin-top: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 0.2rem 1.15rem 0.2rem;
}
.manual summary {
  cursor: pointer;
  list-style: none;
  min-height: 48px;
  display: flex;
  align-items: center;
  font-weight: 600;
  color: var(--muted);
}
.manual summary::-webkit-details-marker {
  display: none;
}
.manual summary::after {
  content: "Show";
  margin-left: auto;
  font-size: var(--type-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.manual[open] summary::after {
  content: "Hide";
}
.manual[open] {
  padding-bottom: 1.2rem;
}
.manual .panel-body {
  padding-top: 0.4rem;
}

.agent-panel h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 620;
  letter-spacing: -0.045em;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}

.auth-title {
  font-family: var(--font-display);
  font-size: var(--type-page);
  font-weight: 620;
  letter-spacing: -0.045em;
  margin-bottom: 0.25rem;
}
.auth-sub {
  color: var(--muted);
  font-size: var(--type-body);
  margin-bottom: 1.15rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.row {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}

button,
input,
select {
  font-family: var(--font-ui);
  font-size: var(--type-body);
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 0.55rem;
  min-height: 44px;
  padding: 0.7rem 1.15rem;
  font-weight: 600;
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:active:not(:disabled) {
  opacity: 0.88;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  min-height: 40px;
  padding: 0.4rem 0.7rem;
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--bg-hover);
}
.btn-ghost.danger:hover:not(:disabled) {
  color: var(--danger);
}
.app-nav button {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: var(--muted);
  min-height: 40px;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  font-weight: 600;
}
.app-nav button.active {
  background: var(--tint);
  color: var(--accent);
  box-shadow: none;
}
.app-nav button:hover:not(:disabled):not(.active) {
  color: var(--text);
  background: var(--bg-hover);
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 600;
}
.btn-oauth:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: color-mix(in srgb, var(--text) 22%, var(--line));
}
.btn-oauth svg {
  flex-shrink: 0;
}
.btn-oauth .hint {
  display: block;
  font-size: var(--type-caption);
  font-weight: 500;
  color: var(--faint);
  margin-top: 1px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--faint);
  font-size: var(--type-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0.15rem 0;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border-radius: 12px;
  margin-bottom: 0.85rem;
}
.toggle button {
  min-height: 40px;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
}
.toggle button.active {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--line);
}

label.field {
  display: block;
  font-size: var(--type-caption);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  outline: none;
  transition: border-color var(--dur) var(--ease);
}
input:hover,
select:hover {
  border-color: color-mix(in srgb, var(--text) 18%, var(--line));
}
input:focus,
select:focus {
  border-color: var(--accent);
}

.err {
  color: var(--danger);
  font-size: var(--type-body);
  min-height: 1.2rem;
}
.err[role="alert"] {
  font-weight: 550;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border: 0;
  padding: 0;
  margin: 0;
  min-inline-size: 0;
}
.chip {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--type-meta);
  font-weight: 600;
}
.chip:hover {
  color: var(--text);
  border-color: var(--accent);
}

.next {
  padding: 1.75rem;
  border-radius: var(--radius);
  background: var(--tint);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 255px;
}
.kicker {
  font-size: var(--type-caption);
  font-weight: 500;
  color: var(--muted);
}
.next-time {
  margin-top: 1.25rem;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.next-label {
  font-size: 1rem;
  font-weight: 500;
  margin: 0.6rem 0 0.3rem;
}
.next .btn-ghost {
  margin: auto 0 -0.5rem -0.7rem;
  padding-top: 1rem;
  color: var(--accent);
}

.tabs {
  display: flex;
  gap: 1.25rem;
  margin: 1.6rem 0 0.9rem;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  background: none;
  border-radius: 0;
  min-height: 44px;
  padding: 0.7rem 0;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tab {
  display: none;
  animation: fade var(--dur) var(--ease);
}
.tab.active {
  display: block;
}

.alarm {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 1rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--line);
  animation: fade var(--dur) var(--ease);
}
.alarm:first-child {
  border-top: 0;
}
.alarm .name {
  font-size: var(--type-input);
  font-weight: 600;
}
.meta {
  color: var(--muted);
  font-size: var(--type-meta);
}
[data-contact-email] {
  color: var(--accent);
}
.status {
  font-size: var(--type-caption);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: right;
}
.status.created {
  color: var(--accent);
}
.status.fired,
.status.rang {
  color: var(--danger);
}
.status.delivered {
  color: var(--ok);
}
.status.acknowledged {
  color: var(--ok);
}
.status.cancelled {
  color: var(--faint);
}
.kind {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.kind.message {
  color: var(--ok);
}
.kind.alarm {
  color: var(--alarm);
}
.history-message {
  color: var(--muted);
  font-size: var(--type-body);
  margin-top: 0.15rem;
}
.delivery-fail {
  color: var(--danger);
}
.history-filters {
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}
.history-filters .field {
  margin-bottom: 0.25rem;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}
.kv:first-child {
  border-top: 0;
}

.empty {
  padding: 1.4rem 0;
  color: var(--muted);
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: var(--type-caption);
  background: var(--bg);
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-size: var(--type-body);
  font-weight: 500;
}
.check input {
  width: auto;
  min-height: 0;
  accent-color: var(--accent);
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  left: 1.25rem;
  max-width: 24rem;
  margin-left: auto;
  z-index: 30;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: fade var(--dur) var(--ease);
}
.toast.ok {
  border-color: color-mix(in srgb, var(--ok) 55%, var(--line));
}
.toast.bad {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
}

.plan-picker {
  margin: 0 0 1rem;
}
.plan-picker-label {
  display: block;
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: var(--type-caption);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.plan-picker-note {
  margin: 0 0 0.7rem;
}
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.plan-card {
  display: flex;
  min-height: 7.5rem;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  text-align: left;
  font-weight: 500;
}
.plan-card small {
  color: var(--faint);
  font-size: var(--type-caption);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}
.plan-card .plan-events {
  font-family: var(--font-display);
  font-size: var(--type-section);
  font-weight: 620;
}
.plan-card .plan-price {
  color: var(--accent);
  font-size: var(--type-body);
  font-weight: 650;
}
.plan-card .plan-blurb {
  color: var(--muted);
  font-size: var(--type-caption);
  font-weight: 500;
  line-height: 1.35;
}
.plan-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.plan-card.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.plan-card.current {
  border-color: color-mix(in srgb, var(--ok) 50%, var(--line));
}
.plan-card:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.usage-track {
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.usage-track span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}
.usage-track.urgent span,
.quota-nudge.urgent {
  background: color-mix(in srgb, var(--danger) 70%, var(--accent));
}
.quota-nudge {
  margin: 1rem 0 0;
  padding: 0.75rem 0.95rem;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  font-size: var(--type-body);
  cursor: pointer;
}
.quota-nudge.blocked,
.quota-nudge.urgent {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
}
.quota-nudge button {
  margin-top: 0.55rem;
}

@media (max-width: 640px) {
  .plan-grid {
    grid-template-columns: 1fr;
  }
  .plan-card {
    min-height: 0;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .clock-colon {
    opacity: 0.7;
  }
}

.app-nav svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.app-nav-list + .app-nav-label {
  margin-top: 2rem;
}
.app-main {
  max-width: 1100px;
}
.bar {
  padding-bottom: 1rem;
}
.bar .status-dot {
  margin-left: auto;
  font-size: var(--type-caption);
}
.theme-toggle {
  order: 3;
}
.user-email {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-ecosystem {
  display: none;
}
.tab-head {
  margin-bottom: 1.8rem;
  align-items: center;
}
.tab-head .kicker {
  margin-bottom: 0.4rem;
}
.tab-head h2 {
  margin-bottom: 0.45rem;
  font-weight: 550;
}
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  width: 100%;
}
h3 {
  font-size: var(--type-body);
  font-weight: 600;
}
.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: var(--type-caption);
  color: var(--muted);
  white-space: nowrap;
}
.attention-card {
  padding: 1.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.attention-card .empty {
  padding: 3rem 0;
}
.attention-card .alarm {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 1rem 0;
}
.attention-card .alarm .name {
  font-size: var(--type-body);
}
.upcoming-section {
  margin-top: 2rem;
}
.upcoming-section > .section-heading {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.dash-card {
  min-height: 8rem;
  background: transparent;
  padding: 1.2rem;
}
.dash-card .dash-kicker {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: var(--type-meta);
  letter-spacing: 0;
  text-transform: none;
}
.dash-card strong {
  font-size: var(--type-page);
  font-weight: 500;
}
.dash-card > span:last-child {
  font-size: var(--type-caption);
}
.setup-card {
  padding: 1.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}
.setup-card h3 {
  color: var(--text);
  font-size: var(--type-section);
  margin-bottom: 0.4rem;
}
.setup-card p {
  font-size: var(--type-body);
  max-width: 38rem;
  margin-bottom: 1rem;
}
.setup-route {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
  font-family: var(--font-mono);
  font-size: var(--type-caption);
  color: var(--accent);
}
.inbox-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.inbox-tools input {
  width: 15rem;
  max-width: 100%;
}
.filter-chips {
  border: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.chip.active {
  background: var(--tint);
  border-color: var(--accent);
  color: var(--accent);
}
.alarm {
  grid-template-columns: minmax(0, 1fr) auto;
}
.alarm .name {
  overflow-wrap: anywhere;
  font-size: var(--type-body);
}
.alarm-body {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  min-width: 0;
}
.delivery-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--tint);
  color: var(--accent);
  border-radius: 11px;
}
.delivery-icon.ring {
  background: color-mix(in srgb, var(--alarm) 10%, var(--bg-elev));
  color: var(--alarm);
}
.delivery-icon svg {
  width: 18px;
  height: 18px;
}
.alarm-copy {
  min-width: 0;
}
.alarm-copy .meta {
  margin-top: 0.35rem;
  overflow-wrap: anywhere;
}
.alarm-actions {
  text-align: right;
}
.status {
  font-size: 0.66rem;
  letter-spacing: 0.02em;
}
.alarm-actions button {
  font-size: var(--type-caption);
  margin-top: 0.25rem;
}
.key-field {
  flex: 1 1 160px;
  font-size: var(--type-caption);
  color: var(--muted);
}
.key-field input,
.key-field select {
  margin-top: 0.4rem;
  color: var(--text);
}
.agent-panel > .row {
  align-items: end;
}
.agent-panel #keys-list .panel {
  border: 0;
  padding: 0;
  box-shadow: none;
}
.history-filters > div {
  flex: 1 1 130px;
}
.kv {
  align-items: center;
}
.kv > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
#tab-account .panel {
  max-width: 820px;
}
#tab-account .panel h2 {
  font-size: 1rem;
  font-weight: 600;
}
#tab-account .danger-panel {
  margin-top: 2rem !important;
}
.clock {
  font-size: clamp(3rem, 6vw, 5rem);
}
.clock-colon {
  margin: 0 0.06em;
  animation: none;
}
.clock-ss {
  margin-left: 0.4em;
}
.gate {
  gap: 3rem;
  padding: 5rem 0;
}
.clock-block {
  min-height: 0;
}
.lede {
  font-size: var(--type-section);
  line-height: 1.7;
  max-width: 24rem;
}
.quota-nudge {
  margin: 0 0 1.5rem;
}
@media (min-width: 1600px) {
  .wrap:has(#app-screen:not(.hidden)) {
    padding-top: 1.75rem;
  }
}
@media (max-width: 1000px) {
  .wrap:has(#app-screen:not(.hidden)) {
    width: calc(100% - 2.5rem);
  }
  .app-shell {
    grid-template-columns: 10rem minmax(0, 1fr);
    gap: 2rem;
  }
  .home-grid {
    grid-template-columns: 1fr;
  }
  .attention-card .empty {
    padding: 1.5rem 0;
  }
  .tab-head {
    align-items: flex-start;
  }
  .tab-head h2 {
    font-size: 1.55rem;
  }
}
@media (max-width: 760px) {
  .wrap,
  .wrap:has(#app-screen:not(.hidden)) {
    width: calc(100% - 2rem);
    padding-top: 0.75rem;
    padding-bottom: calc(6rem + env(safe-area-inset-bottom));
  }
  .bar {
    gap: 0.5rem;
  }
  .bar .status-dot {
    font-size: 0;
    gap: 0;
  }
  .user-bar {
    margin-left: auto;
  }
  .user-email {
    display: none;
  }
  .app-shell {
    display: block;
    padding-top: 1.75rem;
  }
  .app-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 20;
    background: var(--bg-elev);
    border-top: 1px solid var(--line);
    padding: 0.4rem 0.25rem calc(0.4rem + env(safe-area-inset-bottom));
    display: flex;
    gap: 0;
  }
  .app-nav-label {
    display: none;
  }
  .app-nav-list {
    flex-direction: row;
    gap: 0;
    flex: 5;
  }
  .app-nav-list:last-child {
    flex: 2;
  }
  .app-nav button {
    flex: 1;
    min-width: 0;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.6rem;
    padding: 0.5rem 0.1rem;
    text-align: center;
    justify-content: center;
    border-radius: 8px;
    min-height: 54px;
  }
  .app-nav svg {
    width: 20px;
    height: 20px;
  }
  .app-main {
    width: 100%;
  }
  .tab-head {
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
  }
  .tab-head h2 {
    font-size: 1.65rem;
  }
  .home-grid {
    gap: 1rem;
  }
  .next,
  .attention-card {
    padding: 1.25rem;
  }
  .next-time {
    font-size: 2.75rem;
  }
  .next {
    min-height: 235px;
  }
  .dash-grid {
    grid-template-columns: 1fr;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
  }
  .dash-card {
    border: 0;
    border-radius: 0;
    min-height: 0;
    padding: 1rem 1.25rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.3rem 1rem;
  }
  .dash-card + .dash-card {
    border-top: 1px solid var(--line);
  }
  .dash-card strong {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
    font-size: 1.25rem;
  }
  .dash-kicker span {
    display: none;
  }
  .gate {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 0;
  }
  .clock {
    font-size: clamp(2.8rem, 13vw, 4rem);
  }
  .lede {
    font-size: 1rem;
  }
  .panel {
    padding: 1.15rem;
  }
  .alarm,
  .attention-card .alarm {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }
  .alarm-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-left: 2.25rem;
  }
  .alarm-actions button {
    margin: 0;
  }
  .alarm-body {
    gap: 0.6rem;
  }
  .delivery-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }
  .inbox-tools input {
    width: 100%;
  }
  .toast {
    bottom: calc(5.5rem + env(safe-area-inset-bottom));
  }
  .setup-route {
    gap: 0.4rem;
    font-size: 0.58rem;
  }
  .history-filters > div {
    flex-basis: 40%;
  }
}

.connection-result {
  padding: 1.2rem;
  border: 1px solid var(--line);
  background: var(--tint);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 0.8rem;
}

/* Loading keeps the page structure stable without pretending the account is empty. */
.screen-state {
  display: grid;
  gap: 18px;
  padding: 24px 0;
  min-height: 280px;
}
.loading-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: var(--type-body);
}
.spinner,
.is-loading::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: loading-spin 800ms linear infinite;
}
.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.skeleton {
  background: var(--line);
  border-radius: var(--radius-sm);
  animation: loading-fade 1.8s ease-in-out infinite alternate;
}
.skeleton-title {
  width: 48%;
  height: 24px;
}
.skeleton-card {
  height: 180px;
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.skeleton-row {
  height: 56px;
}
.awaiting-data > :not(.screen-state):not(.tab-head) {
  display: none !important;
}
.refresh-status {
  min-height: 0;
  padding: 0 0 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.load-failed .skeleton {
  display: none;
}
.screen-state .btn-ghost {
  justify-self: start;
}
#auth-content {
  display: grid;
  gap: 16px;
}
#auth-content.hidden,
.screen-state.hidden {
  display: none;
}
dialog {
  margin: auto;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: 0 24px 90px #0003;
}
dialog::backdrop {
  background: #1118;
  backdrop-filter: blur(3px);
}
.dialog-symbol {
  color: var(--danger);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 600;
}
.btn-danger {
  background: #b44136;
  color: #fff;
  border: 1px solid #b44136;
  min-height: 48px;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-danger:not(:disabled):hover {
  background: #96372e;
}
#delete-email {
  overflow-wrap: anywhere;
  text-transform: none;
  letter-spacing: normal;
}
#delete-error:empty {
  display: none;
}
@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes loading-fade {
  to {
    opacity: 0.45;
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner,
  .is-loading::before,
  .skeleton {
    animation: none;
  }
}

.refresh-status {
  min-height: 34px;
}
.refresh-status.hidden {
  display: flex;
  visibility: hidden;
}

.loading-courier {
  width: 112px;
  height: 100px;
  object-fit: contain;
}
.load-failed .loading-courier {
  display: none;
}

/* Keep the layout and navigation visible while each independent data area arrives. */
.section-pending .next-time,
.section-pending .next-label,
.section-pending .next-detail,
.section-pending .pill,
.section-pending #attention-list,
.section-pending #upcoming-list,
.section-pending > strong,
.section-pending #dash-plan-meta {
  color: transparent;
  background: var(--line);
  border-radius: 6px;
  pointer-events: none;
  user-select: none;
  animation: loading-fade 1.8s ease-in-out infinite alternate;
}
.section-pending #attention-list *,
.section-pending #upcoming-list * {
  visibility: hidden;
}
@media (prefers-reduced-motion: reduce) {
  .section-pending * {
    animation: none !important;
  }
}

#dashboard-no-devices.section-pending {
  display: none;
}

/* Courier rests after data arrives; only pending sections animate. */
.state-courier,
.section-courier {
  display: block;
  width: 112px;
  height: 100px;
  object-fit: contain;
}
.courier-empty {
  padding: 20px 0;
}
.section-pending #next-courier {
  display: none;
}
#next-time {
  font-size: clamp(28px, 3.4vw, 52px);
  overflow-wrap: anywhere;
}

.state-courier.hidden,
.section-courier.hidden {
  display: none;
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}
dialog[aria-labelledby] h2 {
  font-size: var(--type-dialog);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
dialog .meta {
  font-size: var(--type-body);
  line-height: 1.6;
}
dialog > .meta {
  margin-top: 8px;
}
dialog .stack {
  gap: 12px;
}
dialog label.field {
  display: block;
  margin: 4px 0 0;
  font-size: var(--type-body);
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}
dialog label.field input {
  margin-top: 8px;
}
dialog input {
  font-size: var(--type-input);
  color: var(--text);
  font-weight: 400;
  letter-spacing: normal;
}
input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 18%, transparent);
}
::selection {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--text);
}
dialog .err:empty {
  display: none;
}
dialog .dialog-actions {
  margin-top: 8px;
  gap: 8px;
}
dialog > .dialog-actions {
  margin-top: 24px;
}
dialog .dialog-actions button {
  flex: 0 1 auto;
}
dialog .btn-ghost {
  border: 1px solid var(--line);
}
dialog .btn-danger {
  min-height: 44px;
  font-size: var(--type-body);
  padding: 0.7rem 1.15rem;
}
@media (max-width: 480px) {
  dialog {
    padding: 20px;
  }
  dialog .dialog-actions button {
    flex: 1 1 auto;
  }
}
.oauth-transition {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.oauth-card {
  width: min(100%, 440px);
  padding: 32px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.oauth-card h1 {
  font-size: 28px;
  margin: 16px 0 8px;
}
.oauth-card .btn-primary {
  margin-top: 24px;
}

#devices-list {
  display: grid;
  gap: 16px;
}
.phone-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-elev);
  min-width: 0;
}
.phone-card-head {
  display: flex;
  gap: 14px;
  align-items: center;
}
.phone-symbol {
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--accent);
  border-radius: 12px;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.phone-symbol svg {
  width: 26px;
  height: 26px;
}
.phone-copy {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.phone-copy h3,
.phone-copy p {
  margin: 0;
}
.phone-copy p {
  margin-top: 4px;
}
.phone-seen {
  margin: 18px 0;
}
.phone-agents {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.phone-agents > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.phone-agent {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  overflow-wrap: anywhere;
}
.phone-agent span {
  color: var(--muted);
  font-size: 12px;
}
.phone-menu {
  position: relative;
  flex-shrink: 0;
}
.phone-menu summary {
  display: grid;
  place-items: center;
  list-style: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 26px;
}
.phone-menu summary::-webkit-details-marker {
  display: none;
}
.phone-menu-items {
  position: absolute;
  right: 0;
  top: 50px;
  z-index: 5;
  width: 180px;
  padding: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px #0002;
}
.phone-menu-items button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.phone-menu-items button:hover {
  background: var(--bg);
}
.phone-menu-items .danger {
  color: var(--danger);
}
#devices-reinstall {
  margin: 18px 0;
}
@media (max-width: 600px) {
  .phone-card {
    padding: 18px;
  }
}

.nav-short {
  display: none;
}
#tab-billing .panel {
  margin-top: 0;
}
#account-plan-grid .plan-card {
  opacity: 1;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  text-align: left;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}
#account-plan-grid .plan-card:hover {
  border-color: var(--accent);
}
#account-plan-grid .plan-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-elev));
  box-shadow: inset 0 0 0 1px var(--accent);
}
#account-plan-grid .plan-card small {
  color: var(--muted);
}
#account-plan-grid .plan-card.active small {
  color: var(--accent);
}
a.legal-link,
a.legal-link:visited {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 4px;
}
a.legal-link:hover {
  text-decoration-color: currentColor;
}
.btn-danger-outline {
  border: 1px solid var(--danger);
  border-radius: 9px;
  padding: 12px 16px;
  color: var(--danger);
  background: transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.btn-danger-outline:hover {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}
#tab-account .danger-panel h2 {
  color: var(--text);
}
@media (max-width: 760px) {
  .nav-long {
    display: none;
  }
  .nav-short {
    display: inline;
  }
}

:root {
  --theme-muted: var(--muted);
  --theme-accent: var(--accent);
}

/* Appearance: a recessed switch with a stable footprint in both themes. */
:root .theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 60px;
  width: 60px;
  min-width: 60px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--theme-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 160ms ease;
}
.appearance-art {
  display: grid;
  place-items: center;
  width: 56px;
  height: 32px;
}
.appearance-art img {
  grid-area: 1 / 1;
  display: block;
  width: 56px;
  height: 32px;
  transition: opacity 320ms ease;
}
.appearance-dark {
  opacity: 0;
}
[data-theme="dark"] .appearance-light {
  opacity: 0;
}
[data-theme="dark"] .appearance-dark {
  opacity: 1;
}
:root .theme-toggle:hover {
  color: var(--theme-accent);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .appearance-art img {
    transition: none;
  }
}

.theme-toggle:hover .appearance-art {
  filter: brightness(1.08);
}
.theme-toggle:active .appearance-art {
  filter: brightness(0.94);
}

/* The thumb travels independently; repeated clicks reverse from its current position. */
.appearance-art .appearance-thumb {
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
  transform: translateX(0);
}
[data-theme="dark"] .appearance-art .appearance-thumb {
  transform: translateX(22px);
}
@media (prefers-reduced-motion: reduce) {
  .appearance-art .appearance-thumb {
    transition: none;
  }
}

.phone-connect {
  margin-top: 12px;
  border: 1px solid var(--line);
  color: var(--accent);
}
#agent-setup {
  scroll-margin-top: 24px;
}
#agent-needs-phone {
  padding: 16px;
  background: var(--tint);
  border-radius: var(--radius-sm);
}
#agent-needs-phone button,
#keys-empty button {
  align-self: flex-start;
}

.copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}
.copy-button {
  display: grid;
  padding: 10px 14px;
  min-height: 44px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
}
.copy-button:hover {
  background: var(--bg-hover);
}
.copy-button > span {
  grid-area: 1 / 1;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  transition: opacity 160ms ease;
}
.copy-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.copy-success {
  opacity: 0;
}
.copy-button.is-copied {
  color: var(--accent);
  border-color: var(--accent);
}
.copy-button.is-copied .copy-default {
  opacity: 0;
}
.copy-button.is-copied .copy-success {
  opacity: 1;
}
.copy-button.is-copied .copy-success svg {
  animation: copy-check 200ms ease-out;
}
#copy-status:not(.copy-error) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
#copy-status.copy-error {
  color: var(--danger);
}
#connection-preview {
  margin-top: 0;
}
#connection-preview summary {
  cursor: pointer;
  color: var(--muted);
  font-size: var(--type-meta);
  padding: 8px 0;
}
#connection-preview pre {
  max-height: 320px;
  overflow: auto;
}
@keyframes copy-check {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .copy-button > span {
    transition: none;
  }
  .copy-button.is-copied .copy-success svg {
    animation: none;
  }
}
