:root {
  color-scheme: light;
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-muted: #f0f2f8;
  --surface-hover: #eceefa;
  --border: #dde1ec;
  --border-strong: #c9cedc;
  --text: #202536;
  --text-soft: #626b80;
  --text-faint: #8b93a5;
  --primary: #6d4aff;
  --primary-strong: #5736df;
  --primary-soft: #ede9ff;
  --success: #12845c;
  --success-soft: #e5f7ef;
  --warning: #a3610b;
  --warning-soft: #fff3dc;
  --danger: #c4374a;
  --danger-soft: #ffeaed;
  --info: #2364cb;
  --info-soft: #e7f0ff;
  --shadow-sm: 0 1px 2px rgb(25 32 56 / 0.06), 0 1px 5px rgb(25 32 56 / 0.04);
  --shadow-md: 0 16px 44px rgb(25 32 56 / 0.14), 0 2px 8px rgb(25 32 56 / 0.08);
  --sidebar-width: 272px;
  --topbar-height: 72px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11131a;
  --surface: #181b24;
  --surface-raised: #1d202b;
  --surface-muted: #222631;
  --surface-hover: #292e3b;
  --border: #303543;
  --border-strong: #414859;
  --text: #f2f4f8;
  --text-soft: #b1b7c5;
  --text-faint: #7f8798;
  --primary: #9b85ff;
  --primary-strong: #b3a3ff;
  --primary-soft: #2b2547;
  --success: #62d9a6;
  --success-soft: #17362a;
  --warning: #f5bd65;
  --warning-soft: #3a2b16;
  --danger: #ff8292;
  --danger-soft: #402129;
  --info: #82b2ff;
  --info-soft: #1c2d4a;
  --shadow-sm: 0 1px 3px rgb(0 0 0 / 0.25);
  --shadow-md: 0 18px 52px rgb(0 0 0 / 0.42);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
::selection { background: var(--primary-soft); color: var(--text); }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  transform: translateY(-150%);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--surface);
}
.skip-link:focus { transform: translateY(0); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 48%, transparent); outline-offset: 2px; }

.app-shell { min-height: 100vh; }
.splash {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: 100vh;
  color: var(--text-soft);
}
.splash img { filter: drop-shadow(0 14px 26px rgb(72 48 190 / 0.24)); }
.splash strong { color: var(--text); font-size: 18px; }

.workspace-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-height);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-row img { flex: none; width: 34px; height: 34px; }
.brand-copy { min-width: 0; }
.brand-copy strong { display: block; font-size: 16px; letter-spacing: -0.02em; }
.brand-copy span { display: block; overflow: hidden; color: var(--text-faint); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-scroll { flex: 1; overflow: auto; padding: 12px 10px 20px; scrollbar-width: thin; }
.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }

