/* Workspace Hub - Muted Pastel Design System & Responsive Layout */

:root {
  /* Light Mode (Default) */
  --bg-canvas: #F7F6F2;
  --bg-surface: #FFFFFF;
  --bg-sidebar: #EFECE6;
  --bg-subtle: #F3F0EA;
  --bg-hover: #EAE6DD;
  --border: #E6E3DC;
  --border-strong: #D5D0C5;
  --shadow-sm: 0 1px 3px rgba(38, 36, 32, 0.04);
  --shadow-card: 0 2px 8px rgba(38, 36, 32, 0.04);
  --shadow-modal: 0 16px 40px rgba(38, 36, 32, 0.12);

  --text-primary: #2B2D2F;
  --text-muted: #6E7175;
  --text-faint: #94979B;

  --accent: #6B9080;
  --accent-hover: #587A6B;
  --accent-soft: rgba(107, 144, 128, 0.14);
  --accent-contrast: #FFFFFF;

  --pastel-sage: #A4C3B2;
  --pastel-periwinkle: #9BB1D4;
  --pastel-clay: #D8A48F;
  --pastel-ochre: #E6CCB2;
  --pastel-rose: #D68C8C;

  --status-backlog: #8B8E93;
  --status-week: #6F88AD;
  --status-in_progress: #5C8372;
  --status-blocked: #BA6D6D;
  --status-done: #6B9080;

  --prio-low: #9BA0A6;
  --prio-medium: #C79F79;
  --prio-high: #C87E68;
  --prio-urgent: #C46868;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Consolas, monospace;

  --sidebar-width: 264px;
  --header-height: 58px;
  --bottom-nav-height: 62px;
  --transition: 150ms cubic-bezier(0.2, 0.6, 0.3, 1);
}

[data-theme="dark"] {
  --bg-canvas: #191B1D;
  --bg-surface: #222528;
  --bg-sidebar: #1D2023;
  --bg-subtle: #282B2F;
  --bg-hover: #2E3237;
  --border: #31353A;
  --border-strong: #40454C;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.24);
  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow-modal: 0 20px 48px rgba(0, 0, 0, 0.52);

  --text-primary: #E6E4DF;
  --text-muted: #9EA2A8;
  --text-faint: #6F747B;

  --accent: #7FA695;
  --accent-hover: #90B5A5;
  --accent-soft: rgba(127, 166, 149, 0.16);
  --accent-contrast: #121514;

  --pastel-sage: #7FA695;
  --pastel-periwinkle: #8DA4C7;
  --pastel-clay: #C99580;
  --pastel-ochre: #C8AE91;
  --pastel-rose: #C87F7F;

  --status-backlog: #92969D;
  --status-week: #8DA4C7;
  --status-in_progress: #7FA695;
  --status-blocked: #D28787;
  --status-done: #7FA695;

  --prio-low: #8C9197;
  --prio-medium: #CFAF8B;
  --prio-high: #D3927D;
  --prio-urgent: #D48484;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

code, pre, .mono {
  font-family: var(--font-mono);
}

.hidden {
  display: none !important;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}

/* Buttons & Controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
}

.btn-lg {
  min-height: 44px;
  padding: 0 18px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(214, 140, 140, 0.16);
  color: var(--status-blocked);
  border-color: rgba(214, 140, 140, 0.35);
}
.btn-danger:hover {
  background: rgba(214, 140, 140, 0.28);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.input, .select, .textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Auth Screen */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-shell {
  width: 100%;
  max-width: 430px;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.auth-logo {
  border-radius: 10px;
  flex-shrink: 0;
}

.auth-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-sage { background: var(--pastel-sage); }
.dot-periwinkle { background: var(--pastel-periwinkle); }

.auth-desc {
  color: var(--text-muted);
  font-size: 13.5px;
  margin: 0 0 20px;
}

.auth-alert {
  background: rgba(214, 140, 140, 0.16);
  border: 1px solid rgba(214, 140, 140, 0.45);
  color: var(--status-blocked);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* App Shell */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-canvas);
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition), transform var(--transition);
  z-index: 40;
}

