:root {
  /* Nautical palette: sailcloth, navy, sea blue and brass. */
  --bg: #f4f0e6;
  --panel: #fffdf8;
  --text: #13263a;
  --muted: #5d6b7a;
  --line: #e2dccd;
  --accent: #1d5f8a;
  --accent-soft: #dfeaf2;
  --brass: #b5842a;
  --navy: #10263d;
  --navy-text: #f4ead2;
  --danger: #b8392f;
  --ok: #2e7d5b;
  --warn: #b0701c;
  --plum: #7a4f8c;
  --user-bubble: #1d4f76;
  --user-text: #ffffff;
  --on-accent: #ffffff;
  --bot-bubble: #ecf1f3;
  --shadow: 0 1px 2px rgba(16, 38, 61, .07), 0 2px 8px rgba(16, 38, 61, .06);
  --radius: 10px;
  --brand-font: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1724;
    --panel: #11212f;
    --text: #e6edf2;
    --muted: #93a3b3;
    --line: #213447;
    --accent: #5ca9d6;
    --accent-soft: #173247;
    --brass: #d8a748;
    --navy: #07111b;
    --navy-text: #f1e3c0;
    --danger: #ec6b5e;
    --ok: #5cc493;
    --warn: #e0a24a;
    --plum: #b78bd0;
    --user-bubble: #245f8c;
    --bot-bubble: #1a2d3e;
    --on-accent: #06121c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font-size: 17px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
h4 { font-size: 14px; margin: 8px 0 4px; }

button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; }
button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
h2 { font-family: var(--brand-font); font-size: 18px; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; }
button.danger { color: var(--danger); background: transparent; }
button.small { padding: 4px 10px; font-size: 13px; }
button.icon { border: none; background: transparent; padding: 4px 6px; color: var(--muted); border-radius: 6px; }
button.icon:hover { background: var(--bg); color: var(--text); }
button:disabled { opacity: .6; cursor: default; }

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 20px;
  background: var(--navy);
  color: var(--navy-text);
  border-bottom: 3px solid var(--brass);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--brand-font); font-size: 20px; letter-spacing: .01em; }
.brand-mark { color: var(--brass); font-size: 20px; line-height: 1; }
.tabs { display: flex; gap: 4px; }
.tab { border: none; background: transparent; color: rgba(244, 234, 210, .7); padding: 6px 12px; }
.tab:hover { color: var(--navy-text); background: rgba(255, 255, 255, .07); }
.tab[aria-selected="true"] { background: rgba(255, 255, 255, .1); color: var(--navy-text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--brass); }
.topbar button.ghost { color: var(--navy-text); border-color: rgba(244, 234, 210, .3); }
.topbar button.ghost:hover { border-color: var(--navy-text); }

.layout {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  gap: 16px;
  padding: 16px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  min-height: 0;
  overflow: auto;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 13px; }
.only-narrow { display: none; }
/* Wide screens: chat on the left, Tasks, Projects or Drafts on the right. */
.layout > .chat { grid-column: 1; grid-row: 1; }
.layout > [data-panel="tasks"], .layout > [data-panel="calendar"], .layout > [data-panel="projects"], .layout > [data-panel="drafts"] { grid-column: 2; grid-row: 1; }
.layout > [data-panel]:not(.chat):not(.active) { display: none; }

@media (max-width: 860px) {
  .only-narrow { display: inline-block; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .layout { grid-template-columns: 1fr; padding: 10px; }
  .layout > [data-panel] { grid-column: 1 !important; }
  .layout > [data-panel]:not(.active) { display: none; }
  .board { grid-template-columns: 1fr; }
}

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 12px; }
.msg { max-width: 88%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--user-bubble); color: var(--user-text); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--bot-bubble); border-bottom-left-radius: 4px; }
.msg ul { margin: 4px 0; padding-left: 20px; white-space: normal; }
.msg code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.msg.typing { color: var(--muted); font-style: italic; }
.confirm-actions { display: flex; gap: 8px; margin-top: 8px; white-space: normal; }
.chat-intro { color: var(--muted); text-align: center; margin: auto 12px; font-size: 14px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 12px; }
.chat-form textarea { flex: 1; resize: none; max-height: 160px; }