.nav-section { margin-bottom: 18px; }
.nav-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding: 0 8px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-list { display: grid; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--primary-soft); color: var(--primary-strong); font-weight: 650; }
.nav-item .nav-label { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-faint);
  font-size: 11px;
  text-align: center;
}
.nav-item[aria-current="page"] .nav-count { background: color-mix(in srgb, var(--primary) 13%, transparent); color: var(--primary-strong); }
.project-dot { width: 9px; height: 9px; flex: none; border-radius: 3px; background: var(--project-color, var(--primary)); }
.project-dot.indigo { --project-color: #6d4aff; }
.project-dot.emerald { --project-color: #15936b; }
.project-dot.amber { --project-color: #d18417; }
.project-dot.rose { --project-color: #d64d68; }
.project-dot.sky { --project-color: #2789c9; }

.icon { display: inline-grid; flex: none; place-items: center; width: 18px; height: 18px; }
.icon svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}
.icon-button:hover { border-color: var(--border); background: var(--surface-hover); color: var(--text); }
.icon-button.small { width: 28px; height: 28px; border-radius: 7px; }
.icon-button.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.main-area { min-width: 0; height: 100vh; overflow: hidden; }
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--topbar-height);
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
}
.mobile-menu { display: none; }
.page-heading { min-width: 0; flex: 1; }
.page-heading .eyebrow { margin-bottom: 2px; }
.page-heading h1 { margin: 0; overflow: hidden; font-size: 20px; letter-spacing: -0.025em; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: min(300px, 28vw);
}
.search-box .icon { position: absolute; left: 10px; color: var(--text-faint); pointer-events: none; }
.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 36px 0 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--text);
}
.search-box input:focus { border-color: var(--primary); background: var(--surface); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.search-shortcut { position: absolute; right: 9px; color: var(--text-faint); font-size: 11px; }

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}
.sync-pill:hover { background: var(--surface-hover); color: var(--text); }
.sync-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.sync-pill.offline .sync-dot { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.sync-pill.error .sync-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.content-frame {
  height: calc(100vh - var(--topbar-height));
  overflow: auto;
  padding: 22px;
  scrollbar-gutter: stable;
}
.content-width { width: min(1520px, 100%); margin: 0 auto; }

.quick-add-card {
  position: relative;
  z-index: 3;
  margin-bottom: 16px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.quick-add-row { display: flex; align-items: center; gap: 8px; }
.quick-add-row .add-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary-strong); font-size: 20px; }
.quick-add-row input { min-width: 0; height: 40px; flex: 1; border: 0; background: transparent; color: var(--text); outline: none; }
.quick-add-row input::placeholder { color: var(--text-faint); }
.quick-add-help { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 0; padding: 0 6px 0 42px; color: var(--text-faint); font-size: 12px; }
.quick-add-help:not(:empty) { padding-top: 5px; padding-bottom: 3px; }
.parse-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 999px; background: var(--surface-muted); color: var(--text-soft); }

.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.view-tabs { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); overflow: auto; }
.view-tab { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text-soft); cursor: pointer; white-space: nowrap; }
.view-tab:hover { background: var(--surface-muted); color: var(--text); }
.view-tab[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary-strong); font-weight: 650; }
.toolbar-side { display: flex; align-items: center; gap: 8px; }
.filter-select { height: 36px; padding: 0 30px 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-soft); }

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 650;
  cursor: pointer;
}
.button.primary { background: var(--primary); color: white; box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 25%, transparent); }
.button.primary:hover { background: var(--primary-strong); }
.button.secondary { border-color: var(--border); background: var(--surface); color: var(--text); }
.button.secondary:hover { background: var(--surface-hover); }
.button.ghost { background: transparent; color: var(--text-soft); }
.button.ghost:hover { background: var(--surface-hover); color: var(--text); }
.button.danger { background: var(--danger); color: white; }
.button.small { min-height: 31px; padding: 0 10px; border-radius: 8px; font-size: 12px; }
.button:disabled { opacity: .52; cursor: not-allowed; box-shadow: none; }

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 15px; }
.panel-body { padding: 18px; }

.task-list { overflow: hidden; }
.list-group + .list-group { border-top: 1px solid var(--border); }
.list-group-title { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface-muted); color: var(--text-soft); font-size: 12px; font-weight: 700; }
.task-row {
  display: grid;
  grid-template-columns: 32px minmax(180px, 1fr) minmax(90px, 140px) 92px 118px 34px;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.list-group .task-row:first-of-type { border-top: 0; }
.task-row:hover { background: var(--surface-hover); }
.task-row.is-done .task-title { color: var(--text-faint); text-decoration: line-through; }
.task-check {
  appearance: none;
  width: 19px;
  height: 19px;
  margin: 0;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}
.task-check:checked { border-color: var(--success); background: var(--success); box-shadow: inset 0 0 0 3px var(--surface); }
.task-main { min-width: 0; }
.task-title { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; overflow: hidden; color: var(--text-faint); font-size: 11px; white-space: nowrap; }
.task-meta span { overflow: hidden; text-overflow: ellipsis; }
.assignee-cell { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--text-soft); }
.avatar { display: inline-grid; width: 25px; height: 25px; flex: none; place-items: center; border-radius: 999px; background: var(--primary-soft); color: var(--primary-strong); font-size: 10px; font-weight: 750; }
.assignee-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-cell { color: var(--text-soft); font-size: 12px; }
.due-cell.overdue { color: var(--danger); font-weight: 650; }
.priority-badge, .status-badge, .label-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.priority-badge.p1 { background: var(--danger-soft); color: var(--danger); }
.priority-badge.p2 { background: var(--warning-soft); color: var(--warning); }
.priority-badge.p3 { background: var(--info-soft); color: var(--info); }
.priority-badge.p4 { background: var(--surface-muted); color: var(--text-soft); }
.status-badge { background: var(--surface-muted); color: var(--text-soft); }
.status-badge.done { background: var(--success-soft); color: var(--success); }
.status-badge.in_progress, .status-badge.review { background: var(--info-soft); color: var(--info); }
.label-chip { min-height: 20px; background: var(--primary-soft); color: var(--primary-strong); font-weight: 550; }

