/* ==========================================================================
   Orbit design system — shared core

   This block is identical in Orbit AI (static/css/app.css), Orbit Mission
   Control (static/css/auth.css) and Orbit Mail (static/css/mail.css), apart
   from the .brand__logo rule noted below. Each app appends its own
   components after it. Keep the copies in sync.

   Direction
   ---------
   Monochrome. Light mode is white paper with black ink and a black accent;
   dark mode is true black with white ink and a white accent. Neutrals carry
   no hue at all, so the only colour on the page is semantic status (danger,
   success, warning). The brand mark is rendered black on light and white on
   dark. Everything else is quiet.

   Theming follows the operating system by default; the theme control sets
   `data-theme` on <html>:

     (no attribute)      -> follow the system
     data-theme="light"  -> force light
     data-theme="dark"   -> force dark

   Dark values are defined twice on purpose — once for the system preference
   and once for the explicit override — so the two can never drift apart.
   Every text token clears WCAG AA (4.5:1) on the surfaces it is used on.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens — light
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Surfaces, flattest to most raised. Pure neutral, no cast. */
  --bg: #ffffff;
  --bg-subtle: #f7f7f7;
  --bg-raised: #ffffff;
  --bg-inset: #efefef;
  --bg-hover: #f2f2f2;
  --bg-active: #e6e6e6;
  --sidebar-bg: #f7f7f7;

  /* Hairlines. */
  --border: #e4e4e4;
  --border-strong: #cfcfcf;

  /* Text. */
  --text: #111111;
  --text-muted: #4d4d4d;   /* 7.5:1 on --bg */
  --text-faint: #6b6b6b;   /* 5.3:1 on --bg */

  /* Brand is black. */
  --brand: #111111;
  --brand-bright: #333333;

  /* The accent is the brand. */
  --accent: #111111;
  --accent-hover: #2a2a2a;
  --accent-soft: #efefef;
  --accent-soft-text: #111111;
  --accent-text: #ffffff;
  --accent-ring: rgba(0, 0, 0, 0.22);
  --link: #111111;

  --danger: #b42318;
  --danger-hover: #912018;
  --danger-soft: #fef3f2;
  --danger-text: #ffffff;

  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;

  /* User message bubble (Orbit AI). */
  --bubble-user: #efefef;
  --bubble-user-text: #111111;

  --scrim: rgba(0, 0, 0, 0.45);

  /* Radii — generous, to match the friendly mark. */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  /* Elevation. Neutral black at low alpha so shadows read as depth. */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 24px -12px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.05), 0 20px 48px -16px rgba(0, 0, 0, 0.28);

  --ring: 0 0 0 3px var(--accent-ring);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.2, 0, 0.13, 1);
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 260ms;
}

/* --------------------------------------------------------------------------
   Tokens — dark
   -------------------------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #000000;
    --bg-subtle: #0a0a0a;
    --bg-raised: #141414;
    --bg-inset: #1c1c1c;
    --bg-hover: #1a1a1a;
    --bg-active: #262626;
    --sidebar-bg: #0a0a0a;

    --border: #262626;
    --border-strong: #3a3a3a;

    --text: #f5f5f5;
    --text-muted: #a8a8a8;
    --text-faint: #8a8a8a;

    --brand: #ffffff;
    --brand-bright: #e5e5e5;

    --accent: #ffffff;
    --accent-hover: #e5e5e5;
    --accent-soft: #1f1f1f;
    --accent-soft-text: #e5e5e5;
    --accent-text: #0a0a0a;
    --accent-ring: rgba(255, 255, 255, 0.32);
    --link: #ffffff;

    --danger: #f87171;
    --danger-hover: #fca5a5;
    --danger-soft: #2a1515;
    --danger-text: #1a0808;

    --success: #4ade80;
    --success-soft: #0f2a1c;
    --warning: #fbbf24;
    --warning-soft: #2b2110;

    --bubble-user: #1f1f1f;
    --bubble-user-text: #f0f0f0;

    --scrim: rgba(0, 0, 0, 0.62);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -8px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 56px -16px rgba(0, 0, 0, 0.75);
  }
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #000000;
  --bg-subtle: #0a0a0a;
  --bg-raised: #141414;
  --bg-inset: #1c1c1c;
  --bg-hover: #1a1a1a;
  --bg-active: #262626;
  --sidebar-bg: #0a0a0a;

  --border: #262626;
  --border-strong: #3a3a3a;

  --text: #f5f5f5;
  --text-muted: #a8a8a8;
  --text-faint: #8a8a8a;

  --brand: #ffffff;
  --brand-bright: #e5e5e5;

  --accent: #ffffff;
  --accent-hover: #e5e5e5;
  --accent-soft: #1f1f1f;
  --accent-soft-text: #e5e5e5;
  --accent-text: #0a0a0a;
  --accent-ring: rgba(255, 255, 255, 0.32);
  --link: #ffffff;

  --danger: #f87171;
  --danger-hover: #fca5a5;
  --danger-soft: #2a1515;
  --danger-text: #1a0808;

  --success: #4ade80;
  --success-soft: #0f2a1c;
  --warning: #fbbf24;
  --warning-soft: #2b2110;

  --bubble-user: #1f1f1f;
  --bubble-user-text: #f0f0f0;

  --scrim: rgba(0, 0, 0, 0.62);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 56px -16px rgba(0, 0, 0, 0.75);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

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

body {
  min-height: 100%;
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

.prose a,
.message a,
.notice a,
.text-link {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-fast) var(--ease);
}
.prose a:hover,
.message a:hover,
.notice a:hover,
.text-link:hover { text-decoration-color: var(--link); }

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.95rem; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

img, svg { max-width: 100%; }
img { display: block; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

code, pre, kbd, samp {
  font-family: var(--mono);
  font-size: 0.875em;
}

code {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.1em 0.4em;
}

pre {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
  line-height: 1.55;
}

pre code { background: none; border: none; padding: 0; font-size: 1em; }

kbd {
  display: inline-block;
  padding: 0.05em 0.45em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  background: var(--bg-raised);
  font-size: 0.78em;
  line-height: 1.5;
}

blockquote {
  margin: 0 0 1em;
  padding-left: 14px;
  border-left: 2px solid var(--border-strong);
  color: var(--text-muted);
}

ul, ol { margin: 0 0 1em; padding-left: 1.35em; }
li { margin: 0.2em 0; }

table { border-collapse: collapse; }

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

::selection { background: var(--accent-soft); color: var(--text); }
::-moz-focus-inner { border: 0; }

/* Icons inherit colour and sit on the text baseline. */
.icon {
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: -0.18em;
}