/* ---------- tasks ---------- */
.task-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.task-form #task-title { flex: 1 1 220px; }
.every { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.every input { width: 64px; }
.task-groups { display: flex; flex-direction: column; gap: 20px; }
.task-group summary { cursor: pointer; list-style: none; }
.task-group summary::-webkit-details-marker { display: none; }
.task-group summary h3::before { content: "▸ "; }
.task-group[open] summary h3::before { content: "▾ "; }
.count { font-weight: 400; }
.task-list { list-style: none; margin: 6px 0 0; padding: 0; }
.task {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}
.task:last-child { border-bottom: none; }
.task input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; cursor: pointer; }
.task .body { flex: 1; min-width: 0; }
.task .title { overflow-wrap: anywhere; }
.task .meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.task .meta .overdue { color: var(--danger); font-weight: 600; }
.task .meta .today { color: var(--warn); font-weight: 600; }
.task .meta .freq { color: var(--accent); }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .actions { display: flex; gap: 2px; opacity: .55; }
.task:hover .actions, .task:focus-within .actions { opacity: 1; }
.task.flash { animation: flash .8s ease; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.empty { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

/* ---------- projects board ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 6px;
}
.column {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 200px;
  display: flex; flex-direction: column; gap: 8px;
}
.column.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.column-head { display: flex; align-items: center; justify-content: space-between; }
.column-head h3 { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.col-add { display: flex; gap: 6px; }
.col-add input { flex: 1; font-size: 14px; padding: 6px 8px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: grab;
  box-shadow: var(--shadow);
}
.card:hover { border-color: var(--muted); }
.card.dragging { opacity: .4; }
.card .title { font-weight: 600; overflow-wrap: anywhere; }
.card .desc { color: var(--muted); font-size: 13px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .progress { margin-top: 8px; font-size: 12px; color: var(--muted); }
.bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 3px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ok); }
.card .next { font-size: 12.5px; margin-top: 6px; }
.card .next::before { content: "Next: "; color: var(--muted); }
.drop-marker { height: 3px; background: var(--accent); border-radius: 2px; }

/* ---------- dialogs ---------- */
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  padding: 20px;
  width: min(440px, calc(100vw - 32px));
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
dialog.wide { width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 15, 25, .45); }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
dialog label > * { color: var(--text); font-size: 15px; }
dialog .row { display: flex; gap: 12px; }
dialog .row label { flex: 1; }
.dialog-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.spacer { flex: 1; }
.step-add { display: flex; gap: 8px; margin-top: 6px; }
.step-add textarea { flex: 1; resize: none; overflow: hidden; }
.step-add { align-items: flex-start; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: var(--panel);
  padding: 9px 16px; border-radius: 8px; font-size: 14px;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 32px);
}

