/* === Theme tokens === */
:root {
  --accent: #047857;
  --accent-hover: #065f46;
  --accent-soft: #ecfdf5;
  --accent-strong: #065f46;
  --accent-text: #065f46;
  --accent-ring: rgba(4, 120, 87, 0.18);

  --bg: #f5f6f7;
  --bg-elev: #ffffff;
  --bg-sunken: #eef0f2;
  --panel: #ffffff;
  --panel-2: #fafbfb;
  --border: #e3e6e8;
  --border-strong: #cdd2d6;
  --text: #0b1418;
  --text-2: #283036;
  --text-muted: #5b6770;
  --text-faint: #8a949c;

  --shadow-sm: 0 1px 2px rgba(11,20,24,.04);
  --shadow-md: 0 1px 3px rgba(11,20,24,.06), 0 4px 12px rgba(11,20,24,.04);
  --shadow-lg: 0 24px 48px -16px rgba(11,20,24,.18), 0 8px 16px -8px rgba(11,20,24,.08);

  --p-low: #1d4ed8;       --p-low-bg: #eff5ff;
  --p-med: #b45309;       --p-med-bg: #fff7ed;
  --p-high: #b91c1c;      --p-high-bg: #fef2f2;

  --status-todo: #475569;    --status-todo-bg: #eef1f4;
  --status-doing: #1d4ed8;   --status-doing-bg: #eff5ff;
  --status-review: #6d28d9;  --status-review-bg: #f5f1fc;
  --status-done: #047857;    --status-done-bg: #ecfdf5;

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;

  /* Touch-friendly hit sizes */
  --hit: 40px;
  --hit-lg: 44px;

  color-scheme: light;
}

html[data-theme="dark"] {
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-soft: #062e23;
  --accent-strong: #34d399;
  --accent-text: #6ee7b7;
  --accent-ring: rgba(16, 185, 129, 0.22);

  --bg: #0a0e10;
  --bg-elev: #11161a;
  --bg-sunken: #080b0d;
  --panel: #11161a;
  --panel-2: #161c20;
  --border: #1d2429;
  --border-strong: #2a333a;
  --text: #e8ecef;
  --text-2: #c0c8cd;
  --text-muted: #8d979e;
  --text-faint: #5b656b;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 24px 48px -16px rgba(0,0,0,.7), 0 8px 16px -8px rgba(0,0,0,.5);

  --p-low: #93c5fd;       --p-low-bg: #0f1d3a;
  --p-med: #fbbf24;       --p-med-bg: #3a2a0f;
  --p-high: #fca5a5;      --p-high-bg: #3a1717;

  --status-todo: #94a3b8;    --status-todo-bg: #18222b;
  --status-doing: #93c5fd;   --status-doing-bg: #0f1d3a;
  --status-review: #c4b5fd;  --status-review-bg: #221a3a;
  --status-done: #6ee7b7;    --status-done-bg: #082a20;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}
#root { height: 100vh; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
input, textarea, select { font-family: inherit; }
input:focus, textarea:focus, select:focus { outline: none; }

/* Focus ring (keyboard) */
button:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* === Layout === */
.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  background: var(--bg);
  transition: grid-template-columns .18s ease;
}
.app.sidebar-collapsed {
  grid-template-columns: 76px 1fr;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* === Sidebar === */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--accent);
  display: grid; place-items: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.015em;
  color: var(--text);
}
.brand-sub {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 500;
  margin-top: 1px;
  letter-spacing: 0.005em;
}
.sidebar-toggle {
  display: none;
}
.app.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding-left: 12px;
  padding-right: 12px;
}
.app.sidebar-collapsed .sidebar-header > div:not(.brand-mark),
.app.sidebar-collapsed .sidebar-actions {
  display: none;
}
.app.sidebar-collapsed .sidebar-content {
  padding-left: 8px;
  padding-right: 8px;
}
.app.sidebar-collapsed .sidebar-section-title {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
.app.sidebar-collapsed .sidebar-section-title span,
.app.sidebar-collapsed .nav-item span:not(.count),
.app.sidebar-collapsed .project-item > span:not(.count),
.app.sidebar-collapsed .user-card > div:not(.avatar),
.app.sidebar-collapsed .count {
  display: none;
}
.app.sidebar-collapsed .nav-item,
.app.sidebar-collapsed .project-item {
  justify-content: center;
  padding: 0;
}
.app.sidebar-collapsed .project-item,
.app.sidebar-collapsed .project-item-wrap {
  gap: 0;
}
.app.sidebar-collapsed .project-item-wrap {
  display: flex;
  justify-content: center;
}
.app.sidebar-collapsed .project-actions {
  display: none;
}
.app.sidebar-collapsed .sidebar-footer {
  padding: 10px 8px;
}
.app.sidebar-collapsed .user-card {
  justify-content: center;
  padding: 6px 0;
}
.app.sidebar-collapsed .user-card .icon-btn {
  display: none;
}

.sidebar-content {
  padding: 12px 12px 6px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.sidebar-section {
  margin-bottom: 6px;
}
.sidebar-actions {
  padding: 14px 16px 8px;
  display: grid;
  gap: 8px;
}
.sidebar-actions .btn {
  width: 100%;
  justify-content: center;
}
.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 14px 10px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-section-title button {
  width: 24px; height: 24px;
  border-radius: var(--r-xs);
  display: grid; place-items: center;
  color: var(--text-faint);
}
.sidebar-section-title button:hover { background: var(--bg-sunken); color: var(--text); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  height: 40px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  width: 100%;
  text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--bg-sunken); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-sunken);
  padding: 2px 7px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 22px;
  text-align: center;
}
.nav-item.active .count { background: rgba(4,120,87,.12); color: var(--accent-text); }
html[data-theme="dark"] .nav-item.active .count { background: rgba(16,185,129,.18); }

