/* COR-X Task Hub */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f5f7;
  --bg-card: #ffffff;
  --bg-hover: #f0f0f2;
  --bg-input: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-inset: #f0f0f2;
  --text: #1a1a1a;
  --text-secondary: #6b6b6b;
  --text-muted: #999999;
  --accent: #FF4D00;
  --accent-hover: #e64500;
  --accent-soft: rgba(255, 77, 0, 0.06);
  --accent-border: rgba(255, 77, 0, 0.18);
  --border: #e8e8ec;
  --border-light: #f0f0f2;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.07);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.07);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.07);
  --purple: #7c3aed;
  --purple-soft: rgba(124, 58, 237, 0.07);
}

[data-theme="dark"] {
  --bg: #111111;
  --bg-card: #1a1a1a;
  --bg-hover: #222222;
  --bg-input: #222222;
  --bg-sidebar: #161616;
  --bg-inset: #111111;
  --text: #eeeeee;
  --text-secondary: #999999;
  --text-muted: #666666;
  --accent: #ff5c1a;
  --accent-hover: #ff7a42;
  --accent-soft: rgba(255, 92, 26, 0.1);
  --accent-border: rgba(255, 92, 26, 0.25);
  --border: #2a2a2a;
  --border-light: #222222;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow: 0 1px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.1);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --purple: #8b5cf6;
  --purple-soft: rgba(139, 92, 246, 0.1);
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

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

.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ===== Login ===== */

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
}

.login-card .brand { color: var(--accent); font-weight: 700; font-size: 12px; letter-spacing: 0.12em; margin-bottom: 24px; }
.login-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.02em; }
.login-card .subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg-input);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group textarea { resize: vertical; min-height: 56px; }

.login-card .btn-primary { width: 100%; padding: 10px; margin-top: 4px; }
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; display: none; }

/* ===== App Layout ===== */

.app { display: none; height: 100vh; flex-direction: column; }
.app.active { display: flex; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: 48px;
  flex-shrink: 0;
  z-index: 100;
}

.app-header .brand { font-weight: 700; font-size: 13px; letter-spacing: 0.08em; color: var(--accent); }

.header-right { display: flex; align-items: center; gap: 2px; }

.header-right .user-pill {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 4px 10px;
  background: var(--bg-inset);
  border-radius: 20px;
  margin-right: 6px;
}

.header-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all 0.12s;
}
.header-btn:hover { background: var(--bg-inset); color: var(--text); }
.header-btn svg { width: 18px; height: 18px; }

.app-body { display: flex; flex: 1; overflow: hidden; }

/* ===== Sidebar ===== */

.sidebar {
  width: 192px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  gap: 2px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.today-dot { background: var(--accent); }
.week-dot { background: #3b82f6; }
.month-dot { background: #8b5cf6; }
.quarter-dot { background: #06b6d4; }
.backlog-dot { background: var(--text-muted); opacity: 0.4; }
.activity-dot { background: var(--success); }
.stats-dot { background: var(--warning); }

.nav-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-inset);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-item.active .nav-avatar { background: var(--accent-soft); color: var(--accent); }

.nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-muted); min-width: 18px; text-align: center; }
.nav-item.active .nav-badge { color: var(--accent); }

.sidebar-spacer { flex: 1; }

/* ===== Main Content ===== */

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  min-width: 0;
  transition: margin-right 0.2s;
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.view-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.view-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ===== Quick Add Bar ===== */

.quick-add-bar { margin-bottom: 20px; }

.quick-add-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-card);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.quick-add-input::placeholder { color: var(--text-muted); }
.quick-add-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ===== Alert Bar ===== */

.alert-bar {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
}
.alert-bar.crit { background: var(--danger-soft); color: var(--danger); }

/* ===== Briefing ===== */

