/* ==========================================================================
   "Soft" - option D from design/style-options.png.

   Friendly and rounded: Nunito throughout, pill buttons and tags, big-radius
   white cards with soft blue-tinted shadows on a light blue page. Color comes
   from tinted fills, never from a single colored edge.

   Components only use the tokens below. Breakpoints: 640 / 900 / 1100.
   ========================================================================== */
:root {
  --font: "Nunito", "Segoe UI", system-ui, Arial, sans-serif;

  --bg: #eaf0fa;
  --surface: #ffffff;
  --surface-2: #f3f7fd;       /* rows and wells inside a card */
  --surface-3: #e6eefb;       /* tinted controls */
  --field: #ffffff;
  --text: #14223b;
  --text-2: #53617a;
  --text-3: #64718a;
  --border: #e1e8f4;
  --border-strong: #b9c9e6;

  --primary: #1156b0;
  --on-primary: #ffffff;
  --primary-text: #1156b0;
  --primary-soft: #dbe7fb;
  --primary-mid: #8fb6ee;     /* the "current step" part of a progress bar */

  --success: #1d7a4c;
  --on-success: #ffffff;
  --success-soft: #dcf3e6;
  --warning: #7a4b00;
  --warning-soft: #fff0cf;
  --danger: #b42318;
  --on-danger: #ffffff;
  --danger-soft: #fde0e0;
  --google: #0b6b80;
  --google-soft: #dcf2f6;

  --shadow: 0 4px 16px rgba(40, 80, 150, .08);
  --shadow-md: 0 8px 24px rgba(40, 80, 150, .14);
  --shadow-lg: 0 24px 60px rgba(20, 40, 90, .26);
  --shadow-btn: 0 6px 14px rgba(17, 86, 176, .28);
  --scrim: rgba(20, 34, 59, .45);

  --radius: 22px;             /* cards */
  --radius-md: 14px;          /* rows, inputs */
  --pill: 999px;
  --ring: 0 0 0 4px rgba(17, 86, 176, .28);
  --topbar-h: 60px;
  --gutter: 16px;
}

:root[data-theme="dark"] {
  --bg: #0e1626;
  --surface: #18233a;
  --surface-2: #1f2c47;
  --surface-3: #283857;
  --field: #121b2f;
  --text: #eef3fb;
  --text-2: #b7c3d8;
  --text-3: #93a1ba;
  --border: #2a3855;
  --border-strong: #46597f;

  --primary: #2f73d6;
  --on-primary: #ffffff;
  --primary-text: #9cc3ff;
  --primary-soft: rgba(110, 168, 255, .2);
  --primary-mid: #5f84bd;

  --success: #5ad69a;
  --on-success: #0e1626;
  --success-soft: rgba(90, 214, 154, .16);
  --warning: #ffcf7a;
  --warning-soft: rgba(255, 186, 67, .17);
  --danger: #ff9a92;
  --on-danger: #0e1626;
  --danger-soft: rgba(255, 120, 110, .17);
  --google: #7fd8e8;
  --google-soft: rgba(34, 165, 190, .2);

  --shadow: 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  --shadow-btn: 0 6px 14px rgba(0, 0, 0, .35);
  --scrim: rgba(4, 8, 16, .7);
  --ring: 0 0 0 4px rgba(156, 195, 255, .4);
}

