/* myOrb UI. Tokens and components follow the "myOrb Dashboard Design" design system:
   components use the custom properties below, never raw colors. */

@import url("fonts/fonts.css");

:root {
  color-scheme: dark;
  /* The screen's edges the system covers (status bar, home indicator) when myOrb is
     installed on a phone, which draws under them (viewport-fit=cover, black-translucent). */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* The screen's height: in a browser tab without Safari's own bars (dvh). */
  --screen: 100dvh;

  --bg: #07090c;
  --surface: #0d1117;
  --surface-2: #121821;
  --surface-3: #18212c;
  --field: #0a0e13;
  --line: #1f2833;
  --line-soft: #161d26;
  --line-strong: #2a3644;
  --line-accent: #1e3a44;
  --text: #e6edf3;
  --text-strong: #d3dce5;
  --text-body: #c9d4de;
  --text-2: #9aa7b4;
  --text-3: #8794a1;
  --text-done: #6b7884;
  --accent: #4fd1e8;
  --accent-hover: #8be3f2;
  --accent-ink: #04141a;
  --accent-surface: #0b1b20;
  --accent-glow: rgb(79 209 232 / 35%);

  --ok: #6ee7a0;
  --ok-line: #1f4d33;
  --ok-surface: #0e1f16;
  --live: #4ade80;
  --warn: #f5c46a;
  --warn-line: #4d3b17;
  --warn-surface: #1f180a;
  --fail: #ff8a8a;
  --fail-text: #ffb3b3;
  --fail-line: #5a2326;
  --fail-surface: #21100f;
  --info: #7dddf0;
  --info-line: #1a4450;
  --info-surface: #0b1b20;
  --neutral: #b4c0cc;

  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --font-num: "Barlow Condensed", var(--font-sans);

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-6: 24px;
  --s-8: 32px;
  --s-12: 48px;

  --r-badge: 4px;
  --r-control: 6px;
  --r-card: 10px;
  --r-dialog: 12px;
}

/* Installed on the home screen there are no browser bars, and iOS takes the status bar out of
   dvh although the page is drawn under it (black-translucent): the page and the dialogs ended
   short of the bottom. vh is the whole screen there. */
@media (display-mode: standalone) {
  :root {
    --screen: 100vh;
  }
}

/* Base */

[hidden] {
  display: none !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

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

h1,
h2,
h3 {
  margin: 0;
  font-weight: 500;
}

code,
.mono {
  font-family: var(--font-mono);
}

.label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.num {
  font-family: var(--font-num);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
}

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

.trunc {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Page layout */

.page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1600px;
  margin: 0 auto;
  /* Below the status bar and its blur when installed (max() put the logo right under it). */
  padding: calc(18px + var(--safe-top)) 28px calc(40px + var(--safe-bottom));
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-6);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--text);
}

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

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px rgb(79 209 232 / 45%);
}

.brand-mark::after {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.brand-name {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.32em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}

.nav a,
.nav button {
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  background: none;
  border: 0;
  border-radius: var(--r-control);
  cursor: pointer;
}

.nav a:hover,
.nav button:hover {
  color: var(--text);
}

.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.topbar-end {
  margin-left: auto;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: 6px;
}

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

.page-title h1 {
  margin-top: var(--s-1);
  font-size: 26px;
}

/* Dashboard grid: 12 columns on desktop, 2 on tablets, 1 on phones */

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s-4);
  align-items: stretch;
}

.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
.rows-2 { grid-row: span 2; }

@media (max-width: 1180px) {
  .span-3,
  .span-4 { grid-column: span 6; }
  .span-6,
  .span-8 { grid-column: span 12; }
  .rows-2 { grid-row: auto; }
}

@media (max-width: 720px) {
  .page {
    padding: calc(14px + var(--safe-top)) 12px calc(32px + var(--safe-bottom));
  }

  .grid > * {
    grid-column: 1 / -1;
  }

  .topbar {
    gap: var(--s-3);
  }

  .topbar-end {
    margin-left: 0;
  }
}

/* Widget card */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--line-soft);
}

.card-header > svg {
  flex: none;
  color: var(--accent);
}

.card-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-strong);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--live);
  border-radius: 50%;
  box-shadow: 0 0 6px rgb(74 222 128 / 60%);
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 14px 16px;
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
}

.card-action {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card.is-error {
  border-color: var(--fail-line);
}

.card.is-error .card-header > svg {
  color: var(--fail);
}

.card.is-stale .card-body {
  opacity: 0.75;
}

.card.is-empty .card-body {
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  text-align: center;
}

.empty-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--accent);
  border: 1px dashed #2e5560;
  border-radius: 50%;
}

/* Hero card: HUD corner ticks and glow. Only for the main briefing card. */