.briefing {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.briefing-date { font-weight: 600; font-size: 14px; white-space: nowrap; }
.briefing-sep { width: 1px; height: 20px; background: var(--border); }
.briefing-stats { display: flex; gap: 14px; font-size: 13px; color: var(--text-secondary); }
.briefing-stat { display: flex; align-items: center; gap: 4px; }
.briefing-stat .num { font-weight: 700; color: var(--text); }
.briefing-stat.warn .num { color: var(--warning); }
.briefing-stat.crit .num { color: var(--danger); }

/* ===== Two Column (Today) ===== */

/* ===== Today Board ===== */
.today-board { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }

.founder-col {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 160px;
  transition: border-color 0.15s, background 0.15s;
}
.founder-col.drop-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.founder-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.founder-name { font-size: 15px; font-weight: 700; color: var(--text); }
.founder-count { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.founder-progress { height: 3px; background: var(--bg-inset); border-radius: 2px; margin-bottom: 12px; overflow: hidden; }
.founder-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s ease; }

.founder-tasks { min-height: 40px; }

.drop-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px 10px;
  line-height: 1.5;
}
.drop-hint strong {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  background: var(--bg-inset);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}

/* Pool sections (Up Next / This Month below the board) */
.pool-section { margin-bottom: 20px; }
.pool-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pool-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.pool-count { font-size: 11px; color: var(--text-muted); }
.pool-tasks { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

.pool-row { cursor: grab; }
.pool-row:active { cursor: grabbing; }

/* Assign buttons on pool tasks (P / L) */
.assign-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: none;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  transition: all 0.12s;
  color: var(--text-muted);
}
.assign-btn:hover { transform: scale(1.15); }
.assign-p:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.assign-l:hover { background: var(--purple-soft); color: var(--purple); border-color: var(--purple); }

/* Remove from today button */
.remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s;
  display: flex;
  align-items: center;
}
.task-row:hover .remove-btn { opacity: 0.4; }
.remove-btn:hover { opacity: 1 !important; color: var(--danger); }

.show-more-link {
  display: block;
  width: 100%;
  padding: 8px;
  text-align: center;
  background: none;
  border: none;
  border-top: 1px solid var(--border-light);
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.show-more-link:hover { background: var(--accent-soft); }

/* Keep old two-col for backward compat */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.progress-track { height: 3px; background: var(--bg-inset); border-radius: 2px; margin-bottom: 12px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s ease; }

/* ===== Task Section ===== */

.task-section { margin-bottom: 24px; }

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  padding: 0 2px;
}

.section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.section-count { font-size: 11px; color: var(--text-muted); background: var(--bg-inset); padding: 1px 7px; border-radius: 10px; font-weight: 600; }

.show-done-link {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 4px 0;
}
.show-done-link:hover { color: var(--accent); }
.show-done-link.small { font-size: 11px; margin: 4px 0; }

.task-list { display: flex; flex-direction: column; }
.empty-small { padding: 12px 0; color: var(--text-muted); font-size: 13px; }

/* ===== Task Row (Todoist-style) ===== */

.task-row {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  transition: background 0.08s, opacity 0.3s, transform 0.3s;
  cursor: default;
  border-bottom: 1px solid var(--border-light);
}
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--bg-hover); }
.task-row.is-expanded { background: var(--bg-hover); }
.task-row.is-new { box-shadow: inset 3px 0 0 var(--accent); }
.task-row.is-done { opacity: 0.5; }
.task-row.is-done:hover { opacity: 0.7; }
.task-row.completing { opacity: 0; transform: translateX(20px); }
.task-row.dragging { opacity: 0.4; }
.task-row.drag-over { box-shadow: inset 0 2px 0 var(--accent); }

.task-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
}

/* Inline accordion */
.task-expand {
  padding: 0 12px 10px 38px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.expand-desc { line-height: 1.5; }
.expand-notes {
  background: var(--bg-inset);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
}
.expand-subtasks {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.expand-st {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 0;
}
.expand-st.done span { text-decoration: line-through; color: var(--text-muted); }
.expand-st input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}
.expand-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 4px;
  border-top: 1px solid var(--border-light);
}
.expand-status {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.expand-edit-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.expand-edit-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }

/* Checkbox */
.check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.check svg { width: 10px; height: 10px; display: none; }
.check:hover { border-color: var(--success); background: var(--success-soft); }
.check:hover svg { display: block; color: var(--success); opacity: 0.5; }