/* One accent color per workflow template, used as a tinted label. */
.tone-blue { --tone: #1156b0; }
.tone-violet { --tone: #5b3d9a; }
.tone-teal { --tone: #0c6b66; }
.tone-amber { --tone: #9a4a12; }
.tone-rose { --tone: #a3123a; }
.tone-slate { --tone: #4b5870; }
[data-theme="dark"] .tone-blue { --tone: #9cc3ff; }
[data-theme="dark"] .tone-violet { --tone: #c3b0f0; }
[data-theme="dark"] .tone-teal { --tone: #6fd8cd; }
[data-theme="dark"] .tone-amber { --tone: #ffc98a; }
[data-theme="dark"] .tone-rose { --tone: #ffa3b8; }
[data-theme="dark"] .tone-slate { --tone: #bcc8da; }

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 32px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-2);
  font: 500 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex; flex-direction: column;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { color: var(--text); font-family: var(--font); font-weight: 900; }
h1 { font-size: clamp(1.75rem, 1.3rem + 1.9vw, 2.25rem); line-height: 1.15; letter-spacing: -.01em; }
h2 { font-size: 1.1875rem; line-height: 1.25; }
h3 { font-size: 1.0625rem; line-height: 1.3; font-weight: 800; }
a { color: inherit; text-decoration: none; }
b, strong { font-weight: 800; color: var(--text); }
img { max-width: 100%; }
code { font: .875em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-3); padding: 2px 7px; border-radius: 8px; color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.icon { flex: none; vertical-align: middle; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 10px; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 200; padding: 12px 20px; background: var(--primary); color: var(--on-primary); border-radius: var(--pill); font-weight: 800; transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.when-dark { display: none; }
.when-light { display: inline-flex; }
[data-theme="dark"] .when-dark { display: inline-flex; }
[data-theme="dark"] .when-light { display: none; }

/* "Provided by" credit at the foot of every page. */
.site-foot { margin-top: auto; padding: 8px var(--gutter) calc(env(safe-area-inset-bottom) + 22px); text-align: center; }
.provided-by { display: inline-block; padding: 6px 12px; border-radius: 14px; line-height: 1.2; opacity: .7; transition: opacity .2s; }
.provided-by:hover, .provided-by:focus-visible { opacity: 1; }
.provided-by-label { color: var(--text-3); font-size: .6875rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.provided-by img { height: 28px; width: auto; margin-top: 6px; vertical-align: top; }

.eyebrow { display: block; color: var(--text-2); font-size: .9375rem; font-weight: 700; margin-bottom: 2px; }

/* ==========================================================================
   App shell: floating pill nav (desktop), hamburger dropdown (phones)
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h);
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  background: var(--surface);
  box-shadow: var(--shadow);
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; margin-right: 10px; border-radius: var(--pill); }
.brand-logo {
  flex: none; width: 42px; height: 38px; background: var(--primary);
  -webkit-mask: url("../img/emblem-white.png") center / contain no-repeat;
  mask: url("../img/emblem-white.png") center / contain no-repeat;
}
[data-theme="dark"] .brand-logo { background: #ffffff; }
.brand-name { color: var(--text); font-weight: 900; font-size: 1.1875rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 479px) {
  .topbar { gap: 6px; }
  .topbar .brand { gap: 8px; margin-right: 0; }
  .topbar .brand-name { font-size: 1.0625rem; }
  .topbar-actions { gap: 0; flex: none; }
}

.tabs { display: none; align-items: center; gap: 4px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  padding: 0 16px; border-radius: var(--pill); color: var(--text-2); font-weight: 700; font-size: .9375rem;
  transition: background-color .2s, color .2s;
}
.tab:hover { background: var(--surface-3); color: var(--text); }
.tab.is-active { background: var(--primary); color: var(--on-primary); }
.tab:focus-visible { border-radius: var(--pill); }
.tab-badge b {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--pill); background: #ffe2a8; color: #6b4300; font-size: .75rem; font-weight: 800; font-variant-numeric: tabular-nums;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.page {
  width: 100%; max-width: 1280px; margin: 0 auto;
  padding: 22px var(--gutter) calc(env(safe-area-inset-bottom) + 36px);
  display: flex; flex-direction: column; gap: 18px;
}
.page > [data-live], .doc-main, .doc-side, .form-page, .dash-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.page-wide { max-width: 1560px; }
.page-narrow { max-width: 780px; }

@media (min-width: 900px) {
  :root { --gutter: 28px; }
  /* Only the white pill is drawn; the strip around it is see-through, so the
     page shows past its rounded ends as it scrolls (as on the agency sites).
     The strip itself ignores the mouse so it never blocks what is behind it. */
  .topbar {
    isolation: isolate;
    height: calc(var(--topbar-h) + 28px);
    padding: 16px max(calc(var(--gutter) + 10px), calc((100% - 1280px) / 2 + 10px)) 12px max(calc(var(--gutter) + 20px), calc((100% - 1280px) / 2 + 20px));
    background: transparent; box-shadow: none; pointer-events: none;
  }
  .topbar > * { pointer-events: auto; align-self: stretch; }
  .topbar::before {
    content: ""; position: absolute; z-index: -1; top: 16px; left: 50%; transform: translateX(-50%);
    width: calc(100% - var(--gutter) * 2); max-width: 1280px; height: var(--topbar-h);
    background: var(--surface); border-radius: var(--pill); box-shadow: var(--shadow-md);
  }
  .tabs { flex: 1; }
  .tabs { display: flex; }
  .page { padding-top: 20px; padding-bottom: 64px; gap: 22px; }
  .page > [data-live], .doc-main, .doc-side, .form-page, .dash-main { gap: 22px; }
}

/* ==========================================================================
   Page furniture
   ========================================================================== */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
.page-sub { margin-top: 4px; max-width: 60ch; }
.page-sub .icon { margin-right: 6px; vertical-align: -2px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.toolbar > * { max-width: 100%; }
.section-head, .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head { margin-bottom: 12px; }
.section-head h2 { font-size: 1.375rem; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: .9375rem; font-weight: 700; margin-bottom: -6px; }
.crumbs a { color: var(--primary-text); padding: 6px 0; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--primary-text); font-weight: 800; font-size: .9375rem; display: inline-flex; align-items: center; gap: 4px; }
.link .icon { transition: transform .2s; }
.link:hover { text-decoration: underline; }
.link:hover .icon { transform: translateX(3px); }
.hint { color: var(--text-3); font-size: .875rem; line-height: 1.45; display: inline-flex; align-items: flex-start; gap: 6px; }
.hint .icon { margin-top: 2px; }
.hint-warn { color: var(--warning); }
.count { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 9px; border-radius: var(--pill); background: var(--surface-3); color: var(--primary-text); font-size: .8125rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.subhead { margin: 22px 0 8px; color: var(--text-2); font-size: .9375rem; font-weight: 800; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card-head { margin-bottom: 14px; flex-wrap: wrap; }
.card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
@media (min-width: 900px) { .card { padding: 24px; } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 26px 12px; }
.empty-icon { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); margin-bottom: 8px; }
.empty-title { font-weight: 900; font-size: 1.125rem; color: var(--text); }
.empty-text { max-width: 44ch; }
.empty .btn { margin-top: 12px; }

/* ==========================================================================
   Controls
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 0; border-radius: var(--pill);
  background: var(--primary-soft); color: var(--primary-text);
  font-weight: 800; font-size: .9375rem; line-height: 1.2; white-space: nowrap;
  transition: background-color .2s, box-shadow .2s, transform .15s, filter .2s;
}
.btn:hover { filter: brightness(.96); transform: translateY(-1px); }
[data-theme="dark"] .btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { border-radius: var(--pill); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-btn); }
.btn-primary:hover, [data-theme="dark"] .btn-primary:hover { filter: brightness(1.1); }
.btn-success { background: var(--success); color: var(--on-success); box-shadow: 0 6px 14px rgba(29, 122, 76, .24); }
.btn-success:hover, [data-theme="dark"] .btn-success:hover { filter: brightness(1.08); }
.btn-outline { background: var(--surface); color: var(--primary-text); box-shadow: inset 0 0 0 2px var(--primary-soft); }
.btn-ghost { background: var(--surface-3); color: var(--primary-text); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); filter: none; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .875rem; }
.btn-block { width: 100%; }
/* Google's button keeps Google's own colors and wording. */
.btn-google { background: #fff; color: #1f1f1f; box-shadow: inset 0 0 0 1px #747775; font-weight: 700; }
.btn-google:hover { background: #f4f6fa; filter: none; }
.is-busy { opacity: .6; pointer-events: none; }
@media (pointer: coarse) { .btn-sm { min-height: 44px; } }

.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); transition: background-color .2s, color .2s; }
.icon-btn:hover { background: var(--surface-3); color: var(--primary-text); }
.icon-btn:focus-visible { border-radius: 50%; }

.seg-control { display: inline-flex; gap: 2px; max-width: 100%; padding: 4px; border-radius: var(--pill); background: var(--surface); box-shadow: var(--shadow); overflow-x: auto; scrollbar-width: none; }
.seg-control::-webkit-scrollbar { display: none; }
.seg-btn { display: inline-flex; flex: none; align-items: center; gap: 6px; min-height: 36px; padding: 0 16px; border: 0; border-radius: var(--pill); background: transparent; color: var(--text-2); font-weight: 800; font-size: .875rem; transition: background-color .2s, color .2s; }
.seg-btn:hover { color: var(--text); background: var(--surface-2); }
.seg-btn.is-active { background: var(--primary); color: var(--on-primary); }
.seg-btn:focus-visible { border-radius: var(--pill); }
@media (pointer: coarse) { .seg-btn { min-height: 40px; } }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; border: 0; padding: 0; }
.field label, .field legend { color: var(--text); font-weight: 800; font-size: .9375rem; padding: 0; }
.req { color: var(--danger); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 48px; padding: 10px 16px;
  background-color: var(--field); color: var(--text); font-weight: 600;
  border: 2px solid var(--border); border-radius: var(--radius-md);
  transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364718a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }
[data-theme="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2393a1ba' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; font-weight: 500; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--primary); box-shadow: var(--ring); border-radius: var(--radius-md); }
input[readonly] { background-color: var(--surface-2); color: var(--text-2); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { color-scheme: dark; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 700; color: var(--text); }
.check input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.filter select, .filter input { min-width: 190px; border-color: transparent; box-shadow: var(--shadow); border-radius: var(--pill); min-height: 44px; }
.filter select:focus-visible, .filter input:focus-visible { border-radius: var(--pill); border-color: var(--primary); }
.form-grid { display: grid; gap: 0 18px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .field-wide { grid-column: 1 / -1; } }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.form-actions-inline { justify-content: flex-start; margin-top: 8px; }
@media (max-width: 639px) { .form-actions .btn { flex: 1; } }

/* Status and due-date tags: soft tinted pills. */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: var(--pill); font-size: .8125rem; line-height: 1.1; font-weight: 800; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.pill-todo, .pill-admin { background: var(--primary-soft); color: var(--primary-text); }
.pill-in_progress { background: var(--warning-soft); color: var(--warning); }
.pill-done { background: var(--success-soft); color: var(--success); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.due { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: var(--pill); background: var(--surface-3); color: var(--primary-text); font-size: .8125rem; line-height: 1.1; font-weight: 800; white-space: nowrap; }
.due-muted { padding: 0; background: transparent; color: var(--text-3); font-weight: 600; white-space: normal; line-height: 1.4; }
.due-warning { background: var(--warning-soft); color: var(--warning); }
.due-danger { background: var(--danger-soft); color: var(--danger); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); margin-right: 8px; }
.dot-todo { background: var(--primary); }
.dot-in_progress { background: #f0a92c; }
.dot-done { background: var(--success); }

.avatar { --size: 32px; display: inline-grid; place-items: center; flex: none; width: var(--size); height: var(--size); border-radius: 50%; background: var(--avatar, var(--surface-3)); color: var(--avatar-ink, #fff); font-size: calc(var(--size) * .38); font-weight: 800; letter-spacing: .02em; object-fit: cover; user-select: none; }
.avatar-sm { --size: 24px; }
.avatar-lg { --size: 44px; }
.avatar-xl { --size: 64px; }
.avatar-empty { background: var(--surface-3); color: var(--text-3); }
.who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: .9375rem; font-weight: 700; color: var(--text-2); }
.who > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Account menu */
.menu { position: relative; }
.avatar-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.avatar-btn .avatar { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px transparent; transition: box-shadow .2s; }
.avatar-btn:hover .avatar, .avatar-btn[aria-expanded="true"] .avatar { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--primary-soft); }
.avatar-btn:focus-visible { border-radius: 50%; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 14px); z-index: 60; width: min(300px, calc(100vw - 24px)); padding: 10px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: pop .2s ease-out; transform-origin: top right; }
.menu-who { display: flex; gap: 12px; align-items: center; padding: 10px 10px 16px; }
.menu-name { color: var(--text); font-weight: 900; overflow-wrap: anywhere; }
.menu-email { color: var(--text-3); font-size: .875rem; overflow-wrap: anywhere; margin-bottom: 6px; }
.menu-label { padding: 12px 12px 4px; color: var(--text-3); font-size: .8125rem; font-weight: 800; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text); font-weight: 700; text-align: left; transition: background-color .2s, color .2s; }
.menu-item:hover { background: var(--surface-3); color: var(--primary-text); }
.menu-item .icon { color: var(--text-3); transition: color .2s; }
.menu-item:hover .icon { color: inherit; }
.menu-sep { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* Dialogs */
.dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 28px; background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-lg); overflow: auto; }
.dialog-sm { width: min(440px, calc(100vw - 24px)); }
.dialog::backdrop { background: var(--scrim); }
.dialog[open] { animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.dialog-body { padding: 26px 26px 8px; }
.dialog-title { font-weight: 900; font-size: 1.5rem; line-height: 1.2; margin-bottom: 14px; }
.dialog-text { margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 26px 24px; flex-wrap: wrap; }
.dialog-actions-start { margin-right: auto; }
@media (max-width: 639px) {
  .dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 28px 28px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .dialog[open] { animation: sheet .28s ease-out; }
  @keyframes sheet { from { transform: translateY(100%); } }
}

/* Toasts */
.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 14px); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 12px; border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); font-weight: 700; pointer-events: auto; animation: toast-in .25s ease-out; }
.toast-icon { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--success-soft); color: var(--success); }
.toast.is-error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast p { flex: 1; }
.toast button { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); display: grid; place-items: center; }
.toast button:hover { background: var(--surface-3); color: var(--text); }
.toast.is-leaving { animation: toast-out .16s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@media (min-width: 900px) { .toasts { left: auto; right: 28px; bottom: 28px; transform: none; } }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s; }
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat:focus-visible { border-radius: var(--radius); }
.stat-icon { display: none; }
.stat-value { display: grid; place-items: center; flex: none; min-width: 48px; height: 48px; padding: 0 8px; border-radius: var(--pill); background: var(--primary-soft); color: var(--primary-text); font-weight: 900; font-size: 1.375rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { min-width: 0; color: var(--text); font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.stat-alert .stat-value { background: var(--danger-soft); color: var(--danger); }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; } .stat { padding: 16px 20px; gap: 14px; } .stat-value { min-width: 54px; height: 54px; font-size: 1.5rem; } }

.dash-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 22px; align-items: start; } }

.todos { display: flex; flex-direction: column; gap: 8px; }
.todo { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "check body" ". meta"; align-items: center; gap: 0 6px; padding: 6px 14px 8px 6px; background: var(--surface-2); border-radius: 16px; }
.todo > form, .todo > .check-btn { grid-area: check; }
.todo-body { grid-area: body; display: flex; flex-direction: column; min-width: 0; padding: 4px 0; border-radius: 10px; }
.todo-title { color: var(--text); font-weight: 800; overflow-wrap: anywhere; }
.todo-body:hover .todo-title { color: var(--primary-text); }
.todo-sub { font-size: .9375rem; overflow-wrap: anywhere; }
.todo-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.todos-quiet .todo { background: transparent; padding-top: 0; padding-bottom: 0; }
.todos-quiet .todo-title { font-weight: 700; }
@media (min-width: 640px) { .todo { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "check body meta"; padding-bottom: 6px; } .todo-meta { justify-content: flex-end; } }

/* The check-off circle. */
.check-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: transparent; position: relative; }
.check-btn::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); transition: border-color .2s, background-color .2s; }
.check-btn .icon { position: relative; transition: color .2s; }
button.check-btn:hover::before, button.check-btn:focus-visible::before { border-color: var(--success); background: var(--success); }
button.check-btn:hover, button.check-btn:focus-visible { color: var(--on-success); }
button.check-btn:focus-visible { border-radius: 50%; }
.check-btn-off { color: var(--text-3); cursor: default; }
.check-btn-off::before { border-color: transparent; background: var(--surface-3); }
.check-btn-done { color: var(--on-success); cursor: default; }
.check-btn-done::before { background: var(--success); border-color: var(--success); }

.feed { display: flex; flex-direction: column; gap: 16px; }
.feed-item { display: flex; gap: 10px; align-items: flex-start; font-size: .9375rem; }
.feed-item p { min-width: 0; overflow-wrap: anywhere; }
.feed-item .avatar { margin-top: 1px; }
.feed-link { color: var(--primary-text); font-weight: 800; }
.feed-link:hover { text-decoration: underline; }
.feed-time { color: var(--text-3); font-size: .8125rem; white-space: nowrap; margin-left: 4px; }

/* Project cards */
.pgrid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.pcard { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s; }
.pcard:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.pcard:focus-visible { border-radius: var(--radius); }
.pcard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }
.pcard-kind, .doc-head .eyebrow { display: inline-block; align-self: flex-start; padding: 4px 11px; border-radius: var(--pill); background: color-mix(in srgb, var(--tone) 13%, var(--surface)); color: var(--tone); font-size: .8125rem; line-height: 1.2; font-weight: 800; }
.pcard-title { font-weight: 900; font-size: 1.25rem; line-height: 1.2; margin-top: 4px; overflow-wrap: anywhere; }
.pcard-client { font-size: .9375rem; overflow-wrap: anywhere; }
.pcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
/* Progress: one rounded track, filled step by step. */
.segs { display: flex; height: 10px; margin: 12px 0 10px; border-radius: var(--pill); background: var(--surface-3); overflow: hidden; }
.seg { flex: 1; }
.seg-done { background: var(--primary); }
.seg-todo, .seg-in_progress { background: var(--primary-mid); border-radius: 0 var(--pill) var(--pill) 0; }

/* ==========================================================================
   Tasks: board and list
   ========================================================================== */
.col-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; margin-bottom: 10px; scrollbar-width: none; }
.col-tabs::-webkit-scrollbar { display: none; }
.col-tab { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--pill); background: var(--surface); color: var(--text-2); font-weight: 800; font-size: .875rem; white-space: nowrap; box-shadow: var(--shadow); }
.col-tab[aria-selected="true"] { background: var(--primary); color: var(--on-primary); }
.col-tab[aria-selected="true"] .count { background: rgba(255, 255, 255, .22); color: #fff; }
.col-tab:focus-visible { border-radius: var(--pill); }

.board { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.col { display: none; min-width: 0; border-radius: var(--radius); transition: background-color .2s, box-shadow .2s; }
[data-col="waiting"] .col-waiting, [data-col="todo"] .col-todo, [data-col="in_progress"] .col-in_progress, [data-col="done"] .col-done { display: block; }
.col-head { display: none; align-items: center; justify-content: space-between; margin: 0 6px 12px; }
.col-head h2 { display: flex; align-items: center; font-size: 1.0625rem; }
.col-body { display: flex; flex-direction: column; gap: 12px; min-height: 80px; }
.col-empty { padding: 22px 12px; text-align: center; color: var(--text-3); font-size: .9375rem; font-weight: 600; background: color-mix(in srgb, var(--surface) 55%, transparent); border-radius: 18px; }
.col.is-drop-target { background: var(--primary-soft); box-shadow: 0 0 0 10px var(--primary-soft); }
.board-hint { display: none; }
@media (min-width: 900px) {
  .col-tabs { display: none; }
  .board { grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 22px; overflow-x: auto; padding: 4px 4px 12px; margin: -4px; }
  .col { display: block !important; }
  .col-head { display: flex; }
  .board-hint { display: inline-flex; }
}

.tcard { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s, opacity .2s; }
.tcard[draggable="true"] { cursor: grab; }
.tcard[draggable="true"]:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tcard.dragging { opacity: .4; }
.tcard.is-done .tcard-title, .tcard.is-waiting .tcard-title { color: var(--text-2); }
.tcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tcard-step { color: var(--tone); font-size: .8125rem; font-weight: 800; }
.tcard-title { font-weight: 900; font-size: 1.125rem; line-height: 1.2; overflow-wrap: anywhere; }
.tcard-title a:hover { color: var(--primary-text); }
.tcard-title a::after { content: ""; position: absolute; inset: 0; border-radius: 20px; }  /* whole card opens the document */
.tcard-project { display: flex; align-items: center; gap: 6px; font-size: .9375rem; min-width: 0; }
.tcard-project span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.tcard-actions { position: relative; z-index: 1; display: flex; gap: 6px; margin-left: auto; }

.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: grid; align-items: center; gap: 4px 10px; padding: 8px 14px 10px 6px; background: var(--surface-2); border-radius: 16px; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "check main actions" ". who status" ". due due"; }
.row-check { grid-area: check; display: grid; place-items: center; min-width: 44px; }
.row-main { grid-area: main; display: flex; flex-direction: column; min-width: 0; padding: 2px 0; border-radius: 10px; }
.row-title { color: var(--text); font-weight: 800; overflow-wrap: anywhere; }
a.row-main:hover .row-title { color: var(--primary-text); }
.row-sub { font-size: .9375rem; overflow-wrap: anywhere; }
.row-who { grid-area: who; }
.row-status { grid-area: status; justify-self: end; }
.row-due { grid-area: due; justify-self: start; }
.row-actions { grid-area: actions; display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions form { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row.is-off { opacity: .6; }
@media (min-width: 900px) {
  .row { padding: 6px 14px 6px 6px; grid-template-columns: auto minmax(0, 2.2fr) minmax(0, 1fr) 130px minmax(150px, auto) minmax(96px, auto); grid-template-areas: "check main who status due actions"; gap: 16px; }
  .row-status { justify-self: start; }
  .row-person { grid-template-columns: auto minmax(0, 2fr) 110px minmax(0, 1fr) auto; grid-template-areas: "check main status due actions"; }
}
@media (max-width: 899px) { .row-person { grid-template-areas: "check main status" ". due due" ". actions actions"; } .row-person .row-actions, .row-person .row-actions form { justify-content: flex-start; } }

.row-mail { display: block; padding: 0; }
.row-mail summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; border-radius: 16px; }
.row-mail summary::-webkit-details-marker { display: none; }
.row-mail .hint { margin: 0 16px 10px; }
.mail-body { margin: 0 12px 12px; padding: 16px; background: var(--surface); color: var(--text); border-radius: var(--radius-md); font: .8125rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ==========================================================================
   Project (document card)
   ========================================================================== */
.doc-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.doc-head .eyebrow { margin-bottom: 8px; }
.doc-head-main { flex: 1 1 320px; min-width: 0; }
.doc-head h1 { overflow-wrap: anywhere; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-top: 8px; font-size: .9375rem; }
.doc-meta span { display: inline-flex; align-items: center; gap: 6px; }
.doc-head .segs { max-width: 440px; height: 12px; margin: 16px 0 0; }
.doc-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.doc-solo { min-width: 0; }
@media (min-width: 1100px) { .doc-grid { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 22px; align-items: start; } .doc-head { padding: 28px; } }

.steps { display: flex; flex-direction: column; }
.step { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 14px; padding-bottom: 22px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 17px; top: 42px; bottom: 4px; width: 4px; border-radius: var(--pill); background: var(--surface-3); }
.step:last-child::before { display: none; }
.step-done::before { background: var(--success-soft); }
.step-marker { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-3); color: var(--text-3); font-weight: 900; z-index: 1; }
.step-done .step-marker { background: var(--success-soft); color: var(--success); }
.step-todo .step-marker, .step-in_progress .step-marker { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-btn); }
.step-body { min-width: 0; padding-top: 6px; }
.step-todo .step-body, .step-in_progress .step-body { margin-top: -8px; padding: 14px 16px 16px; background: var(--surface-2); border-radius: 20px; }
.step-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.step-top h3 { font-weight: 900; font-size: 1.125rem; overflow-wrap: anywhere; }
.step-waiting .step-top h3 { color: var(--text-2); font-weight: 800; }
.step-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; }
.step-notes { margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.step-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.step-actions .btn { white-space: normal; text-align: left; padding-top: 8px; padding-bottom: 8px; border-radius: 24px; }
.step-waiting .step-actions .btn { min-height: 36px; font-size: .875rem; }
/* Phones: Start gets its own row, above Done. */
@media (max-width: 899px) { .step-actions .step-start { order: -1; flex: 0 0 100%; } }

.note-form textarea { min-height: 80px; }
.note-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 10px 0 18px; }
.notes { display: flex; flex-direction: column; gap: 10px; }
.note { display: flex; gap: 12px; padding: 14px 16px; background: var(--surface-2); border-radius: 20px; }
.note-body { min-width: 0; flex: 1; }
.note-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: .875rem; color: var(--text-3); }
.note-head b { font-size: 1rem; }
.note-text { margin-top: 4px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }

.details { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.details dt { color: var(--text-3); font-size: .875rem; font-weight: 700; margin-bottom: 2px; }
.details dd { color: var(--text); font-weight: 800; overflow-wrap: anywhere; }
.details-wide { grid-column: 1 / -1; }
.details-wide dd { font-weight: 600; }

/* ==========================================================================
   Calendar
   ========================================================================== */
.cal-nav { display: inline-flex; align-items: center; gap: 4px; padding: 0 2px; border-radius: var(--pill); background: var(--surface); box-shadow: var(--shadow); }
.cal-nav .btn { background: transparent; min-height: 44px; padding: 0 10px; }
.cal { padding: 8px; overflow: hidden; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 4px; }
.cal-row:last-child { margin-bottom: 0; }
.cal-weekdays span { padding: 8px 4px; text-align: center; color: var(--text-3); font-size: .875rem; font-weight: 800; }
.cal-cell { position: relative; min-height: 58px; padding: 4px; background: var(--surface-2); border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.cal-cell.is-weekend { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.cal-cell.is-outside { background: transparent; }
.cal-cell.is-outside .cal-date { color: var(--text-3); opacity: .7; }
.cal-cell-head { display: flex; align-items: center; justify-content: center; width: 100%; }
.cal-date { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 4px; border-radius: var(--pill); color: var(--text); font-weight: 800; font-size: .9375rem; font-variant-numeric: tabular-nums; }
.is-today .cal-date { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-btn); }
.cal-add { display: none; }
.cal-items { display: none; }
.cal-dots { display: flex; gap: 3px; justify-content: center; padding: 6px; margin: -4px; }
.cal-dots::after { content: ""; position: absolute; inset: 0; border-radius: 14px; }
.cal-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.cal-dot-task { background: var(--primary); }
[data-theme="dark"] .cal-dot-task { background: var(--primary-text); }
.cal-dot-warning { background: #f0a92c; }
.cal-dot-danger, [data-theme="dark"] .cal-dot-danger { background: #e0483b; }
.cal-dot-event { background: #8b6fd6; }
.cal-dot-google { background: var(--google); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: .875rem; font-weight: 700; padding: 0 6px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 8px; }

.chip { display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; padding: 4px 9px; border: 0; border-radius: 10px; background: var(--primary-soft); color: var(--primary-text); font-size: .8125rem; font-weight: 800; line-height: 1.3; text-align: left; transition: filter .2s; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip b { flex: none; font-size: .75rem; color: inherit; font-weight: 900; }
.chip:hover { filter: brightness(.95); }
[data-theme="dark"] .chip:hover { filter: brightness(1.2); }
.chip:focus-visible { border-radius: 10px; }
.chip-warning { background: var(--warning-soft); color: var(--warning); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-event { background: color-mix(in srgb, #8b6fd6 16%, var(--surface)); color: #5b3d9a; }
[data-theme="dark"] .chip-event { color: #c3b0f0; }
.chip-google { background: var(--google-soft); color: var(--google); }

.agenda-days { display: flex; flex-direction: column; gap: 8px; }
.agenda-day { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 10px; background: var(--surface-2); border-radius: 18px; scroll-margin-top: calc(var(--topbar-h) + 32px); }
.agenda-date { display: flex; flex-direction: column; align-items: center; justify-content: center; align-self: start; width: 52px; height: 52px; border-radius: 50%; background: var(--surface); line-height: 1.05; }
.agenda-date b { font-weight: 900; font-size: 1.25rem; }
.agenda-date span { font-size: .6875rem; font-weight: 800; color: var(--text-3); }
.agenda-day.is-today .agenda-date { background: var(--primary); }
.agenda-day.is-today .agenda-date b, .agenda-day.is-today .agenda-date span { color: var(--on-primary); }
.agenda-day:target { box-shadow: 0 0 0 3px var(--primary-soft); }
.agenda-items { display: flex; flex-direction: column; gap: 6px; min-width: 0; justify-content: center; }
.agenda-items .chip { min-height: 44px; padding: 6px 14px; font-size: .9375rem; border-radius: 14px; }
.agenda-items .chip span { white-space: normal; }

@media (min-width: 900px) {
  .cal { padding: 12px; }
  .cal-row { gap: 6px; margin-bottom: 6px; }
  .cal-cell { min-height: 122px; padding: 8px; align-items: stretch; border-radius: 16px; }
  .cal-cell-head { justify-content: space-between; }
  .cal-items { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .cal-dots { display: none; }
  .cal-add { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--surface); color: var(--primary-text); opacity: 0; transition: opacity .2s, background-color .2s; }
  .cal-cell:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
  .cal-add:hover { background: var(--primary-soft); }
  .cal-add:focus-visible { border-radius: 50%; }
  .cal-more { font-size: .8125rem; font-weight: 800; color: var(--primary-text); padding: 1px 8px; }
  .cal-more:hover { text-decoration: underline; }
}

/* ==========================================================================
   Templates and the step builder
   ========================================================================== */
.tgrid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); align-items: start; }
.tmpl-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tmpl-head h2 { font-size: 1.375rem; line-height: 1.2; }
.tmpl-desc { margin-top: 4px; }
.tmpl-steps { display: flex; flex-direction: column; gap: 6px; margin: 16px 0; }
.tmpl-steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "num name days" ". who who"; align-items: center; gap: 2px 10px; padding: 8px 12px 8px 8px; background: var(--surface-2); border-radius: 14px; }
.tmpl-num { grid-area: num; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--tone) 15%, var(--surface)); color: var(--tone); font-weight: 900; font-size: .875rem; }
.tmpl-name { grid-area: name; color: var(--text); font-weight: 800; overflow-wrap: anywhere; }
.tmpl-steps .who { grid-area: who; }
.tmpl-steps .due { grid-area: days; }
.tmpl-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tmpl-foot form { margin-left: auto; }
@media (min-width: 640px) { .tmpl-steps li { grid-template-columns: 30px minmax(0, 1.4fr) minmax(0, 1fr) auto; grid-template-areas: "num name who days"; } }

.swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.swatch { display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch span[aria-hidden] { width: 28px; height: 28px; border-radius: 50%; background: var(--tone); transition: box-shadow .2s; }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--tone); }
.swatch input:focus-visible + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 7px var(--primary); }

.step-rows { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.step-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px; background: var(--surface-2); border-radius: 20px; }
.step-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.step-row-num { display: inline-flex; align-items: center; gap: 12px; font-size: .9375rem; font-weight: 700; }
.step-row-num b { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); font-weight: 900; }
.step-row-tools { display: flex; gap: 2px; }
.step-row-tools .icon-btn { width: 40px; height: 40px; }
.step-row-tools .icon-btn:hover { background: var(--surface); }
.step-row-tools .icon-btn[disabled] { opacity: .3; cursor: default; background: transparent; color: var(--text-2); }
.step-row-tools .icon-btn.is-danger:not([disabled]):hover { background: var(--danger-soft); color: var(--danger); }
.step-row-fields { display: grid; gap: 0 16px; grid-template-columns: minmax(0, 1fr); }
.step-row .field { margin-bottom: 10px; }
.input-group { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 8px; }
.step-toggles { display: flex; flex-wrap: wrap; gap: 0 24px; }
.btn-add-step { width: 100%; background: transparent; box-shadow: inset 0 0 0 2px var(--primary-soft); }
@media (min-width: 640px) {
  .step-row-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .step-row-fields .field-wide { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .step-row-fields { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr); }
}
.field-note { justify-content: flex-end; }
.field-note .hint { min-height: 48px; align-items: center; }

/* ==========================================================================
   Settings
   ========================================================================== */
.profile { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-option { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 92px; padding: 16px 8px; border: 0; border-radius: 20px; background: var(--surface-2); color: var(--text-2); font-weight: 800; font-size: .9375rem; text-align: center; transition: background-color .2s, color .2s, box-shadow .2s; }
.theme-option:hover { color: var(--text); background: var(--surface-3); }
.theme-option[aria-checked="true"] { background: var(--primary-soft); color: var(--primary-text); box-shadow: inset 0 0 0 2px var(--primary); }
.theme-option:focus-visible { border-radius: 20px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; padding: 18px 0; border-top: 1px solid var(--border); }
.setting-row:first-of-type { border-top: 0; padding-top: 0; }
.setting-row:last-child { padding-bottom: 0; }
.setting-row > div:first-child { flex: 1 1 280px; }
.setting-row h3 { margin-bottom: 4px; }
.setting-row-stack { flex-direction: column; align-items: stretch; }
.setting-row-stack > div:first-child { flex: none; }
.copy-row { display: flex; gap: 8px; flex-wrap: wrap; }
.copy-row input { flex: 1 1 240px; font-size: .875rem; }

/* ==========================================================================
   Sign-in: the firm's logo above one card
   ========================================================================== */
.login { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px var(--gutter) 40px; }
/* The logo file is white; using it as a mask lets the theme choose its color. */
.login-logo {
  width: min(330px, 78vw); aspect-ratio: 540 / 241; background: var(--primary);
  -webkit-mask: url("../img/logo-white.png") center / contain no-repeat;
  mask: url("../img/logo-white.png") center / contain no-repeat;
}
[data-theme="dark"] .login-logo { background: #ffffff; }
.login-card { position: relative; width: 100%; max-width: 440px; padding: 28px 22px; background: var(--surface); border-radius: 28px; box-shadow: var(--shadow-md); }
.login-theme { position: absolute; top: 14px; right: 14px; }
.login-title { font-size: 2rem; line-height: 1.1; margin-bottom: 6px; }
.login-sub { margin-bottom: 22px; }
.login-card .btn-google { width: 100%; min-height: 50px; }
.login-card > .hint { margin-top: 10px; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 26px 0 14px; color: var(--text-3); font-size: .875rem; font-weight: 800; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: var(--border); }
.dev-panel { padding: 16px; border-radius: 20px; background: var(--surface-2); }
.dev-panel-title { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 900; }
.dev-panel .hint { margin: 4px 0 12px; }
.login-foot { color: var(--text-3); font-size: .875rem; text-align: center; }
@media (min-width: 900px) { .login-card { padding: 40px 36px; } .login { gap: 28px; } }

.error-page { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 24px; }
.error-page p { max-width: 46ch; }
.error-page .btn { margin-top: 16px; }
.error-code { display: grid; place-items: center; min-width: 140px; height: 140px; padding: 0 24px; border-radius: var(--pill); background: var(--primary-soft); color: var(--primary-text) !important; font-weight: 900; font-size: 3rem; line-height: 1; margin-bottom: 8px; }

/* ==========================================================================
   Phone menu: a hamburger that turns into an X and drops the menu down
   (same motion as the agency sites' nav)
   ========================================================================== */
@media (max-width: 899px) { .only-desktop { display: none !important; } }
@media (min-width: 900px) { .only-mobile, .mobile-scrim { display: none !important; } }

.nav-toggle { display: grid; place-items: center; width: 44px; height: 44px; margin-left: 2px; padding: 0; border: 0; border-radius: 50%; background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-btn); }
.nav-toggle:focus-visible { border-radius: 50%; }
.nav-toggle-box { position: relative; width: 20px; height: 14px; }
.nav-line { position: absolute; left: 50%; width: 100%; height: 2.5px; border-radius: 2px; background: currentColor; transform: translateX(-50%); }
.nav-line1 { top: 0; transition: transform .5s, top .3s; }
.nav-line2 { top: 50%; transform: translate(-50%, -50%); transition: transform .5s, top .3s; }
.nav-line3 { bottom: 0; transition: bottom .3s, opacity .3s; }
.topbar.is-open .nav-line1 { top: 50%; transform: translate(-50%, -50%) rotate(225deg); }
.topbar.is-open .nav-line2 { transform: translate(-50%, -50%) rotate(-225deg); }
.topbar.is-open .nav-line3 { bottom: 100%; opacity: 0; }

.mobile-menu {
  position: absolute; top: 100%; left: 0; right: 0; z-index: -1;
  max-height: calc(100dvh - var(--topbar-h)); overflow-y: auto; overscroll-behavior: contain;
  padding: 14px var(--gutter) calc(18px + env(safe-area-inset-bottom));
  background: var(--surface); border-radius: 0 0 26px 26px; box-shadow: var(--shadow-lg);
  transform: scaleY(0); transform-origin: top; visibility: hidden;
  transition: transform .4s, visibility 0s .4s;
}
.topbar.is-open .mobile-menu { transform: scaleY(1); visibility: visible; transition: transform .4s, visibility 0s; }
.mobile-links { display: flex; flex-direction: column; gap: 6px; }
.mobile-links > li { opacity: 0; transform: translateY(-28px); transition: transform .5s, opacity .6s; }
.topbar.is-open .mobile-links > li { opacity: 1; transform: none; }
.topbar.is-open .mobile-links > li:nth-child(1) { transition-delay: .05s; }
.topbar.is-open .mobile-links > li:nth-child(2) { transition-delay: .1s; }
.topbar.is-open .mobile-links > li:nth-child(3) { transition-delay: .15s; }
.topbar.is-open .mobile-links > li:nth-child(4) { transition-delay: .2s; }
.topbar.is-open .mobile-links > li:nth-child(5) { transition-delay: .25s; }
.topbar.is-open .mobile-links > li:nth-child(6) { transition-delay: .3s; }
.topbar.is-open .mobile-links > li:nth-child(7) { transition-delay: .35s; }
.topbar.is-open .mobile-links > li:nth-child(n + 8) { transition-delay: .4s; }
.mobile-link { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border-radius: 16px; color: var(--text); font-weight: 800; font-size: 1.0625rem; transition: background-color .2s, color .2s; }
.mobile-link .icon { color: var(--text-3); }
.mobile-link:hover { background: var(--surface-2); }
.mobile-link.is-active { background: var(--primary-soft); color: var(--primary-text); }
.mobile-link.is-active .icon { color: inherit; }
.mobile-link .tab-badge { margin-left: auto; }
.mobile-new { min-height: 52px; margin-top: 8px; font-size: 1.0625rem; }
.mobile-user { margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--border); }
.mobile-user .menu-who { padding: 12px 6px 10px; }
.mobile-scrim { position: fixed; inset: 0; z-index: 39; background: var(--scrim); opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s .3s; }
body.nav-open { overflow: hidden; }
body.nav-open .mobile-scrim { opacity: 1; visibility: visible; transition: opacity .3s, visibility 0s; }

/* ==========================================================================
   Form controls drawn to match: number stepper, dropdown list, date picker.
   The native select and date inputs stay in the page (so forms and screen
   readers work as usual); only their pop-up parts are replaced.
   ========================================================================== */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper { position: relative; }
.stepper input:not([type="checkbox"]):not([type="radio"]) { padding-right: 42px; }
.stepper-btns { position: absolute; top: 5px; right: 5px; bottom: 5px; width: 30px; display: flex; flex-direction: column; gap: 2px; }
.stepper-btns button { flex: 1; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: var(--surface-3); color: var(--primary-text); transition: background-color .2s; }
.stepper-btns button:hover { background: var(--primary-soft); }
.stepper-btns button:focus-visible { border-radius: 8px; }

select, input[type="date"] { cursor: pointer; }
/* (The :not() pair only gives this rule the same weight as the base input rule.) */
input[type="date"]:not([type="checkbox"]):not([type="radio"]) { padding-right: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364718a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='3'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
[data-theme="dark"] input[type="date"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2393a1ba' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='3'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E"); }
input[type="date"]::-webkit-calendar-picker-indicator { display: none; }
select[aria-expanded="true"], input[type="date"][aria-expanded="true"] { border-color: var(--primary); box-shadow: var(--ring); }
/* On touch screens the page's script opens our list or calendar instead of the system one. */
@media (pointer: coarse) { select, input[type="date"] { pointer-events: none; } }

.pop { position: fixed; z-index: 300; padding: 6px; border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); animation: pop .16s ease-out; }
[data-theme="dark"] .pop { box-shadow: var(--shadow-lg), 0 0 0 1px var(--border); }
.pop-list { display: flex; flex-direction: column; gap: 2px; max-width: calc(100vw - 16px); max-height: min(320px, 60dvh); overflow-y: auto; overscroll-behavior: contain; }
.pop-option { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex: none; width: 100%; min-height: 42px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font-weight: 700; text-align: left; white-space: nowrap; }
.pop-option.is-active { background: var(--surface-3); color: var(--primary-text); }
.pop-option[aria-selected="true"] { color: var(--primary-text); font-weight: 800; }
.pop-option[disabled] { opacity: .45; cursor: default; }
@media (pointer: coarse) { .pop-option { min-height: 48px; } }

.pop-cal { width: min(304px, calc(100vw - 16px)); padding: 12px; }
.cal-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal-pop-title { font-weight: 900; font-size: 1.0625rem; }
.cal-pop-nav { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: var(--surface-3); color: var(--primary-text); transition: background-color .2s; }
.cal-pop-nav:hover { background: var(--primary-soft); }
.cal-pop-nav:focus-visible { border-radius: 50%; }
.cal-pop-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-pop-wd { padding: 4px 0; text-align: center; color: var(--text-3); font-size: .75rem; font-weight: 800; }
.cal-pop-day { display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text); font-weight: 700; font-size: .9375rem; font-variant-numeric: tabular-nums; transition: background-color .15s; }
.cal-pop-day:hover { background: var(--surface-3); }
.cal-pop-day:focus-visible { border-radius: 50%; }
.cal-pop-day.is-out { color: var(--text-3); opacity: .6; }
.cal-pop-day.is-today { color: var(--primary-text); box-shadow: inset 0 0 0 2px var(--primary-soft); }
.cal-pop-day.is-selected { background: var(--primary); color: var(--on-primary); opacity: 1; box-shadow: var(--shadow-btn); }
.cal-pop-day[disabled] { opacity: .3; cursor: default; background: transparent; }
.cal-pop-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; }

/* A due date the assignee still has to choose, or may change. */
button.due { position: relative; z-index: 1; border: 0; font-family: inherit; transition: filter .2s, transform .15s; }
button.due:hover { filter: brightness(.95); transform: translateY(-1px); }
[data-theme="dark"] button.due:hover { filter: brightness(1.15); }
button.due:focus-visible { border-radius: var(--pill); }
.due-pick { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-btn); }
.due-pick:hover, [data-theme="dark"] .due-pick:hover { filter: brightness(1.1); }