.empty-state { display: grid; min-height: 310px; place-items: center; padding: 40px; text-align: center; }
.empty-state-inner { max-width: 420px; }
.empty-icon { display: grid; width: 56px; height: 56px; margin: 0 auto 14px; place-items: center; border-radius: 16px; background: var(--primary-soft); color: var(--primary-strong); }
.empty-icon .icon, .empty-icon .icon svg { width: 28px; height: 28px; }
.empty-state h2 { margin: 0 0 6px; font-size: 18px; }
.empty-state p { margin: 0 0 18px; color: var(--text-soft); }

.table-wrap { overflow: auto; border-radius: var(--radius-lg); }
.data-table { width: 100%; min-width: 880px; border-collapse: collapse; }
.data-table th { position: sticky; z-index: 2; top: 0; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-muted); color: var(--text-faint); font-size: 11px; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.table-title { min-width: 260px; font-weight: 600; }

.board { display: grid; grid-auto-columns: minmax(270px, 1fr); grid-auto-flow: column; gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.board-column { display: flex; min-width: 270px; max-height: calc(100vh - 250px); flex-direction: column; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface-muted) 72%, transparent); }
.board-column.is-over { border-color: var(--primary); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent); }
.board-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; }
.board-title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.board-count { display: inline-grid; min-width: 22px; height: 22px; place-items: center; border-radius: 999px; background: var(--surface); color: var(--text-faint); font-size: 11px; }
.board-cards { display: grid; gap: 9px; padding: 0 9px 12px; overflow-y: auto; }
.board-card { padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-sm); cursor: grab; }
.board-card:active { cursor: grabbing; }
.board-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.board-card-title { margin-bottom: 9px; font-weight: 650; }
.board-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-faint); font-size: 11px; }
.board-card-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 9px; }

