/* Tellspin web UI — design system
 *
 * Light, calm, and fast. Brand blues from the marketing site
 * (tellspin-600 / tellspin-black). Generous whitespace, real
 * information density where it matters (the timeline).
 */

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  color-scheme: light;

  /* Same scale as tellspin-landing-v2 (tellspin-50…950, tellspin-black). */
  --bg: #eefaff;
  --surface: #ffffff;
  --surface-translucent: rgba(255, 255, 255, 0.82);
  --border: #d5e8f4;
  --border-strong: #b6c4cf;

  --ink: #153456;
  --ink-soft: #1a548e;
  --ink-muted: #5a7d9a;

  /* --accent is for fills (buttons, badges); --accent-ink is for text on
     the page background, so dark mode can lighten it for contrast. */
  --accent: #2196f3;
  --accent-hover: #167bdf;
  --accent-ink: #167bdf;
  --accent-soft: #daf3ff;
  --accent-border: #8fe0ff;
  --brand: #2196f3;
  --on-accent: #ffffff;

  --ok: #059669;
  --ok-soft: #ecfdf5;
  --ok-border: #a7f3d0;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --override: #7c3aed;
  --override-soft: #f5f3ff;
  --override-border: #ddd6fe;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);

  --radius: 12px;
  --radius-sm: 8px;
  --dialog-duration: 150ms;
  --shadow: 0 1px 2px rgba(21, 52, 86, 0.04), 0 4px 16px rgba(21, 52, 86, 0.06);
  --shadow-hover: 0 2px 4px rgba(21, 52, 86, 0.08), 0 12px 28px rgba(21, 52, 86, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #0f2438;
    --surface: #153456;
    --surface-translucent: rgba(21, 52, 86, 0.82);
    --border: #1a548e;
    --border-strong: #1863b5;

    --ink: #eefaff;
    --ink-soft: #bdebff;
    --ink-muted: #8ab4d4;

    --accent: #34b1fd;
    --accent-hover: #5accff;
    --accent-ink: #5accff;
    --accent-soft: rgba(52, 177, 253, 0.16);
    --accent-border: rgba(90, 204, 255, 0.42);
    --brand: #5accff;

    --ok: #34d399;
    --ok-soft: rgba(16, 185, 129, 0.13);
    --ok-border: rgba(52, 211, 153, 0.32);
    --warn: #fbbf24;
    --warn-soft: rgba(245, 158, 11, 0.12);
    --warn-border: rgba(251, 191, 36, 0.3);
    --danger: #f87171;
    --danger-soft: rgba(239, 68, 68, 0.13);
    --danger-border: rgba(248, 113, 113, 0.3);
    --override: #c4b5fd;
    --override-soft: rgba(139, 92, 246, 0.15);
    --override-border: rgba(196, 181, 253, 0.3);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.35);
  }
}

@supports (font-variation-settings: normal) {
  :root { --font: "InterVariable", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
}

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

body.web {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

/* no 300ms double-tap delay on interactive elements */
.web a, .web button, .web input, .web select, .web textarea, .web label {
  touch-action: manipulation;
}

.web h1, .web h2, .web h3 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
.web p { margin: 0; }
body.web button { font-family: var(--font); }
.web a { color: var(--accent-ink); text-decoration: none; }
.web a:hover { text-decoration: underline; }

body.web ::selection { background: var(--accent); color: var(--on-accent); }

.web a:focus-visible,
.web button:focus-visible,
.web summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

html { margin: 0; }

.web turbo-frame { display: block; }
#flash { display: contents; }

.turbo-progress-bar { background: var(--accent); height: 3px; }

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

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

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding-inline: 24px;
}

/* ---------- Top bar ---------- */

.topbar {
  background: var(--surface-translucent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: var(--safe-area-top);
  padding-left: var(--safe-area-left);
  padding-right: var(--safe-area-right);
}

/* Fizzy: park the skip link off-canvas inside the header so it never
   participates in the body line box. .btn { position: relative } must not win. */
.skip-link.btn {
  position: absolute;
  top: calc(8px + var(--safe-area-top));
  left: -999em;
  z-index: 50;
}
.skip-link.btn:focus {
  left: calc(12px + var(--safe-area-left));
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--brand) !important;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none !important; opacity: 0.9; }
.brand__logo { height: 30px; width: auto; display: block; }
.brand__mark { display: none; height: 30px; width: auto; }
.brand__name {
  display: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.topbar__nav { display: flex; gap: 4px; flex: 1; min-width: 0; }

.topbar__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft) !important;
  font-weight: 500;
  white-space: nowrap;
}
.topbar__link:hover { text-decoration: none !important; }
@media (any-hover: hover) {
  .topbar__link:hover { background: var(--bg); }
}
.topbar__link.is-active { color: var(--ink) !important; background: var(--bg); font-weight: 600; }

.topbar__actions { display: flex; align-items: center; gap: 14px; }
.topbar__user { display: inline-flex; }