/* Search matches */
mark { padding: 0 3px; margin: 0 -1px; border-radius: 6px; background: #ffe066; color: #14223b; font-weight: 900; }

/* ==========================================================================
   Notes drawer inside a step; canceled steps; seats
   ========================================================================== */
.step-notes-drawer { margin-top: 14px; }
.notes-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 34px; padding: 0 14px; border: 0; border-radius: var(--pill); background: var(--surface-3); color: var(--primary-text); font-weight: 800; font-size: .875rem; transition: background-color .2s; }
.step-todo .notes-toggle, .step-in_progress .notes-toggle { background: var(--surface); }
.notes-toggle:hover { background: var(--primary-soft); }
.notes-toggle:focus-visible { border-radius: var(--pill); }
.notes-toggle .count { min-width: 22px; height: 20px; padding: 0 7px; background: var(--primary-soft); }
.notes-chevron { transition: transform .3s; }
.notes-toggle[aria-expanded="true"] .notes-chevron { transform: rotate(180deg); }
@media (pointer: coarse) { .notes-toggle { min-height: 44px; } }
/* Height animates by growing a grid row from 0 to its content. */
.notes-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.notes-panel.is-open { grid-template-rows: 1fr; }
.notes-panel.no-anim { transition: none; }
.notes-panel-inner { min-height: 0; overflow: hidden; visibility: hidden; transition: visibility 0s .3s; }
.notes-panel.is-open .notes-panel-inner { visibility: visible; transition: visibility 0s; }
.notes-panel .note-form { padding-top: 12px; }
.notes-panel .note-form-foot { margin-bottom: 12px; }
.notes-panel textarea { min-height: 64px; }
.step-todo .notes-panel .note, .step-in_progress .notes-panel .note { background: var(--surface); }
.notes-none { padding: 2px 4px 6px; }