.calendar-shell { overflow: hidden; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.calendar-toolbar h2 { margin: 0; font-size: 16px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(105px, 1fr)); min-width: 760px; }
.calendar-weekday { padding: 9px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); background: var(--surface-muted); color: var(--text-faint); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-align: center; text-transform: uppercase; }
.calendar-day { min-height: 122px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); }
.calendar-day.outside { background: color-mix(in srgb, var(--surface-muted) 55%, transparent); color: var(--text-faint); }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.calendar-date { display: inline-grid; width: 25px; height: 25px; place-items: center; margin-bottom: 5px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.calendar-day.today .calendar-date { background: var(--primary); color: white; }
.calendar-tasks { display: grid; gap: 4px; }
.calendar-task { display: block; width: 100%; padding: 4px 6px; overflow: hidden; border: 0; border-left: 3px solid var(--primary); border-radius: 5px; background: var(--primary-soft); color: var(--primary-strong); font-size: 10px; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }

.timeline-shell { overflow: auto; }
.timeline { min-width: 900px; }
.timeline-header, .timeline-row { display: grid; grid-template-columns: 250px repeat(14, minmax(52px, 1fr)); }
.timeline-header { position: sticky; z-index: 3; top: 0; background: var(--surface-muted); }
.timeline-header > div { padding: 9px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--text-faint); font-size: 10px; text-align: center; }
.timeline-header > div:first-child { text-align: left; }
.timeline-row { position: relative; min-height: 48px; border-bottom: 1px solid var(--border); cursor: pointer; }
.timeline-row:hover { background: var(--surface-hover); }
.timeline-name { position: sticky; z-index: 2; left: 0; padding: 13px 10px; overflow: hidden; border-right: 1px solid var(--border); background: inherit; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.timeline-cell { border-right: 1px solid var(--border); }
.timeline-bar { position: absolute; z-index: 1; top: 12px; height: 24px; padding: 4px 8px; overflow: hidden; border-radius: 7px; background: var(--primary); color: white; font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }

.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.metric-card { grid-column: span 3; padding: 17px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-label { color: var(--text-soft); font-size: 12px; }
.metric-value { margin: 6px 0 2px; font-size: 30px; font-weight: 760; letter-spacing: -0.04em; }
.metric-foot { color: var(--text-faint); font-size: 11px; }
.dashboard-card { grid-column: span 6; min-height: 280px; }
.dashboard-card.wide { grid-column: span 8; }
.dashboard-card.narrow { grid-column: span 4; }
.chart-bars { display: grid; gap: 12px; }
.chart-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 34px; align-items: center; gap: 9px; }
.chart-label { overflow: hidden; color: var(--text-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.chart-track { height: 10px; overflow: hidden; border-radius: 999px; background: var(--surface-muted); }
.chart-fill { height: 100%; border-radius: inherit; background: var(--primary); }
.chart-value { color: var(--text-faint); font-size: 11px; text-align: right; }
.donut-wrap { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 22px; }
.donut { position: relative; width: 130px; aspect-ratio: 1; border-radius: 50%; background: conic-gradient(var(--success) 0 var(--progress), var(--surface-muted) var(--progress) 100%); }
.donut::after { position: absolute; inset: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--text); content: attr(data-label); font-size: 20px; font-weight: 750; }
.legend { display: grid; gap: 9px; }
.legend-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-soft); }
.legend-key { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--primary); }

.activity-list { display: grid; }
.activity-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: 0; }
.activity-mark { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; background: var(--surface-muted); color: var(--text-soft); }
.activity-copy strong { display: block; font-size: 13px; }
.activity-copy span, .activity-time { color: var(--text-faint); font-size: 11px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.feature-card { padding: 17px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-sm); }
.feature-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.feature-card h3 { margin: 0; font-size: 15px; }
.feature-card p { margin: 0 0 14px; color: var(--text-soft); }
.feature-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-faint); font-size: 11px; }
.toggle { position: relative; width: 38px; height: 22px; flex: none; border: 0; border-radius: 999px; background: var(--border-strong); cursor: pointer; }
.toggle::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 999px; background: white; box-shadow: 0 1px 4px rgb(0 0 0 / .2); content: ""; transition: transform .16s ease; }
.toggle[aria-pressed="true"] { background: var(--success); }
.toggle[aria-pressed="true"]::after { transform: translateX(16px); }

.dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-md);
}
.dialog::backdrop { background: rgb(14 18 30 / .54); backdrop-filter: blur(3px); }
.compact-dialog { width: min(560px, calc(100vw - 28px)); }
.settings-dialog { width: min(940px, calc(100vw - 28px)); }
.task-dialog { width: min(1080px, calc(100vw - 28px)); }
.dialog-panel { display: flex; max-height: calc(100vh - 38px); flex-direction: column; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.dialog-header h2 { margin: 2px 0 0; font-size: 19px; letter-spacing: -0.025em; }
.eyebrow { display: block; color: var(--text-faint); font-size: 10px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.dialog-body { overflow: auto; padding: 20px; }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-muted); }

.form-stack { display: grid; gap: 14px; padding: 20px; overflow: auto; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { color: var(--text-soft); font-size: 12px; font-weight: 650; }
.field input, .field textarea, .field select, .inline-input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
}
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, .inline-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.field-help { color: var(--text-faint); font-size: 11px; }
.checkbox-field { display: flex; align-items: center; gap: 9px; }
.checkbox-field input { width: 17px; height: 17px; }
.form-error { padding: 10px 12px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: 12px; }