.project-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  height: 40px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  width: 100%;
  text-align: left;
}
.project-item:hover { background: var(--bg-sunken); color: var(--text); }
.project-item.active { background: var(--bg-sunken); color: var(--text); font-weight: 600; }
.project-item-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px;
  border-radius: var(--r-md);
}
.project-item-wrap.active { background: var(--bg-sunken); }
.project-item-wrap .project-item { min-width: 0; }
.project-item.editing { cursor: default; }
.project-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 4px;
  opacity: .35;
  transition: opacity .12s;
}
.project-item-wrap:hover .project-actions,
.project-item-wrap.active .project-actions {
  opacity: 1;
}
.project-actions button {
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  display: grid;
  place-items: center;
  color: var(--text-faint);
}
.project-actions button:hover {
  background: var(--panel);
  color: var(--text);
}
.project-actions button:last-child:hover {
  background: var(--p-high-bg);
  color: var(--p-high);
}
.project-edit-input {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--accent);
  border-radius: var(--r-xs);
  background: var(--panel);
  color: var(--text);
  padding: 5px 7px;
  font-size: 13px;
  font-weight: 600;
}
.project-tile {
  width: 24px; height: 24px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: white;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--r-md);
  cursor: pointer;
  min-height: 48px;
}
.user-card:hover { background: var(--bg-sunken); }
.user-card .icon-btn {
  opacity: .55;
  transition: opacity .12s, background .12s, color .12s;
}
.user-card:hover .icon-btn { opacity: 1; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 99px;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 600;
  display: grid; place-items: center;
  flex-shrink: 0;
  letter-spacing: 0;
}
.user-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.user-email { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }

/* === Top bar === */
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  flex-shrink: 0;
}
.tablet-bottom-nav {
  display: none;
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 100px;
  flex: 1 1 100px;
  overflow: hidden;
}
.topbar-title h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: var(--text);
}
.crumb {
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.view-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-sunken);
  padding: 4px;
  border-radius: var(--r-md);
}
.view-tab {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.view-tab:hover { color: var(--text); }
.view-tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.topbar-spacer { display: none; }
.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-sunken);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 0 14px;
  height: 40px;
  width: 240px;
  min-width: 120px;
  flex-shrink: 1;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-input:focus-within {
  border-color: var(--accent);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.search-input input {
  border: none; background: transparent;
  flex: 1; font-size: 13.5px;
  color: var(--text); min-width: 0;
}
.search-input input::placeholder { color: var(--text-faint); }
@media (max-width: 1080px) {
  .search-input { width: 180px; }
  .topbar .btn-primary .btn-label { display: none; }
  .crumb { display: none; }
  .topbar { gap: 10px; }
  .topbar .icon-btn[data-narrow-hide] { display: none; }
  .view-tab { padding: 0 10px; }
  .view-tab .vt-label { display: none; }
}
@media (max-width: 880px) {
  .search-input { width: 40px; padding: 0 10px; }
  .search-input input { display: none; }
  .sync-pill { display: none; }
}

.icon-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  color: var(--text-muted);
  border: 1px solid transparent;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }
.icon-btn-sm { width: 32px; height: 32px; }
.sync-pill {
  height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.sync-online {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: transparent;
}
.sync-offline {
  background: var(--p-high-bg);
  color: var(--p-high);
  border-color: transparent;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 40px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  user-select: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: var(--panel);
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-sunken); color: var(--text); border-color: var(--border-strong); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }

/* === Content area === */
.content {
  flex: 1;
  overflow: auto;
  padding: 28px 32px 80px;
}
.content-wide { padding: 0; }

/* === Cards === */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}

/* === Dashboard === */
.dash-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px;
}
.dash-greeting { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0; color: var(--text); }
.dash-sub { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px 16px;
}
.stat-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  margin-bottom: 14px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
}
.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}
.stat-delta {
  font-size: 12px;
  margin-top: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.stat-delta.up { color: var(--accent); }
.stat-delta.down { color: var(--p-high); }

.dash-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
}
.dash-section-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  letter-spacing: -0.005em;
}
.dash-section-title .link {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}
.dash-section-title .link:hover { text-decoration: underline; }

.project-progress {
  display: grid;
  grid-template-columns: 32px 1fr auto 80px;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  min-height: 56px;
}
.project-progress:hover { background: var(--bg-sunken); margin: 0 -10px; padding: 12px 10px; border-radius: var(--r-sm); }
.project-progress:last-child { border-bottom: none; }
.project-progress-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.project-progress-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.progress-bar {
  height: 6px;
  background: var(--bg-sunken);
  border-radius: 99px;
  overflow: hidden;
  width: 140px;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .3s ease;
}
.pct {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
  min-width: 38px;
  letter-spacing: -0.01em;
}

.upcoming-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
  min-height: 56px;
}
.upcoming-item:hover { background: var(--bg-sunken); margin: 0 -10px; padding: 12px 10px; border-radius: var(--r-sm); }
.upcoming-item:last-child { border-bottom: none; }
.upcoming-date {
  width: 48px;
  text-align: center;
  flex-shrink: 0;
  padding: 6px 0;
  background: var(--bg-sunken);
  border-radius: var(--r-sm);
}
.upcoming-date-day { font-size: 17px; font-weight: 700; line-height: 1; color: var(--text); letter-spacing: -0.02em; }
.upcoming-date-month { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 3px; font-weight: 600; }
.upcoming-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.upcoming-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; display: flex; gap: 8px; align-items: center; }

.heatmap {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 4px;
  margin-top: 4px;
}
.heat-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--bg-sunken);
}
.heat-1 { background: rgba(4,120,87,.2); }
.heat-2 { background: rgba(4,120,87,.45); }
.heat-3 { background: rgba(4,120,87,.7); }
.heat-4 { background: rgba(4,120,87,1); }
html[data-theme="dark"] .heat-1 { background: rgba(16,185,129,.25); }
html[data-theme="dark"] .heat-2 { background: rgba(16,185,129,.5); }
html[data-theme="dark"] .heat-3 { background: rgba(16,185,129,.75); }
html[data-theme="dark"] .heat-4 { background: rgba(16,185,129,1); }