.card.hero {
  border-color: var(--line-accent);
  box-shadow:
    0 0 0 1px rgb(79 209 232 / 8%),
    0 0 48px -18px var(--accent-glow);
}

.hud-corners::before,
.hud-corners::after,
.hud-corners > .hud-corner-b::before,
.hud-corners > .hud-corner-b::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 0 solid var(--accent);
  opacity: 0.9;
  pointer-events: none;
}

.hud-corners::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
  border-top-left-radius: var(--r-card);
}

.hud-corners::after {
  top: -1px;
  right: -1px;
  border-width: 2px 2px 0 0;
  border-top-right-radius: var(--r-card);
}

.hud-corners > .hud-corner-b::before {
  bottom: -1px;
  left: -1px;
  border-width: 0 0 2px 2px;
  border-bottom-left-radius: var(--r-card);
}

.hud-corners > .hud-corner-b::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 2px 2px 0;
  border-bottom-right-radius: var(--r-card);
}

/* Loading skeleton: static shapes, no animation */

.skeleton {
  height: 12px;
  background: #151c25;
  border-radius: var(--r-badge);
}

/* Lists and sections inside cards */

.section-label {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #1a222c;
}

.list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list > li {
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
}

.list > li:first-child {
  padding-top: 0;
  border-top: 0;
}

.list a:not(.btn) {
  color: var(--text);
}

.list a:not(.btn):hover {
  color: var(--accent);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.row.spread {
  justify-content: space-between;
}

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

.account-name {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--info);
}

/* Badges: color always comes with a glyph and a word */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid;
  border-radius: var(--r-badge);
}

.badge-ok { color: var(--ok); background: var(--ok-surface); border-color: var(--ok-line); }
.badge-warn { color: var(--warn); background: var(--warn-surface); border-color: var(--warn-line); }
.badge-fail { color: var(--fail); background: var(--fail-surface); border-color: var(--fail-line); }
.badge-info { color: var(--info); background: var(--info-surface); border-color: var(--info-line); }
.badge-neutral { color: var(--neutral); background: var(--surface-2); border-color: var(--line-strong); }

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font: 500 13px var(--font-sans);
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  cursor: pointer;
}

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

.btn-primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover {
  color: var(--accent-ink);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:focus-visible {
  outline-color: var(--text);
}

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

.btn-danger {
  color: var(--fail);
  background: var(--fail-surface);
  border-color: var(--fail-line);
}

.btn-danger:hover {
  color: var(--fail);
  background: #2c1414;
  border-color: var(--fail-line);
}

.btn-danger:focus-visible {
  outline-color: var(--fail);
}

.btn-large {
  height: 48px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
}

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

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

/* Forms */

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > .label {
  color: var(--neutral);
}

.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font: 15px var(--font-sans);
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

/* Safari on an iPhone zooms into a field whose text is smaller than 16px when it is tapped. */
@media (pointer: coarse) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

.input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgb(79 209 232 / 18%);
}

.input[aria-invalid="true"] {
  border-color: #ff6b6b;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid;
  border-radius: 8px;
}

.alert-tag {
  flex: none;
  padding-top: 1px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.alert-error {
  color: var(--fail-text);
  background: var(--fail-surface);
  border-color: var(--fail-line);
}

.alert-error .alert-tag {
  color: var(--fail);
}

.alert-success {
  color: var(--ok);
  background: var(--ok-surface);
  border-color: var(--ok-line);
}

.alert-info {
  color: var(--text-body);
  background: var(--accent-surface);
  border-color: var(--info-line);
}

.alert-info .alert-tag {
  color: var(--info);
}

.alert-warn {
  color: var(--warn);
  background: var(--warn-surface);
  border-color: var(--warn-line);
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Panels (settings pages) */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
}

.panel-header .label {
  color: var(--text-strong);
}

.panel-section {
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
}

/* Stacked content gets spacing; flex rows (.actions) and forms space their items with gap. */
.panel-section:not(.actions, .form) > * + * {
  margin-top: var(--s-3);
}

.panel-narrow {
  max-width: 44rem;
}

/* Sign-in, setup and other standalone pages */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 16px;
  background-image:
    linear-gradient(#0e141a 1px, transparent 1px),
    linear-gradient(90deg, #0e141a 1px, transparent 1px);
  background-position: center;
  background-size: 48px 48px;
}

.auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  width: 100%;
  max-width: 400px;
}

.login-orb {
  position: relative;
  width: 112px;
  height: 112px;
}

.login-orb span {
  position: absolute;
  border-style: solid;
  border-radius: 50%;
}

/* Rings turn at different speeds and directions; the core pulses. */
.login-orb span:nth-child(1) {
  inset: 0;
  border-width: 1px;
  border-color: var(--accent) var(--line-accent) var(--line-accent);
  animation: orb-spin 40s linear infinite;
}

.login-orb span:nth-child(2) {
  inset: 8px;
  border-width: 2px;
  border-color: var(--accent) transparent;
  animation: orb-spin 6s linear infinite;
}

.login-orb span:nth-child(3) {
  inset: 14px;
  border-width: 1px;
  border-color: transparent #f2b84b transparent transparent;
  opacity: 0.8;
  animation: orb-spin-reverse 9s linear infinite;
}

.login-orb span:nth-child(4) {
  inset: 22px;
  border-width: 1px;
  border-style: dashed;
  border-color: #2e5560;
  animation: orb-spin-reverse 18s linear infinite;
}

.login-orb span:nth-child(5) {
  inset: 36px;
  border-width: 2px;
  border-color: var(--accent);
  background: var(--accent-surface);
  box-shadow: 0 0 30px -2px rgb(79 209 232 / 55%);
  animation: orb-pulse 3.2s ease-in-out infinite;
}

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

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

@keyframes orb-pulse {
  0%,
  100% {
    box-shadow: 0 0 22px -4px rgb(79 209 232 / 45%);
    transform: scale(0.96);
  }

  50% {
    box-shadow: 0 0 38px 0 rgb(79 209 232 / 75%);
    transform: scale(1.04);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-orb span {
    animation: none;
  }
}

.auth-title {
  text-align: center;
}

.auth-title .brand-name {
  padding-left: 0.4em;
  font-size: 20px;
  letter-spacing: 0.4em;
}

.auth-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-dialog);
}