.app-shell.sidebar-collapsed .sidebar {
  margin-left: calc(var(--sidebar-width) * -1);
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 16px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.area-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.area-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
  transition: background var(--transition), border-color var(--transition);
}

.area-item:hover {
  background: var(--bg-hover);
}

.area-item.active {
  background: var(--bg-surface);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.area-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.area-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.area-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.area-count {
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}

.sidebar-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 0 4px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 11px;
}

.stat-val {
  font-size: 18px;
  font-weight: 600;
  font-family: var(--font-mono);
  line-height: 1.2;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.user-chip-info {
  min-width: 0;
}

.user-chip-name {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip-email {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Main Column */
.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--header-height);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.view-tabs {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.view-tab:hover {
  color: var(--text-primary);
}

.view-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kbd-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-area {
  background: var(--bg-subtle);
  border-color: var(--border);
  color: var(--text-primary);
}

.badge-status-backlog { background: rgba(139, 142, 147, 0.14); color: var(--status-backlog); }
.badge-status-week { background: rgba(155, 177, 212, 0.22); color: var(--status-week); }
.badge-status-in_progress { background: rgba(107, 144, 128, 0.18); color: var(--status-in_progress); }
.badge-status-blocked { background: rgba(214, 140, 140, 0.2); color: var(--status-blocked); }
.badge-status-done { background: rgba(164, 195, 178, 0.24); color: var(--status-done); }

.badge-prio-low { background: rgba(155, 160, 166, 0.14); color: var(--prio-low); }
.badge-prio-medium { background: rgba(230, 204, 178, 0.3); color: var(--prio-medium); }
.badge-prio-high { background: rgba(216, 164, 143, 0.28); color: var(--prio-high); }
.badge-prio-urgent { background: rgba(214, 140, 140, 0.28); color: var(--prio-urgent); }

.badge-milestone {
  background: rgba(230, 204, 178, 0.34);
  color: var(--text-primary);
  border-color: rgba(216, 164, 143, 0.45);
}

.badge-project {
  background: var(--accent-soft);
  border-color: rgba(107, 144, 128, 0.28);
  color: var(--text-primary);
}

.proj-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.proj-dot-all { background: var(--text-muted); }
.proj-dot-active { background: var(--accent); }
.proj-dot-planned { background: var(--pastel-periwinkle); }
.proj-dot-on_hold { background: var(--pastel-ochre); }
.proj-dot-done { background: var(--pastel-sage); opacity: 0.7; }

/* View Toolbar */
.view-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pill-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--transition);
}
.pill-toggle.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text-primary);
  font-weight: 500;
}

/* Todo View */
.quick-add-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.quick-add-form {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto auto;
  gap: 8px;
  align-items: center;
}
.quick-add-form-proj {
  grid-template-columns: 1fr auto auto auto auto auto auto;
}

.todo-project-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-group-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
}

.project-group-head {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background var(--transition);
}
.project-group-head:hover {
  background: var(--bg-hover);
}
.project-group-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.project-group-title {
  font-weight: 600;
  font-size: 14px;
}
.project-group-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.project-chevron {
  font-size: 12px;
  color: var(--text-muted);
  width: 14px;
  display: inline-block;
  text-align: center;
}
.project-group-list {
  margin-top: 6px;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 11px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.todo-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}

.todo-card.is-done {
  opacity: 0.72;
}

.todo-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.check-circle {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.8px solid var(--border-strong);
  background: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--accent-contrast);
  transition: all var(--transition);
}
.check-circle.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.todo-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.todo-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.todo-title {
  font-weight: 500;
  font-size: 14.5px;
}
.todo-card.is-done .todo-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.todo-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.inline-select {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 7px;
  font-size: 12px;
  cursor: pointer;
}