/* Account menu (avatar in the top bar) */
.user-menu { position: relative; }
.user-menu__trigger {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
  border-radius: 999px;
  outline-offset: 2px;
}
.user-menu__trigger::-webkit-details-marker { display: none; }
.user-menu__trigger::marker { content: none; }
.user-menu[open] .user-menu__trigger { box-shadow: 0 0 0 2px var(--accent-border); }
.user-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  z-index: 30;
}
.user-menu__who {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.user-menu__who strong { font-size: 14px; font-weight: 600; }
.user-menu__who span { font-size: 12px; color: var(--ink-muted); }
.user-menu__signout {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.user-menu__signout:hover { background: var(--bg); }

.more-menu { display: none; position: relative; }
.more-menu__trigger {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  list-style: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
}
.more-menu__trigger::-webkit-details-marker { display: none; }
.more-menu__trigger::marker { content: none; }
.more-menu__trigger svg { width: 22px; height: 22px; display: block; }
.more-menu__trigger:hover { background: var(--bg); color: var(--ink); }
.more-menu[open] .more-menu__trigger { background: var(--bg); color: var(--ink); box-shadow: 0 0 0 2px var(--accent-border); }
.more-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  z-index: 30;
}
.more-menu__who {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border);
}
.more-menu__who strong { font-size: 14px; font-weight: 600; }
.more-menu__who span { font-size: 12px; color: var(--ink-muted); }
.more-menu__nav {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.more-menu__link,
.more-menu__signout {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink) !important;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.more-menu__link:hover,
.more-menu__signout:hover { background: var(--bg); text-decoration: none !important; }
.more-menu__link.is-active { color: var(--accent-ink) !important; font-weight: 600; }
.more-menu__signout { color: var(--ink); }

/* ---------- Sign in ---------- */

.web .login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: calc(100vh - 60px - 96px - 104px); /* topbar, main padding, footer */
}
.web .login__card {
  width: 100%;
  max-width: 400px;
  padding: 40px 32px 36px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise 0.25s ease both;
}
.web .login__mark { height: 44px; width: auto; color: var(--brand); margin-bottom: 18px; }
.web .login__title { font-size: 22px; margin-bottom: 8px; }
.web .login__lead { color: var(--ink-muted); font-size: 14.5px; line-height: 1.55; margin: 0 auto 28px; max-width: 30em; }
.web .login__hint { font-size: 13px; color: var(--ink-muted); }

/* Slack's "Sign in with Slack" button, per their brand guidelines. */
.slack-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 48px;
  min-width: 256px;
  padding: 0 20px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--ink) !important;
  font-size: 16px;
  font-weight: 600;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.slack-button:hover { border-color: var(--ink-muted); text-decoration: none !important; box-shadow: var(--shadow); }
.slack-button__logo { width: 20px; height: 20px; }

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

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 570;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease,
    transform 0.06s ease, box-shadow 0.12s ease;
}
.btn:hover { text-decoration: none !important; }
.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

.btn--primary {
  background: var(--accent);
  color: var(--on-accent) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(23, 23, 28, 0.12);
}

.btn--soft {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink) !important;
  box-shadow: 0 1px 2px rgba(23, 23, 28, 0.05);
}

.btn--ghost { background: transparent; color: var(--accent-ink) !important; }

.btn--danger { color: var(--danger) !important; }
.btn--primary.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff !important;
}