.auth-card h1 {
  font-size: 20px;
}

.auth-card.hud-corners::before {
  width: 14px;
  height: 14px;
  border-top-left-radius: var(--r-dialog);
}

.auth-card.hud-corners::after {
  display: none;
}

/* It only holds the bottom corners: over the card, not a row of its own, which would add a gap
   above the first line. */
.auth-card > .hud-corner-b {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.auth-card > .hud-corner-b::before {
  display: none;
}

.auth-card > .hud-corner-b::after {
  width: 14px;
  height: 14px;
  border-bottom-right-radius: var(--r-dialog);
}

.auth-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

/* Integrations */

.integration {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
}

.integration-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--info);
  background: var(--surface-2);
  border: 1px solid rgb(125 221 240 / 33%);
  border-radius: 8px;
}

.integration-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-2);
}

.integration-name strong {
  font-weight: 500;
}

/* Get started on the Integrations page: the steps in order, each ticked by what works. */

.setup {
  margin-bottom: 8px;
  border-color: var(--line-accent);
}

.setup-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(80px, 160px) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
}

.setup-head .label {
  margin: 0;
  color: var(--accent);
}

.setup-sub,
.setup-detail {
  font-size: 12.5px;
}

.setup-progress {
  height: 4px;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.setup-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.setup-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
}

.setup-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: 12px;
  color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.setup-step.is-done .setup-mark {
  color: var(--ok);
  border-color: var(--ok-line);
  background: var(--ok-surface);
}

.setup-step.is-done .setup-title strong,
.setup-step.is-blocked {
  color: var(--text-3);
}

.setup-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.setup-show {
  margin-top: 16px;
}

.link-btn {
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
}