.inline-date {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.subtask-drawer {
  margin-top: 10px;
  padding-top: 10px;
  padding-left: 32px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subtask-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

/* Kanban View */
.kanban-mobile-pills {
  display: none;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(250px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-col {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.kanban-col.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
}

.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 13px;
}

.kanban-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 11px 12px;
  cursor: grab;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.kanban-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}
.kanban-card.dragging {
  opacity: 0.45;
  transform: scale(0.98);
}

.kanban-card-title {
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.38;
}

.kanban-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Gantt View */
.gantt-shell {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.gantt-scroll {
  overflow: auto;
  max-height: calc(100vh - 205px);
  position: relative;
}

.gantt-canvas {
  position: relative;
  min-width: 100%;
}

.gantt-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  height: 46px;
}

.gantt-label-col-head {
  width: 270px;
  min-width: 270px;
  position: sticky;
  left: 0;
  z-index: 20;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-muted);
}

.gantt-days-head {
  display: flex;
  position: relative;
}

.gantt-day-cell {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.gantt-day-cell.weekend {
  background: rgba(110, 113, 117, 0.06);
}
.gantt-day-cell.today {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.gantt-body {
  position: relative;
}

.gantt-row {
  display: flex;
  height: 46px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.gantt-row:hover {
  background: rgba(107, 144, 128, 0.04);
}

.gantt-row-label {
  width: 270px;
  min-width: 270px;
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  cursor: pointer;
}
.gantt-row-label.indented {
  padding-left: 26px;
}
.gantt-row-project {
  background: rgba(107, 144, 128, 0.045);
}
.gantt-row-label-project {
  background: var(--bg-sidebar);
}
.gantt-project-summary-bar {
  position: absolute;
  top: 13px;
  height: 20px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--accent);
  display: flex;
  align-items: center;
  padding: 0 8px;
  overflow: hidden;
  z-index: 5;
}
.gantt-project-summary-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  opacity: 0.38;
  pointer-events: none;
}
.gantt-project-summary-text {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}

.gantt-row-track {
  position: relative;
  flex: 1;
}

.gantt-grid-day {
  position: absolute;
  top: 0;
  bottom: 0;
  border-right: 1px solid var(--border);
  pointer-events: none;
}
.gantt-grid-day.weekend {
  background: rgba(110, 113, 117, 0.045);
}

.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0.7;
  z-index: 4;
  pointer-events: none;
}

.gantt-svg-layer {
  position: absolute;
  top: 0;
  left: 270px;
  pointer-events: none;
  z-index: 5;
}

.gantt-bar {
  position: absolute;
  top: 9px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: #1F2421;
  cursor: grab;
  user-select: none;
  touch-action: none;
  z-index: 6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.gantt-bar.critical {
  box-shadow: 0 0 0 2px var(--status-blocked), 0 2px 6px rgba(186, 109, 109, 0.25);
}

.gantt-bar-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.28);
  transition: width 200ms ease;
  pointer-events: none;
}

.gantt-elapsed-tick {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 2px;
  background: rgba(31, 36, 33, 0.42);
  border-radius: 1px;
  pointer-events: none;
  z-index: 2;
}

.gantt-bar-text {
  position: relative;
  z-index: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: ew-resize;
  background: rgba(0, 0, 0, 0.08);
}