@media (any-hover: hover) {
  .btn--primary:hover { background: var(--accent-hover); }
  .btn--soft:hover { border-color: var(--ink-muted); }
  .btn--ghost:hover { background: var(--accent-soft); }
  .btn--danger:hover { background: var(--danger-soft); }
  .btn--primary.btn--danger:hover { background: #b91c1c; }
}

.btn--sm { padding: 5px 11px; font-size: 13px; }

@keyframes submitting {
  0%    { -webkit-mask-position: 0% 0%,   50% 0%,   100% 0%; mask-position: 0% 0%,   50% 0%,   100% 0%; }
  12.5% { -webkit-mask-position: 0% 50%,  50% 0%,   100% 0%; mask-position: 0% 50%,  50% 0%,   100% 0%; }
  25%   { -webkit-mask-position: 0% 100%, 50% 50%,  100% 0%; mask-position: 0% 100%, 50% 50%,  100% 0%; }
  37.5% { -webkit-mask-position: 0% 100%, 50% 100%, 100% 50%; mask-position: 0% 100%, 50% 100%, 100% 50%; }
  50%   { -webkit-mask-position: 0% 100%, 50% 100%, 100% 100%; mask-position: 0% 100%, 50% 100%, 100% 100%; }
  62.5% { -webkit-mask-position: 0% 50%,  50% 100%, 100% 100%; mask-position: 0% 50%,  50% 100%, 100% 100%; }
  75%   { -webkit-mask-position: 0% 0%,   50% 50%,  100% 100%; mask-position: 0% 0%,   50% 50%,  100% 100%; }
  87.5% { -webkit-mask-position: 0% 0%,   50% 0%,   100% 50%; mask-position: 0% 0%,   50% 0%,   100% 50%; }
  100%  { -webkit-mask-position: 0% 0%,   50% 0%,   100% 0%; mask-position: 0% 0%,   50% 0%,   100% 0%; }
}

.spinner {
  position: relative;
  display: block;
  width: 1.25em;
  height: 0.8em;
}
.spinner::before {
  --mask: no-repeat radial-gradient(#000 68%, #0000 71%);
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  -webkit-mask: var(--mask), var(--mask), var(--mask);
  -webkit-mask-size: 28% 45%;
  mask: var(--mask), var(--mask), var(--mask);
  mask-size: 28% 45%;
  animation: submitting 1.3s infinite linear;
}

form[aria-busy="true"] .btn--primary:disabled {
  color: transparent !important;
}
form[aria-busy="true"] .btn--primary:disabled::after {
  --mask: no-repeat radial-gradient(#000 68%, #0000 71%);
  --size: 1.25em;
  content: "";
  position: absolute;
  inset: 50%;
  width: var(--size);
  height: auto;
  aspect-ratio: 8 / 5;
  margin: calc((var(--size) / 3) * -1) 0 0 calc((var(--size) / 2) * -1);
  background: var(--on-accent);
  -webkit-mask: var(--mask), var(--mask), var(--mask);
  -webkit-mask-size: 28% 45%;
  mask: var(--mask), var(--mask), var(--mask);
  mask-size: 28% 45%;
  animation: submitting 1.3s infinite linear;
}
form[aria-busy="true"] .btn--primary.btn--danger:disabled::after {
  background: #fff;
}

/* ---------- Page scaffolding ---------- */

.main { padding: 32px 24px 64px; min-height: calc(100vh - 160px); }
#main:focus { outline: none; }

.back { margin: 0 0 12px; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 32px;
  color: var(--ink-muted) !important;
  font-size: 14px;
  font-weight: 550;
}
.back-link:hover { text-decoration: none !important; }
@media (any-hover: hover) {
  .back-link:hover { color: var(--ink) !important; }
}
.back-link__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.back-link__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
}
.back-link__kbd {
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.page-head__title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-head__title h1 { font-size: 26px; min-width: 0; }
.page-head h1 { font-size: 26px; }
.page-head__sub {
  margin-top: 8px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.page-head__actions { display: flex; gap: 12px; flex-shrink: 0; }
.page-head:has(+ .usage-hint) { margin-bottom: 8px; }

.footer {
  padding: 24px 24px 48px;
  color: var(--ink-muted);
  font-size: 13px;
}

/* ---------- Flash ---------- */

.flashes {
  position: fixed;
  top: calc(16px + var(--safe-area-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(420px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  pointer-events: none;
}

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 520;
  animation: flash-in 0.2s ease;
}
.flashes .flash {
  pointer-events: auto;
  margin-bottom: 0;
  box-shadow: var(--shadow-hover);
}
.flash--notice { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-border); }
.flash--alert { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); }
.flash--leaving { opacity: 0; transform: translateY(-4px); transition: all 0.25s ease; }

.flash__close {
  border: 0;
  background: none;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.6;
  padding: 0 2px;
  line-height: 1;
}
.flash__close:hover { opacity: 1; }

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Search ---------- */

.schedules-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.schedules-toolbar .search { margin-bottom: 0; flex: 1; max-width: none; }
.schedules-toolbar .toggle { flex-shrink: 0; white-space: nowrap; }
.schedules-toolbar .btn { flex-shrink: 0; }

.search {
  position: relative;
  max-width: 460px;
}

.search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--ink-muted);
  pointer-events: none;
}
.search__icon svg { width: 100%; height: 100%; display: block; }
.search__spinner {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 17px;
  height: 11px;
  margin: -5px 0 0 -8px;
}
.search[aria-busy="true"] .search__icon svg { visibility: hidden; }
.search[aria-busy="true"] .search__spinner { display: block; }

.search__input {
  width: 100%;
  padding: 11px 40px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.search__input::placeholder { color: var(--ink-muted); }
.search__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search__input::-webkit-search-cancel-button,
.search__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.search__clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: var(--bg);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 15px;
  color: var(--ink-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
}
.search__clear:hover { background: var(--border); }
.search:has(.search__input:placeholder-shown) .search__clear { display: none; }

.search__kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 7px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  transition: opacity 0.1s ease;
}
.search:has(.search__input:focus) .search__kbd,
.search:not(:has(.search__input:placeholder-shown)) .search__kbd {
  opacity: 0;
  visibility: hidden;
}

#schedules {
  transition: opacity 0.15s ease;
}
#schedules[busy],
#schedules[aria-busy="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.form-section--preview turbo-frame,
.preview-box turbo-frame {
  transition: opacity 0.15s ease;
}
.form-section--preview turbo-frame[busy],
.form-section--preview turbo-frame[aria-busy="true"],
.preview-box turbo-frame[busy],
.preview-box turbo-frame[aria-busy="true"] {
  opacity: 0.55;
}

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

.card-grid {
  --cards-gap: 20px;
  display: grid;
  gap: var(--cards-gap);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}
.pager__prev { justify-self: start; }
.pager__next { justify-self: end; }
.pager__status {
  margin: 0;
  color: var(--ink-muted);
  font-size: 13.5px;
  text-align: center;
  white-space: nowrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.schedule-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: 22px 22px 20px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.schedule-card__link {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
}
.schedule-card__link:focus,
.schedule-card__link:focus-visible {
  outline: none;
}
.schedule-card:has(.schedule-card__link:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (any-hover: hover) {
  .schedule-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--border-strong);
  }
  .schedule-card:hover .schedule-card__title { color: var(--accent-ink); }
}

.schedule-card--mine { border-color: var(--accent-border); }

.schedule-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: -6px -8px 14px 0; /* let the 36px star sit flush with the title */
}
.schedule-card__heading { flex: 1; min-width: 0; padding-top: 6px; }
.schedule-card__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
  overflow-wrap: anywhere;
  min-width: 0;
  transition: color 0.15s ease;
}
.schedule-card__contact {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--accent-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.favorite-star { position: relative; z-index: 1; flex-shrink: 0; }
.favorite-star form { display: grid; margin: 0; }
.star-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  position: relative;
}
.star-btn:hover { color: var(--warn); background: var(--warn-soft); text-decoration: none; }
.star-btn::after,
.star-btn::before {
  position: absolute;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 12;
}
.star-btn::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 5px 8px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 520;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.star-btn::before {
  content: "";
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--ink);
}
.star-btn:hover::after,
.star-btn:hover::before,
.star-btn:focus-visible::after,
.star-btn:focus-visible::before { opacity: 1; }
.star-btn.is-on { color: var(--warn); }
.star-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}
.star-btn.is-on svg { fill: currentColor; }