/* ---------- login page and account ---------- */
.auth-page { align-items: center; justify-content: center; padding: 16px 16px 120px; background: var(--waves), var(--bg); }
.auth-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; flex: none; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.auth-card label > * { color: var(--text); font-size: 15px; }
.auth-card a { color: var(--accent); }
.auth-card label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.auth-card label.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.auth-error { margin: 0; color: var(--danger); font-size: 14px; }
.account { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.google-status { font-size: 14px; }
.google-status .linked { color: var(--ok); }
.accounts-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.accounts-list li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.accounts-list .spacer { flex: 1; }
a.button {
  display: inline-block; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 14px;
}
a.button.small { padding: 4px 10px; font-size: 13px; }
a.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
a.button.ghost { background: transparent; }

/* ---------- title screen ---------- */
.welcome-page, .auth-page {
  --waves: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 160' preserveAspectRatio='none'%3E%3Cpath fill='%231d5f8a' fill-opacity='.18' d='M0 60 C240 10 480 110 720 60 S1200 10 1440 60 V160 H0Z'/%3E%3Cpath fill='%231d5f8a' fill-opacity='.3' d='M0 95 C240 55 480 135 720 95 S1200 55 1440 95 V160 H0Z'/%3E%3Cpath fill='%2310263d' fill-opacity='.55' d='M0 125 C240 95 480 155 720 125 S1200 95 1440 125 V160 H0Z'/%3E%3C/svg%3E") bottom / 100% 160px no-repeat;
}
.auth-card h1 { font-family: var(--brand-font); font-size: 24px; display: flex; align-items: center; gap: 8px; }
.auth-card h1 .brand-mark { font-size: 22px; }

/* The home page at deck-hand.us for visitors who aren't logged in. */
.welcome-page {
  display: block; height: auto; min-height: 100%;
  background: radial-gradient(ellipse 90% 520px at 70% 0%, var(--accent-soft), var(--bg) 70%) no-repeat var(--bg);
}
.home-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1120px; margin: 0 auto;
  padding: 14px max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
}
.home-bar .brand { font-size: 22px; }
.home-bar-actions { display: flex; gap: 8px; }
.home-bar-actions a.button { padding: 7px 16px; font-weight: 600; }
.welcome-page a.button { text-decoration: none; }
.home { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.home h2 { font-size: 28px; text-align: center; margin-bottom: 22px; }

.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center;
  padding: 56px 0 72px;
}
.eyebrow {
  margin: 0 0 10px; color: var(--brass); font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: .12em;
}
.hero h1 { font-family: var(--brand-font); font-size: clamp(38px, 5.4vw, 58px); line-height: 1.05; letter-spacing: -.01em; }
.lede { font-size: 18px; color: var(--muted); margin: 18px 0 26px; max-width: 34em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-note { margin: 14px 0 0; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.hero-note::before { content: "✓"; color: var(--ok); font-weight: 700; }

/* The app sketch beside the headline */
.hero-demo { position: relative; min-height: 400px; }
.demo-card {
  position: absolute; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 2px 6px rgba(16, 38, 61, .08), 0 18px 40px rgba(16, 38, 61, .14);
  font-size: 14px;
}
.demo-chat { inset: 0 64px auto 0; overflow: hidden; }
.demo-head {
  display: flex; align-items: center; gap: 6px; padding: 10px 14px;
  background: var(--navy); color: var(--navy-text); font-family: var(--brand-font); font-weight: 600;
  border-bottom: 2px solid var(--brass);
}
.demo-head .dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(244, 234, 210, .3); }
.demo-head .dot + span:not(.dot) { margin-left: 8px; }
.demo-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bubble { margin: 0; padding: 8px 12px; border-radius: 14px; max-width: 85%; line-height: 1.4; }
.bubble.me { align-self: flex-end; background: var(--user-bubble); color: var(--user-text); border-bottom-right-radius: 4px; }
.bubble.bot { align-self: flex-start; background: var(--bot-bubble); border-bottom-left-radius: 4px; }
.demo-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.demo-today { right: 0; bottom: 0; width: 230px; padding: 14px; }
.demo-today ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.demo-today li { display: flex; gap: 10px; align-items: center; }
.demo-today .t { width: 38px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.demo-today .ev { flex: 1; padding: 4px 8px; border-radius: 6px; border-left: 3px solid; font-size: 13px; }
.ev.blue { border-color: var(--accent); background: var(--accent-soft); }
.ev.brass { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 16%, var(--panel)); font-weight: 600; }
.ev.green { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--panel)); }
.demo-draft { left: 24px; bottom: 18px; width: 220px; padding: 14px; }
.demo-draft p { margin: 0 0 10px; }
.demo-buttons { display: flex; gap: 6px; }
.pill { padding: 3px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; }
.pill.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Features */
.features { padding: 24px 0 56px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; box-shadow: var(--shadow);
}
.feature h3 { font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 12px 0 6px; }
.feature p { margin: 0; color: var(--muted); }
.feature-icon {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--navy); border: 1px solid var(--brass);
}
.feature-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--brass); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* How it works */
.steps-strip { padding: 24px 0 56px; }
.how { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.how li { display: flex; gap: 14px; align-items: flex-start; }
.how .num {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brass); color: var(--navy); font-weight: 700; font-family: var(--brand-font);
}
.how strong { font-size: 16px; }
.how p { margin: 2px 0 0; color: var(--muted); }