.gantt-milestone {
  position: absolute;
  top: 12px;
  width: 22px;
  height: 22px;
  transform: rotate(45deg);
  border-radius: 4px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  z-index: 7;
  border: 2px solid var(--bg-surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.gantt-milestone.critical {
  box-shadow: 0 0 0 2px var(--status-blocked);
}

.gantt-tooltip {
  position: fixed;
  z-index: 90;
  background: var(--text-primary);
  color: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 5px 9px;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: var(--shadow-modal);
}

/* Chain List (Mobile & Toggleable Gantt View) */
.chain-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chain-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.chain-card.critical {
  border-left: 4px solid var(--status-blocked);
}

/* Notes View */
.notes-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 16px;
  min-height: calc(100vh - 140px);
}

.notes-list-pane {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.note-list-item {
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.note-list-item:hover {
  background: var(--bg-subtle);
}
.note-list-item.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.notes-editor-pane {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notes-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-height: 380px;
}

.md-textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
}
.md-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Milkdown Crepe In-Place WYSIWYG Editor (Muted Pastel Theme Overrides) */
.milkdown-host {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  min-height: 440px;
  overflow: visible;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.milkdown-host:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.milkdown-host-compact {
  min-height: 210px;
}

.milkdown {
  --crepe-color-background: var(--bg-canvas);
  --crepe-color-on-background: var(--text-primary);
  --crepe-color-surface: var(--bg-surface);
  --crepe-color-surface-low: var(--bg-sidebar);
  --crepe-color-on-surface: var(--text-primary);
  --crepe-color-on-surface-variant: var(--text-muted);
  --crepe-color-outline: var(--border-strong);
  --crepe-color-primary: var(--accent);
  --crepe-color-secondary: var(--bg-hover);
  --crepe-color-on-secondary: var(--text-primary);
  --crepe-color-inverse: var(--text-primary);
  --crepe-color-on-inverse: var(--bg-surface);
  --crepe-color-inline-code: var(--status-blocked);
  --crepe-color-error: var(--status-blocked);
  --crepe-color-hover: var(--bg-hover);
  --crepe-color-selected: var(--accent-soft);
  --crepe-color-inline-area: var(--bg-subtle);

  --crepe-base-font-size: 14.5px;
  --crepe-font-title: var(--font-sans);
  --crepe-font-default: var(--font-sans);
  --crepe-font-code: var(--font-mono);
  --crepe-shadow-1: var(--shadow-card);
  --crepe-shadow-2: var(--shadow-modal);
  background: transparent;
}

.milkdown .ProseMirror {
  padding: 20px 26px 36px 52px !important;
  min-height: 400px;
}
.milkdown-host-compact .milkdown .ProseMirror {
  padding: 14px 18px 24px 44px !important;
  min-height: 180px;
}
.milkdown milkdown-slash-menu,
.milkdown milkdown-toolbar,
.milkdown milkdown-link-tooltip,
.milkdown milkdown-block-handle {
  z-index: 75;
}
@media (max-width: 767px) {
  .milkdown .ProseMirror {
    padding: 16px 14px 28px 36px !important;
  }
}

.md-preview {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  overflow-y: auto;
  min-height: 220px;
}

.md-preview h1, .md-preview h2, .md-preview h3 {
  margin: 0.7em 0 0.35em;
  line-height: 1.3;
}
.md-preview h1:first-child, .md-preview h2:first-child { margin-top: 0; }
.md-preview blockquote {
  margin: 10px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--accent);
  background: var(--bg-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.md-pre {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 12.5px;
}
.md-table-wrap { overflow-x: auto; margin: 10px 0; }
.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.md-table th, .md-table td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.md-table th { background: var(--bg-sidebar); }
.md-img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 6px 0;
}
.md-task-item {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.md-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.md-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.md-task-done {
  text-decoration: line-through;
  color: var(--text-muted);
}

.attachment-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: 12px;
}

/* Inspector Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 27, 29, 0.35);
  z-index: 60;
  display: flex;
  justify-content: flex-end;
}

.inspector-drawer {
  width: 100%;
  max-width: 510px;
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.field-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.field-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.inspector-section {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.dep-chip-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.dep-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px 5px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.dep-task-link {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 2px 4px;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: background var(--transition), color var(--transition);
}
.dep-task-link:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.dep-downstream-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dep-downstream-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 12px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background var(--transition), border-color var(--transition);
}
.dep-downstream-chip:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

/* Modals & Command Palette */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 27, 29, 0.42);
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 16px 20px;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}

.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 16px 18px;
  max-height: 70vh;
  overflow-y: auto;
}