/* === Kanban === */
.kanban {
  display: flex;
  gap: 16px;
  padding: 20px 24px 40px;
  height: 100%;
  overflow-x: auto;
  align-items: flex-start;
}
.kanban-col {
  flex: 0 0 308px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 12px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
}
.kanban-col-header .dot {
  width: 8px; height: 8px; border-radius: 99px;
}
.kanban-col-header .col-count {
  color: var(--text-faint);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.kanban-col-header .col-add {
  margin-left: auto;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--r-xs);
  color: var(--text-muted);
}
.kanban-col-header .col-add:hover { background: var(--border); color: var(--text); }
.kanban-list {
  display: flex; flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 2px;
  min-height: 24px;
}
.kanban-list.drag-over {
  background: var(--accent-soft);
  border-radius: var(--r-md);
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
}
.task-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .12s, transform .12s, border-color .12s;
  position: relative;
}
.task-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: .4; cursor: grabbing; }
.task-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity .12s;
}
.task-card:hover .task-card-actions,
.task-card:focus-within .task-card-actions {
  opacity: 1;
}
.task-card-actions button {
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  display: grid;
  place-items: center;
  background: var(--panel);
  color: var(--text-faint);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.task-card-actions button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.task-card-actions button:last-child:hover {
  color: var(--p-high);
  background: var(--p-high-bg);
}
.task-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.task-card-title { font-size: 14px; font-weight: 600; line-height: 1.4; margin-bottom: 10px; word-break: break-word; color: var(--text); letter-spacing: -0.005em; }
.task-card-footer { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.task-card-footer .meta-pill {
  display: inline-flex; align-items: center; gap: 4px;
}
.task-card-progress {
  height: 4px;
  background: var(--bg-sunken);
  border-radius: 99px;
  margin: 8px 0 10px;
  overflow: hidden;
}
.task-card-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}
.touch-status-control {
  display: none;
}

/* === Tag chip === */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--r-xs);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

/* Priority pill */
.prio {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border-radius: var(--r-xs);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
}
.prio-high { background: var(--p-high-bg); color: var(--p-high); }
.prio-med  { background: var(--p-med-bg); color: var(--p-med); }
.prio-low  { background: var(--p-low-bg); color: var(--p-low); }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
}

/* === List view === */
.list-table {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow-x: auto;
  overflow-y: visible;
}
.list-table-inner {
  min-width: 760px;
}
.list-header {
  display: grid;
  grid-template-columns: 28px minmax(240px, 1fr) 160px 120px 110px 100px 76px;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 1;
}
.list-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 10px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
  position: sticky;
  top: 41px;
  z-index: 1;
}
.list-group-header .group-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-sunken);
  padding: 2px 8px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
}
.list-row {
  display: grid;
  grid-template-columns: 28px minmax(240px, 1fr) 160px 120px 110px 100px 76px;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  font-size: 14px;
  cursor: pointer;
  min-height: 64px;
  transition: background .1s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--bg-sunken); }
.list-row.done .list-title { text-decoration: line-through; color: var(--text-faint); }
.list-title { font-weight: 600; color: var(--text); letter-spacing: -0.005em; }
.list-row .meta { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.list-row .meta.overdue { color: var(--p-high); font-weight: 600; }
.list-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}
.list-actions .danger:hover {
  background: var(--p-high-bg);
  color: var(--p-high);
}

.checkbox {
  width: 22px; height: 22px;
  border-radius: var(--r-xs);
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  cursor: pointer;
  background: var(--panel);
  flex-shrink: 0;
  transition: background .12s, border-color .12s;
}
.checkbox:hover { border-color: var(--accent); }
.checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox.checked svg { color: white; }

.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--border-strong); color: var(--text); background: var(--panel-2); }
.filter-chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}
.filter-chip.active .project-dot { box-shadow: 0 0 0 2px white; }

.filter-divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* Select control */
.select-control {
  height: 40px;
  padding: 0 34px 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--panel) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none' stroke='%235b6770' stroke-width='1.5'><polyline points='2 4 5 7 8 4'/></svg>") no-repeat right 12px center;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
html[data-theme="dark"] .select-control {
  background: var(--panel) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none' stroke='%238d979e' stroke-width='1.5'><polyline points='2 4 5 7 8 4'/></svg>") no-repeat right 10px center;
}
.select-control:hover { border-color: var(--border-strong); }
.select-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* Project dot */
.project-dot { width: 8px; height: 8px; border-radius: 99px; flex-shrink: 0; display: inline-block; }