.favorites { margin-bottom: 36px; }
.favorites__head { margin-bottom: 16px; }
.favorites__head h2,
.schedules-rest h2 { font-size: 18px; }
.favorites__sub { color: var(--ink-muted); font-size: 13.5px; margin-top: 4px; }
.schedules-rest { margin-bottom: 16px; }

.schedule-card__body { flex: 1; }

.schedule-card__next {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-muted);
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.schedule-card__next strong { color: var(--ink-soft); font-weight: 570; }
.schedule-card__next-label {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.schedule-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.schedule-card__cadence {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.schedule-card__actions { position: relative; z-index: 1; display: flex; gap: 6px; }

/* ---------- Status ---------- */

.status { display: flex; align-items: center; gap: 12px; font-weight: 520; }

.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status--warn { color: var(--warn); }
.status--warn .status__dot { background: var(--warn); }
.status--fault { color: var(--ink-muted); }
.status--fault .status__dot { background: var(--ink-muted); }

.status__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.status__text strong {
  font-weight: 620;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.status__meta { color: var(--ink-muted); font-size: 13px; font-weight: 450; }

/* ---------- Chips & avatars ---------- */

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 550;
  line-height: 1.5;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.chip--kind { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-ink); }
.chip--you { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip--override { background: var(--override-soft); border-color: var(--override-border); color: var(--override); }
.chip--now { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }

.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.avatar--sm { width: 24px; height: 24px; }
.avatar--md { width: 34px; height: 34px; }
.avatar--lg { width: 48px; height: 48px; }

.avatar--initials {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 650;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.avatar--initials.avatar--md { font-size: 13px; }
.avatar--initials.avatar--lg { font-size: 16px; }

.avatar--more {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--ink-soft);
  font-weight: 650;
  font-size: 10px;
}

.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { border: 2px solid var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -8px; }

/* ---------- Hero (schedule show) ---------- */

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 28px;
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero--mine {
  border-color: var(--accent-border);
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 55%);
}

.hero__main { display: flex; align-items: center; gap: 16px; }

.hero__label {
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}
/* chips inside the uppercase label should keep their own casing */
.hero__label .chip { text-transform: none; letter-spacing: normal; }

.live-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--ok);
  animation: ping 2.2s ease-out infinite;
}
@keyframes ping {
  0% { transform: scale(0.45); opacity: 0.7; }
  75%, 100% { transform: scale(1.1); opacity: 0; }
}
.hero__names {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hero__until { color: var(--ink-muted); font-size: 13.5px; margin-top: 2px; }

.hero__next { text-align: right; }
.hero__next p strong { font-weight: 600; }

/* ---------- Callout ---------- */

.callout {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  font-weight: 520;
}
.callout--warn { background: var(--warn-soft); border: 1px solid var(--warn-border); color: var(--warn); }

/* ---------- Columns / panels ---------- */

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.sidebar { display: flex; flex-direction: column; gap: 24px; }

.panel {
  --panel-pad-x: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.panel__head h2 { font-size: 15px; }
.panel__hint { color: var(--ink-muted); font-size: 12.5px; }
p.panel__hint { margin-bottom: 16px; line-height: 1.45; }
.panel__notice {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid var(--ok-border);
  font-size: 13px;
  font-weight: 520;
}
.panel__empty { color: var(--ink-muted); font-size: 14px; padding: 6px 0; list-style: none; }

/* ---------- Timeline ---------- */

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

.timeline__row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px var(--panel-pad-x);
  margin: 0 calc(-1 * var(--panel-pad-x));
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border);
}
.timeline__row:last-child { border-bottom: 0; }
.timeline__row:hover { background: var(--bg); }
.timeline__row--now { background: var(--ok-soft); box-shadow: inset 3px 0 0 var(--ok); }
.timeline__row--now:hover { background: var(--ok-soft); }
.timeline__row--override .timeline__when { color: var(--override); }

.timeline__when {
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.timeline__who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 520;
  min-width: 0;
}
.timeline__who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline__disabled { color: var(--ink-muted); font-style: italic; font-weight: 450; }

.timeline__actions { opacity: 0; transition: opacity 0.1s ease; }
.timeline__row:hover .timeline__actions,
.timeline__row:focus-within .timeline__actions { opacity: 1; }

/* ---------- Override list ---------- */

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

.override-list__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.override-list__row:last-child { border-bottom: 0; }

.override-list__who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 570;
}
.override-list__when {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.override-list__by { font-size: 12.5px; color: var(--ink-muted); margin-top: 1px; }

/* ---------- Roster / meta ---------- */

.roster { list-style: none; margin: 0; padding: 0; }
.roster__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}
.roster__pos {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 650;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.panel--meta .meta-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  color: var(--ink-muted);
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.panel--meta .meta-list strong { color: var(--ink-soft); font-weight: 570; }

/* ---------- Empty state ---------- */

.empty {
  text-align: center;
  padding: 80px 24px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty h2 { font-size: 18px; margin-bottom: 8px; }
.empty p { color: var(--ink-muted); margin-bottom: 20px; }
.empty p:last-child { margin-bottom: 0; }
.empty .btn { margin: 0 5px; }

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

.form-wrap { max-width: 720px; }

.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}
.form-section__title { font-size: 15px; margin-bottom: 8px; }
.form-section__title + *:not(.field__hint) { margin-top: 8px; }
.form-section > .field__hint { margin-top: 0; margin-bottom: 18px; }

.field { margin-bottom: 20px; min-width: 0; }
.field:last-child { margin-bottom: 0; }

.field__label {
  display: block;
  font-size: 13.5px;
  font-weight: 590;
  margin-bottom: 8px;
}

.field__input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field__input--short { max-width: 280px; }

select.field__input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%238a8a96' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 34px;
}