.task-editor { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr); max-height: calc(100vh - 38px); }
.task-editor-main { min-width: 0; overflow: auto; border-right: 1px solid var(--border); }
.task-editor-side { min-width: 0; overflow: auto; background: color-mix(in srgb, var(--surface-muted) 55%, var(--surface)); }
.task-editor-title { width: 100%; padding: 0; border: 0; background: transparent; color: var(--text); font-size: 23px; font-weight: 720; letter-spacing: -0.035em; outline: none; }
.task-editor-title::placeholder { color: var(--text-faint); }
.task-section { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.task-section:last-child { border-bottom: 0; }
.task-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.task-section-heading h3 { margin: 0; font-size: 13px; }
.task-description { width: 100%; min-height: 130px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); resize: vertical; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.checklist { display: grid; gap: 7px; }
.checklist-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) 30px; align-items: center; gap: 7px; }
.checklist-row input[type="text"] { width: 100%; padding: 7px 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--text); }
.checklist-row input[type="text"]:focus { border-color: var(--border); background: var(--surface); outline: none; }
.comment-list { display: grid; gap: 10px; }
.comment { padding: 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.comment-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.comment-author { font-size: 12px; font-weight: 700; }
.comment-time { color: var(--text-faint); font-size: 10px; }
.comment-body { color: var(--text-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: flex; gap: 7px; margin-top: 10px; }
.comment-form input { flex: 1; }
.attachment-list { display: grid; gap: 7px; }
.attachment-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.attachment-icon { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 8px; background: var(--info-soft); color: var(--info); }
.attachment-name { overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.attachment-meta { color: var(--text-faint); font-size: 10px; }
.timer-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.timer-value { font-size: 18px; font-weight: 720; font-variant-numeric: tabular-nums; }

.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 560px; max-height: calc(100vh - 38px); }
.settings-nav { padding: 14px 10px; border-right: 1px solid var(--border); background: var(--surface-muted); }
.settings-nav button { display: flex; width: 100%; align-items: center; gap: 8px; min-height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text-soft); text-align: left; cursor: pointer; }
.settings-nav button:hover { background: var(--surface-hover); color: var(--text); }
.settings-nav button[aria-current="page"] { background: var(--surface); color: var(--primary-strong); font-weight: 650; box-shadow: var(--shadow-sm); }
.settings-content { overflow: auto; }
.settings-section { padding: 22px; border-bottom: 1px solid var(--border); }
.settings-section:last-child { border-bottom: 0; }
.settings-section h3 { margin: 0 0 5px; font-size: 16px; }
.settings-section > p { margin: 0 0 16px; color: var(--text-soft); }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.storage-meter { height: 10px; overflow: hidden; border-radius: 999px; background: var(--surface-muted); }
.storage-meter span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.security-note { padding: 12px; border: 1px solid color-mix(in srgb, var(--success) 28%, var(--border)); border-radius: 10px; background: var(--success-soft); color: var(--success); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }

.command-dialog { width: min(620px, calc(100vw - 28px)); align-self: start; margin-top: 12vh; }
.command-panel { padding: 8px; }
.command-search input { width: 100%; height: 48px; padding: 0 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font-size: 16px; outline: none; }
.command-results { display: grid; max-height: 340px; overflow: auto; padding: 7px 0; }
.command-item { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text-soft); text-align: left; cursor: pointer; }
.command-item:hover, .command-item[aria-selected="true"] { background: var(--surface-hover); color: var(--text); }
.command-item span:nth-child(2) { flex: 1; }
.command-key { color: var(--text-faint); font-size: 11px; }

.toast-region { position: fixed; z-index: 10000; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(390px, calc(100vw - 36px)); pointer-events: none; }
.toast { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: start; gap: 9px; padding: 12px 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-raised); box-shadow: var(--shadow-md); animation: toast-in .18s ease-out; pointer-events: auto; }
.toast.success { border-color: color-mix(in srgb, var(--success) 28%, var(--border)); }
.toast.error { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.toast-title { font-weight: 700; }
.toast-message { margin-top: 2px; color: var(--text-soft); font-size: 12px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.notice { padding: 12px 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-muted); color: var(--text-soft); }
.notice.warning { border-color: color-mix(in srgb, var(--warning) 30%, var(--border)); background: var(--warning-soft); color: var(--warning); }
.notice.danger { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); background: var(--danger-soft); color: var(--danger); }
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }
.text-danger { color: var(--danger); }
.stack { display: grid; gap: 12px; }
.divider { height: 1px; background: var(--border); }