@media (max-width: 720px) {
  .setup-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .setup-progress {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .setup-step {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .setup-step .actions {
    grid-column: 2;
  }
}

/* Integrations: each service in its own panel, its connected accounts below it */

.services-title {
  margin: 8px 0 -4px;
}

.services {
  display: grid;
  gap: 12px;
}

.service .integration:first-child {
  border-top: 0;
}

.account {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  padding: 10px 18px 10px 72px;
  /* A shade lighter than the service above, so its accounts read as one group under it. */
  background: var(--surface-2);
  border-top: 1px solid var(--line-soft);
}

/* The last account follows the panel's rounded corners (the panel does not clip: menus open
   beyond it). */
.service > .account:last-child {
  border-radius: 0 0 calc(var(--r-card) - 1px) calc(var(--r-card) - 1px);
}

.account .capabilities {
  grid-column: 1 / -1;
}

.capabilities {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.capabilities li {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: var(--s-3);
  align-items: start;
}

@media (max-width: 720px) {
  .integration {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .integration > .actions {
    grid-column: 1 / -1;
  }

  .capabilities li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* Setup wizard */

.steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: var(--s-3);
  padding: 18px;
  border-top: 1px solid var(--line-soft);
  counter-increment: step;
}

.steps > li::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  border: 1px solid var(--line-accent);
  border-radius: 50%;
}

.steps h2 {
  margin-bottom: 6px;
  font-size: 15px;
}

.steps p,
.steps ul {
  margin: 0 0 var(--s-2);
  color: var(--text-body);
}

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

.copy code {
  padding: 8px 12px;
  overflow-wrap: anywhere;
  background: var(--field);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
}

/* Calendar widget */

.events {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.event {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.event-time {
  padding-top: 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
}

.event-body {
  min-width: 0;
  padding: 7px 10px;
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  border-radius: var(--r-control);
}

.event-body a {
  color: var(--text);
}

.event-body a:hover {
  color: var(--accent);
}

.event-title {
  font-size: 13.5px;
  font-weight: 500;
}

.event-sub {
  font-size: 12px;
  color: var(--text-2);
}

.event.is-past .event-body {
  opacity: 0.55;
}

.event.is-now .event-body {
  display: flex;
  align-items: center;
  padding: 6px 0;
  background: none;
  border: 0;
}

.event.is-now .event-body::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--fail);
}

/* Tasks page */

.task-add {
  gap: var(--s-2);
  flex-wrap: nowrap;
  /* The button as tall as the field. */
  align-items: stretch;
}

.task-add .btn {
  height: auto;
}

.label.overdue {
  color: var(--fail);
}

.task-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
}

.task-row.is-done > span:nth-child(2) {
  color: var(--text-done);
  text-decoration: line-through;
}

.task-check {
  display: block;
  width: 18px;
  height: 18px;
  padding: 0;
  background: var(--field);
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  cursor: pointer;
}

.task-check:hover {
  border-color: var(--accent);
}

.task-check.checked {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2304141a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 14px no-repeat;
  border-color: var(--accent);
}

.task-edit {
  display: grid;
  /* The title on a line of its own, as long as it needs; when it is due under it. */
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  gap: var(--s-2);
  align-items: center;
}

.task-repeat {
  margin-left: 6px;
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
}

.task-edit .input {
  height: 36px;
  font-size: 14px;
}

.task-edit .input[name="title"] {
  grid-column: 1 / -1;
}

/* Safari on iOS draws date and time fields its own way: wider than their column (the time ran
   off the screen), taller than the other fields and centered. Without its appearance they
   take the size given here. */
.task-edit input[type="date"],
.task-edit input[type="time"] {
  min-width: 0;
  appearance: none;
}

.task-edit ::-webkit-date-and-time-value {
  min-height: 1lh;
  text-align: left;
}

/* Phone: after the rules it adjusts. The title on a line of its own, then the date and the
   time with their names above them, since an empty one shows nothing at all on an iPhone. */
@media (max-width: 720px) {
  .task-edit {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 6px;
  }

  .task-edit .input[name="title"] {
    grid-column: 1 / -1;
  }

  .task-edit-label {
    position: static;
    grid-row: 2;
    width: auto;
    height: auto;
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    color: var(--text-3);
    text-transform: uppercase;
    clip-path: none;
  }

  .task-edit-label[for^="time-"],
  .task-edit input[type="time"] {
    grid-column: 2;
  }

  .task-edit input[type="date"],
  .task-edit input[type="time"] {
    grid-row: 3;
  }

  .task-edit .btn {
    margin-top: 6px;
  }
}

/* Setup instructions on connect pages */

.instructions ol,
.instructions ul {
  margin: 0;
  padding-left: 1.2em;
  color: var(--text-body);
}

.instructions li + li {
  margin-top: 6px;
}

/* A list inside a step: its items closer together than the steps. */
.instructions li > ul {
  margin: 6px 0;
}

.instructions li > ul li + li {
  margin-top: 2px;
}

/* A guide in parts: each part's title above its steps. */
.instructions h3 {
  margin: 22px 0 8px;
  color: var(--text-strong);
}

.instructions p {
  margin: 12px 0 0;
}

/* Radio choices */

.choices {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
}

.choice:has(input:checked) {
  background: var(--accent-surface);
  border-color: var(--accent);
}

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

.choice > span {
  display: grid;
  gap: 2px;
}

.manifest {
  max-height: 220px;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  font: 12px var(--font-mono);
  color: var(--text-body);
  background: var(--field);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
}


/* Media dock: sound and music controls in the bottom-right corner, on every page */

.media-dock {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, var(--safe-bottom));
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.media-dock > * {
  pointer-events: auto;
}

.music-player.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.dock-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  background: rgb(13 17 23 / 85%);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(8px);
}

/* On a phone the controls would cover the page (on its side, the orb); a video started from
   the details still shows. After .dock-controls, so it wins over it. */
@media (max-width: 720px), (orientation: landscape) and (max-height: 560px) {
  .dock-controls {
    display: none;
  }
}

.page {
  padding-bottom: 72px;
}

.btn-small {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

[data-toggle="sounds"],
.dock-controls [data-toggle="video"],
.dock-controls [data-toggle="volume"] {
  width: 34px;
  padding: 0;
}

[data-toggle="sounds"] .sound-on,
[data-toggle="sounds"][aria-pressed="true"] .sound-off {
  display: none;
}

[data-toggle="sounds"][aria-pressed="true"] .sound-on {
  display: inline;
}

.music {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.volume {
  display: flex;
  align-items: center;
  gap: 6px;
}

.media-dock .volume {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px -12px rgb(0 0 0 / 80%);
}

.media-dock .volume[hidden] {
  display: none;
}

.media-dock .volume label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.volume input {
  width: 90px;
  accent-color: var(--accent);
}

.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.eq i {
  display: block;
  width: 2px;
  height: 12px;
  background: var(--accent);
  transform: scaleY(0.3);
  transform-origin: bottom;
}

.eq.on i { animation: eq 1.4s ease-in-out infinite; }
.eq.on i:nth-child(2) { animation-delay: 0.3s; }
.eq.on i:nth-child(3) { animation-delay: 0.7s; }
.eq.on i:nth-child(4) { animation-delay: 0.15s; }

@keyframes eq {
  0%,
  100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

.music-player {
  width: min(356px, calc(100vw - 40px));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-accent);
  border-radius: var(--r-card);
  box-shadow: 0 20px 50px -20px rgb(0 0 0 / 80%), 0 0 40px -20px var(--accent-glow);
}

/* Only on a phone, where the dock with its video button is not shown: ✕ in a row over the
   video hides it. */
.music-player-head {
  display: none;
}

@media (max-width: 720px), (orientation: landscape) and (max-height: 560px) {
  .music-player-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 6px 12px;
  }

  .music-player-head .icon-btn {
    width: 26px;
    height: 26px;
  }
}

.dock-controls [data-toggle="video"][aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--line-accent);
}

.music-player iframe {
  display: block;
  width: 100%;
  height: 200px;
  border: 0;
}

/* The logo breathes, as in the design */

@keyframes logo-pulse {
  0%,
  100% { transform: scale(0.92); box-shadow: 0 0 6px -2px rgb(79 209 232 / 40%); }
  50% { transform: scale(1.08); box-shadow: 0 0 18px 2px rgb(79 209 232 / 75%); }
}

@keyframes logo-dot {
  0%,
  100% { opacity: 0.55; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

.brand-mark {
  animation: logo-pulse 2.6s ease-in-out infinite;
}

.brand-mark::after {
  animation: logo-dot 2.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark,
  .brand-mark::after {
    animation: none;
  }
}

/* Integrations → Voice */

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

.voice-section[hidden] {
  display: none;
}

.voice-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.voice-row[hidden] {
  display: none;
}

.preload {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
  cursor: pointer;
}

/* On a phone the voice's name needs the width: the language above it, Try and Preload below. */
@media (max-width: 720px) {
  .voice-row {
    grid-template-columns: auto auto minmax(0, 1fr);
    row-gap: 8px;
  }

  .voice-row > label:first-child,
  .voice-row > select {
    grid-column: 1 / -1;
  }
}

.voice-note {
  font-size: 12.5px;
}

/* Media dock: finding music */

.music-finder {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 40px));
  max-height: min(460px, calc(100vh - 140px));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-accent);
  border-radius: var(--r-card);
  box-shadow: 0 20px 50px -20px rgb(0 0 0 / 80%), 0 0 40px -20px var(--accent-glow);
}

