:root {
  color-scheme: light;
  --surface: #fbfcfe;
  --panel: #f1f5fb;
  --ink: #1a2639;
  --heading: #214679;
  --muted: #526179;
  --label: #3f536e;
  --placeholder: #495e79;
  --line: #e0e7f0;
  --line-strong: #c7d4e6;
  --navigation: #17273f;
  --nav-heading: #f1f6ff;
  --nav-text: #c2d0e6;
  --nav-accent: #b9d6ff;
  --nav-hover: #203650;
  --nav-active: #263e5f;
  --nav-line: #36567e;
  --accent: #245ba9;
  --accent-light: #dceaff;
  --primary: #255fac;
  --primary-hover: #1a4c91;
  --focus: #3a74c6;
  --halo: #e1ecff;
  --selected: #e8f1fe;
  --pressed: #caddf9;
  --hover: #edf3fb;
  --subtle: #e8edf4;
  --icon: #647694;
  --checked: #456eaa;
  --gold: #efad37;
  --gold-line: #92600b;
  --danger: #a13046;
  --danger-line: #e6c4cf;
  --danger-surface: #fbf0f4;
  --danger-hover: #f8e3eb;
  --assign: #2a61ae;
  --remove: #ad3f59;
  --error: #83364b;
  --composer-line: #b8cdeb;
  --project-color: #526179;
  --toast: #172f50;
  --login-backdrop: #e9f0fa;
  --backdrop: #0c1c3480;
  --shadow: #102c5321;
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2354739b' stroke-width='1.7'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--surface);
  color: var(--ink);
}