.mobile-overlay { display: none; }

@media (max-width: 1100px) {
  :root { --sidebar-width: 238px; }
  .task-row { grid-template-columns: 32px minmax(180px, 1fr) 92px 110px 34px; }
  .assignee-cell { display: none; }
  .metric-card { grid-column: span 6; }
  .dashboard-card, .dashboard-card.wide, .dashboard-card.narrow { grid-column: span 12; }
  .task-editor { grid-template-columns: minmax(0, 1fr) 320px; }
}

@media (max-width: 820px) {
  body { overflow: hidden; }
  .workspace-layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 100; left: 0; width: min(300px, 86vw); transform: translateX(-105%); box-shadow: var(--shadow-md); transition: transform .2s ease; }
  .workspace-layout.sidebar-open .sidebar { transform: translateX(0); }
  .mobile-overlay { position: fixed; z-index: 90; inset: 0; display: none; border: 0; background: rgb(14 18 30 / .48); }
  .workspace-layout.sidebar-open .mobile-overlay { display: block; }
  .mobile-menu { display: inline-grid; }
  .topbar { padding: 10px 12px; gap: 9px; }
  .search-box { width: 42px; }
  .search-box input { padding: 0; color: transparent; cursor: pointer; }
  .search-box input:focus { position: fixed; z-index: 200; top: 12px; left: 56px; width: calc(100vw - 68px); padding: 0 36px; color: var(--text); }
  .search-box input:focus ~ .search-shortcut { display: none; }
  .search-shortcut { display: none; }
  .sync-pill span:last-child { display: none; }
  .content-frame { padding: 14px 10px 24px; }
  .view-toolbar { align-items: flex-start; flex-direction: column; }
  .view-tabs { width: 100%; }
  .toolbar-side { width: 100%; justify-content: flex-end; }
  .task-row { grid-template-columns: 30px minmax(0, 1fr) 80px 30px; padding: 8px; }
  .task-row .priority-badge, .task-row .due-cell { display: none; }
  .board-column { max-height: calc(100vh - 300px); }
  .task-editor { display: block; max-height: calc(100vh - 28px); overflow: auto; }
  .task-editor-main, .task-editor-side { overflow: visible; border: 0; }
  .task-editor-side { border-top: 1px solid var(--border); }
  .settings-layout { display: block; max-height: calc(100vh - 28px); overflow: auto; }
  .settings-nav { position: sticky; z-index: 4; top: 0; display: flex; gap: 4px; overflow: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .settings-nav button { width: auto; white-space: nowrap; }
  .dialog { max-height: calc(100vh - 18px); }
}

@media (max-width: 560px) {
  .page-heading .eyebrow { display: none; }
  .page-heading h1 { font-size: 17px; }
  .topbar .button.primary span:not(.icon) { display: none; }
  .quick-add-row .button { display: none; }
  .quick-add-help { padding-left: 6px; }
  .metric-card { grid-column: span 12; }
  .field-row, .detail-grid { grid-template-columns: 1fr; }
  .dialog-header, .dialog-body, .task-section, .settings-section { padding-left: 14px; padding-right: 14px; }
  .dialog-footer { padding: 12px 14px; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
}

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

.sidebar-empty { padding: 8px; }
.board-empty { padding: 12px; text-align: center; }
.section-title { margin: 3px 0 0; }
.panel-header-plain { padding-right: 0; padding-left: 0; border: 0; }
.compact-empty-icon { width: 42px; height: 42px; margin: 0; }
.settings-actions-spaced { margin-top: 12px; }
.conflict-actions { margin-top: 8px; }
.form-stack-flush { padding: 0; }
.splash-compact { min-height: 180px; }
.notice-spaced { margin-bottom: 14px; }
.heading-reset { margin: 0; }
.command-empty { padding: 14px; }

.chart-progress, .storage-meter progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: var(--surface-muted);
}
.chart-progress::-webkit-progress-bar, .storage-meter progress::-webkit-progress-bar { border-radius: 999px; background: var(--surface-muted); }
.chart-progress::-webkit-progress-value, .storage-meter progress::-webkit-progress-value { border-radius: 999px; background: var(--primary); }
.chart-progress::-moz-progress-bar, .storage-meter progress::-moz-progress-bar { border-radius: 999px; background: var(--primary); }