.music-finder[hidden] {
  display: none;
}

.finder-search {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.finder-search .input {
  flex: 1;
  min-width: 0;
  height: 32px;
  font-size: 13px;
}

.finder-results {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 10px;
  overflow-y: auto;
}

.finder-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.finder-section > .label {
  padding: 0 4px 4px;
}

.finder-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 6px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
}

.finder-item:hover,
.finder-item:focus-visible {
  background: rgb(79 209 232 / 6%);
  border-color: var(--line-accent);
}

.finder-thumb {
  display: block;
  width: 64px;
  height: 36px;
  overflow: hidden;
  background: #121821;
  border-radius: 4px;
}

.finder-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.finder-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.finder-title,
.finder-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finder-title {
  font-size: 13px;
  color: var(--text-strong);
}

.finder-meta {
  font-size: 11.5px;
  color: var(--text-3);
}

.finder-message {
  margin: 4px;
  font-size: 13px;
  color: var(--text-3);
}

.dock-controls [data-toggle="finder"] {
  width: 34px;
  padding: 0;
}

/* Uptime settings: a monitor's group, edited in the list */

.monitor-group {
  display: flex;
  gap: 6px;
}

.monitor-group {
  align-items: center;
}

.monitor-group .input {
  width: 180px;
  height: 34px;
}

.monitor-group .saved-note {
  width: 64px;
  color: var(--ok);
  opacity: 0;
  transition: opacity 0.3s;
}