.cmd-results {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.cmd-item:hover {
  background: var(--bg-hover);
}

/* Toast Notifications */
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  padding: 11px 14px;
  font-size: 13px;
}
.toast.error { border-left-color: var(--status-blocked); }
.toast.warn { border-left-color: var(--prio-medium); }

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  display: none;
}

.sidebar-scrim {
  display: none;
}

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) {
  .btn, .icon-btn, .view-tab, .area-item, .pill-toggle {
    min-height: 44px;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    margin-left: 0 !important;
  }
  .app-shell.sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }
  .app-shell.sidebar-mobile-open .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(25, 27, 29, 0.35);
    z-index: 35;
  }
  .quick-add-form {
    grid-template-columns: 1fr 1fr;
  }
  .notes-layout {
    grid-template-columns: 1fr;
  }
  .notes-split {
    grid-template-columns: 1fr;
  }
  .inspector-drawer {
    max-width: 100%;
  }
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
  .topbar {
    padding: 0 12px;
  }
  .view-tabs, .kbd-hint, .desktop-only {
    display: none !important;
  }
  .main-content {
    padding: 12px 12px calc(var(--bottom-nav-height) + 18px);
  }
  .todo-row {
    flex-wrap: wrap;
  }
  .todo-controls {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .kanban-mobile-pills {
    display: flex;
  }
  .kanban-board {
    grid-template-columns: 1fr;
  }
  .kanban-col {
    display: none;
    min-height: 280px;
  }
  .kanban-col.mobile-active {
    display: flex;
  }
  .gantt-label-col-head, .gantt-row-label {
    width: 145px;
    min-width: 145px;
  }
  .gantt-svg-layer {
    left: 145px;
  }
  .field-grid-2, .field-grid-3 {
    grid-template-columns: 1fr;
  }
  .toast-stack {
    bottom: calc(var(--bottom-nav-height) + 12px);
    left: 12px;
    right: 12px;
    max-width: none;
  }
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
  }
  .mobile-nav-btn.active {
    color: var(--accent);
    font-weight: 600;
  }
  .mobile-nav-add {
    color: var(--accent);
    font-weight: 700;
  }
}

/* Smart Progress Bars, Inspector Mode Pills & Muted Pastel Controls */
.task-progress-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.progress-track {
  display: inline-block;
  position: relative;
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.progress-track-full {
  flex: 1;
  width: auto;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 200ms ease;
}

.task-progress-pct {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 30px;
  text-align: right;
}

.kanban-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.gantt-project-summary-fill {
  transition: width 200ms ease;
}

.insp-progress-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.insp-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.insp-progress-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.progress-mode-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.progress-mode-auto {
  background: rgba(164, 195, 178, 0.25);
  color: #3D5A4C;
  border: 1px solid rgba(164, 195, 178, 0.55);
}

.progress-mode-manual {
  background: rgba(230, 204, 178, 0.35);
  color: #6B4F35;
  border: 1px solid rgba(215, 181, 156, 0.65);
}

.insp-reset-auto-btn {
  padding: 2px 7px;
  font-size: 11px;
  min-height: 24px;
}

.insp-progress-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.insp-prog-slider {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
  transition: opacity 160ms ease;
}

.insp-prog-slider.is-auto-muted {
  opacity: 0.62;
}

.insp-prog-slider.is-auto-muted:hover,
.insp-prog-slider.is-auto-muted:focus {
  opacity: 0.92;
}

.insp-prog-num-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.insp-prog-num {
  width: 62px;
  padding: 5px 6px;
  text-align: right;
  font-size: 12.5px;
}

.insp-prog-unit {
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 1023px) {
  .insp-reset-auto-btn,
  .insp-prog-num {
    min-height: 44px;
  }
}