.closing {
  text-align: center; padding: 40px 20px; margin-bottom: 24px;
  background: var(--navy); color: var(--navy-text); border-radius: 18px; border-bottom: 3px solid var(--brass);
}
.closing h2 { margin-bottom: 18px; }
.closing .hero-actions { justify-content: center; }
.closing a.button.big:not(.primary) { background: transparent; color: var(--navy-text); border-color: rgba(244, 234, 210, .35); }
.home-foot {
  padding: 8px max(20px, calc((100% - 1080px) / 2)) calc(150px + env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted); background: var(--waves);
}
.home-foot .brand-mark { font-size: 14px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding: 28px 0 48px; }
  .hero-demo { min-height: 380px; max-width: 480px; width: 100%; margin: 0 auto; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .how { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .home-bar .brand { font-size: 19px; }
  .home-bar-actions a.button { padding: 6px 12px; }
  .home h2 { font-size: 23px; }
  .lede { font-size: 16.5px; }
  .hero-actions a.button.big { flex: 1; min-width: 0; }
  .feature-grid { grid-template-columns: 1fr; }
  .hero-demo { min-height: 0; display: flex; flex-wrap: wrap; gap: 12px; }
  .demo-card { position: static; }
  .demo-chat { flex: 1 1 100%; }
  .demo-today, .demo-draft { flex: 1 1 150px; width: auto; }
  .demo-today { order: 1; }
}
a.button.big { padding: 11px 28px; font-size: 16px; font-weight: 600; min-width: 140px; text-align: center; background: var(--panel); }
a.button.big.primary { background: var(--accent); }
.head-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- drafts ---------- */
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 11.5px; font-weight: 600; line-height: 18px; text-align: center;
}
.draft-list { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.draft {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
}
.draft .fields { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 14px; }
.draft .fields dt { color: var(--muted); }
.draft .fields dd { margin: 0; overflow-wrap: anywhere; }
.draft .why { font-size: 13px; color: var(--muted); }
.draft textarea { width: 100%; min-height: 160px; line-height: 1.5; }
.draft .edited { font-size: 12.5px; color: var(--warn); }
.draft .draft-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.draft h4 { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.thread { display: flex; flex-direction: column; gap: 6px; }
.mail { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 6px 10px; }
.mail.replying { border-left: 3px solid var(--accent); }
.mail summary { cursor: pointer; list-style: none; display: flex; gap: 8px; font-size: 14px; }
.mail summary::-webkit-details-marker { display: none; }
.mail summary::before { content: "▸"; color: var(--muted); }
.mail[open] summary::before { content: "▾"; }
.mail summary .from { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail summary .when { color: var(--muted); font-size: 12.5px; flex: none; }
.mail .tag { font-size: 12px; color: var(--accent); margin-top: 2px; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; margin-top: 6px; max-height: 320px; overflow-y: auto; }
button.link { border: none; background: none; padding: 2px 0; color: var(--accent); font-size: 13px; }

/* Project steps renamed in place */
.task .title.editable { cursor: text; }
.task .title.editable:hover { text-decoration: underline dotted var(--muted); }
.step-edit { width: 100%; padding: 3px 8px; resize: none; overflow: hidden; display: block; line-height: 1.45; }
.task .meta .completed { color: var(--ok); }
.every-field { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.every-field input { width: 80px; }
dialog label.disabled { opacity: .45; }
input:disabled { cursor: not-allowed; background: var(--bg); }
.auth-done { margin: 0; color: var(--ok); font-size: 14px; }
.inline-field { display: flex; gap: 8px; } .inline-field input { flex: 1; }
.auth-card label > span { color: inherit; font-size: inherit; }

/* Installed as an app on a phone: keep content clear of the notch, status bar and home indicator. */
.topbar {
  padding-top: max(10px, env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.layout { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.auth-page { padding-top: max(16px, env(safe-area-inset-top)); }
.welcome-page { padding-top: env(safe-area-inset-top); }

/* Notifications section of the account dialog */
.notify-status { font-size: 14px; color: var(--muted); margin: 0; }
.notify-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.install-steps { margin: 0; padding-left: 20px; font-size: 14px; }
.app-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 16px 0; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--brass); border-radius: var(--radius);
  font-size: 14px; box-shadow: var(--shadow);
}
.app-banner[hidden] { display: none; }
.app-banner span { flex: 1; min-width: 0; }
.app-banner button { flex: none; }

/* Project step target dates and reminders */
.card .next .meta .overdue { color: var(--danger); font-weight: 600; }
.card .next .meta .today { color: var(--warn); font-weight: 600; }
.card .next .meta { color: var(--muted); }
.task:has(.step-dates) { flex-wrap: wrap; }
.step-dates { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; padding: 6px 0 2px 54px; }
.step-dates label { flex: 1 1 160px; }
.step-dates-actions { display: flex; gap: 6px; }

/* Drag to reorder tasks and steps */
.task .handle { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; padding: 4px 2px; margin-left: -4px; font-size: 16px; line-height: 1; opacity: .6; }
.task .handle:hover, .task .handle:focus-visible { opacity: 1; }
.task-list.sorting, .task-list.sorting * { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.task.dragging { position: relative; z-index: 2; background: var(--panel); box-shadow: var(--shadow); border-radius: 8px; opacity: .95; }
#step-add-dates { padding-left: 0; }

/* Anthropic API key: in the account dialog, and a nudge above the chat box until one is added */
.chat-notice {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 10px 12px;
  border: 1px solid var(--brass); border-radius: var(--radius); font-size: 14px;
}
.chat-notice span { flex: 1; min-width: 0; }
.chat-notice button { flex: none; }

/* ---------- calendar ---------- */
.cal-panel { display: flex; flex-direction: column; }
.cal-panel.loading .cal-range::after { content: " ·  updating…"; color: var(--muted); font-weight: 400; font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: transparent; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.cal-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-nav { gap: 10px; }
.cal-nav button.icon { font-size: 22px; line-height: 1; padding: 0 8px 3px; }
.cal-today {
  background: var(--navy); color: var(--navy-text); border: 1px solid var(--brass);
  font-weight: 600; border-radius: 999px; padding: 4px 14px; box-shadow: inset 0 -2px 0 var(--brass);
}
.cal-today::before { content: "⚓\FE0E"; color: var(--brass); margin-right: 6px; }
.cal-today:hover { border-color: var(--brass); filter: brightness(1.15); }
.cal-today.here { opacity: .7; box-shadow: none; }
.cal-week-nav { position: relative; display: flex; align-items: center; gap: 2px; }
.cal-range {
  font-family: var(--brand-font); font-size: 17px; border: 1px solid transparent; background: transparent;
  padding: 3px 10px; border-radius: 8px;
}
.cal-range::after { content: " ▾"; font-size: 12px; color: var(--muted); }
.cal-range:hover, .cal-range[aria-expanded="true"] { border-color: var(--line); background: var(--bg); }
.cal-picker {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 10;
  width: 280px; padding: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.picker-month { font-family: var(--brand-font); font-size: 16px; }
.picker-dows, .picker-week { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.picker-dows span { font-size: 11px; color: var(--muted); padding: 4px 0; }
.picker-week { border-radius: 8px; }
.picker-week:hover { background: var(--bg); }
.picker-week.selected { background: var(--accent-soft); }
.picker-day { border: none; background: transparent; padding: 0; height: 34px; border-radius: 50%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.picker-day.other { color: var(--muted); opacity: .6; }
.picker-day.today { background: var(--navy); color: var(--navy-text); box-shadow: 0 0 0 2px var(--brass); font-weight: 600; }
.picker-day:focus-visible { outline: 2px solid var(--accent); }
.cal-legend { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.cal-unlinked {
  display: flex; align-items: center; gap: 10px; padding: 14px; font-size: 14px;
  border: 1px dashed var(--brass); border-radius: var(--radius);
}
.cal-unlinked span { flex: 1; }

/* Week: a time grid with a column per day */
.cal-week { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-row { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); }
.cal-gutter { font-size: 11px; color: var(--muted); text-align: right; padding-right: 6px; }
.cal-head { border-bottom: 1px solid var(--line); background: var(--bg); }
.cal-dayhead { display: flex; flex-direction: column; align-items: center; padding: 6px 0 8px; gap: 2px; border-left: 1px solid var(--line); }
.cal-dayhead .dow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cal-dayhead .dom { font-family: var(--brand-font); font-size: 20px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; }
.cal-dayhead.today .dow { color: var(--brass); font-weight: 600; }
.cal-dayhead.today .dom { background: var(--navy); color: var(--navy-text); box-shadow: 0 0 0 2px var(--brass); }
.cal-allday { border-bottom: 1px solid var(--line); }
.cal-allday .cal-gutter { padding-top: 6px; }
.cal-allday-cell { border-left: 1px solid var(--line); padding: 3px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-scroll { flex: 1; min-height: 320px; overflow-y: auto; }
.cal-grid { position: relative; }
.cal-hours { position: relative; }
.cal-hours span { position: absolute; right: 6px; transform: translateY(-50%); white-space: nowrap; }
.cal-col {
  position: relative; border-left: 1px solid var(--line);
  background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 48px);
}
.cal-col.today { background-color: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--brass); z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brass); }

.cal-event {
  display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 0;
  border: none; border-left: 3px solid var(--c); border-radius: 6px;
  background: color-mix(in srgb, var(--c) 16%, var(--panel));
  color: var(--text); font-size: 12px; line-height: 1.3; padding: 3px 6px; min-width: 0; overflow: hidden;
}
.cal-event:hover { background: color-mix(in srgb, var(--c) 26%, var(--panel)); }
.cal-event:focus-visible { outline: 2px solid var(--c); outline-offset: 1px; }
.cal-event.timed { position: absolute; z-index: 1; box-shadow: 0 0 0 1px var(--panel); }
.cal-event.short { flex-direction: row; gap: 6px; align-items: baseline; }
.cal-event.past { opacity: .65; }
.cal-event .ev-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event.timed:not(.short) .ev-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; flex: none; }
.cal-event .ev-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.cal-event.allday { padding: 2px 6px; }

/* Agenda: each day of the week with its events listed */
.cal-agenda { display: flex; flex-direction: column; }
.agenda-day { display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.agenda-day:last-child { border-bottom: none; }
.agenda-date { display: flex; flex-direction: column; align-items: center; align-self: start; line-height: 1.1; padding-top: 2px; }
.agenda-date .dow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.agenda-date .dom { font-family: var(--brand-font); font-size: 28px; }
.agenda-date .mon { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.agenda-day.today .agenda-date { color: var(--navy-text); background: var(--navy); border-radius: 10px; padding: 6px 0; box-shadow: inset 0 -3px 0 var(--brass); }
.agenda-day.today .agenda-date .dow, .agenda-day.today .agenda-date .mon { color: var(--brass); font-weight: 600; }
.agenda-day.free { padding-top: 8px; padding-bottom: 8px; }
.agenda-day.free .dom { font-size: 22px; color: var(--muted); }
.agenda-free { margin: 0; align-self: center; color: var(--muted); font-size: 13.5px; font-style: italic; }
.agenda-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.agenda-event {
  width: 100%; display: flex; gap: 12px; align-items: baseline; text-align: left;
  border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 8px;
  background: color-mix(in srgb, var(--c) 7%, var(--panel)); padding: 8px 12px;
}
.agenda-event:hover { border-color: var(--c); }
.agenda-event.past { opacity: .65; }
.agenda-time { flex: none; width: 150px; white-space: nowrap; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.agenda-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.agenda-event .ev-title { font-weight: 600; overflow-wrap: anywhere; }
.ev-where { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) {
  .agenda-day { grid-template-columns: 48px 1fr; gap: 10px; }
  .agenda-event { flex-direction: column; gap: 2px; }
  .agenda-time { width: auto; font-size: 12px; }
  .cal-row { grid-template-columns: 36px repeat(7, minmax(0, 1fr)); }
  .cal-gutter { font-size: 9.5px; padding-right: 3px; }
  .cal-dayhead .dom { font-size: 16px; width: 28px; height: 28px; }
  .cal-event { font-size: 10.5px; padding: 2px 3px; }
  .cal-event .ev-time { display: none; }
}

/* Event details */
.event-detail p { margin: 0; }
.event-title { display: flex; align-items: center; gap: 10px; }
.event-title h3 { font-family: var(--brand-font); font-size: 19px; text-transform: none; letter-spacing: 0; color: var(--text); overflow-wrap: anywhere; }
.event-title .swatch { width: 14px; height: 14px; border-radius: 4px; }

/* Tasks and project steps shown on their dates */
.cal-toggle { color: var(--muted); background: transparent; }
.cal-toggle::before { content: "☐ "; }
.cal-toggle[aria-pressed="true"] { color: var(--text); background: var(--accent-soft); border-color: var(--accent); }
.cal-toggle[aria-pressed="true"]::before { content: "☑ "; color: var(--accent); }
.cal-legend + .cal-toggle { margin-left: 8px; }
.cal-legend:empty + .cal-toggle { margin-left: auto; }
.cal-item {
  display: flex; align-items: baseline; gap: 5px; text-align: left; min-width: 0;
  border: 1px dashed color-mix(in srgb, var(--muted) 55%, transparent); border-radius: 6px;
  background: var(--panel); color: var(--text); font-size: 12px; line-height: 1.3; padding: 2px 6px;
}
.cal-item:hover { border-style: solid; border-color: var(--muted); }
.cal-item .ev-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.item-mark { flex: none; color: var(--accent); }
.step .item-mark { color: var(--brass); }
.overdue .item-mark { color: var(--danger); }
.agenda-item { border-style: dashed; border-left: 1px dashed color-mix(in srgb, var(--muted) 55%, transparent); background: transparent; }
.agenda-item:hover { border-color: var(--muted); }
.agenda-item.overdue .agenda-time { color: var(--danger); font-weight: 600; }
.agenda-item .ev-title { font-weight: 500; }
@media (max-width: 520px) { .cal-item { font-size: 10.5px; padding: 2px 3px; } }

/* ---------- settings ---------- */
.account-open { display: inline-flex; align-items: center; gap: 8px; padding-left: 4px; }
.account-open .gear { opacity: .75; }
.topbar .account-open[aria-pressed="true"] { background: rgba(255, 255, 255, .1); border-color: var(--brass); }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--brass); color: var(--navy); font-family: var(--brand-font); font-weight: 700; font-size: 13px;
}
.avatar.big { width: 52px; height: 52px; font-size: 26px; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--brass); }
.avatar:empty { display: none; }

/* Settings fills the page, chat included, on every screen size. */
.in-settings .layout { grid-template-columns: 1fr; }
.in-settings .layout > [data-panel]:not(.settings) { display: none; }
.layout > .settings { grid-column: 1 / -1; grid-row: 1; }
.layout > .settings:not(.active) { display: none; }
.in-settings .app-banner { display: none; }
.settings { padding: 0; background: var(--bg); border: none; box-shadow: none; scroll-padding-top: 12px; }
.settings-head {
  display: flex; align-items: center; gap: 12px; max-width: 920px; margin: 0 auto; padding: 4px 0 14px;
}
.settings-head h2 { font-size: 24px; }
.settings-body { display: grid; grid-template-columns: 190px 1fr; gap: 24px; max-width: 920px; margin: 0 auto; align-items: start; }
.settings-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a {
  color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: 14px;
  border-left: 3px solid transparent;
}
.settings-nav a:hover { color: var(--text); background: var(--panel); border-left-color: var(--brass); }
.settings-sections { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding-bottom: 24px; }
.setting-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 10px;
}
.setting-card > h3 {
  font-family: var(--brand-font); font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--text);
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.setting-card h4 { margin: 6px 0 -4px; }
.setting-card p { margin: 0; }
.setting-card .accounts-list li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.setting-card .accounts-list li > .hint {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--brass);
  border: 1px solid var(--brass); border-radius: 9px; padding: 0 7px; line-height: 17px;
}
.profile-card { flex-direction: row; align-items: center; gap: 16px; border-top: 3px solid var(--brass); }
.profile-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.profile-who strong { font-family: var(--brand-font); font-size: 20px; overflow-wrap: anywhere; }
.people-list .seen { color: var(--muted); font-size: 13px; }
.people-list li.off .person { color: var(--muted); text-decoration: line-through; }
.people-list select { width: auto; }
.password-form { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.password-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.password-form label > * { color: var(--text); font-size: 15px; }

@media (max-width: 860px) {
  .settings-body { grid-template-columns: 1fr; gap: 12px; }
  .settings-nav { display: none; }
  .setting-card { padding: 16px; }
  .setting-card .accounts-list .spacer { flex-basis: 100%; }
  /* Brand and the settings button share the first row, the tabs get the next. */
  .account-open #account-name { display: none; }
  .topbar .account { order: 2; }
  .topbar .tabs { order: 3; flex-basis: 100%; }
}
@media (max-width: 420px) {
  .profile-card { flex-wrap: wrap; }
}