.monitor-group.saved .saved-note {
  opacity: 1;
}

/* Remove, or the Uptime Kuma badge in its place: one width, so the group fields line up. */
.monitor-end {
  display: flex;
  justify-content: flex-end;
  width: 96px;
}

/* Uptime settings: adding a monitor on the left, the monitors on the right */

.uptime-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .uptime-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Profile and security: the profile on the left, passkeys and the password on the right */

.settings-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.settings-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 900px) {
  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A button waiting for an answer: a spinner in front of its label (htmx requests as well) */

.btn.is-loading,
.btn.htmx-request,
form.htmx-request .btn[type="submit"] {
  gap: 8px;
  cursor: progress;
}

.btn.is-loading::before,
.btn.htmx-request::before,
form.htmx-request .btn[type="submit"]::before {
  content: "";
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spin 0.8s linear infinite;
}

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

/* Checkboxes to choose parts of an account, e.g. Asana workspaces */

.choice-list {
  display: grid;
  gap: 2px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}

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

.choice input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* The assistant's color in the profile: round swatches to pick from */

.color-field {
  border: 0;
  margin: 0;
  padding: 0;
}

/* A legend is not a flex item, so the field's gap misses it; its own browser padding goes. */
.color-field > legend {
  padding: 0;
  margin-bottom: 8px;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.color-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 10px -2px var(--swatch);
}

.color-swatch:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-surface);
}

.color-swatch:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* A field with buttons next to it, e.g. a token with Generate and Copy */

.input-row {
  display: flex;
  gap: 8px;
}

.input-row .input {
  flex: 1;
  min-width: 0;
}

.input-row .btn {
  height: 44px; /* as tall as the field */
}

/* Integrations as tiles: a logo, a name and how it is, five or six to a row (three on a
   phone). A click opens the service's panel in a dialog. */
.service-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
}

.service-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.service-tile:hover,
.service-tile:focus-visible {
  background: var(--surface-2);
  border-color: var(--line-accent);
}

.service-tile-name {
  max-width: 100%;
  font-weight: 500;
}

.service-tile-status {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--text-3);
}

.service-tile-status::before {
  flex: none;
  width: 7px;
  height: 7px;
  content: "";
  background: var(--line-strong);
  border-radius: 50%;
}

.service-tile.is-ok .service-tile-status::before { background: var(--ok); }
.service-tile.is-fail { border-color: var(--fail-line); }
.service-tile.is-fail .service-tile-status { color: var(--fail); }
.service-tile.is-fail .service-tile-status::before { background: var(--fail); }
.service-tile.is-plain .service-tile-status::before { display: none; }

.service-dialog {
  width: min(760px, calc(100% - 32px));
  max-height: calc(100dvh - 64px);
  padding: 0;
  overflow: auto;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-accent);
  border-radius: var(--r-dialog);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 85%);
}

.service-dialog::backdrop {
  background: rgb(3 6 8 / 74%);
  backdrop-filter: blur(6px);
}

.service-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 10px 18px;
}

.service-dialog > .alert {
  margin: 0 12px 10px;
}