.step-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 12px 16px; border-radius: 16px; background: var(--surface-3); color: var(--text); font-weight: 700; }
.step-banner .icon { flex: none; color: var(--text-3); }
.step-cancelled .step-top h3 { color: var(--text-3); font-weight: 800; }
.step-cancelled .step-marker { background: var(--surface-3); color: var(--text-3); }

.seat-meter { display: flex; gap: 6px; margin-bottom: 12px; }
.seat { flex: 1; height: 12px; border-radius: var(--pill); background: var(--surface-3); }
.seat.is-used { background: var(--primary); }
.seat-note { display: flex; align-items: flex-start; gap: 12px; margin-top: 14px; padding: 14px 16px; border-radius: 16px; background: var(--warning-soft); color: var(--text); font-size: .9375rem; line-height: 1.45; }
.seat-note .icon { flex: none; margin-top: 2px; color: var(--warning); }
.seat-note .link { display: inline; font-size: inherit; overflow-wrap: anywhere; }
.fieldset-plain { margin: 0; padding: 0; border: 0; min-width: 0; }
.fieldset-plain:disabled { opacity: .5; }
.fieldset-plain:disabled * { cursor: not-allowed; }
.form-foot-note { margin-top: 12px; }

/* ==========================================================================
   Motion and print
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .bottomnav, .toasts, .toolbar, .doc-head-actions, .step-actions, .note-form, .site-foot { display: none !important; }
  .page { padding: 0; }
}