.field__hint { font-size: 13px; color: var(--ink-muted); margin-top: 6px; }

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.field-row .field { margin-bottom: 0; }

.form-actions { display: flex; gap: 12px; padding: 8px 0 0; }
.form-actions--end { justify-content: flex-end; }

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
}
.checkbox input {
  margin: 3px 0 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.checkbox span { font-weight: 550; }
.checkbox__hint {
  display: block;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 450;
}

/* ---------- Rotation builder ---------- */

.rotation-builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.rotation-builder__label {
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.rotation-builder__search { margin-bottom: 10px; }

.rotation-builder__list {
  list-style: none;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  min-height: 120px;
  max-height: 360px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rotation-builder__empty,
.rotation-builder__status,
.rotation-builder__none {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.rotation-builder__none { margin: 4px 2px; list-style: none; }

.user-pick {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: 14px;
  font-weight: 520;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.1s ease;
}
.user-pick:hover { border-color: var(--accent-border); }
.user-pick span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pick__add { color: var(--accent-ink); font-weight: 700; font-size: 16px; }

.user-chosen {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  font-weight: 520;
  user-select: none;
  -webkit-user-select: none;
}
.user-chosen__handle {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 28px;
  margin: -4px 0 -4px -4px;
  color: var(--ink-muted);
  font-size: 12px;
  letter-spacing: -1px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
.user-chosen__handle:active { cursor: grabbing; color: var(--ink); }
.user-chosen.is-dragging {
  opacity: 0.45;
  outline: 2px dashed var(--accent-border);
}
.user-chosen__pos {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.user-chosen__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chosen__controls { display: flex; gap: 2px; }
.user-chosen__controls button {
  border: 0;
  background: none;
  color: var(--ink-muted);
  font-size: 14px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
}
.user-chosen__controls button:hover { background: var(--bg); color: var(--ink); }

/* ---------- Choice grid (override who) ---------- */

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.choice {
  position: relative;
  display: block;
  cursor: pointer;
}
.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice__body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-weight: 540;
  transition: border-color 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
}
.choice__body em { color: var(--ink-muted); font-style: normal; font-weight: 450; }
.choice:hover .choice__body { border-color: var(--accent-border); }
.choice input:checked + .choice__body {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.choice input:focus-visible + .choice__body { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Segmented control ---------- */

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.segmented__item {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 550;
  color: var(--ink-soft) !important;
}
.segmented__item:hover { text-decoration: none !important; background: var(--bg); }
.segmented__item.is-active {
  background: var(--accent-soft);
  color: var(--accent-ink) !important;
}

/* ---------- Custom cadence ---------- */

.custom-cadence {
  padding: 18px 20px;
  margin-bottom: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.custom-cadence .field-row:last-of-type { margin-bottom: 6px; }

.day-picks { display: flex; gap: 6px; flex-wrap: wrap; }

.day-pick { position: relative; cursor: pointer; }
.day-pick input { position: absolute; opacity: 0; pointer-events: none; }
.day-pick span {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 570;
  color: var(--ink-soft);
  transition: all 0.1s ease;
}
.day-pick:hover span { border-color: var(--accent-border); }
.day-pick input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.day-pick input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Shift preview ---------- */

.preview-shifts {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}

.preview-shifts__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.preview-shifts__row:last-child { border-bottom: 0; }

.preview-shifts__when {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.preview-shifts__who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 570;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-shifts__row--off { color: var(--ink-muted); }
.preview-shifts__row--off .preview-shifts__who { font-weight: 450; font-style: italic; }

.preview-shifts__empty {
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  font-size: 13.5px;
  text-align: center;
}

.preview-shifts__tz {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-muted);
}

/* ---------- Connect card ---------- */

.connect-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.connect-card__body { flex: 1; }
.connect-card__body .field__hint { margin-top: 0; }

/* ---------- Mapping list ---------- */

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

.mapping-list__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.mapping-list__row:last-child { border-bottom: 0; }

.mapping-list__pd { display: flex; flex-direction: column; min-width: 0; }
.mapping-list__pd-name { font-weight: 570; }
.mapping-list__pd-email {
  font-size: 12.5px;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.mapping-list__arrow { color: var(--ink-muted); }

/* ---------- Copy field ---------- */

.copy-field { display: flex; gap: 8px; min-width: 0; }
.copy-field input {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- Getting started ---------- */

.getting-started__progress,
.getting-started__done,
.getting-started__support,
.getting-started__extras,
.steps {
  max-width: 640px;
  text-wrap: pretty;
}

.getting-started__progress {
  margin: -8px 0 24px;
  color: var(--ink-muted);
  font-weight: 520;
}

.getting-started__done {
  margin-bottom: 28px;
  padding: 22px 24px;
  background: var(--ok-soft);
  border: 1px solid var(--ok-border);
  border-radius: var(--radius);
}
.getting-started__done p { color: var(--ink-soft); margin-bottom: 12px; }
.getting-started__done p:last-of-type { margin-bottom: 16px; }
.getting-started__done code {
  background: var(--surface);
  border: 1px solid var(--ok-border);
  border-radius: 5px;
  padding: 1px 5px;
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}

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

.step {
  display: flex;
  gap: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.step__marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink-muted);
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.step--current {
  padding: 24px;
  border-color: var(--accent-border);
  box-shadow: var(--shadow-hover);
}
.step--current .step__marker {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.step--done { border-color: var(--ok-border); box-shadow: none; }
.step--done .step__marker { background: var(--ok-soft); color: var(--ok); }
.step--done .step__body h2 { margin-bottom: 4px; color: var(--ink-soft); font-weight: 600; }

.step--upcoming { opacity: 0.62; box-shadow: none; }

.step__body { flex: 1; min-width: 0; }
.step__body h2 {
  font-size: 16px;
  margin-bottom: 8px;
}
.step__body p { color: var(--ink-soft); margin-bottom: 12px; }
.step__body p:last-child { margin-bottom: 0; }
.step__body code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}

.step__status { color: var(--ok); font-weight: 550; }
.step__status a { font-weight: 600; }

.getting-started__extras {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.getting-started__extras h2 {
  font-size: 16px;
  margin-bottom: 6px;
}
.getting-started__extras > p {
  color: var(--ink-muted);
  margin-bottom: 16px;
}

.getting-started__extras-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.getting-started__extras-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.getting-started__extras-list p {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 13.5px;
}
.getting-started__extras-list .btn { flex-shrink: 0; }

.getting-started__support {
  margin-top: 32px;
  color: var(--ink-muted);
}

/* ---------- Mentions & Slack-style preview ---------- */

.mention {
  display: inline;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 570;
}

.web code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.usage-hint {
  margin: 0 0 24px;
  padding: 0 0 16px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}
.usage-hint .chip { font-size: 13px; margin: 0 4px; padding: 4px 10px; }

.preview-box {
  margin-top: 4px;
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.preview-box__label {
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-bottom: 10px;
}
.preview-box .field__hint { margin-top: 10px; }

.slack-message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.slack-message__avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.slack-message__avatar svg { width: 20px; height: 20px; }
.slack-message__body { min-width: 0; }
.slack-message__author { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.slack-message__app {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--border);
  color: var(--ink-soft);
}
.slack-message__time { color: var(--ink-muted); font-weight: 450; font-size: 12px; }
.slack-message__text { font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.slack-message__text code { font-size: 12.5px; }

/* ---------- Option cards (contact method) ---------- */

.option-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.option-card { position: relative; cursor: pointer; display: block; }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
}
.option-card__title { font-weight: 620; }
.option-card__desc { font-size: 13px; color: var(--ink-muted); line-height: 1.4; }
.option-card:hover .option-card__body { border-color: var(--accent-border); }
.option-card input:checked + .option-card__body {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.option-card input:checked + .option-card__body .option-card__desc { color: var(--ink-soft); }
.option-card input:focus-visible + .option-card__body { box-shadow: 0 0 0 3px var(--accent-soft); }

.input-prefix { display: flex; align-items: stretch; max-width: 320px; }
.input-prefix__sign {
  display: grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--bg);
  color: var(--ink-muted);
  font-weight: 600;
}
.input-prefix .field__input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; max-width: none; }

.field__input--area { resize: vertical; min-height: 84px; line-height: 1.5; }

.callout--compact { padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; font-weight: 450; }
.callout--info { background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--ink-soft); }
.callout a { font-weight: 570; }

.form-note { margin: 0 0 20px; }

/* ---------- Segmented radio input ---------- */

.segmented-input {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-wrap: wrap;
}
.segmented-input__item { position: relative; cursor: pointer; }
.segmented-input__item input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-input__item span {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 550;
  color: var(--ink-soft);
  transition: background 0.1s ease, color 0.1s ease;
}
.segmented-input__item:hover span { color: var(--ink); }
.segmented-input__item input:checked + span {
  background: var(--surface);
  color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(23, 23, 28, 0.08);
}
.segmented-input__item input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Settings list (show page sidebar) ---------- */

.setting-list { list-style: none; margin: 0; padding: 0; }
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.setting:first-child { padding-top: 0; }
.setting:last-child { border-bottom: 0; padding-bottom: 0; }
.setting__title { font-weight: 590; font-size: 14px; }
.setting__desc { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; line-height: 1.45; }
.setting .btn { flex-shrink: 0; }

.panel__foot { margin-top: 18px; display: flex; gap: 8px; }

.ical-links { display: flex; flex-direction: column; gap: 12px; }
.ical-links__label { font-size: 12.5px; font-weight: 590; color: var(--ink-soft); margin-bottom: 5px; }

.danger-zone { margin-top: 16px; }
.form-section--danger {
  border-color: var(--danger);
  background: var(--danger-soft);
  box-shadow: 0 0 0 1px var(--danger-border);
}
.form-section--danger .form-section__title { color: var(--danger); }
.field__input.is-invalid,
.rotation-builder__list.is-invalid,
.choice-grid.is-invalid,
.custom-cadence.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

/* ---------- Reminders ---------- */

.reminder-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.reminder { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.reminder--paused { opacity: 0.72; }
.reminder--paused:hover { opacity: 1; }
.reminder__head { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.reminder__where { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.reminder__icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.reminder__title { font-weight: 620; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reminder__meta { color: var(--ink-muted); font-size: 13px; margin-top: 2px; }
.reminder__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.reminder__actions form { display: inline; }
.reminder__text {
  margin: 0;
  padding: 12px 16px;
  border-left: 3px solid var(--accent-border);
  background: var(--bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- Shift picks (override) ---------- */

.shift-picks { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.shift-picks__more { margin: 0 0 20px; }
.shift-pick {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
}
.shift-pick:hover { border-color: var(--accent-border); }
.shift-pick.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.shift-pick__when {
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.shift-pick__who { display: flex; align-items: center; gap: 8px; font-weight: 520; min-width: 0; }
.shift-pick__who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

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

.calendar-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.calendar-nav { display: flex; align-items: center; gap: 8px; }
.calendar-nav__title { font-size: 18px; min-width: 170px; text-align: center; }
.calendar-nav .btn--sm { padding: 5px 12px; font-size: 16px; line-height: 1; }
.calendar-toggles { display: flex; gap: 14px; flex-wrap: wrap; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink-soft) !important;
}
.toggle:hover { text-decoration: none !important; }
@media (any-hover: hover) {
  .toggle:hover { color: var(--ink) !important; }
}
.toggle__track {
  position: relative;
  width: 30px;
  height: 18px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.toggle__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}
.toggle.is-on .toggle__track { background: var(--accent); }
.toggle.is-on .toggle__track::after { transform: translateX(12px); }
.toggle__spinner {
  display: none;
  width: 1em;
  height: 0.65em;
  color: var(--ink-muted);
}
.toggle[aria-busy="true"] {
  pointer-events: none;
}
.toggle[aria-busy="true"] .toggle__spinner { display: block; }

.month {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}
.month__head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.month__head span {
  padding: 8px 10px;
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}
.month__week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.month__week:last-child { border-bottom: 0; }
.month__day {
  min-height: 108px;
  padding: 8px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.month__day:last-child { border-right: 0; }
.month__day--outside { background: var(--bg); }
.month__day--outside .month__date { color: var(--ink-muted); }
.month__day--outside .month__shift { opacity: 0.55; }
.month__date {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.month__day--today .month__date { background: var(--accent); color: var(--on-accent); }
.month__shifts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.month__shift {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 570;
  min-width: 0;
}
a.month__shift { text-decoration: none; cursor: pointer; }
a.month__shift:hover { box-shadow: 0 0 0 1px var(--accent-border); filter: brightness(0.97); }
.month__shift--override { background: var(--override-soft); color: var(--override); }
.month__shift--off { background: var(--bg); color: var(--ink-muted); font-style: italic; font-weight: 450; }
.month__shift-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.month__shift-time { font-variant-numeric: tabular-nums; font-weight: 500; opacity: 0.8; font-size: 11px; }
.month__shift .avatar { border: 0; }
.month__more { font-size: 11.5px; color: var(--ink-muted); padding-left: 6px; }
.avatar--xs { width: 16px; height: 16px; }
.avatar--initials.avatar--xs { font-size: 8px; }
.calendar-empty { color: var(--ink-muted); text-align: center; margin: -8px 0 24px; font-size: 14px; }

.columns--even { grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); }

/* ---------- Help ---------- */

.form--compact .field { margin-bottom: 14px; }
.form--compact .form-actions { padding: 0; }
.help-links { margin-top: 24px; }
.help-links__list { list-style: none; margin: 0; padding: 0; }
.help-links__list li {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.help-links__list li:last-child { border-bottom: 0; }
.help-links__list li:first-child { padding-top: 0; }
.help-links__list span { color: var(--ink-muted); font-size: 13.5px; }
.footer p + p { margin-top: 4px; }

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

@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; }
  .columns--even { grid-template-columns: 1fr; }
  .month__day { min-height: 80px; padding: 6px; }
  .help-links__list li { grid-template-columns: 1fr; gap: 4px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hero__next { text-align: left; }

  .topbar__inner { gap: 16px; height: 56px; }
  .brand__logo { display: none; }
  .brand__mark { display: block; }
  .brand__name { display: inline; }
}

@media (max-width: 640px) {
  html { overflow-x: clip; }
  .main, .footer, .container { overflow-x: clip; max-width: 100%; }
  .main { padding: 28px 16px 48px; }
  .container { padding-inline: 16px; }
  .footer { padding: 32px 16px calc(56px + var(--safe-area-bottom)); }

  .topbar__inner { height: 56px; gap: 12px; }
  .topbar__nav,
  .topbar__user { display: none; }
  .more-menu { display: inline-flex; }
  .topbar__actions { gap: 8px; margin-left: auto; }
  .web .login { min-height: calc(100vh - 56px - 76px - 104px); }
  .web .login__card { padding: 32px 22px 28px; }

  .back-link {
    width: 40px;
    height: 40px;
    min-height: 40px;
    justify-content: center;
    border-radius: var(--radius-sm);
  }
  .back-link__label,
  .back-link__kbd { display: none; }
  @media (any-hover: hover) {
    .back-link:hover { background: var(--surface); }
  }
  .page-head { flex-direction: column; gap: 20px; margin-bottom: 28px; }
  .page-head h1 { font-size: 24px; }
  .favorites { margin-bottom: 28px; }
  .page-head__sub { gap: 8px; margin-top: 12px; }
  .page-head__actions {
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 8px;
  }
  .page-head__actions .btn {
    min-height: 44px;
    padding: 12px 18px;
  }
  .segmented { width: 100%; flex-wrap: wrap; margin-bottom: 20px; }
  .segmented__item {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 12px;
  }
  .usage-hint { margin: 0 0 24px; padding: 0 0 16px; overflow-wrap: anywhere; }
  .field-row { grid-template-columns: 1fr; }
  .field__input { min-width: 0; max-width: 100%; }
  .calendar-bar, .calendar-nav, .calendar-toggles { min-width: 0; max-width: 100%; }
  .calendar-nav { flex-wrap: wrap; }
  .month, .month__week, .month__day, .month__shifts { min-width: 0; max-width: 100%; }
  .month__day { overflow: hidden; }
  .pager__status { white-space: normal; }
  .schedules-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 22px;
  }
  .schedules-toolbar .toggle { min-height: 44px; }
  .schedules-toolbar .btn { min-height: 44px; justify-content: center; }
  .search { max-width: none; }
  .search__kbd { display: none; }

  .hero { padding: 20px; }
  .panel, .form-section, .step {
    --panel-pad-x: 16px;
    padding: 20px 16px;
  }
  .getting-started__extras-list li {
    flex-direction: column;
    align-items: stretch;
  }
  .getting-started__extras-list .btn { align-self: flex-start; }
  .columns, .sidebar, .card-grid { gap: 16px; }
  .rotation-builder { grid-template-columns: 1fr; }
  .timeline__row { grid-template-columns: 1fr; gap: 8px; padding: 14px 16px; }
  .timeline__actions { opacity: 1; }
  .preview-shifts__row { flex-wrap: wrap; gap: 4px 12px; }
  .mapping-list__row { grid-template-columns: 1fr; gap: 6px; }
  .mapping-list__arrow { display: none; }
  .shift-pick { grid-template-columns: 1fr; gap: 6px; }
  .reminder__head { flex-direction: column; }
  .reminder__actions { justify-content: flex-start; }
  .setting { flex-direction: column; align-items: flex-start; }
  .calendar-nav__title { min-width: 0; font-size: 16px; }
  .month__head span { padding: 6px 4px; font-size: 10px; letter-spacing: 0.02em; }
  .month__day { min-height: 56px; padding: 4px; }
  .month__shift { font-size: 10.5px; padding: 2px 4px; }
  .month__shift .avatar, .month__shift-time { display: none; }
  .option-cards { grid-template-columns: 1fr; }
  .connect-card { flex-direction: column; align-items: flex-start; }
  .empty { padding: 48px 20px; }

  /* Comfortable touch targets */
  .btn { padding: 10px 16px; }
  .btn--sm { padding: 8px 12px; font-size: 13.5px; }
  .user-chosen__controls button { width: 32px; height: 32px; }
  .user-pick, .user-chosen { padding: 11px 12px; }
  .flash__close, .search__clear { width: 32px; height: 32px; }

  /* 16px inputs stop iOS Safari from zooming on focus */
  .field__input, .search__input { font-size: 16px; }

  .form-actions { flex-direction: column; }
  .form-actions--end { flex-direction: row; }
  .form-actions .btn { justify-content: center; }
}

/* ---------- Dialogs ---------- */

html:has(dialog:modal) { overflow: hidden; }

.dialog {
  width: min(720px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-hover);
  color: inherit;
  opacity: 0;
  transform: scale(0.85);
  transition-behavior: allow-discrete;
  transition-duration: calc(var(--dialog-duration) / 2);
  transition-property: display, opacity, overlay, transform;
  transition-timing-function: ease-out;
}
.dialog--sm { width: min(440px, calc(100% - 32px)); }
.dialog[open] {
  opacity: 1;
  transform: scale(1);
  transition-duration: var(--dialog-duration);
}
.dialog::backdrop {
  background: rgba(21, 52, 86, 0.42);
  opacity: 0;
  transition-behavior: allow-discrete;
  transition-duration: calc(var(--dialog-duration) / 2);
  transition-property: display, opacity, overlay;
  transition-timing-function: ease-out;
}
.dialog[open]::backdrop {
  opacity: 1;
  transition-duration: var(--dialog-duration);
}
@starting-style {
  .dialog[open] { opacity: 0; transform: scale(0.85); }
  .dialog[open]::backdrop { opacity: 0; }
}
.dialog__panel { padding: 28px 28px 24px; overflow: auto; max-height: calc(100vh - 48px); overscroll-behavior: contain; }
.dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.dialog__head h1 { font-size: 22px; }
.dialog__head p { margin-top: 6px; color: var(--ink-muted); font-size: 14px; }
.dialog__head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.dialog__head form { margin: 0; }
.dialog__close {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.dialog__close:hover { background: var(--surface); color: var(--ink); }
.dialog .form-section {
  box-shadow: none;
  padding: 20px;
  margin-bottom: 16px;
}
.dialog .form-actions { margin-top: 8px; }
.dialog .flash { margin-bottom: 16px; }
.dialog .empty { padding: 36px 16px; }

@media (max-width: 640px) {
  /* Full-screen overlay: only --safe-area-* (covers the tab bar). */
  .dialog {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    inset: 0;
    border: 0;
    border-radius: 0;
    transform: none;
  }
  .dialog[open] { transform: none; }
  .dialog__panel {
    height: 100%;
    max-height: none;
    padding-top: calc(20px + var(--safe-area-top));
    padding-right: calc(16px + var(--safe-area-right));
    padding-bottom: calc(20px + var(--safe-area-bottom));
    padding-left: calc(16px + var(--safe-area-left));
  }
}