/* --- Scrollbars --------------------------------------------------------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 550;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}

.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn:active { background: var(--bg-active); transform: translateY(0.5px); }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-text);
}
.btn--primary:active { background: var(--accent); }

.btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-muted);
}
.btn--ghost:hover { background: var(--bg-hover); color: var(--text); border-color: transparent; }

.btn--soft {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-soft-text);
  box-shadow: none;
}
.btn--soft:hover { background: var(--accent-soft); filter: brightness(0.97); }

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

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

.btn--block { width: 100%; }
.btn--sm { min-height: 32px; padding: 5px 11px; font-size: 0.8rem; gap: 6px; border-radius: var(--radius-xs); }
.btn--lg { min-height: 46px; padding: 11px 22px; font-size: 0.95rem; border-radius: var(--radius); }
.btn--pill { border-radius: var(--radius-pill); }

.btn .icon { margin: 0 -2px; }

/* Icon-only buttons. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  line-height: 1;
  flex: 0 0 auto;
  padding: 0;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn:active { background: var(--bg-active); }
.icon-btn[aria-expanded="true"] { background: var(--bg-active); color: var(--text); }
.icon-btn--bordered { border: 1px solid var(--border-strong); background: var(--bg-raised); box-shadow: var(--shadow-sm); }
.icon-btn--lg { width: 38px; height: 38px; }
.icon-btn.is-success { color: var(--success); }

/* Segmented control. */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.segmented .btn {
  min-height: 30px;
  padding: 4px 12px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  font-weight: 500;
}
.segmented .btn:hover { background: var(--bg-raised); color: var(--text); }
.segmented .btn.is-active {
  background: var(--bg-raised);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.segmented .btn .count {
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

.field__label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.field__hint {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin: 6px 0 0;
  line-height: 1.5;
}

.field__hint a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }

.field__error {
  font-size: 0.78rem;
  color: var(--danger);
  margin: 6px 0 0;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="tel"],
input:not([type]),
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

textarea { resize: vertical; min-height: 96px; line-height: 1.55; }

select {
  cursor: pointer;
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23657189' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238291ab' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}
[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238291ab' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

input:disabled, select:disabled, textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg-inset);
  box-shadow: none;
}

input::placeholder, textarea::placeholder { color: var(--text-faint); opacity: 1; }

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

input[type="checkbox"],
input[type="radio"] {
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
  box-shadow: none;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  margin-bottom: 12px;
  cursor: pointer;
  line-height: 1.45;
  color: var(--text);
}
.checkbox:last-child { margin-bottom: 0; }
.checkbox input { margin-top: 2px; }
.checkbox__hint { display: block; font-size: 0.78rem; color: var(--text-faint); margin-top: 2px; }

/* Input with a leading icon. */
.input-icon { position: relative; }
.input-icon > .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.input-icon > input { padding-left: 36px; }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }

.card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 650;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.card__title .icon { color: var(--text-faint); }

.card__subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}
.card__subtitle:last-child { margin-bottom: 0; }

.card--flush { padding: 0; overflow: hidden; }
.card--soft { background: var(--bg-subtle); box-shadow: none; }
.card--accent { border-color: var(--accent); box-shadow: var(--shadow); }

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.card__header > div:first-child { min-width: 0; }
.card__header .card__subtitle { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
  background: var(--bg-inset);
  color: var(--text-muted);
  border: 1px solid transparent;
  white-space: nowrap;
  vertical-align: middle;
}
.badge .icon { width: 12px; height: 12px; }

.badge--accent { background: var(--accent-soft); color: var(--accent-soft-text); }
.badge--outline { background: transparent; border-color: var(--border-strong); color: var(--text-muted); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--premium { background: var(--accent-soft); color: var(--accent-soft-text); }
.badge--pro { background: var(--accent); color: var(--accent-text); }
.badge--free { background: var(--bg-inset); color: var(--text-muted); }
.badge--muted { background: var(--bg-inset); color: var(--text-muted); }
.badge--personal { background: var(--bg-inset); color: var(--text-muted); }
.badge--link { text-decoration: none; }
.badge--link:hover { background: var(--accent-soft); color: var(--accent-soft-text); text-decoration: none; }

/* --------------------------------------------------------------------------
   Flash messages (Django messages framework)
   -------------------------------------------------------------------------- */

.messages { list-style: none; margin: 0 0 18px; padding: 0; }

.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.message:last-child { margin-bottom: 0; }
.message > .icon { margin-top: 2px; flex: 0 0 auto; }

.message--success { border-color: color-mix(in srgb, var(--success) 35%, var(--border)); }
.message--success > .icon { color: var(--success); }
.message--info { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.message--info > .icon { color: var(--accent); }
.message--warning { border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.message--warning > .icon { color: var(--warning); }
.message--error {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
  font-weight: 500;
}
.message--error > .icon { color: var(--danger); }

/* --------------------------------------------------------------------------
   Avatars
   -------------------------------------------------------------------------- */

.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  flex: 0 0 auto;
  overflow: hidden;
  line-height: 1;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--soft { background: var(--accent-soft); color: var(--accent-soft-text); }
.avatar--neutral { background: var(--bg-inset); color: var(--text-muted); }
.avatar--square { border-radius: var(--radius-sm); }
.avatar--sm { width: 24px; height: 24px; font-size: 0.6rem; }
.avatar--lg { width: 40px; height: 40px; font-size: 0.85rem; border-radius: 12px; }
.avatar--xl { width: 56px; height: 56px; font-size: 1.1rem; border-radius: 16px; }

/* --------------------------------------------------------------------------
   Dropdown menus
   -------------------------------------------------------------------------- */

.menu { position: relative; }

.menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
  display: none;
  max-height: min(440px, 70vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.menu__panel.is-open { display: block; animation: menu-in var(--dur) var(--ease); }
.menu__panel--up { top: auto; bottom: calc(100% + 6px); }
.menu__panel--left { right: auto; left: 0; }

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.menu__panel--up.is-open { animation-name: menu-in-up; }
@keyframes menu-in-up {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-xs);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.menu__item .icon { color: var(--text-faint); }
.menu__item:hover { background: var(--bg-hover); }
.menu__item:hover .icon { color: var(--text); }
.menu__item--danger { color: var(--danger); }
.menu__item--danger .icon { color: var(--danger); }
.menu__item--danger:hover { background: var(--danger-soft); color: var(--danger); }
.menu__item__value { margin-left: auto; color: var(--text-faint); font-weight: 500; font-size: 0.78rem; }
.menu__divider { height: 1px; background: var(--border); margin: 6px 4px; }
.menu__label {
  padding: 8px 10px 4px;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* --------------------------------------------------------------------------
   Meter
   -------------------------------------------------------------------------- */

.meter {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-active);
  overflow: hidden;
}
.meter__fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width var(--dur-slow) var(--ease);
}
.meter__fill--warning { background: var(--warning); }
.meter__fill--danger { background: var(--danger); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  font-weight: 650;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table tr:last-child td { border-bottom: none; }
.table td:last-child, .table th:last-child { text-align: right; }
.table--numeric td, .table--numeric th { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Empty states
   -------------------------------------------------------------------------- */

.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}
.empty__icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--bg-inset);
  color: var(--text-faint);
  margin-bottom: 14px;
}
.empty__title {
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.empty__body { max-width: 44ch; margin: 0 auto; font-size: 0.9rem; }
.empty .btn { margin-top: 18px; }

/* --------------------------------------------------------------------------
   Site chrome — marketing nav and footer
   -------------------------------------------------------------------------- */

.site {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.site__main { flex: 1 1 auto; }

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}

.nav__links {
  display: flex;
  gap: 6px;
  margin-left: auto;
  align-items: center;
  font-size: 0.875rem;
}

.nav__link {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav__link:hover { background: var(--bg-hover); color: var(--text); }
.nav__link.is-active { color: var(--text); }

.nav__sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  letter-spacing: -0.02em;
  min-width: 0;
  text-decoration: none;
}

/* The mark is the inline "orbit-mail" icon, drawn in currentColor, so it is
   black on light pages, white on dark ones and white in the black command
   bar without any filter. (Orbit AI and Mission Control use a bitmap mark
   and a filter here; this is the one intentional difference in the core.) */
.brand__logo {
  height: 28px;
  width: auto;
  flex: 0 0 auto;
  display: block;
  vertical-align: middle;
}

.brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand__sub {
  display: block;
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  margin-top: auto;
}
.footer__inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-faint);
}
.footer__brand { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-weight: 600; }
.footer__links { display: flex; gap: 4px; flex-wrap: wrap; }
.footer__links a {
  color: var(--text-faint);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
}
.footer__links a:hover { color: var(--text); background: var(--bg-hover); }

/* --------------------------------------------------------------------------
   Entrance — sign in, sign up, reset, and every other allauth screen
   -------------------------------------------------------------------------- */

.entrance {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 64px;
  position: relative;
}

.entrance__card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow);
  position: relative;
}