.donut-chart { position: relative; width: 130px; height: 130px; }
.donut-chart svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-track, .donut-progress { fill: none; stroke-width: 5; }
.donut-track { stroke: var(--surface-muted); }
.donut-progress { stroke: var(--success); stroke-linecap: round; }
.donut-chart strong { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; }
.legend-dot.success { background: var(--success); }
.legend-dot.neutral { background: var(--border-strong); }
.storage-meter { height: auto; background: transparent; }

.timeline-start-0 { left: 250px; }
.timeline-start-1 { left: calc(250px + (100% - 250px) * 1 / 14); }
.timeline-start-2 { left: calc(250px + (100% - 250px) * 2 / 14); }
.timeline-start-3 { left: calc(250px + (100% - 250px) * 3 / 14); }
.timeline-start-4 { left: calc(250px + (100% - 250px) * 4 / 14); }
.timeline-start-5 { left: calc(250px + (100% - 250px) * 5 / 14); }
.timeline-start-6 { left: calc(250px + (100% - 250px) * 6 / 14); }
.timeline-start-7 { left: calc(250px + (100% - 250px) * 7 / 14); }
.timeline-start-8 { left: calc(250px + (100% - 250px) * 8 / 14); }
.timeline-start-9 { left: calc(250px + (100% - 250px) * 9 / 14); }
.timeline-start-10 { left: calc(250px + (100% - 250px) * 10 / 14); }
.timeline-start-11 { left: calc(250px + (100% - 250px) * 11 / 14); }
.timeline-start-12 { left: calc(250px + (100% - 250px) * 12 / 14); }
.timeline-start-13 { left: calc(250px + (100% - 250px) * 13 / 14); }
.timeline-span-1 { width: max(48px, calc((100% - 250px) * 1 / 14 - 6px)); }
.timeline-span-2 { width: max(48px, calc((100% - 250px) * 2 / 14 - 6px)); }
.timeline-span-3 { width: max(48px, calc((100% - 250px) * 3 / 14 - 6px)); }
.timeline-span-4 { width: max(48px, calc((100% - 250px) * 4 / 14 - 6px)); }
.timeline-span-5 { width: max(48px, calc((100% - 250px) * 5 / 14 - 6px)); }
.timeline-span-6 { width: max(48px, calc((100% - 250px) * 6 / 14 - 6px)); }
.timeline-span-7 { width: max(48px, calc((100% - 250px) * 7 / 14 - 6px)); }
.timeline-span-8 { width: max(48px, calc((100% - 250px) * 8 / 14 - 6px)); }
.timeline-span-9 { width: max(48px, calc((100% - 250px) * 9 / 14 - 6px)); }
.timeline-span-10 { width: max(48px, calc((100% - 250px) * 10 / 14 - 6px)); }
.timeline-span-11 { width: max(48px, calc((100% - 250px) * 11 / 14 - 6px)); }
.timeline-span-12 { width: max(48px, calc((100% - 250px) * 12 / 14 - 6px)); }
.timeline-span-13 { width: max(48px, calc((100% - 250px) * 13 / 14 - 6px)); }
.timeline-span-14 { width: max(48px, calc((100% - 250px) * 14 / 14 - 6px)); }

.cloud-members { display: grid; gap: .75rem; }
.member-list { display: grid; gap: .5rem; }
.member-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: .55rem;
  padding: .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}
.member-copy { min-width: 0; display: grid; gap: .1rem; }
.member-copy span { color: var(--text-muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; }
.member-role { min-width: 7.5rem; }
.member-add-form { display: grid; gap: .75rem; padding-top: .25rem; }
@media (max-width: 680px) {
  .member-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .member-row .member-role { grid-column: 2 / 4; width: 100%; }
}