.check.s-progress { border-color: var(--accent); border-width: 2px; }
.check.s-progress::after { content: ''; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
.check.s-done { border-color: var(--success); background: var(--success); }
.check.s-done svg { display: block; color: white; }
.check.s-done:hover { background: var(--success); border-color: var(--success); opacity: 0.8; }
.check.s-done:hover svg { opacity: 1; }
.check.s-blocked { border-color: var(--danger); }
.check.s-blocked::after { content: ''; width: 6px; height: 6px; background: var(--danger); border-radius: 50%; }

/* Task content */
.task-content {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.task-name {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-row.is-done .task-name { text-decoration: line-through; color: var(--text-muted); }

.task-chips {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  align-items: center;
}

.chip {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-inset);
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.chip-danger { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.chip-warn { background: var(--warning-soft); color: var(--warning); font-weight: 600; }
.chip-muted { background: var(--bg-inset); color: var(--text-muted); }

.task-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.horizon-chip {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 3px;
  background: none;
  color: var(--h-color, var(--text-muted));
  border: 1px solid var(--h-color, var(--border));
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.1s;
}
.task-row:hover .horizon-chip { opacity: 0.6; }
.horizon-chip:hover { opacity: 1 !important; background: var(--bg-inset); }

.owner-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-inset);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
}
.owner-btn:hover { background: var(--accent-soft); color: var(--accent); transform: scale(1.1); }

.focus-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s;
  display: flex;
  align-items: center;
}
.task-row:hover .focus-btn { opacity: 0.5; }
.focus-btn:hover { opacity: 1 !important; color: var(--accent); }

/* Horizon picker dropdown */
.horizon-picker {
  position: fixed;
  z-index: 999;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 130px;
}
.hp-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  transition: background 0.1s;
}
.hp-opt:hover { background: var(--bg-hover); }
.hp-opt.hp-current { font-weight: 600; }
.hp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--h-color);
  flex-shrink: 0;
}

/* ===== Side Panel ===== */

.side-panel {
  width: 0;
  overflow: hidden;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  transition: width 0.2s ease;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.panel-open .side-panel {
  width: 380px;
  overflow-y: auto;
}

.panel-header {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px 0;
  flex-shrink: 0;
}

.panel-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.panel-close:hover { background: var(--bg-hover); color: var(--text); }

.panel-body { padding: 8px 20px 20px; }

.panel-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}
.panel-title-row .check { margin-top: 4px; }

.panel-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  outline: none;
  flex: 1;
  min-width: 0;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.1s;
}
.panel-title:focus { background: var(--bg-inset); }
.panel-title.done { text-decoration: line-through; color: var(--text-muted); }

.panel-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.panel-field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.panel-field select,
.panel-field input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.panel-field select:focus,
.panel-field input:focus { border-color: var(--accent); }

.panel-section { margin-bottom: 16px; }
.panel-section > label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.panel-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  outline: none;
  line-height: 1.5;
}
.panel-textarea:focus { border-color: var(--accent); }
.panel-textarea::placeholder { color: var(--text-muted); }

.panel-subtasks { display: flex; flex-direction: column; gap: 2px; }

.subtask-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.subtask-row input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }
.subtask-row.done { text-decoration: line-through; color: var(--text-muted); }

.subtask-add {
  width: 100%;
  font-size: 12px;
  padding: 5px 0;
  border: none;
  border-bottom: 1px dashed var(--border);
  background: transparent;
  color: var(--text);
  outline: none;
  font-family: inherit;
  margin-top: 2px;
}
.subtask-add::placeholder { color: var(--text-muted); }
.subtask-add:focus { border-color: var(--accent); }

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
}

.panel-meta { font-size: 11px; color: var(--text-muted); }

.panel-delete {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: inherit;
}
.panel-delete:hover { color: var(--danger); background: var(--danger-soft); }

/* ===== Kanban ===== */

.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; }

.kanban-col { min-width: 220px; max-width: 260px; flex-shrink: 0; }