.entrance__mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-soft);
  margin: 0 0 18px;
}
.entrance__mark img,
.entrance__mark svg { height: 30px; width: auto; display: block; }
.entrance__mark { color: var(--accent-soft-text); }

.entrance__title {
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
}
.entrance__lede {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 22px;
  line-height: 1.5;
}
.entrance__card form { margin: 0; }
.entrance__card .field { margin-bottom: 14px; }
.entrance__card .stack > * + * { margin-top: 14px; }
.entrance__actions { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.entrance__actions .btn { width: 100%; min-height: 42px; }
.entrance__card h1 { font-size: 1.45rem; letter-spacing: -0.025em; margin-bottom: 6px; }
.entrance__card h2 { font-size: 0.95rem; margin: 0 0 10px; color: var(--text-muted); font-weight: 600; }
.entrance__card p { font-size: 0.9rem; color: var(--text-muted); }
.entrance__card hr { margin: 18px 0; }

.entrance__footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.entrance__meta {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-faint);
}
.entrance__meta a { padding: 2px 6px; border-radius: var(--radius-xs); }
.entrance__meta a:hover { color: var(--text); background: var(--bg-hover); }

/* "or" divider between the password form and third-party providers. */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-faint);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.providers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.providers .btn { width: 100%; justify-content: center; min-height: 42px; font-weight: 550; }
.providers .btn .icon { width: 18px; height: 18px; }

/* Decorative orbit rings behind an entrance card. Pure CSS, no images. */
.orbit-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.orbit-bg::before,
.orbit-bg::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 14%, transparent);
  transform: translate(-50%, -50%);
}
.orbit-bg::before { width: 680px; height: 680px; }
.orbit-bg::after { width: 1040px; height: 1040px; border-color: color-mix(in srgb, var(--accent) 8%, transparent); }
.orbit-bg__glow {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 720px;
  height: 520px;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
}
.entrance > *:not(.orbit-bg) { position: relative; z-index: 1; }

/* --------------------------------------------------------------------------
   Prose (legal and about pages)
   -------------------------------------------------------------------------- */