.badge, .project-icon {
  --project-display-color: var(--project-color);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface: #111822;
    --panel: #192332;
    --ink: #edf3fc;
    --heading: #9ec3ff;
    --muted: #a9b6cb;
    --label: #c1cfe3;
    --placeholder: #a7bad6;
    --line: #263448;
    --line-strong: #3c4c64;
    --navigation: #0d1521;
    --nav-hover: #192b43;
    --nav-active: #1d3452;
    --nav-line: #385c88;
    --accent: #a4c9ff;
    --accent-light: #253c5c;
    --primary: #285ca7;
    --primary-hover: #316abd;
    --focus: #85b7ff;
    --halo: #243a58;
    --selected: #1c2d45;
    --pressed: #314e75;
    --hover: #1c293b;
    --subtle: #243143;
    --icon: #a0b2ce;
    --checked: #3866a3;
    --gold: #efb44b;
    --gold-line: #f4c778;
    --danger: #ffafbd;
    --danger-line: #6a3a4b;
    --danger-surface: #33232d;
    --danger-hover: #472a38;
    --assign: #285ca7;
    --composer-line: #3c5880;
    --project-color: #8093b2;
    --toast: #243d5e;
    --login-backdrop: #0d1521;
    --backdrop: #060b14b0;
    --shadow: #050c1b70;
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a7bad6' stroke-width='1.7'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  }

  .badge, .project-icon {
    --project-display-color: color-mix(in srgb, var(--project-color), var(--ink) 40%);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
button, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button svg, .add-icon svg, .project-icon svg, .swipe-bg svg, .picker-check svg { width: 22px; height: 22px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.workspace {
  display: grid;
  grid-template-columns: 234px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.workspace.has-detail { grid-template-columns: 234px minmax(0, 1fr) clamp(300px, 30vw, 416px); }
.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 32px 18px 22px;
  background: var(--navigation);
  color: var(--nav-heading);
}
.wordmark { display: flex; align-items: center; gap: 11px; font-size: 1.28rem; font-weight: 740; letter-spacing: -.035em; }
.wordmark img { display: block; }
.sidebar .wordmark { padding: 0 10px; margin-bottom: 42px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--nav-text);
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 9px;
  text-align: left;
  font-weight: 600;
  font-size: .95rem;
}
.sidebar nav button[aria-current] { color: #fff; border-color: var(--nav-line); background: var(--nav-active); }
.sidebar nav button[aria-current] svg { color: var(--nav-accent); }
.sidebar button:hover { background: var(--nav-hover); color: #fff; }
.account-actions { display: grid; gap: 4px; margin-top: auto; }
.sidebar .account-actions button { color: var(--nav-text); font-size: .9rem; }
.sidebar .account-actions svg { width: 19px; height: 19px; }
.board { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.list-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.list-area, .composer-inner { width: min(100%, 870px); margin-inline: auto; padding-inline: clamp(24px, 4.6vw, 68px); }
.list-area { padding-top: clamp(39px, 7vh, 74px); padding-bottom: 28px; }
.list-heading { margin-bottom: 35px; }
.list-heading h1 { color: var(--heading); margin: 0; font-size: clamp(2.35rem, 4.15vw, 3.45rem); line-height: 1.04; font-weight: 740; letter-spacing: -.065em; }
.list-heading p { margin: 11px 0 0; font-size: .96rem; color: var(--muted); }
.task-group { margin: 0; }
.task-group + .task-group { margin-top: 35px; }
.task-group h2 {
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .9rem;
  color: var(--label);
  font-weight: 690;
}
.task-group h2 span { background: var(--accent-light); color: var(--accent); border-radius: 6px; padding: 2px 7px; font-size: .79rem; }
.completed-group h2 span { background: var(--subtle); color: var(--muted); }
.task-row { isolation: isolate; position: relative; border-top: 1px solid var(--line); }
.task-row:last-child, .project-row:last-child { border-bottom: 1px solid var(--line); }
.task-surface {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 44px;
  background: var(--surface);
  min-height: 55px;
  transform: translateX(var(--swipe, 0px));
}
.task-row { overflow: hidden; touch-action: pan-y; }
.task-surface.is-selected { background: var(--selected); }
@media (hover: hover) {
  .task-surface:hover, .project-button:hover { background: var(--hover); }
}
.task-open, .row-check, .row-star, .project-button { border: 0; background: transparent; }
.task-open:focus-visible, .row-check:focus-visible, .row-star:focus-visible, .project-button:focus-visible { outline-offset: -3px; border-radius: 6px; }
.task-open { display: flex; align-items: center; min-width: 0; gap: 12px; text-align: left; padding: 8px 2px; }
.task-name { font-size: 1rem; line-height: 1.32; overflow-wrap: anywhere; }
.badge {
  flex: 0 0 auto;
  max-width: min(37%, 124px);
  border-radius: 6px;
  border: 1px solid var(--project-display-color);
  color: var(--project-display-color);
  padding: 3px 7px;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.15;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.row-check, .row-star, .icon-button { display: grid; place-items: center; padding: 0; }
.row-check > span { display: grid; place-items: center; border: 1.5px solid var(--icon); border-radius: 6px; width: 19px; height: 19px; color: white; }
.row-check svg { width: 14px; height: 14px; visibility: hidden; stroke-width: 2.35; }
.row-check[aria-checked="true"] > span { border-color: var(--checked); background: var(--checked); }
.row-check[aria-checked="true"] svg { visibility: visible; }
.row-star svg { width: 24px; height: 24px; }
.star-button { color: var(--icon); }
.star-button[aria-pressed="true"] { color: var(--gold-line); }
.star-button[aria-pressed="true"] svg { fill: var(--gold); }
.is-complete .task-name { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.swipe-bg { display: none; position: absolute; inset: 0; align-items: center; color: #fff; }
.assign-bg { background: var(--assign); justify-content: flex-start; padding-left: 34px; }
.remove-bg { background: var(--remove); justify-content: flex-end; padding-right: 34px; }
.toward-project .assign-bg, .toward-delete .remove-bg { display: flex; }
.empty { margin: 0; padding: 19px 4px; border-top: 1px solid var(--line); font-size: .94rem; color: var(--muted); }

.project-row { border-top: 1px solid var(--line); }
.project-button { width: 100%; display: flex; align-items: center; min-height: 62px; gap: 13px; text-align: left; padding: 7px 10px; }
.project-button[aria-current] { background: var(--selected); }
.project-icon { width: 33px; height: 33px; border-radius: 8px; display: grid; place-items: center; flex: none; color: var(--project-display-color); background: color-mix(in srgb, var(--project-display-color) 13%, var(--surface)); }
.project-icon svg { width: 19px; height: 19px; }
.project-name { overflow-wrap: anywhere; }
.row-chevron { margin-left: auto; color: var(--icon); display: flex; }
.row-chevron svg { width: 19px; height: 19px; }

.composer-dock { position: relative; flex: none; background: var(--surface); padding-block: 12px 25px; }
.composer-inner { position: relative; }
.composer {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 56px;
  border: 1px solid var(--composer-line);
  border-radius: 11px;
  padding: 0 8px 0 13px;
  background: var(--selected);
}
.composer:focus-within { border-color: var(--focus); box-shadow: 0 0 0 2px var(--halo); }
.composer .add-icon { display: flex; color: var(--accent); }
.composer input { outline: none; min-width: 0; width: 100%; border: 0; background: transparent; padding: 0; height: 100%; }
.composer input::placeholder { color: var(--placeholder); opacity: 1; }
.composer button { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border: 1px solid var(--composer-line); border-radius: 7px; background: var(--accent-light); color: var(--accent); }
.composer button:not(:disabled):hover { background: var(--pressed); }
.composer button:disabled { opacity: .66; }
.toasts, .feedback { position: absolute; z-index: 3; inset-inline: clamp(24px, 4.6vw, 68px); bottom: calc(100% + 10px); }
.toasts { display: grid; gap: 5px; max-height: 140px; overflow: auto; }
.toast, .feedback {
  display: flex;
  min-height: 45px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--toast);
  color: #fff;
  border-radius: 9px;
  padding: 3px 7px 3px 13px;
  font-size: .92rem;
  box-shadow: 0 2px 8px var(--shadow);
}
.toast button { display: inline-flex; gap: 5px; align-items: center; padding: 6px 7px; border: 0; border-radius: 5px; background: transparent; color: var(--nav-accent); font-size: .91rem; font-weight: 700; }
.toast button:hover { background: #ffffff20; }
.toast button svg { width: 19px; height: 19px; }
.feedback { background: var(--error); z-index: 4; }
.feedback.positive { background: var(--toast); }
.detail-feedback { display: none; }

.detail {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
}
.detail-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 65px;
  padding: 0 18px 0 24px;
  border-bottom: 1px solid var(--line);
  color: var(--label);
  font-size: .9rem;
  font-weight: 665;
}
.icon-button { background: transparent; border: 0; border-radius: 8px; width: 40px; height: 40px; flex: none; }
.icon-button:hover { background: var(--hover); }
.back-button { display: none; }
.detail-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 25px 23px 18px; }
.detail-title-row { display: flex; align-items: flex-start; gap: 7px; }
#task-title {
  width: 100%; min-width: 0; padding: 9px 10px; border-radius: 7px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 1.12rem; font-weight: 690;
}
.fields { display: grid; gap: 8px; margin-top: 23px; }
.fields label, .field-label { font-size: .89rem; font-weight: 660; color: var(--label); }
.fields select, .fields textarea, .date-field input {
  border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); padding: 10px 11px; width: 100%;
  min-width: 0; min-height: 43px; font-size: 1rem;
}
.fields select { appearance: none; background-image: var(--select-chevron); background-repeat: no-repeat; background-position: right 7px center; background-size: 24px; padding-right: 32px; }
.fields textarea { resize: vertical; }
.fields textarea::placeholder { color: var(--placeholder); }
.fields label:not(:first-child) { margin-top: 12px; }
.date-field { display: flex; gap: 5px; min-width: 0; position: relative; }
.date-field input { flex: 1; }
.date-field .date-empty:not(:focus) { color: transparent; }
.date-field .date-empty:not(:focus)::-webkit-datetime-edit { color: transparent; }
.date-placeholder { display: none; }
.date-empty:not(:focus) + .date-placeholder {
  display: block;
  position: absolute;
  inset-inline-start: 12px;
  inset-block-start: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--placeholder);
}
.detail-footer { padding: 14px 23px 23px; border-top: 1px solid var(--line); }
.detail-footer p { font-size: .88rem; color: var(--muted); margin: 0 0 10px; }
.danger-button {
  width: 100%; min-height: 44px; border: 1px solid var(--danger-line); border-radius: 8px; background: var(--danger-surface); color: var(--danger);
  display: flex; justify-content: center; align-items: center; gap: 8px; font-size: .93rem; font-weight: 650; padding: 7px;
}
.danger-button:hover { background: var(--danger-hover); }
.danger-button svg { width: 19px; height: 19px; }
.project-detail-heading { display: flex; align-items: center; gap: 12px; }
.project-detail-heading h2 { margin: 0; font-size: 1.43rem; letter-spacing: -.035em; overflow-wrap: anywhere; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; padding-block: 5px; }
.swatch { width: 35px; height: 35px; border: 2px solid var(--panel); border-radius: 50%; background: var(--project-color); color: white; display: grid; place-items: center; padding: 0; }
.swatch[aria-pressed="true"] { outline: 1px solid var(--icon); }
.swatch:not([aria-pressed="true"]) svg { visibility: hidden; }
.swatch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

dialog { width: min(416px, calc(100vw - 28px)); max-width: none; max-height: min(75dvh, 520px); padding: 0; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: var(--backdrop); }
.picker-header { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px 9px 16px; border-bottom: 1px solid var(--line); }
.picker-header h2 { margin: 0; font-size: 1.12rem; }
.picker-options { padding: 6px; }
.picker-option { width: 100%; display: flex; min-height: 47px; gap: 10px; align-items: center; border: 0; border-radius: 8px; padding: 6px 9px; background: transparent; text-align: left; }
.picker-option:hover { background: var(--accent-light); }
.picker-check { margin-left: auto; margin-right: 4px; color: var(--accent); display: flex; }

.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--login-backdrop); }
.login-card { width: min(100%, 420px); border: 1px solid var(--line-strong); border-radius: 20px; padding: clamp(23px, 6vw, 39px); background: var(--surface); box-shadow: 0 14px 32px var(--shadow); }
.login-card .wordmark { margin-bottom: 28px; }
.login-card h1 { margin: 0; color: var(--ink); font-size: 1.8rem; letter-spacing: -.05em; }
.login-card > p { font-size: .95rem; color: var(--muted); margin: 8px 0 24px; }
.login-card form { display: grid; gap: 8px; }
.login-card label { font-size: .87rem; font-weight: 630; color: var(--muted); }
.login-card input { width: 100%; min-height: 44px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); padding: 7px 10px; margin-bottom: 6px; }
.primary { min-height: 44px; background: var(--primary); color: white; border: 0; font-weight: 650; border-radius: 7px; margin-top: 5px; }
.primary:hover { background: var(--primary-hover); }
.demo-action { width: 100%; padding: 10px 5px; border: 0; background: transparent; color: var(--accent); margin-top: 11px; font-size: .93rem; font-weight: 640; }
#login-error { color: var(--danger); margin: 4px 0 0; font-size: .9rem; }