/* === Calendar === */
.cal-wrap { padding: 24px 28px 40px; }
.cal-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
  flex-wrap: wrap;
}
.cal-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.cal-nav { display: flex; gap: 4px; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.cal-day-name {
  background: var(--panel-2);
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.cal-cell {
  background: var(--panel);
  min-height: 120px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.cal-cell.muted { background: var(--panel-2); }
.cal-cell.muted .cal-date { color: var(--text-faint); }
.cal-cell.today .cal-date {
  background: var(--accent);
  color: white;
  border-radius: 99px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  font-weight: 700;
}
.cal-date {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  width: 24px; height: 24px;
  display: grid; place-items: center;
}
.cal-event {
  font-size: 11.5px;
  padding: 3px 7px;
  border-radius: var(--r-xs);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  border-left: 3px solid;
  min-height: 22px;
  display: flex;
  align-items: center;
}

/* === Drawer === */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,20,24,.4);
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}
html[data-theme="dark"] .drawer-overlay { background: rgba(0,0,0,.55); }
.drawer {
  width: 500px;
  max-width: 100%;
  background: var(--panel);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 22px 30px; }
.drawer-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: space-between; align-items: center; }

.field { margin-bottom: 20px; }
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 14px;
  color: var(--text);
  transition: border-color .12s, background .12s, box-shadow .12s;
  min-height: 44px;
}
.input:focus {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
textarea.input { resize: vertical; min-height: 92px; line-height: 1.5; }
.title-input {
  font-size: 19px;
  font-weight: 700;
  border: none;
  background: transparent;
  padding: 6px 0;
  width: 100%;
  letter-spacing: -0.02em;
  color: var(--text);
}
.title-input::placeholder { color: var(--text-faint); }

.meta-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
.meta-row:last-child { border-bottom: none; }
.meta-row .meta-label {
  color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
  font-weight: 600;
  font-size: 12.5px;
}
.meta-row select, .meta-row input[type="date"] {
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--text);
  width: 100%;
  cursor: pointer;
  min-height: 36px;
  font-weight: 500;
}
.meta-row select:hover, .meta-row input[type="date"]:hover { border-color: var(--border); background: var(--bg-sunken); }
.meta-row select:focus, .meta-row input[type="date"]:focus { border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-ring); }

.subtask {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  min-height: 38px;
}
.subtask input[type="text"] {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--text);
  padding: 6px 8px;
  border-radius: var(--r-xs);
}
.subtask input[type="text"]:focus { background: var(--bg-sunken); }
.subtask.done input { text-decoration: line-through; color: var(--text-faint); }
.subtask-remove {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  color: var(--text-faint);
  border-radius: var(--r-xs);
  opacity: 0.4;
  transition: opacity .12s, background .12s, color .12s;
}
.subtask:hover .subtask-remove { opacity: 1; }
.subtask-remove:hover { background: var(--p-high-bg); color: var(--p-high); }

/* === Empty state === */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}
.empty-icon {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  background: var(--bg-sunken);
  border-radius: var(--r-md);
  display: grid; place-items: center;
  color: var(--text-faint);
}
.empty-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; letter-spacing: -0.01em; }

