:root {
  --ink: #202536;
  --muted: #727b8d;
  --subtle: #9ba3b1;
  --line: #e8ebf0;
  --canvas: #f6f7f9;
  --surface: #fff;
  --accent: #6258d9;
  --accent-soft: #f0efff;
  --green: #21845f;
  --shadow: 0 3px 14px rgba(30, 39, 60, .035);
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; align-items: start; }

/* Navigation */
.sidebar {
  position: sticky; top: 0; z-index: 20; display: flex; flex-direction: column;
  width: 248px; height: 100vh; padding: 25px 15px 18px; overflow: auto;
  color: #e8eaf2; background: #202331; border-right: 1px solid #2c3040;
}
.brand { gap: 11px; padding: 0 10px 32px; font-size: 15px; }
.brand strong { color: #fff; letter-spacing: -.025em; }
.brand small { margin-top: 3px; color: #9ba1b2; font-size: 11px; }
.brand-mark { width: 34px; height: 34px; flex: none; transform: none; border-radius: 10px; background: #7168e8; color: #fff; box-shadow: none; }
.brand-mark svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.sidebar-section { margin: 0 0 27px; }
.side-label { margin: 0 10px 9px; padding: 0; color: #858b9c; font-size: 9px; letter-spacing: .13em; }
.sidebar .primary-nav, .sidebar #area-nav { display: grid; gap: 4px; }
.primary-nav-item, .nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 41px;
  padding: 8px 10px; border: 0; border-radius: 9px; color: #b9becc; background: transparent;
  text-align: left; font-size: 12px; font-weight: 620; transition: background .15s ease, color .15s ease;
}
.primary-nav-item:hover, .nav-item:hover { color: #fff; background: #2c3040; }
.primary-nav-item.active, .nav-item.active { color: #fff; background: #34344b; }
.primary-nav-item svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .86; }
.primary-nav-item span, .nav-item span:not(.nav-dot) { min-width: 0; }
.primary-nav-item b, .nav-item b { margin-left: auto; color: #9ba1b2; font-size: 10px; font-weight: 600; }
.primary-nav-item.active b { color: #d5d2ff; }
.nav-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--dot); }
.workspaces-section { margin-top: 1px; }
.sidebar-bottom { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid #383b49; }
.settings-nav { min-height: 38px; padding-left: 2px; font-size: 11px; }
.settings-nav svg { width: 15px; height: 15px; }
.sidebar-sync { display: flex; align-items: center; gap: 8px; margin: 14px 2px 0; color: #c5c9d3; font-size: 10px; }
.sidebar-sync .status-light { width: 7px; height: 7px; flex: none; box-shadow: none; }
.sidebar-bottom p { margin: 7px 2px 0; color: #8990a0; font-size: 10px; line-height: 1.45; }

/* Main frame */
.main { width: 100%; max-width: 1600px; min-width: 0; margin: 0 auto; padding: 34px clamp(22px, 3.1vw, 48px) 70px; }
.topbar { min-height: 70px; margin-bottom: 23px; }
.topbar > div { min-width: 0; }
.topbar .eyebrow { margin: 0 0 6px; color: #858da0; font-size: 10px; letter-spacing: .09em; }
.topbar h1 { margin: 0 0 5px; color: var(--ink); font-size: clamp(25px, 2.2vw, 31px); font-weight: 720; letter-spacing: -.045em; }
.subhead { color: var(--muted); font-size: 13px; }
.primary-button { min-height: 41px; padding: 10px 15px; border: 0; border-radius: 9px; color: #fff; background: var(--accent); box-shadow: 0 3px 8px #6258d926; font-size: 12px; font-weight: 700; transition: background .15s ease, transform .15s ease; }
.primary-button:hover { background: #5148c9; transform: translateY(-1px); }
.secondary-button { min-height: 38px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; color: #4d5669; background: #fff; font-size: 12px; font-weight: 650; }
.demo-banner { align-items: center; margin: 0 0 17px; border: 1px solid #efdfb8; border-radius: 10px; background: #fffaf0; color: #705a2b; font-size: 12px; }
.demo-banner button { color: #705a2b; }

/* Overview */
.metrics { gap: 12px; margin-bottom: 16px; }
.metric { position: relative; min-height: 102px; padding: 16px 17px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.metric::after { position: absolute; top: 15px; right: 16px; width: 8px; height: 8px; border-radius: 50%; background: #8d83ef; content: ""; }
.metric:nth-child(2)::after { background: #de746a; }
.metric:nth-child(3)::after { background: #dda84d; }
.metric:nth-child(4)::after { background: #4aa985; }
.metric span { color: #6f7788; font-size: 11px; font-weight: 600; }
.metric strong { margin: 10px 0 0; color: #242a3a; font-size: 28px; font-weight: 700; letter-spacing: -.05em; }
.metric small { color: #9ba2af; font-size: 10px; }
.metric-alert strong { color: #c85656; }
.content-grid { grid-template-columns: minmax(0, 1.55fr) minmax(275px, .85fr); gap: 15px; }
.left-column, .right-column { gap: 15px; }
.panel, .team-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.panel { padding: 18px; }
.section-heading { gap: 14px; margin-bottom: 14px; }
.section-heading .eyebrow { margin: 0 0 4px; color: #939aaa; font-size: 9px; letter-spacing: .1em; }
.section-heading h2 { color: #252b3b; font-size: 16px; font-weight: 700; letter-spacing: -.025em; }
.pill { color: #655bd3; background: #f1f0ff; border-radius: 6px; font-size: 9px; }
.task-list { gap: 6px; }
.task-row { gap: 10px; padding: 11px 9px; border: 1px solid transparent; border-radius: 9px; background: #f8f9fb; transition: border-color .15s ease, background .15s ease; }
.task-row:hover { border-color: #e5e3fb; background: #fff; transform: none; box-shadow: none; }
.task-check { width: 18px; min-width: 18px; height: 18px; min-height: 18px; border: 1.5px solid #c7ccd5; border-radius: 50%; }
.task-check:hover { border-color: var(--accent); background: var(--accent); }
.task-title { color: #2d3342; font-size: 12px; font-weight: 650; }
.task-meta { gap: 5px 9px; margin-top: 5px; color: #858d9c; font-size: 10px; }
.area-badge:before { width: 6px; height: 6px; border-radius: 50%; }
.task-status { border-radius: 5px; font-size: 9px; }
.priority { border-radius: 5px; padding: 4px 6px; font-size: 9px; }
.task-edit { width: 30px; min-height: 30px; border-radius: 7px; color: #838b9b; font-size: 17px; }
.task-edit:hover { color: var(--accent); background: var(--accent-soft); }
.empty { padding: 15px; border: 1px dashed #dce1e8; border-radius: 9px; color: #7f8796; background: #fafbfc; font-size: 12px; }
.count { color: #6258d9; background: #f0efff; font-size: 10px; }
.habit-row { gap: 10px; padding: 9px 5px; margin: 0; border-radius: 8px; }
.habit-symbol { width: 32px; height: 32px; border-radius: 8px; }
.habit-head { margin-bottom: 5px; }
.habit-head strong { color: #303647; font-size: 11px; }
.habit-head span { color: #838b9b; font-size: 10px; }
.habit-progress { height: 5px; background: #edf0f3; }
.habit-action { min-height: 34px; padding: 6px 9px; border-radius: 7px; color: #6359d7; font-size: 10px; }
.habit-message, .insight-foot { color: #939aaa; font-size: 10px; }
.agenda-row { gap: 9px; padding: 9px 0 11px; }
.agenda-row + .agenda-row { padding-top: 11px; border-color: #edf0f4; }
.agenda-time { width: 44px; color: #687386; font-size: 10px; }
.agenda-detail strong { color: #353b4a; font-size: 11px; }
.agenda-detail small { color: #9299a7; font-size: 9px; }
.agenda-stripe { width: 3px; }
.text-button { color: var(--accent); font-size: 11px; }
.insight-panel { border-color: #e4e1ff; background: #f8f7ff; box-shadow: none; }
.insight-main { color: #34304f; font-size: 12px; }
.insight-reason { color: #74718d; font-size: 11px; }
.insight-foot { border-color: #e8e6f7; }

/* Task list and board */
.main[data-active-tab="tasks"] .content-grid, .main[data-active-tab="more"] .content-grid { grid-template-columns: minmax(0, 1fr); }
.main[data-active-tab="tasks"] .right-column, .main[data-active-tab="more"] .left-column { display: none; }
.main[data-active-tab="more"] .right-column { display: grid; max-width: 820px; }
.main[data-active-tab="team"] .team-view { display: block; }
.main[data-active-tab="team"] .metrics, .main[data-active-tab="team"] .content-grid { display: none; }
.main[data-active-tab="today"] [data-tab="tasks"], .main[data-active-tab="today"] [data-tab="more"],
.main[data-active-tab="tasks"] [data-tab="today"], .main[data-active-tab="tasks"] [data-tab="more"],
.main[data-active-tab="more"] [data-tab="today"], .main[data-active-tab="more"] [data-tab="tasks"] { display: none !important; }
.tasks-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 17px; }
.tasks-heading h2 { margin: 0; color: #252b3b; font-size: 19px; letter-spacing: -.035em; }
.tasks-heading .eyebrow { margin: 0 0 4px; color: #9299a7; font-size: 9px; letter-spacing: .1em; }
.tasks-subline { margin: 5px 0 0; color: #828a99; font-size: 11px; }
.task-layout-switch { display: inline-flex; flex: none; gap: 3px; padding: 3px; border: 1px solid #e7e9ef; border-radius: 8px; background: #f6f7f9; }
.layout-button { min-height: 31px; padding: 6px 11px; border: 0; border-radius: 6px; color: #778091; background: transparent; font-size: 10px; font-weight: 650; }
.layout-button:hover { color: #373d50; }
.layout-button.active { color: #4d45bf; background: #fff; box-shadow: 0 1px 4px #20253614; }
.task-toolbar { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; }
.task-toolbar .search-label { position: relative; display: flex; flex: 1; min-width: 160px; max-width: 440px; }
.task-toolbar .search-label svg { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); fill: none; stroke: #8e96a5; stroke-width: 1.8; stroke-linecap: round; }
.task-toolbar .search-label input { width: 100%; min-height: 37px; padding: 8px 10px 8px 34px; border: 1px solid #e3e6ec; border-radius: 8px; outline: none; color: #303747; background: #fff; font-size: 11px; }
.task-toolbar .search-label input:focus { border-color: #aaa4ef; box-shadow: 0 0 0 3px #f0efff; }
.assignee-filter-label select { min-width: 145px; min-height: 37px; padding: 7px 28px 7px 10px; border: 1px solid #e3e6ec; border-radius: 8px; color: #5f6878; background: #fff; font-size: 11px; }
.task-filters { margin-bottom: 13px; }
.filter-row { gap: 5px; margin: 0; }
.filter-button { min-height: 29px; padding: 6px 10px; border: 1px solid transparent; border-radius: 6px; color: #7b8392; background: transparent; font-size: 10px; }
.filter-button:hover { border-color: #e8eaf0; color: #42495a; background: #fafbfc; }
.filter-button.active { color: #4e46bd; border-color: #e7e5ff; background: #f1f0ff; }
.kanban-board { display: grid; grid-auto-columns: minmax(210px, 1fr); grid-auto-flow: column; gap: 11px; width: 100%; overflow-x: auto; padding: 2px 1px 13px; scrollbar-color: #d6d8e2 transparent; scrollbar-width: thin; }
.kanban-column { min-width: 0; }
.kanban-column-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; margin-bottom: 8px; padding: 0 2px; }
.kanban-column-head h3 { display: flex; align-items: center; gap: 7px; margin: 0; color: #4c5363; font-size: 11px; font-weight: 700; }
.kanban-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9aa2b0; }
.kanban-status-dot.status-progress { background: #6089d5; }
.kanban-status-dot.status-review { background: #d39d44; }
.kanban-status-dot.status-blocked { background: #d86b6b; }
.kanban-status-dot.status-done { background: #52a37e; }
.kanban-count { display: grid; place-items: center; min-width: 21px; height: 21px; border-radius: 6px; color: #7a8290; background: #eceef2; font-size: 9px; font-weight: 700; }
.kanban-dropzone { display: grid; align-content: start; gap: 8px; min-height: 140px; height: 100%; padding: 7px; border: 1px solid #e9ebf0; border-radius: 10px; background: #f1f2f5; transition: background .15s ease, border-color .15s ease; }
.kanban-dropzone.drag-over { border-color: #9d96ef; background: #eeedff; }
.kanban-empty { display: grid; place-items: center; min-height: 80px; border: 1px dashed #d9dde5; border-radius: 8px; color: #9aa1ad; font-size: 10px; }
.kanban-card { position: relative; display: grid; gap: 11px; padding: 12px; border: 1px solid #e6e8ee; border-radius: 9px; background: #fff; box-shadow: 0 1px 2px #20253608; cursor: grab; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.kanban-card:hover { border-color: #cfcaf5; box-shadow: 0 5px 14px #2f31500c; transform: translateY(-1px); }
.kanban-card.dragging { opacity: .45; cursor: grabbing; }
.kanban-card.readonly { cursor: default; }
.kanban-card-top { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-width: 0; }
.kanban-project { display: inline-flex; align-items: center; gap: 6px; overflow: hidden; color: #778091; font-size: 9px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.kanban-project i { width: 6px; height: 6px; flex: none; border-radius: 2px; background: var(--area-color); }
.kanban-priority { flex: none; padding: 3px 5px; border-radius: 4px; color: #ba5b54; background: #fff0ef; font-size: 8px; font-weight: 700; }
.kanban-title { min-height: 34px; margin: 0; color: #303646; font-size: 11px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.kanban-title a { color: inherit; text-decoration: none; }
.kanban-title a:hover { color: var(--accent); }
.kanban-card-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; padding-top: 7px; border-top: 1px solid #f0f1f4; }
.kanban-due { flex: 1; overflow: hidden; color: #87909e; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.kanban-due.today { color: #ad751c; font-weight: 700; }
.kanban-due.overdue { color: #c45353; font-weight: 700; }
.kanban-owner { display: grid; place-items: center; width: 23px; height: 23px; flex: none; border-radius: 50%; color: #5550a4; background: #efeeff; font-size: 9px; font-weight: 750; }
.kanban-open { display: grid; place-items: center; width: 23px; height: 23px; flex: none; border: 0; border-radius: 6px; color: #808898; background: transparent; text-decoration: none; font-size: 14px; font-weight: 700; }
.kanban-open:hover { color: var(--accent); background: #f0efff; }
.team-view { padding-top: 3px; }
.team-intro { margin: -5px 0 17px; color: #7a8392; font-size: 12px; }
.team-grid { gap: 12px; }
.team-card { padding: 15px; }
.team-card-head h3 { color: #2e3444; font-size: 13px; }
.team-card-head p, .team-source { color: #858d9c; font-size: 10px; }
.team-count strong { color: #252b3b; font-size: 25px; }
.team-count span { color: #808898; font-size: 10px; }
.team-stats span { color: #677183; background: #f2f3f6; font-size: 9px; }
.team-task-title { color: #343a49; font-size: 11px; }
.team-task-meta { color: #8991a0; font-size: 9px; }
.connection { border-color: #edf0f4; }
.connection > span:nth-child(2) { color: #3f4656; font-size: 11px; }
.connection small { color: #858d9a; font-size: 10px; }
.connection em { color: #7f8795; font-size: 9px; }
.connection em.connected { color: #267958; }
.install-panel p { color: #687283; font-size: 12px; line-height: 1.55; }
.install-panel .local-note { color: #8991a0; font-size: 10px; }
.text-button, .secondary-button, .layout-button, .primary-nav-item, .nav-item { -webkit-tap-highlight-color: transparent; }

/* Dialogs */
.entry-dialog { border-radius: 14px; }
.entry-dialog form { gap: 13px; }
.entry-dialog label { color: #596273; font-size: 11px; }
.entry-dialog input, .entry-dialog select { min-height: 39px; border-color: #e0e4eb; border-radius: 8px; color: #2d3444; font-size: 12px; }
.entry-dialog input:focus, .entry-dialog select:focus { outline: 2px solid #eeedff; border-color: #a59eed; }
.dialog-heading h2 { color: #262c3b; font-size: 18px; }
.form-note, .board-preview { color: #838b99; font-size: 10px; line-height: 1.45; }
.dialog-actions { gap: 7px; }
.danger-button { color: #bc4c4c; font-size: 11px; }

/* Mobile and foldable screens */
.bottom-nav { background: rgba(255,255,255,.97); border-color: #e7e9ef; box-shadow: 0 -4px 18px #2025360c; backdrop-filter: blur(16px); }
.bottom-nav-button { color: #7d8593; font-size: 11px; }
.bottom-nav-button.active { color: #5148c9; background: #f0efff; }
@media (max-width: 940px) {
  .shell { grid-template-columns: 218px minmax(0,1fr); }
  .sidebar { width: 218px; }
  .main { padding-right: 22px; padding-left: 22px; }
  .content-grid { grid-template-columns: minmax(0,1.25fr) minmax(245px,.85fr); }
}
@media (max-width: 900px) {
  .shell { display: block; min-height: 100vh; }
  .sidebar { position: sticky; top: 0; display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 14px; width: 100%; height: auto; padding: 10px 14px; overflow: hidden; border-right: 0; border-bottom: 1px solid #e8ebf0; color: var(--ink); background: rgba(255,255,255,.96); box-shadow: 0 2px 10px #20253608; backdrop-filter: blur(14px); }
  .brand { padding: 0; gap: 8px; font-size: 13px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .brand small { display: none; }
  .brand strong { color: #252b3b; }
  .sidebar-section:not(.workspaces-section), .sidebar-bottom, .side-label { display: none; }
  .workspaces-section { min-width: 0; margin: 0; }
  .sidebar #area-nav { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
  .sidebar #area-nav::-webkit-scrollbar { display: none; }
  .nav-item { width: auto; min-height: 33px; flex: none; gap: 7px; padding: 6px 9px; border-radius: 7px; color: #687183; background: #f6f7f9; font-size: 10px; }
  .nav-item:hover { color: #41495a; background: #eef0f5; }
  .nav-item.active { color: #5148c9; background: #efeeff; }
  .nav-item b { display: none; }
  .nav-dot { width: 6px; height: 6px; }
  .main { padding: 22px 16px calc(92px + env(safe-area-inset-bottom)); }
  .topbar { display: flex; align-items: center; margin-bottom: 18px; }
  .topbar h1 { font-size: 25px; }
  .topbar .subhead { font-size: 11px; }
  .topbar .primary-button { min-height: 38px; margin: 0; }
  .view-tabs { display: none; }
  .bottom-nav { display: grid; grid-template-columns: repeat(4,1fr); position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 6px 9px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav-button { min-height: 43px; border-radius: 8px; }
  .content-grid { display: flex; flex-direction: column; gap: 12px; }
  .left-column, .right-column { display: contents; }
  .focus-panel { order: 1; }
  .habits-panel { order: 2; }
  .agenda-panel { order: 3; }
  .waiting-panel { order: 4; }
  .insight-panel { order: 5; }
  .all-tasks-panel, .connections-panel, .install-panel { order: 1; width: 100%; }
  .main[data-active-tab="tasks"] .right-column, .main[data-active-tab="more"] .left-column { display: none; }
  .main[data-active-tab="more"] .right-column { display: grid; max-width: none; }
  .team-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .kanban-board { grid-auto-columns: minmax(225px, 72vw); }
}
@media (max-width: 560px) {
  .sidebar { grid-template-columns: 1fr; gap: 7px; padding: 8px 12px 9px; }
  .brand { display: none; }
  .main { padding: 19px 12px calc(89px + env(safe-area-inset-bottom)); }
  .topbar { gap: 9px; }
  .topbar h1 { margin-bottom: 2px; font-size: 23px; }
  .topbar .eyebrow { font-size: 9px; }
  .topbar .subhead { display: none; }
  .topbar .primary-button { padding: 9px 11px; font-size: 11px; }
  .metrics { gap: 7px; margin-bottom: 11px; }
  .metric { min-height: 78px; padding: 11px 12px; border-radius: 10px; }
  .metric::after { top: 12px; right: 12px; width: 6px; height: 6px; }
  .metric span { font-size: 9px; }
  .metric strong { margin-top: 7px; font-size: 23px; }
  .metric small { display: none; }
  .panel { padding: 14px; border-radius: 11px; }
  .section-heading h2 { font-size: 14px; }
  .section-heading .eyebrow { font-size: 8px; }
  .tasks-heading { align-items: flex-start; gap: 8px; }
  .tasks-heading h2 { font-size: 17px; }
  .tasks-subline { font-size: 10px; }
  .layout-button { min-height: 29px; padding: 5px 8px; }
  .task-toolbar { align-items: stretch; flex-direction: column; }
  .task-toolbar .search-label { max-width: none; }
  .assignee-filter-label select { width: 100%; }
  .task-filters { overflow-x: auto; }
  .filter-row { flex-wrap: nowrap; width: max-content; }
  .filter-button { flex: none; }
  .kanban-board { grid-auto-columns: minmax(235px, 82vw); gap: 8px; }
  .kanban-dropzone { min-height: 110px; padding: 6px; }
  .team-grid { grid-template-columns: 1fr; }
  .connection { flex-wrap: wrap; }
  .connection em { margin-left: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .bottom-nav-button { min-height: 41px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