.kanban-col-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 6px 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

/* ===== Activity Feed ===== */

.feed { display: flex; flex-direction: column; }

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-light);
}

.feed-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
  background: var(--border);
}
.feed-dot.a-created { background: var(--accent); }
.feed-dot.a-completed { background: var(--success); }
.feed-dot.a-updated { background: var(--warning); }
.feed-dot.a-moved { background: var(--purple); }

.feed-body { flex: 1; font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.feed-body strong { color: var(--text); font-weight: 600; }
.feed-task-link { color: var(--accent); font-weight: 500; cursor: pointer; }
.feed-task-link:hover { text-decoration: underline; }
.feed-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.feed-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', monospace;
  white-space: nowrap;
  margin-top: 1px;
}

.filter-select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
}

/* ===== Stats ===== */

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.stat-num { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.stats-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.chart-card h3 { font-size: 13px; font-weight: 600; margin-bottom: 12px; }

.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.bar-label { width: 70px; color: var(--text-secondary); text-transform: capitalize; font-size: 12px; }
.bar-track { flex: 1; height: 6px; background: var(--bg-inset); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.3s; }
.bar-count { width: 24px; text-align: right; font-size: 12px; color: var(--text-muted); font-weight: 600; }

/* ===== Search ===== */

.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
[data-theme="dark"] .search-overlay { background: rgba(0,0,0,0.5); }
.search-overlay.active { display: flex; }

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

.search-input {
  width: 100%;
  padding: 14px 18px;
  border: none;
  font-size: 15px;
  background: transparent;
  color: var(--text);
  outline: none;
  font-family: inherit;
}

.search-results { max-height: 280px; overflow-y: auto; }

.sr-item {
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.08s;
  border-top: 1px solid var(--border-light);
}
.sr-item:hover { background: var(--bg-hover); }
.sr-title { font-size: 14px; font-weight: 500; }
.sr-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* ===== Modal ===== */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 460px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.modal h2 { font-size: 16px; font-weight: 600; margin-bottom: 18px; }
.modal .form-row { display: flex; gap: 10px; }
.modal .form-row .form-group { flex: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ===== Toast ===== */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--bg);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { background: var(--danger); color: white; }
.toast.success { background: var(--success); color: white; }

.toast-undo {
  background: none;
  border: none;
  color: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.85;
}
.toast-undo:hover { opacity: 1; }

/* ===== Filter Bar ===== */

.filter-bar { display: none; gap: 8px; margin-bottom: 16px; align-items: center; }
.filter-bar.active { display: flex; }
.filter-bar select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
}

/* ===== Empty State ===== */

.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Keyboard Hints ===== */

.kbd-hints {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 14px;
  opacity: 0.4;
}
.kbd-hints kbd {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0px 5px;
  font-size: 10px;
  font-family: 'SF Mono', monospace;
  font-weight: 500;
}

/* ===== Mobile ===== */

.mobile-nav { display: none; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.mobile-open {
    display: flex;
    position: fixed;
    inset: 48px 0 56px 0;
    width: 100%;
    z-index: 150;
    background: var(--bg-sidebar);
    border-right: none;
  }

  .two-col { grid-template-columns: 1fr; }
  .today-board { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
  .kanban { flex-direction: column; }
  .kanban-col { min-width: 100%; max-width: 100%; }
  .kbd-hints { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stats-charts { grid-template-columns: 1fr; }
  .briefing { flex-wrap: wrap; gap: 8px; }
  .briefing-sep { display: none; }

  /* Side panel on mobile = full overlay */
  .panel-open .side-panel {
    position: fixed;
    inset: 48px 0 0 0;
    width: 100%;
    z-index: 150;
  }

  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    height: 56px;
    z-index: 100;
    justify-content: space-around;
    align-items: center;
  }

  .mobile-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    padding: 4px 14px;
    cursor: pointer;
    font-family: inherit;
  }
  .mobile-nav button .m-icon { width: 20px; height: 20px; }
  .mobile-nav button.active { color: var(--accent); }

  .app-body { padding-bottom: 56px; }
}