.prose { max-width: 68ch; }
.prose h1 { font-size: 2rem; margin-bottom: 8px; }
.prose h2 { font-size: 1.15rem; margin: 36px 0 10px; }
.prose h3 { font-size: 0.98rem; margin: 24px 0 8px; }
.prose p, .prose li { color: var(--text-muted); font-size: 0.95rem; line-height: 1.7; }
.prose ul, .prose ol { padding-left: 20px; }
.prose .lede { font-size: 1.05rem; color: var(--text-muted); }
.prose__meta { font-size: 0.8rem; color: var(--text-faint); margin-bottom: 28px; }

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.stack > * + * { margin-top: 16px; }
.stack--sm > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.row--top { align-items: flex-start; }
.row--end { justify-content: flex-end; }
.row--center { justify-content: center; }
.row--tight { gap: 6px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions--end { justify-content: flex-end; }
.actions--center { justify-content: center; }
.actions--spaced { margin-top: 20px; }
.grow, .flex-1 { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.accent { color: var(--accent); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.74rem; }
.strong { font-weight: 600; }
.mono { font-family: var(--mono); font-size: 0.85em; }
.tabular { font-variant-numeric: tabular-nums; }
.center, .text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.gap-3 { gap: 14px; }
.weight-normal { font-weight: 500; }
.entrance__mark--center { margin-left: auto; margin-right: auto; }
.entrance__mark--danger { background: var(--danger-soft); }
.grid-span { grid-column: 1 / -1; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.px-1 { padding-left: 8px; padding-right: 8px; }
.pt-2 { padding-top: 16px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.shell { margin: 0 auto; width: 100%; }
.shell--xs { max-width: 420px; }
.shell--sm { max-width: 560px; }
.shell--md { max-width: 720px; }
.shell--lg { max-width: 960px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Eyebrow label above a heading. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Key/value definition rows. */
.kv { display: flex; flex-direction: column; gap: 0; }
.kv__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.kv__row:last-child { border-bottom: none; }
.kv__key { color: var(--text-muted); }
.kv__value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* --------------------------------------------------------------------------
   Motion, contrast and print
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .btn, .card, .badge, .menu__panel, .entrance__card, .avatar { border: 1px solid CanvasText; }
  .meter__fill { background: Highlight; }
  .icon-btn { border: 1px solid transparent; }
}

@media (max-width: 640px) {
  .nav { padding: 12px 16px; gap: 12px; }
  .nav__links { gap: 2px; }
  .nav__link { padding: 7px 8px; }
  .footer { padding: 22px 16px; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
  .entrance { padding: 24px 16px 48px; }
  .entrance__card { padding: 24px 20px; border-radius: var(--radius-lg); }
}


/* ==========================================================================
   Orbit Mail — application components

   Layout follows Outlook: a thin app rail on the far left (Mail / Calendar /
   Admin), a folder pane, the conversation list, and a reading pane, with a
   command bar across the top of the list and reading pane.

   The theme is the shared monochrome one. The command bar is the one black
   surface in light mode (white ink on #111, like Mission Control's entrance
   panel); in dark mode it sits one step off the page black and takes a
   hairline. Sender avatars and the default calendar colour are neutral so
   the only colour in the window is semantic status and the calendar swatches
   people choose themselves.
   ========================================================================== */

:root {
  --topbar-h: 52px;
  --rail-w: 68px;
  --folders-w: 236px;
  --list-w: 380px;
  --cal-side-w: 256px;

  /* The command bar: black ink in both themes. */
  --topbar-bg: #111111;
  --topbar-text: #ffffff;
  --topbar-border: transparent;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --topbar-bg: #0a0a0a;
    --topbar-text: #f5f5f5;
    --topbar-border: var(--border);
  }
}
[data-theme="dark"] {
  --topbar-bg: #0a0a0a;
  --topbar-text: #f5f5f5;
  --topbar-border: var(--border);
}

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */

body.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-subtle);
}

.topbar {
  flex: 0 0 var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 0 10px;
  background: var(--topbar-bg);
  color: var(--topbar-text);
  border-bottom: 1px solid var(--topbar-border);
  z-index: 30;
}
.topbar .icon-btn { color: rgba(255, 255, 255, 0.86); }
.topbar .icon-btn:hover,
.topbar .icon-btn.is-active,
.topbar .icon-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.14); color: #fff; }
.topbar__menu { display: none; }
.topbar__brand { color: inherit; gap: 9px; min-width: 150px; }
.topbar__brand .brand__logo { height: 26px; }
.topbar__brand .brand__name { font-size: 0.98rem; }
.topbar__search { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.topbar__actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  width: min(620px, 100%);
}
.search > .icon { position: absolute; left: 12px; color: var(--text-faint); pointer-events: none; }
.search input[type="search"] {
  min-height: 36px;
  padding-left: 38px;
  padding-right: 34px;
  border-radius: var(--radius-sm);
  border-color: transparent;
  background: var(--bg-raised);
  box-shadow: none;
  font-size: 0.875rem;
}
.search input:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28); border-color: transparent; }
.search__clear {
  position: absolute;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
  color: var(--text-faint);
}
.search__clear:hover { background: var(--bg-hover); color: var(--text); }
.search--plain { width: 320px; }
.search--plain input { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.avatar-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  padding: 0;
}
.avatar-btn .avatar { width: 30px; height: 30px; background: rgba(255, 255, 255, 0.92); color: #111111; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28); }
.topbar .menu__panel { min-width: 260px; color: var(--text); }
.menu__account { display: flex; align-items: center; gap: 12px; padding: 10px 10px 6px; }
.menu__account-text { display: flex; flex-direction: column; min-width: 0; font-size: 0.85rem; }
.topbar .menu__panel form { margin: 0; }

.app__body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

.rail {
  flex: 0 0 var(--rail-w);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 10px 8px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
}
.rail__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px 7px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.rail__icon { display: grid; place-items: center; width: 36px; height: 30px; border-radius: var(--radius-sm); }
.rail__item:hover { color: var(--text); background: var(--bg-hover); }
.rail__item.is-active { color: var(--accent); }
.rail__item.is-active .rail__icon { background: var(--accent-soft); color: var(--accent-soft-text); }
.rail__spacer { flex: 1 1 auto; }

.workspace {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

/* Toasts: flash messages float over the workspace and fade out. */
.toasts {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 60;
  width: min(380px, calc(100% - 32px));
  pointer-events: none;
}
.toasts .message { pointer-events: auto; box-shadow: var(--shadow-lg); animation: toast-in var(--dur) var(--ease); align-items: center; }
.toasts .message.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.toast__close { width: 26px; height: 26px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.landing .toasts { position: fixed; }

/* --------------------------------------------------------------------------
   Mail window
   -------------------------------------------------------------------------- */

.mailwin,
.calwin {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: var(--folders-w) minmax(0, 1fr);
  min-height: 0;
}
.calwin { grid-template-columns: var(--cal-side-w) minmax(0, 1fr); }

.folders,
.calside {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 10px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.folders__compose { width: 100%; margin-bottom: 12px; }
.folders__account {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.folders__account:hover { background: var(--bg-hover); }
.folders__account--static { cursor: default; color: var(--text-muted); }
.folders__account--static:hover { background: transparent; }
.folders__account .icon { color: var(--text-faint); margin-left: auto; }
.folders__mailbox .menu__panel { width: 100%; }
.folders__nav { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; }
.folders__group {
  padding: 12px 10px 4px;
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.folders__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 500;
  position: relative;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.folders__item .icon { color: var(--text-faint); }
.folders__item span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folders__item:hover { background: var(--bg-hover); color: var(--text); }
.folders__item.is-active { background: var(--bg-active); color: var(--text); font-weight: 600; }
.folders__item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}
.folders__item.is-active .icon { color: var(--accent); }
.folders__count {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.folders__footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

.mail-main,
.cal-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* Command bar. */
.cmdbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 48px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.cmdbar::-webkit-scrollbar { display: none; }
.cmdbar .btn--ghost { font-weight: 500; }
.cmdbar .btn .icon { color: var(--text-faint); }
.cmdbar .btn:hover .icon { color: var(--accent); }
.cmdbar .btn--primary .icon,
.cmdbar .btn--primary:hover .icon { color: inherit; }
.cmdbar__sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; flex: 0 0 auto; }
.cmdbar__back { display: none; }
.cmdbar__new { margin-right: 4px; }
.cmdbar__title { font-size: 1rem; margin: 0 8px; white-space: nowrap; letter-spacing: -0.01em; }
.cmdbar__selection { margin-left: 8px; font-size: 0.78rem; color: var(--text-faint); white-space: nowrap; }
.cmdbar__right { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.cmdbar .menu__panel { min-width: 200px; }
.cmdbar .menu__panel .menu__item { white-space: nowrap; }

.mail-panes {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: var(--list-w) minmax(0, 1fr);
  min-height: 0;
}
.mail-panes--compose { grid-template-columns: minmax(0, 1fr); }

/* Conversation list. */
.list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.list form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.list__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 8px 12px;
  border-bottom: 1px solid var(--border);
}
.list__selectall { display: grid; place-items: center; width: 26px; height: 26px; }
.list__title { font-size: 0.95rem; margin: 0; min-width: 0; }
.list__meta { margin-left: auto; white-space: nowrap; }
.list__items { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; }
.list__empty .empty { padding: 48px 20px; }
.list__pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
}

.row {
  display: flex;
  align-items: stretch;
  position: relative;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.list .row { gap: 0; }
.row__check {
  display: grid;
  place-items: center;
  width: 36px;
  flex: 0 0 36px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.row:hover .row__check,
.row.is-selected .row__check,
.row.is-checked .row__check,
.list.has-selection .row__check { opacity: 1; }
@media (hover: none) { .row__check { opacity: 1; } }
.row__link {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px 10px 0;
  color: inherit;
}
.row:hover { background: var(--bg-hover); }
.row.is-selected { background: var(--accent-soft); }
.row.is-selected::before,
.row.is-unread::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.row.is-unread::before { background: var(--brand-bright); }
.row.is-checked { background: var(--bg-active); }
.row__avatar { width: 34px; height: 34px; font-size: 0.72rem; }
.row__body { display: flex; flex-direction: column; min-width: 0; gap: 1px; font-size: 0.84rem; }
.row__top { display: flex; align-items: baseline; gap: 8px; }
.row__from { flex: 1 1 auto; min-width: 0; font-weight: 500; color: var(--text); }
.row.is-unread .row__from { font-weight: 700; }
.row__time { font-size: 0.72rem; color: var(--text-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row.is-unread .row__time { color: var(--accent); font-weight: 600; }
.row__subject { color: var(--text); font-weight: 450; }
.row.is-unread .row__subject { font-weight: 650; color: var(--accent); }
.row__count {
  display: inline-block;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-inset);
  color: var(--text-faint);
  font-size: 0.66rem;
  font-weight: 600;
  vertical-align: 1px;
}
.row__snippet { color: var(--text-faint); font-size: 0.78rem; }
.row__flags { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; color: var(--text-faint); padding-top: 18px; }
.row__flag { color: var(--warning); }

/* Avatar buckets so senders are distinguishable at a glance. The theme is
   monochrome, so the buckets are four weights of ink rather than hues; each
   pair inverts cleanly in dark mode through the tokens. */
.hue-0, .hue-4 { background: var(--accent); color: var(--accent-text); }
.hue-1, .hue-5 { background: var(--text-muted); color: var(--bg); }
.hue-2, .hue-6 { background: var(--text-faint); color: var(--bg); }
.hue-3, .hue-7 { background: var(--bg-active); color: var(--text); }

/* Reading pane. */
.reading {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg);
}
.reading__empty { height: 100%; display: grid; place-items: center; }
.thread { padding: 20px 28px 40px; max-width: 980px; }
.thread__head { padding-bottom: 14px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.thread__subject { font-size: 1.3rem; margin: 0 0 6px; letter-spacing: -0.02em; }
.thread__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.thread__messages { display: flex; flex-direction: column; gap: 10px; }

.msg {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  box-shadow: var(--shadow-sm);
}
.msg--out { border-color: color-mix(in srgb, var(--accent) 24%, var(--border)); }
.msg--draft { border-style: dashed; }
.msg__summary {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
}
.msg__summary:hover { background: var(--bg-hover); }
.msg.is-open .msg__summary { border-radius: var(--radius) var(--radius) 0 0; }
.msg__avatar { width: 38px; height: 38px; font-size: 0.78rem; }
.msg__who { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.msg__from { font-weight: 650; font-size: 0.92rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.msg__to { font-size: 0.78rem; color: var(--text-muted); }
.msg__time { font-size: 0.78rem; color: var(--text-faint); white-space: nowrap; }
.msg__body { display: none; padding: 4px 16px 16px; }
.msg.is-open .msg__body { display: block; }
.msg__details { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 6px 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.msg__details b { font-weight: 600; color: var(--text-muted); }
.msg__text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; font-size: 0.95rem; }
.msg__text a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.msg__html { width: 100%; min-height: 120px; border: none; background: #fff; border-radius: var(--radius-sm); display: block; }
.msg__plain { margin-top: 10px; }
.msg__plain .msg__text { margin-top: 8px; padding: 10px 12px; background: var(--bg-inset); border-radius: var(--radius-sm); font-size: 0.85rem; }
.msg__score { margin-bottom: 10px; }
.msg__score ul { margin: 6px 0 0; padding-left: 18px; }
.msg__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 0.85rem;
  margin-bottom: 14px;
  line-height: 1.5;
}
.notice > .icon { flex: 0 0 auto; margin-top: 2px; }
.notice--warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.notice--warning > .icon { color: var(--warning); }
.notice--danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.notice--danger > .icon { color: var(--danger); }
.notice__list { margin: 4px 0 4px; padding-left: 16px; font-size: 0.8rem; color: var(--text-muted); }

.attachments { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.attachment__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  font-size: 0.82rem;
  color: var(--text);
}
a.attachment__link:hover { border-color: var(--accent); background: var(--bg-hover); }
.attachment__icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-xs); background: var(--accent-soft); color: var(--accent-soft-text); flex: 0 0 auto; }
.attachment__name { font-weight: 500; }

/* Compose. */
.reading--compose { display: flex; flex-direction: column; }
.compose { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-width: 1000px; width: 100%; }
.compose__bar { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.compose__attach input { display: none; }
.compose__fields { padding: 6px 20px 0; }
.compose__field {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.compose__field--cc { display: none; }
.compose__field--cc.is-shown { display: flex; }
.compose__label { flex: 0 0 60px; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.compose__field input {
  flex: 1 1 auto;
  min-height: 40px;
  border: none;
  box-shadow: none;
  border-radius: 0;
  background: transparent;
  padding: 8px 0;
}
.compose__field input:focus { box-shadow: none; }
.compose__ccbtn { border: none; background: transparent; color: var(--link); cursor: pointer; font: inherit; font-size: 0.78rem; padding: 4px 6px; border-radius: var(--radius-xs); }
.compose__ccbtn:hover { background: var(--bg-hover); }
.compose__attachments { padding: 0 20px; margin-top: 10px; }
.compose__body {
  flex: 1 1 auto;
  margin: 10px 20px 0;
  min-height: 260px;
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 8px 0;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: none;
}
.compose__body:focus { box-shadow: none; }
.compose__signature { padding: 6px 20px 0; display: flex; align-items: center; gap: 6px; }
.compose__hint { padding: 8px 20px 16px; margin: 0; }

/* --------------------------------------------------------------------------
   Pages with a sub-navigation (settings, admin)
   -------------------------------------------------------------------------- */

.page { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 28px 32px 48px; }
.page--center { display: grid; place-items: center; }
.page--settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; }
.page__title { font-size: 1.5rem; letter-spacing: -0.025em; margin-bottom: 4px; }
.page__lede { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 22px; max-width: 72ch; line-height: 1.6; }
.page__content { max-width: 760px; min-width: 0; }
.page__content--wide { max-width: 1080px; }
.page__content .card + .card,
.page__content .card + form,
.page__content form + .card,
.page__content form.card + .card,
.page__content .grid-2 + .card,
.page__content .card + .grid-2 { margin-top: 16px; }

.subnav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }
.subnav__title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); font-weight: 650; padding: 4px 10px 10px; margin: 0; }
.subnav__group { padding: 16px 10px 4px; font-size: 0.66rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.subnav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
}
.subnav__item .icon { color: var(--text-faint); }
.subnav__item:hover { background: var(--bg-hover); color: var(--text); }
.subnav__item.is-active { background: var(--accent-soft); color: var(--accent-soft-text); font-weight: 600; }
.subnav__item.is-active .icon { color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.grid-2 .card + .card { margin-top: 0; }
.w-auto { width: auto; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: inherit;
  box-shadow: var(--shadow-sm);
}
a.stat:hover { border-color: var(--accent); }
.stat__label { font-size: 0.74rem; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.stat__value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat__value small { font-size: 0.9rem; color: var(--text-faint); font-weight: 500; margin-left: 4px; }
.stat--accent { border-color: var(--accent); }
.stat--danger { border-color: var(--danger); }
.stat--danger .stat__value { color: var(--danger); }

.copyable {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
}
.copyable code, .copyable pre { flex: 1 1 auto; min-width: 0; background: none; border: none; padding: 0; margin: 0; font-size: 0.85rem; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.copyable--block { align-items: flex-start; }
.copyable--inline { display: inline-flex; padding: 2px 4px 2px 8px; gap: 4px; max-width: 100%; }
.copyable--inline code { font-size: 0.8rem; }
.copyable .btn.is-done { color: var(--success); border-color: var(--success); }
.table--records td { vertical-align: middle; }
.table--records td:last-child, .table--records th:last-child { text-align: left; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.85rem; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); transition: background var(--dur-fast) var(--ease); flex: 0 0 auto; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--dur-fast) var(--ease); box-shadow: var(--shadow-sm); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--ring); }

.mailbox-add { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.mailbox-add__address { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-raised); box-shadow: var(--shadow-sm); min-width: 0; }
.mailbox-add__address input { border: none; box-shadow: none; min-width: 0; }
.mailbox-add__address input:focus { box-shadow: none; }
.mailbox-add__at { padding: 0 10px; color: var(--text-faint); font-size: 0.85rem; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Calendar
   -------------------------------------------------------------------------- */

.cal-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.mini { margin: 4px 0 8px; }
.mini__head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; }
.mini__title { font-size: 0.85rem; font-weight: 650; }
.mini__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: 6px; }
.mini__dow { text-align: center; font-size: 0.62rem; font-weight: 650; color: var(--text-faint); padding: 2px 0; }
.mini__day { display: grid; place-items: center; aspect-ratio: 1; border-radius: var(--radius-xs); font-size: 0.74rem; color: var(--text); font-variant-numeric: tabular-nums; }
.mini__day:hover { background: var(--bg-hover); }
.mini__day.is-out { color: var(--text-faint); opacity: 0.7; }
.mini__day.is-focus { background: var(--bg-active); font-weight: 600; }
.mini__day.is-today { background: var(--accent); color: var(--accent-text); font-weight: 700; }

.callist { list-style: none; margin: 0; padding: 0; }
.callist__item { display: flex; align-items: center; gap: 10px; padding: 5px 10px; font-size: 0.86rem; border-radius: var(--radius-sm); }
.callist__item:hover { background: var(--bg-hover); }
.callist__item form { display: contents; }
.callist__toggle { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--swatch, var(--accent)); background: transparent; color: var(--swatch-on, #fff); cursor: pointer; padding: 0; flex: 0 0 auto; }
.callist__toggle.is-on { background: var(--swatch, var(--accent)); }
.callist__item span { flex: 1 1 auto; min-width: 0; }
.callist__delete { width: 24px; height: 24px; opacity: 0; }
.callist__item:hover .callist__delete { opacity: 1; }

/* Calendar colours. "navy" is the default and the brand colour, so it is
   ink: black in light mode, white in dark mode. The rest are the colours
   people pick for their own calendars and stay as they are. */
.swatch-navy { --swatch: #111111; --swatch-soft: #efefef; --swatch-text: #111111; --swatch-on: #ffffff; }
.swatch-blue { --swatch: #1a56c9; --swatch-soft: #e6eefc; --swatch-text: #14429b; }
.swatch-teal { --swatch: #0f766e; --swatch-soft: #e0f2f0; --swatch-text: #0b5a54; }
.swatch-green { --swatch: #15803d; --swatch-soft: #e3f3e8; --swatch-text: #11652f; }
.swatch-amber { --swatch: #b45309; --swatch-soft: #fdf1e2; --swatch-text: #8a3f06; }
.swatch-rose { --swatch: #be123c; --swatch-soft: #fbe7ec; --swatch-text: #960e2f; }
.swatch-violet { --swatch: #6d28d9; --swatch-soft: #efe8fb; --swatch-text: #561fa9; }
.swatch-slate { --swatch: #475569; --swatch-soft: #e9edf2; --swatch-text: #374151; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [class*="swatch-"] { --swatch-soft: color-mix(in srgb, var(--swatch) 28%, var(--bg-raised)); --swatch-text: #f5f5f5; }
  :root:not([data-theme="light"]) .swatch-navy { --swatch: #f5f5f5; --swatch-soft: #262626; --swatch-on: #111111; }
}
[data-theme="dark"] [class*="swatch-"] { --swatch-soft: color-mix(in srgb, var(--swatch) 28%, var(--bg-raised)); --swatch-text: #f5f5f5; }
[data-theme="dark"] .swatch-navy { --swatch: #f5f5f5; --swatch-soft: #262626; --swatch-on: #111111; }

.month { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.month__dows { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.month__dows span { padding: 8px 10px; font-size: 0.72rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.month__grid { flex: 1 1 auto; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(96px, 1fr); min-height: 0; overflow-y: auto; }
.month__cell { position: relative; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px 6px 8px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.month__cell:nth-child(7n) { border-right: none; }
.month__cell.is-out { background: var(--bg-subtle); }
.month__cell.is-out .month__date { color: var(--text-faint); }
.month__date { align-self: flex-start; font-size: 0.78rem; font-weight: 600; padding: 2px 6px; border-radius: var(--radius-pill); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.month__date:hover { background: var(--bg-hover); color: var(--text); }
.month__cell.is-today .month__date { background: var(--accent); color: var(--accent-text); }
.month__add { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: var(--radius-xs); color: var(--text-faint); opacity: 0; }
.month__cell:hover .month__add { opacity: 1; }
.month__add:hover { background: var(--bg-hover); color: var(--accent); }
.month__events { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.chip {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--swatch-text, var(--text));
  background: var(--swatch-soft, var(--bg-inset));
  border-left: 3px solid var(--swatch, var(--accent));
}
.chip:hover { filter: brightness(0.96); }
.chip--allday { background: var(--swatch, var(--accent)); color: var(--swatch-on, #fff); border-left-color: transparent; font-weight: 600; }
.chip--more { background: transparent; border-left-color: transparent; color: var(--text-faint); }
.chip__time { color: inherit; opacity: 0.8; font-variant-numeric: tabular-nums; flex: 0 0 auto; }

.timegrid { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; --hour-h: 48px; --cols: 7; }
.timegrid--day { --cols: 1; }
.timegrid__header, .timegrid__allday, .timegrid__body { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); }
.timegrid__header { border-bottom: 1px solid var(--border); }
.timegrid__dayhead { display: flex; flex-direction: column; align-items: center; padding: 8px 0 6px; color: var(--text-muted); border-left: 1px solid var(--border); }
.timegrid__dow { font-size: 0.68rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; }
.timegrid__num { font-size: 1.2rem; font-weight: 600; color: var(--text); line-height: 1.3; width: 34px; text-align: center; border-radius: var(--radius-pill); }
.timegrid__dayhead.is-today .timegrid__num { background: var(--accent); color: var(--accent-text); }
.timegrid__allday { border-bottom: 1px solid var(--border); min-height: 28px; }
.timegrid__alldaycell { border-left: 1px solid var(--border); padding: 3px 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.timegrid__gutter { display: grid; place-items: center; }
.timegrid__scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.timegrid__hours { display: block; position: relative; }
.timegrid__hour { display: block; height: var(--hour-h); font-size: 0.68rem; color: var(--text-faint); text-align: right; padding-right: 8px; transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.timegrid__col { position: relative; border-left: 1px solid var(--border); min-width: 0; }
.timegrid__col.is-today { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.timegrid__slot { display: block; height: var(--hour-h); border-bottom: 1px solid var(--border); }
.timegrid__slot:hover { background: var(--bg-hover); }
.block {
  position: absolute;
  top: calc(var(--top) * var(--hour-h) / 60);
  height: calc(var(--height) * var(--hour-h) / 60 - 2px);
  left: calc(var(--left) + 2px);
  width: calc(var(--width) - 4px);
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--swatch-soft);
  color: var(--swatch-text);
  border-left: 3px solid var(--swatch);
  font-size: 0.74rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.block:hover { filter: brightness(0.96); z-index: 2; }
.block__title { font-weight: 650; }
.block__time, .block__loc { opacity: 0.85; font-size: 0.68rem; }
.timegrid__now { position: absolute; left: 0; right: 0; top: calc(var(--top) * var(--hour-h) / 60); height: 2px; background: var(--danger); z-index: 3; pointer-events: none; }
.timegrid__now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

.agenda { flex: 1 1 auto; overflow-y: auto; padding: 16px 28px 40px; max-width: 900px; }
.agenda__day { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.agenda__date { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }
.agenda__date small { display: block; font-size: 0.72rem; font-weight: 500; color: var(--text-faint); }
.agenda__num { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--bg-inset); color: var(--text); font-size: 1.1rem; font-weight: 700; }
.agenda__day.is-today .agenda__num { background: var(--accent); color: var(--accent-text); }
.agenda__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.agenda__item { display: grid; grid-template-columns: 56px 12px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); color: inherit; }
.agenda__item:hover { background: var(--bg-hover); }
.agenda__time { font-size: 0.78rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.3; }
.agenda__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--swatch, var(--accent)); }
.agenda__text { display: flex; flex-direction: column; min-width: 0; }
.agenda__text .small .icon { vertical-align: -1px; margin-right: 3px; }

.editor { flex: 1 1 auto; overflow-y: auto; padding: 0 0 40px; }
.editor__form { max-width: 760px; }
.editor__bar { display: flex; align-items: center; gap: 8px; padding: 14px 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.editor__form > .field, .editor__row { padding: 0 24px; }
.editor__form > .field { margin: 18px 0 8px; }
.editor__title { font-size: 1.3rem; font-weight: 600; border: none; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; padding-left: 0; background: transparent; letter-spacing: -0.02em; }
.editor__title:focus { box-shadow: none; border-bottom-color: var(--accent); }
.editor__row { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: center; padding-top: 10px; padding-bottom: 10px; }
.editor__row--top { align-items: start; }
.editor__row--top .editor__icon { margin-top: 10px; }
.editor__icon { display: grid; place-items: center; color: var(--text-faint); }
.editor__row input[type="date"], .editor__row input[type="time"], .editor__row select { width: auto; min-width: 0; }
.editor__time { width: 110px; }
.editor__until { display: none; }
.editor__until.is-shown { display: flex; }
.editor .checkbox { margin-bottom: 0; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch-pick { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem; }
.swatch-pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch-pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.swatch-pick__dot { width: 14px; height: 14px; border-radius: 50%; background: var(--swatch); }

/* --------------------------------------------------------------------------
   Landing page (signed out)
   -------------------------------------------------------------------------- */

.landing .site { min-height: 100vh; }
.site__glow {
  position: absolute;
  inset: -200px 0 auto 0;
  height: 620px;
  background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 65%);
  pointer-events: none;
  z-index: 0;
}
.landing .nav, .landing .site__main, .landing .footer { position: relative; z-index: 1; }
.landing-hero { max-width: 760px; margin: 0 auto; padding: 64px 24px 36px; text-align: center; }
.landing-hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -0.04em; line-height: 1.05; margin: 14px 0 18px; }
.landing-hero h1 em { font-style: normal; color: var(--accent); }
.landing-hero__lede { color: var(--text-muted); font-size: 1.08rem; max-width: 60ch; margin: 0 auto 26px; line-height: 1.65; }
.hero__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero__note { font-size: 0.8rem; color: var(--text-faint); margin: 16px 0 0; }

.landing-preview { max-width: 1040px; margin: 20px auto 0; padding: 0 24px; }
.preview-window { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-raised); box-shadow: var(--shadow-lg); overflow: hidden; }
.preview-window__bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg-subtle); }
.preview-window__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.preview-window__title { margin-left: 10px; font-size: 0.75rem; color: var(--text-faint); font-weight: 600; }
.preview-window__body { display: grid; grid-template-columns: 180px 300px minmax(0, 1fr); min-height: 300px; font-size: 0.8rem; }
.preview-folders { background: var(--sidebar-bg); border-right: 1px solid var(--border); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.preview-folders__item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text-muted); }
.preview-folders__item span { margin-left: auto; color: var(--accent); font-weight: 650; font-size: 0.72rem; }
.preview-folders__item.is-active { background: var(--bg-active); color: var(--text); font-weight: 600; }
.preview-list { border-right: 1px solid var(--border); }
.preview-list__row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); align-items: start; }
.preview-list__row > div { display: flex; flex-direction: column; min-width: 0; }
.preview-list__row > div * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-list__row span { color: var(--text); }
.preview-list__row em { font-style: normal; color: var(--text-faint); font-size: 0.74rem; }
.preview-list__row time { font-size: 0.7rem; color: var(--text-faint); }
.preview-list__row.is-unread strong, .preview-list__row.is-unread span { color: var(--accent); font-weight: 700; }
.preview-list__row.is-selected { background: var(--accent-soft); }
.preview-reading { padding: 18px 20px; }
.preview-reading h4 { margin: 0 0 2px; font-size: 1rem; }
.preview-reading p { font-size: 0.82rem; line-height: 1.6; color: var(--text-muted); }
.preview-reading__actions { display: flex; gap: 8px; margin-top: 10px; }
.preview-reading__actions span { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-xs); font-size: 0.74rem; }

.landing-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; max-width: 1040px; margin: 48px auto 72px; padding: 0 24px; }
.feature { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-raised); box-shadow: var(--shadow-sm); }
.feature__icon { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-soft-text); margin-bottom: 12px; }
.feature h3 { font-size: 1rem; margin-bottom: 6px; }
.feature p { color: var(--text-muted); font-size: 0.88rem; line-height: 1.6; margin: 0; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  :root { --list-w: 340px; }
  .cmdbar__label { display: none; }
}

@media (max-width: 1024px) {
  .mailwin, .calwin { grid-template-columns: minmax(0, 1fr); }
  .folders, .calside {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: var(--rail-w);
    width: 280px;
    z-index: 40;
    box-shadow: var(--shadow-lg);
    transform: translateX(-110%);
    transition: transform var(--dur) var(--ease);
  }
  .folders.is-open, .calside.is-open { transform: none; }
  .topbar__menu { display: inline-flex; }
  .page--settings { grid-template-columns: minmax(0, 1fr); }
  .subnav { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
  .subnav__title, .subnav__group { display: none; }
  .mailbox-add { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  :root { --rail-w: 56px; }
  .rail__label { display: none; }
  .rail__item { padding: 6px 0; }
  .topbar__brand .brand__text { display: none; }
  .topbar__brand { min-width: 0; }
  .mail-panes { grid-template-columns: minmax(0, 1fr); }
  .list { display: flex; }
  .reading { display: none; }
  .has-thread .list { display: none; }
  .has-thread .reading { display: block; }
  .has-thread .reading--compose { display: flex; }
  .has-thread .cmdbar__back { display: inline-flex; }
  .has-thread .cmdbar__new { display: none; }
  .thread { padding: 16px; }
  .page { padding: 20px 16px 40px; }
  .agenda { padding: 12px 16px 40px; }
  .agenda__day { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .timegrid { --hour-h: 44px; }
  .timegrid__header, .timegrid__allday, .timegrid__body { grid-template-columns: 44px repeat(var(--cols), minmax(0, 1fr)); }
  .timegrid__num { font-size: 1rem; }
  .month__grid { grid-auto-rows: minmax(72px, 1fr); }
  .chip__time { display: none; }
  .preview-window__body { grid-template-columns: minmax(0, 1fr); }
  .preview-folders, .preview-list { display: none; }
  .editor__row { grid-template-columns: minmax(0, 1fr); }
  .editor__icon { display: none; }
  .compose__label { flex-basis: 48px; }
}

@media (max-width: 640px) {
  .folders, .calside { left: 0; width: min(300px, 86vw); }
  .rail { position: fixed; bottom: 0; left: 0; right: 0; flex-direction: row; justify-content: space-around; padding: 4px 8px; border-right: none; border-top: 1px solid var(--border); z-index: 35; }
  .rail__spacer { display: none; }
  .rail__label { display: block; }
  .rail__item { flex: 1 1 0; padding: 4px 0 6px; }
  .app__body { padding-bottom: 58px; }
  .topbar__search { display: none; }
  .landing-hero { padding-top: 40px; }
}

/* --------------------------------------------------------------------------
   Phones: the page runs under the status bar and home indicator
   (viewport-fit=cover; the iPhone apps show it that way), so the chrome pads
   itself by the safe-area insets. These are 0 everywhere else.
   -------------------------------------------------------------------------- */

.topbar {
  padding-top: env(safe-area-inset-top, 0px);
  flex-basis: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
}
.nav { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
@media (max-width: 1024px) {
  .folders, .calside { top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); }
}
@media (max-width: 640px) {
  .nav { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .rail { padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)); }
  .app__body { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
}

@media print {
  .topbar, .rail, .folders, .list, .cmdbar, .toasts { display: none !important; }
  .mail-panes { grid-template-columns: 1fr; }
  .reading { display: block !important; overflow: visible; }
}

/* Late fixes after the first visual pass. */
.compose__ccbtn { white-space: nowrap; flex: 0 0 auto; }
.row > input:not([type="checkbox"]):not([type="radio"]) { width: auto; flex: 1 1 auto; min-width: 160px; }
.row > select { width: auto; }
.row > .btn { flex: 0 0 auto; }

/* --------------------------------------------------------------------------
   App launcher
   The nine-dot button and the grid of Orbit apps behind it. This block is
   identical in Orbit AI, Orbit Mail and Orbit Mission Control; change all three.
   -------------------------------------------------------------------------- */

.launcher { position: relative; }
.launcher__trigger .icon { transition: transform var(--dur-fast) var(--ease); }
.launcher__trigger[aria-expanded="true"] .icon { transform: scale(0.9); }

.launcher__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  width: 312px;
  max-width: calc(100vw - 24px);
  min-width: 0;
  max-height: none;
  padding: 10px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  display: none;
}
.launcher__panel.is-open { display: block; animation: menu-in var(--dur) var(--ease); }
.launcher__panel--left { right: auto; left: 0; }

.launcher__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.launcher__app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 12px 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 550;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease);
}
.launcher__app:hover,
.launcher__app:focus-visible { background: var(--bg-hover); outline: none; }
.launcher__app.is-current { background: var(--accent-soft); color: var(--accent-soft-text); }

.launcher__mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--bg-inset);
  color: var(--accent);
  transition: transform var(--dur-fast) var(--ease);
}
.launcher__app:hover .launcher__mark { transform: translateY(-1px); }
.launcher__mark--mail { background: var(--accent); color: var(--accent-text); }
.launcher__mark--ai { background: var(--text); color: var(--bg); }
.launcher__mark--control { background: var(--accent-soft); color: var(--accent-soft-text); }

.launcher__name {
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}

.launcher__all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 8px -4px -4px;
  padding: 10px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 550;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.launcher__all:hover,
.launcher__all:focus-visible { background: var(--bg-hover); color: var(--text); outline: none; }

/* On a phone the button sits mid-bar, so a panel hung from it would run off
   the screen. Pin it to the viewport instead, just under the header. */
@media (max-width: 640px) {
  .launcher__panel {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 64px;
    width: auto;
    max-width: none;
  }
}

/* --------------------------------------------------------------------------
   Encryption: messages sealed on a self-hosted relay
   -------------------------------------------------------------------------- */

.notice--muted { background: var(--bg-inset); border-color: var(--border); color: var(--text-muted); }
.notice--muted .icon { color: var(--text-faint); }
.sealed { display: flex; flex-direction: column; gap: 12px; }
.sealed__body .msg__html { width: 100%; border: 0; background: #fff; border-radius: var(--radius-sm); }
.sealed__body .attachments { margin-top: 12px; }
.row__lock { color: var(--text-faint); display: inline-flex; }
.compose__sealed { margin: 0 16px 8px; }
.keylist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.keylist__item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; background: var(--bg-inset); border-radius: var(--radius-sm); font-size: 0.9rem; }
.keylist__id code { font-family: var(--mono); font-size: 0.85rem; }
.keylist__item .btn { margin-left: auto; }