/* === Login === */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(420px, 1fr);
  background:
    linear-gradient(135deg, rgba(236,253,245,.92), transparent 42%),
    var(--bg);
  color: var(--text);
}
html[data-theme="dark"] .login-shell {
  background:
    linear-gradient(135deg, rgba(6,46,35,.75), transparent 44%),
    var(--bg);
}
.login-panel {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: clamp(28px, 6vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 34px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--text);
}
.login-subtitle {
  margin: 12px 0 0;
  max-width: 330px;
  color: var(--text-muted);
  font-size: 14px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.login-field span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.login-field input {
  height: 46px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel-2);
  color: var(--text);
  padding: 0 13px;
  font-size: 14px;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.login-field input:focus {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 2px 0 4px;
}
.login-error {
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--p-high-bg);
  color: var(--p-high);
  font-size: 12.5px;
  font-weight: 600;
}
.login-options button {
  color: var(--accent);
  font-weight: 600;
}
.login-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.login-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.login-submit {
  width: 100%;
  justify-content: center;
  height: 46px;
}
.login-preview {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 7vw, 80px);
  position: relative;
  overflow: hidden;
}
.login-preview::before {
  content: '';
  position: absolute;
  inset: 12%;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 38px 38px;
  opacity: .42;
  transform: rotate(-3deg);
}
.preview-top,
.preview-grid,
.preview-lanes {
  position: relative;
  z-index: 1;
}
.preview-top {
  width: min(640px, 100%);
  height: 58px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  box-shadow: var(--shadow-md);
}
.preview-top span {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--border-strong);
}
.preview-grid {
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 18px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--panel-2);
}
.preview-stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
}
.preview-stat strong {
  display: block;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
}
.preview-stat.warm strong { color: var(--p-med); }
.preview-stat span {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.preview-lanes {
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}
.preview-lanes > div {
  min-height: 190px;
  border-radius: var(--r-md);
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 12px;
}
.preview-lanes span {
  display: block;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.preview-lanes i {
  display: block;
  height: 42px;
  border-radius: var(--r-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 9px;
}
.preview-lanes i:nth-child(3) { width: 82%; }
.preview-lanes i:nth-child(4) { width: 68%; }

/* Scrollbar */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* Tag color variants - more muted, corporate */
.tag-emerald { background: #d1fae5; color: #065f46; }
.tag-blue    { background: #dbeafe; color: #1e3a8a; }
.tag-purple  { background: #ede9fe; color: #5b21b6; }
.tag-pink    { background: #fce7f3; color: #9d174d; }
.tag-amber   { background: #fef3c7; color: #92400e; }
.tag-red     { background: #fee2e2; color: #991b1b; }
.tag-gray    { background: #e5e7eb; color: #374151; }
.tag-teal    { background: #ccfbf1; color: #115e59; }
html[data-theme="dark"] .tag-emerald { background: #064e3b; color: #a7f3d0; }
html[data-theme="dark"] .tag-blue    { background: #1e3a8a; color: #bfdbfe; }
html[data-theme="dark"] .tag-purple  { background: #4c1d95; color: #ddd6fe; }
html[data-theme="dark"] .tag-pink    { background: #831843; color: #fbcfe8; }
html[data-theme="dark"] .tag-amber   { background: #78350f; color: #fde68a; }
html[data-theme="dark"] .tag-red     { background: #7f1d1d; color: #fecaca; }
html[data-theme="dark"] .tag-gray    { background: #1f2937; color: #d1d5db; }
html[data-theme="dark"] .tag-teal    { background: #134e4a; color: #99f6e4; }

/* Touch hint: improve tap responsiveness */
button, .filter-chip, .nav-item, .project-item, .task-card, .list-row, .upcoming-item, .project-progress, .cal-event {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }
  #root { height: auto; min-height: 100vh; }
  .sidebar { display: none; }
  .sidebar-content {
    display: grid;
    grid-template-columns: 1fr;
    max-height: 260px;
  }
  .main { min-height: 0; overflow: visible; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0 16px;
  }
  .content { padding: 22px 18px 96px; }
  .kanban {
    padding: 16px 16px 104px;
    gap: 14px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-col {
    flex-basis: min(318px, calc(100vw - 42px));
    scroll-snap-align: start;
  }
  .task-card-actions {
    position: static;
    justify-content: flex-end;
    opacity: 1;
    margin: -4px -4px 8px 0;
  }
  .touch-status-control {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
  .touch-status-control span {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
  }
  .touch-status-control select {
    height: 40px;
    min-width: 0;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    padding: 0 10px;
    font-size: 13px;
    font-weight: 600;
  }
  .list-table {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    display: grid;
    gap: 12px;
  }
  .list-header {
    display: none;
  }
  .list-group-header {
    position: static;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-top: 2px;
    padding: 10px 14px;
  }
  .list-row {
    display: grid;
    grid-template-columns: 28px 1fr 44px;
    grid-template-areas:
      "check main action"
      "check project action"
      "check status action"
      "check due priority";
    gap: 8px 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    min-height: 104px;
    padding: 16px;
  }
  .list-row > .checkbox {
    grid-area: check;
    margin-top: 2px;
  }
  .list-main { grid-area: main; }
  .list-project { grid-area: project; }
  .list-status,
  .list-priority,
  .list-row .meta {
    display: inline-flex;
    align-items: center;
    width: max-content;
  }
  .list-status { grid-area: status; }
  .list-row .meta {
    grid-area: due;
    margin-left: 0;
    min-height: 27px;
  }
  .list-priority {
    grid-area: priority;
    margin-left: 0;
  }
  .list-actions {
    grid-area: action;
    align-self: start;
    justify-content: flex-end;
    flex-direction: column;
  }
  .stats-grid,
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .project-progress {
    grid-template-columns: 32px 1fr 72px 42px;
  }
  .progress-bar { width: 72px; }
  .cal-wrap { padding: 18px 18px 96px; }
  .cal-header > div:last-child { display: none !important; }
  .cal-cell { min-height: 96px; padding: 6px; }
  .login-shell {
    grid-template-columns: 1fr;
  }
  .login-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: 100vh;
  }
  .login-preview { display: none; }
  .tablet-bottom-nav {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: 14px;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
  }
  .tablet-bottom-nav button {
    min-height: 52px;
    border-radius: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
  }
  .tablet-bottom-nav button.active {
    background: var(--accent-soft);
    color: var(--accent-text);
  }
  .tablet-bottom-nav span {
    line-height: 1;
  }
}

@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .topbar-title { min-width: 0; flex-basis: auto; }
  .view-tabs { margin-left: 0 !important; }
  .kanban {
    padding: 14px;
  }
  .kanban-col {
    flex-basis: min(308px, calc(100vw - 42px));
  }
  .list-row {
    grid-template-columns: 28px 1fr 44px;
  }
  .drawer { width: 100%; }
  .drawer-body { padding: 18px 18px 28px; }
  .meta-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media (min-width: 961px) and (max-width: 1180px) {
  .sidebar-toggle {
    display: grid;
  }
  .app {
    grid-template-columns: 236px 1fr;
  }
  .app.sidebar-collapsed {
    grid-template-columns: 76px 1fr;
  }
  .sidebar-header {
    padding-left: 16px;
    padding-right: 16px;
  }
  .kanban {
    gap: 14px;
    padding: 18px 18px 54px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-col {
    flex-basis: 292px;
    scroll-snap-align: start;
  }
  .task-card {
    padding: 16px;
  }
  .task-card-actions {
    position: static;
    justify-content: flex-end;
    opacity: 1;
    margin: -4px -4px 8px 0;
  }
  .touch-status-control {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
  .touch-status-control span {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
  }
  .touch-status-control select {
    height: 38px;
    min-width: 0;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    padding: 0 10px;
    font-size: 13px;
    font-weight: 600;
  }
  .filter-chip,
  .select-control,
  .icon-btn,
  .btn {
    min-height: 44px;
  }
  .list-table {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    display: grid;
    gap: 12px;
  }
  .list-header {
    display: none;
  }
  .list-group-header {
    position: static;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-top: 2px;
    padding: 10px 14px;
  }
  .list-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    grid-template-areas:
      "check main action"
      "check project action"
      "check status action"
      "check due priority";
    gap: 8px 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    min-height: 104px;
    padding: 16px;
  }
  .list-row > .checkbox {
    grid-area: check;
    margin-top: 2px;
  }
  .list-main {
    grid-area: main;
  }
  .list-project {
    grid-area: project;
  }
  .list-status,
  .list-priority,
  .list-row .meta {
    display: inline-flex;
    align-items: center;
    width: max-content;
  }
  .list-status { grid-area: status; }
  .list-row .meta {
    grid-area: due;
    margin-left: 0;
    min-height: 27px;
  }
  .list-priority {
    grid-area: priority;
    margin-left: 0;
  }
  .list-actions {
    grid-area: action;
    align-self: start;
    justify-content: flex-end;
    flex-direction: column;
  }
}