/* The dialog is the panel: no second frame inside it, the whole width for the service. */
.service-dialog > .service {
  margin: 0;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.service-dialog > .service > .account:last-child {
  border-radius: 0;
}

/* Narrower than the page: the numbers go under the name. */
.service-dialog .integration.service-head {
  grid-template-columns: 40px minmax(0, 1fr) auto;
}

.service-dialog .pace {
  grid-column: 2 / -1;
  grid-row: 2;
}

@media (max-width: 720px) {
  .service-dialog .pace {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .service-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .service-tile {
    gap: 8px;
    padding: 10px;
  }

  .service-tile-name {
    font-size: 13px;
  }

  .service-tile-status {
    font-size: 11px;
  }

  .service-dialog {
    max-height: calc(100dvh - env(safe-area-inset-top) - 24px);
    margin-top: calc(env(safe-area-inset-top) + 12px);
  }
}

/* Integrations: how often a service is asked, and an account's actions in a menu */

/* The numbers sit in the middle of the row, in fixed columns that line up from service to
   service: two slots of the same width, and a fixed width for the buttons after them. */
.integration.service-head {
  grid-template-columns: 40px minmax(0, 1fr) 328px 220px;
}

.integration.service-head > .actions {
  justify-content: flex-end;
}

.pace {
  display: grid;
  grid-template-columns: 160px 160px;
  gap: 8px;
}

.pace-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pace-stat .num {
  font-family: var(--font-num);
  font-size: 18px;
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
}

.pace-stat .num small {
  margin-left: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--warn);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pace-stat .label {
  font-size: 9.5px;
  white-space: nowrap;
}

.pace-stat.warn {
  border-color: var(--warn-line);
}

@media (max-width: 1100px) {
  .integration.service-head {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  .pace {
    grid-column: 2 / -1;
    grid-row: 2;
  }
}

/* Phone: after the rules it adjusts. Two 160 px tiles are wider than the row's second column
   (about 300 px), so they ran off the screen: the whole width under the logo, half each, and
   the label may wrap. The accounts below need no indent to line up with the logo either. */
@media (max-width: 720px) {
  .pace {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-column: 1 / -1;
  }

  .pace-stat .label {
    white-space: normal;
  }

  .account {
    padding-left: 18px;
  }
}

.menu {
  position: relative;
}

.menu > summary {
  list-style: none;
  font-size: 16px;
  line-height: 1;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 16px 40px -12px rgb(0 0 0 / 70%);
}

.menu-panel form {
  display: contents;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 6px;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-3);
}

.menu-item.is-danger {
  margin-top: 4px;
  color: var(--fail);
  border-top: 1px solid var(--line);
  border-radius: 0 0 6px 6px;
}

/* A brand icon in a service's logo, tinted in myOrb's color like the letters it replaces */

.brand-icon {
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* The pace tile as a choice: it opens the paces to choose from */

.pace-menu > summary {
  list-style: none;
  cursor: pointer;
}

.pace-menu > summary::-webkit-details-marker {
  display: none;
}

.pace-stat.is-choice:hover,
.pace-menu[open] > .pace-stat {
  border-color: var(--accent);
}

.pace-caret {
  font-size: 11px;
  color: var(--text-3);
}

.pace-menu .menu-panel {
  right: auto;
  left: 0;
  min-width: 100%;
}

.menu-item.is-default {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 6px 6px;
}

.menu-item.is-chosen::after {
  float: right;
  color: var(--accent);
  content: "✓";
}

/* Reading an email: the conversation's messages, the newest open */

.email-subject {
  overflow-wrap: anywhere;
}

/* Back sits in the top right corner, beside the subject however long it is. */
.email-title {
  flex-wrap: nowrap;
  align-items: flex-start;
}

.email-title > div {
  flex: 1;
  min-width: 0;
}

.email-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.email-top {
  position: sticky;
  z-index: 2;
  top: 0;
  padding-bottom: 14px;
  background: var(--bg);
}

.email-top .email-actions {
  margin-top: 14px;
}

.email-actions form {
  margin: 0;
}

.email-actions .email-actions-end {
  margin-left: auto;
}

/* The rest of the actions: in the row on a wide screen, behind ⋮ on a phone. */
.email-actions-wide {
  display: contents;
}

.email-more {
  position: relative;
  display: none;
  margin-left: auto;
}

.email-more > summary {
  list-style: none;
}

.email-more > summary::-webkit-details-marker {
  display: none;
}

.email-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgb(0 0 0 / 55%);
}

.email-more-menu .btn,
.email-more-menu form {
  width: 100%;
}

/* Rows of the menu, not buttons: only the menu has a border. */
.email-more-menu .btn {
  justify-content: flex-start;
  background: none;
  border-color: transparent;
}

.email-more-menu .btn:hover {
  background: var(--surface-3);
  border-color: transparent;
}

@media (max-width: 760px) {
  .email-actions-wide {
    display: none;
  }

  /* One line on a phone: a little tighter, ⋮ as narrow as the others are tall. */
  .email-actions {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .email-actions > form,
  .email-actions > .btn {
    flex: 0 1 auto;
    min-width: 0;
  }

  .email-actions .btn {
    padding: 0 11px;
    white-space: nowrap;
  }

  .email-more {
    display: block;
    flex: none;
  }

  .email-more > summary.btn {
    padding: 0 10px;
  }
}

.email-star {
  color: var(--warn);
}

/* The reply panel, between the email's notes and its messages */

.email-draft-place:empty {
  display: none;
}

.email-draft {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  /* No box of its own: the reply's field is the only frame, as wide as it can be. */
}

.email-draft-head,
.email-draft-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.email-draft-head {
  justify-content: space-between;
}

.email-draft-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.email-draft-body {
  height: auto;
  min-height: 18rem;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

.email-draft-all {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-2);
}

/* A forward's note is a few lines, not a whole reply. */
.email-forward-body {
  min-height: 6rem;
}

.email-forward-note {
  padding: 0;
  border-top: 0;
  color: var(--text-2);
}

/* While Claude writes or Gmail saves: the buttons wait. */
.email-draft-busy {
  display: none;
}

.email-draft-form:is(.htmx-request, :has(.htmx-request)) .email-draft-busy {
  display: inline;
}

.email-draft-form:is(.htmx-request, :has(.htmx-request)) .btn {
  pointer-events: none;
  opacity: 0.55;
}

.email-note {
  margin: 0 auto 16px;
  font-size: 13px;
}

.email-images {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 4px auto 16px;
  font-size: 13px;
  text-align: center;
}

.email-message {
  margin-bottom: 12px;
  overflow: hidden;
}

.email-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  background: var(--surface-3);
  list-style: none;
}

.email-head::-webkit-details-marker {
  display: none;
}

.email-when {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 4px 8px;
  align-items: flex-end;
}

/* The email's own HTML, on white as it was written; sized to its content by the page. */
.email-frame {
  display: block;
  width: 100%;
  min-height: 120px;
  background: #fff;
  border: 0;
  border-top: 1px solid var(--line);
}

.email-text {
  padding: 16px 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-top: 1px solid var(--line);
}

.email-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 14px 18px;
  list-style: none;
  border-top: 1px solid var(--line);
}

/* An attachment as a card, as in Gmail: its picture (or type) above its name. */
.attachment-card {
  display: flex;
  flex-direction: column;
  width: 180px;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.attachment-card:hover {
  border-color: var(--accent);
}

.attachment-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 110px;
  overflow: hidden;
  background: #fff;
}

.attachment-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* Without a picture, the type in large letters. */
.attachment-type {
  font-family: var(--font-mono);
  font-size: 22px;
  color: #9aa4ad;
}

.attachment-name {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px 10px;
  font-size: 12.5px;
}

.attachment-label {
  flex: none;
  padding: 2px 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  background: #6b7680;
  border-radius: 3px;
}

.attachment-label.kind-pdf {
  background: #e5483b;
}

.attachment-label.kind-img {
  background: #2f8ae0;
}

@media (max-width: 720px) {
  .email-head {
    flex-direction: column;
    padding: 12px 14px;
  }

  .email-when {
    flex-direction: row;
    align-items: center;
  }
}


/* "Music on" and "Music off" take the same room, so the dock keeps still when it changes:
   the longer one, unseen and flat, under the text sets the width. */
.music-label {
  display: inline-flex;
  flex-direction: column;
}

.music-label::after {
  content: "Music off";
  height: 0;
  overflow: hidden;
  visibility: hidden;
}

/* The key that does what a button does, e.g. M on Mark as read in an email. */
.btn-key {
  margin-left: 8px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid currentcolor;
  border-radius: 4px;
  opacity: 0.6;
}

@media (hover: none) and (pointer: coarse) {
  .btn-key {
    display: none;
  }
}

/* The public demo's note in the header, flashing when a change was turned down (app.js) */
.demo-flash {
  animation: demo-flash 1.6s ease-out;
}

@keyframes demo-flash {
  0%, 40% { color: var(--warn); }
}

/* The command palette (palette.js, ⌘K): a search line and what it finds, near the top. */
.palette {
  width: min(640px, calc(100% - 32px));
  max-height: min(560px, calc(100vh - 96px));
  margin: 12vh auto auto;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: #0b0f14;
  border: 1px solid var(--line-accent);
  border-radius: 14px;
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 85%), 0 0 60px -22px rgb(79 209 232 / 45%);
}