@media (701px <= width <= 1040px) {
  .workspace { grid-template-columns: 174px minmax(0, 1fr); }
  .workspace.has-detail { grid-template-columns: 174px minmax(0, 1fr) 282px; }
  .sidebar { padding-inline: 12px; }
  .list-area, .composer-inner { padding-inline: 23px; }
  .toasts, .feedback { inset-inline: 23px; }
  .task-open { gap: 7px; }
  .badge { padding-inline: 4px; }
  .detail-scroll, .detail-footer { padding-inline: 17px; }
}

@media (max-width: 700px) {
  body:has(.workspace:not([hidden])) { overflow: hidden; }
  .workspace, .workspace.has-detail {
    position: fixed;
    top: var(--viewport-top, 0px);
    inset-inline: 0;
    height: var(--viewport-height, 100dvh);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: calc(9px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 9px calc(13px + env(safe-area-inset-left));
  }
  .sidebar .wordmark { display: none; }
  .sidebar nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  .sidebar button { justify-content: center; gap: 6px; padding: 0 4px; min-height: 42px; font-size: .9rem; }
  .sidebar button svg { width: 19px; height: 19px; }
  .account-actions { display: flex; gap: 2px; margin: 0; }
  .sidebar .account-actions button { width: 36px; font-size: 0; gap: 0; }
  .sidebar .account-actions svg { width: 21px; height: 21px; }
  .list-area, .composer-inner { padding-left: max(15px, env(safe-area-inset-left)); padding-right: max(15px, env(safe-area-inset-right)); }
  .list-area { padding-top: 25px; padding-bottom: 19px; }
  .list-heading { margin-bottom: 24px; }
  .list-heading h1 { font-size: 2.43rem; }
  .list-heading p { margin-top: 7px; }
  .task-group + .task-group { margin-top: 25px; }
  .task-surface { grid-template-columns: 40px minmax(0, 1fr) 42px; min-height: 52px; }
  .task-open { gap: 8px; }
  .badge { font-size: .79rem; max-width: 43%; padding-inline: 5px; }
  .composer-dock { padding-block: 7px max(9px, env(safe-area-inset-bottom)); }
  .keyboard-open .composer-dock { padding-bottom: 3px; }
  .composer { height: 51px; }
  .toasts, .feedback { left: max(15px, env(safe-area-inset-left)); right: max(15px, env(safe-area-inset-right)); }
  .has-detail .sidebar, .has-detail .board { display: none; }
  .workspace.has-detail:not([hidden]) + .detail-feedback {
    display: flex;
    position: fixed;
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 68px));
  }
  .detail { grid-row: 1 / -1; border: 0; }
  .detail-bar {
    justify-content: flex-start; gap: 12px; min-height: calc(55px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 13px 0 max(9px, env(safe-area-inset-left)); background: var(--navigation); color: var(--nav-heading);
  }
  .back-button {
    display: flex; gap: 1px; align-items: center; min-height: 42px; padding: 0 8px 0 4px;
    color: var(--nav-heading); background: var(--nav-active); border-radius: 7px; border: 1px solid var(--nav-line); font-weight: 650;
  }
  .back-button svg { width: 18px; height: 18px; }
  .detail-bar > span { color: var(--nav-text); }
  .close-button { display: none; }
  .detail-scroll { padding: 23px max(17px, env(safe-area-inset-right)) 16px max(17px, env(safe-area-inset-left)); }
  .detail-footer { padding: 12px max(17px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(17px, env(safe-area-inset-left)); }
  .keyboard-open .detail-footer { display: none; }
  dialog { margin: auto auto max(9px, env(safe-area-inset-bottom)); }
}