.palette[open] {
  display: flex;
  flex-direction: column;
}

.palette::backdrop {
  background: rgb(3 6 8 / 74%);
  backdrop-filter: blur(6px);
}

.palette-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.palette-prompt {
  font-family: var(--font-mono);
  color: var(--accent);
}

.palette-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: none;
  border: 0;
  outline: none;
}

.palette-list {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.palette-item {
  display: grid;
  grid-template-columns: 96px minmax(0, auto) minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 9px 10px;
  cursor: pointer;
  border-radius: 8px;
}

.palette-item[aria-selected="true"] {
  background: var(--surface-3);
  box-shadow: inset 2px 0 0 var(--accent);
}

.palette-kind {
  overflow: hidden;
  font-size: 10px;
  color: var(--text-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-title {
  font-weight: 500;
}

.palette-detail {
  font-size: 12.5px;
}

.palette-close {
  flex: none;
}

.palette-empty {
  padding: 12px 10px;
}

.palette-foot {
  padding: 8px 16px;
  font-size: 10px;
  color: var(--text-3);
  border-top: 1px solid var(--line-soft);
}

/* On a phone: below the notch and above the keyboard's reach, with no keys to explain. */
@media (max-width: 600px) {
  .palette {
    max-height: calc(100dvh - env(safe-area-inset-top) - 32px);
    margin-top: calc(env(safe-area-inset-top) + 12px);
  }

  .palette-foot {
    display: none;
  }

  .palette-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

/* A row the palette went to, in its details. */
.modal-row.is-found {
  animation: palette-found 1.8s ease-out;
}

@keyframes palette-found {
  0%, 30% { background: var(--surface-3); box-shadow: inset 2px 0 0 var(--accent); }
}
