/* ===== CSS VARIABLES ===== */
:root {
  --bg: #0a0a0f;
  --bg2: #0d0d1a;
  --bg3: #12121f;
  --surface: #161625;
  --surface2: #1e1e32;
  --border: #2a2a45;
  --border-bright: #3a3a60;
  --neon: #00f5c4;
  --neon-dim: rgba(0,245,196,0.15);
  --neon-glow: 0 0 12px rgba(0,245,196,0.4);
  --purple: #b537f2;
  --purple-dim: rgba(181,55,242,0.15);
  --purple-glow: 0 0 12px rgba(181,55,242,0.4);
  --amber: #ffb830;
  --amber-dim: rgba(255,184,48,0.15);
  --danger: #ff3e6c;
  --danger-dim: rgba(255,62,108,0.15);
  --text: #e8e8f0;
  --text2: #a0a0c0;
  --text3: #60607a;
  --sidebar-w: 270px;
  --radius: 10px;
  --radius-sm: 6px;
  --font-display: 'Rajdhani', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --font-body: 'DM Sans', sans-serif;
  --transition: 0.15s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
#app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

/* ===== ONBOARDING ===== */
.overlay {
  position: fixed; inset: 0; background: var(--bg); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.onboard-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  padding: 40px 32px; max-width: 420px; width: 100%; text-align: center;
  box-shadow: 0 0 60px rgba(0,245,196,0.08); animation: fadeInUp 0.4s ease;
}
@keyframes fadeInUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }
.logo-mark { margin-bottom: 16px; }
.onboard-title {
  font-family: var(--font-display); font-size: 2.4rem; font-weight: 700;
  color: var(--neon); letter-spacing: 2px; text-shadow: var(--neon-glow); margin-bottom: 8px;
}
.onboard-sub { color: var(--text2); font-size: 0.9rem; margin-bottom: 28px; }
.onboard-section { display: flex; flex-direction: column; gap: 12px; }
.field-label {
  font-size: 0.72rem; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; display: block;
}
.divider { display: flex; align-items: center; gap: 12px; color: var(--text3); font-size: 0.8rem; }
.divider::before, .divider::after { content:''; flex:1; height:1px; background: var(--border); }

/* ===== INPUTS ===== */
.neon-input {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 14px; font-family: var(--font-body);
  font-size: 0.9rem; width: 100%; transition: border-color var(--transition), box-shadow var(--transition);
  outline: none; -webkit-appearance: none;
}
.neon-input:focus { border-color: var(--neon); box-shadow: 0 0 0 2px var(--neon-dim); }
.neon-input::placeholder { color: var(--text3); }
input[type="date"].neon-input { color-scheme: dark; }
select.neon-input { cursor: pointer; }

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--neon); color: #000; border: none; border-radius: var(--radius-sm);
  padding: 11px 20px; font-family: var(--font-display); font-size: 0.95rem; font-weight: 700;
  letter-spacing: 0.5px; cursor: pointer; transition: opacity var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.88; box-shadow: var(--neon-glow); transform: translateY(-1px); }
.btn-primary:active { transform: none; }
.btn-primary.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 18px; font-family: var(--font-body);
  font-size: 0.88rem; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px; transition: border-color var(--transition), background var(--transition);
}
.btn-secondary:hover { border-color: var(--border-bright); background: var(--surface2); }
.btn-ghost {
  background: transparent; color: var(--text2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 14px; font-size: 0.82rem; cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--border-bright); }
.btn-ghost.btn-sm { }
.btn-ghost.btn-xs { padding: 4px 10px; font-size: 0.75rem; }
.btn-danger {
  background: var(--danger); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 9px 18px; font-size: 0.85rem; cursor: pointer; font-weight: 600; transition: opacity var(--transition);
}
.btn-danger:hover { opacity: 0.85; }
.btn-danger:disabled { opacity: 0.4; cursor: default; }
.icon-btn {
  background: transparent; border: none; color: var(--text3); cursor: pointer; padding: 6px;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition); font-size: 1rem; line-height: 1;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.file-label { cursor: pointer; user-select: none; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w); background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; height: 100%;
  overflow-y: auto; transition: transform 0.25s ease; z-index: 100;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px 12px; border-bottom: 1px solid var(--border);
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-title {
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
  color: var(--neon); letter-spacing: 1.5px; text-shadow: 0 0 8px rgba(0,245,196,0.3);
}
.sidebar-close-btn { display: none; }
.user-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; color: #fff; flex-shrink: 0;
}
.user-name {
  flex: 1; font-size: 0.88rem; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section-label {
  font-size: 0.68rem; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: 1.2px; padding: 4px 6px 6px;
  display: flex; align-items: center; justify-content: space-between;
}
.add-section-btn { width: 20px; height: 20px; font-size: 1.1rem; color: var(--text3); padding: 0; border-radius: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: none; color: var(--text2); font-family: var(--font-body);
  font-size: 0.88rem; padding: 8px 10px; border-radius: 8px; cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--neon-dim); color: var(--neon); }
.nav-item .badge {
  margin-left: auto; background: var(--surface2); color: var(--text3);
  font-size: 0.68rem; padding: 1px 6px; border-radius: 10px; flex-shrink: 0;
}
.nav-item.active .badge { background: var(--neon-dim); color: var(--neon); }
.nav-collection-item { display: flex; align-items: center; position: relative; }
.nav-collection-item .nav-item { flex: 1; min-width: 0; }
.nav-collection-actions { display: none; gap: 2px; padding-right: 6px; }
.nav-collection-item:hover .nav-collection-actions { display: flex; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.footer-btn {
  display: flex; align-items: center; gap: 8px; background: transparent; border: none;
  color: var(--text3); font-family: var(--font-body); font-size: 0.8rem;
  padding: 7px 10px; border-radius: 6px; cursor: pointer;
  transition: background var(--transition), color var(--transition); text-align: left; width: 100%;
}
.footer-btn:hover { background: var(--surface2); color: var(--text); }
.footer-btn.danger:hover { background: var(--danger-dim); color: var(--danger); }
.install-banner {
  background: var(--purple-dim); border: 1px solid rgba(181,55,242,0.3); border-radius: 8px;
  padding: 8px 10px; display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; color: var(--purple); margin-top: 4px;
}
.install-banner span { flex: 1; }
.install-btn { background: var(--purple); color: #fff; border: none; border-radius: 4px; padding: 4px 10px; font-size: 0.75rem; cursor: pointer; font-weight: 600; }
.install-btn:hover { opacity: 0.85; }

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); z-index: 99; }

/* ===== MAIN WRAP ===== */
#main-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; overflow: hidden; }
.top-bar {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  border-bottom: 1px solid var(--border); background: var(--bg); flex-shrink: 0;
}
.hamburger { display: none; }
.page-title {
  flex: 1; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700;
  letter-spacing: 0.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#content-area { flex: 1; overflow-y: auto; padding: 20px; }

/* ===== FILTER BAR / TYPE TOGGLE ===== */
.filter-bar { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-pill {
  background: var(--surface); border: 1px solid var(--border); color: var(--text2);
  border-radius: 20px; padding: 5px 16px; font-size: 0.8rem; font-weight: 500; cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  font-family: var(--font-body);
}
.filter-pill:hover { border-color: var(--border-bright); color: var(--text); }
.filter-pill.active { background: var(--neon-dim); border-color: var(--neon); color: var(--neon); font-weight: 600; }

/* ===== GROUPED TASKS ===== */
.task-group { margin-bottom: 12px; }
.task-group-header {
  display: flex; align-items: center; gap: 8px;
  padding: 0 4px 0 0; margin-bottom: 6px;
}
.group-toggle-btn {
  flex: 1; display: flex; align-items: center; gap: 8px; background: transparent;
  border: none; cursor: pointer; padding: 8px 10px; border-radius: 8px;
  transition: background var(--transition); min-width: 0;
}
.group-toggle-btn:hover { background: var(--surface2); }
.group-chevron {
  color: var(--text3); font-size: 1rem; line-height: 1; transition: transform 0.2s ease;
  flex-shrink: 0;
}
.group-chevron.collapsed { transform: rotate(-90deg); }
.group-name {
  font-family: var(--font-display); font-size: 0.95rem; font-weight: 600;
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.group-count {
  background: var(--surface2); color: var(--text3); font-size: 0.7rem;
  padding: 2px 8px; border-radius: 10px; flex-shrink: 0; font-family: var(--font-mono);
}
.group-pct {
  color: var(--neon); font-family: var(--font-mono); font-size: 0.75rem;
  background: var(--neon-dim); padding: 2px 8px; border-radius: 10px; flex-shrink: 0;
}
.group-nav-btn { flex-shrink: 0; font-size: 0.9rem; }
.task-group-body { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }

/* ===== COLLECTION HEADER ===== */
.collection-header {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px;
}
.coll-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.coll-type-badge {
  font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.8px;
}
.coll-type-badge.project { background: var(--purple-dim); color: var(--purple); }
.coll-type-badge.list { background: var(--neon-dim); color: var(--neon); }
.coll-meta-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 0.8rem; color: var(--text2); }
.coll-deadline-info { display: flex; align-items: center; gap: 6px; }
.coll-deadline-info.near { color: var(--amber); }
.coll-deadline-info.overdue { color: var(--danger); }
.progress-bar-wrap { margin-top: 12px; }
.progress-bar-label { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text3); margin-bottom: 4px; }
.progress-bar-track { height: 4px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--neon); border-radius: 4px; transition: width 0.4s ease; box-shadow: 0 0 8px rgba(0,245,196,0.4); }
.progress-bar-fill.purple { background: var(--purple); box-shadow: 0 0 8px rgba(181,55,242,0.4); }

/* ===== TASK TABLE ===== */
.task-table-wrap { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.task-table { width: 100%; border-collapse: collapse; }
.task-table th {
  background: var(--bg3); color: var(--text3); font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px; padding: 10px 14px;
  text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}
.task-table td { padding: 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.task-table tr:last-child td { border-bottom: none; }
.task-table tbody tr { transition: background var(--transition); }
.task-table tbody tr:hover { background: var(--surface2); }
.task-table tbody tr.completed-row { opacity: 0.55; }
.task-table tbody tr.completed-row .task-name { text-decoration: line-through; color: var(--text3); }
.task-row-cell { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; min-height: 44px; }
.task-check {
  width: 18px; height: 18px; border: 1.5px solid var(--border-bright); border-radius: 4px; flex-shrink: 0;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), border-color var(--transition); background: transparent;
}
.task-check.checked { background: var(--neon); border-color: var(--neon); }
.task-check.checked::after { content:'✓'; font-size: 0.7rem; color: #000; font-weight: 700; }
.task-name { flex: 1; font-size: 0.88rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subtask-count {
  font-size: 0.72rem; color: var(--text3); font-family: var(--font-mono);
  background: var(--surface2); padding: 2px 7px; border-radius: 10px; white-space: nowrap;
}
.date-cell { padding: 0 14px; font-size: 0.78rem; font-family: var(--font-mono); color: var(--text2); white-space: nowrap; }
.date-cell.overdue { color: var(--danger); }
.date-cell.today { color: var(--amber); }
.date-cell.upcoming { color: var(--neon); }
.action-cell { padding: 0 10px; display: flex; gap: 4px; justify-content: flex-end; }
.tag-chip { font-size: 0.65rem; padding: 2px 7px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.task-tag-chips { display: flex; gap: 4px; flex-wrap: wrap; }

/* ===== STATE BADGE (TABLE) ===== */
.state-badge {
  font-size: 0.68rem; font-weight: 600; padding: 3px 9px; border-radius: 10px;
  border: 1px solid; white-space: nowrap; letter-spacing: 0.3px;
}

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state .big-icon { font-size: 3rem; margin-bottom: 12px; display: block; opacity: 0.4; }
.empty-state h3 { font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 6px; color: var(--text2); }
.empty-state p { font-size: 0.82rem; }

/* ===== SUMMARY VIEW ===== */
.summary-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.summary-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 16px; text-align: center; cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  position: relative; overflow: hidden;
}
.summary-card::before {
  content:''; position: absolute; bottom:0; left:0; right:0;
  height: 2px; background: var(--card-accent, var(--neon)); opacity: 0.6;
}
.summary-card:hover { border-color: var(--border-bright); background: var(--surface2); transform: translateY(-2px); }
.summary-card-icon { font-size: 1.6rem; margin-bottom: 8px; }
.summary-card-count { font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.summary-card-label { font-size: 0.75rem; color: var(--text3); }
.dash-section { margin-bottom: 20px; }
.dash-section-title {
  font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text3); padding: 0 4px 10px; display: flex; align-items: center; gap: 10px;
}
.dash-section-title .ds-line { flex:1; height:1px; background: var(--border); }
.summary-breakdown { display: flex; flex-direction: column; gap: 8px; }
.summary-coll-row {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.summary-coll-row:hover { border-color: var(--border-bright); background: var(--surface2); }
.summary-coll-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.summary-coll-name { font-size: 0.88rem; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-coll-stats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }
.scstat { font-size: 0.75rem; white-space: nowrap; }
.scprogress { width: 60px; height: 4px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.scprogress-bar { height: 100%; background: var(--neon); border-radius: 4px; box-shadow: 0 0 6px rgba(0,245,196,0.4); }
.scpct { font-family: var(--font-mono); font-size: 0.75rem; color: var(--neon); }

/* ===== PROJECT DASHBOARD CARD ===== */
.project-dash-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 8px; cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.project-dash-card:hover { border-color: var(--border-bright); background: var(--surface2); }
.pdc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pdc-name { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.pdc-pct { font-family: var(--font-mono); font-size: 0.8rem; color: var(--neon); }
.pdc-deadline { font-size: 0.75rem; color: var(--text3); margin-top: 6px; }
.pdc-deadline.near { color: var(--amber); }
.pdc-deadline.overdue { color: var(--danger); }

/* ===== FILTER PAGE ===== */
.filter-page { display: flex; flex-direction: column; gap: 20px; }
.filter-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 18px;
}
.fp-section { display: flex; flex-direction: column; gap: 8px; }
.fp-bucket-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fp-bucket-btn {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text2);
  border-radius: 8px; padding: 9px 8px; font-size: 0.8rem; cursor: pointer; text-align: center;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  font-family: var(--font-body);
}
.fp-bucket-btn:hover { border-color: var(--border-bright); color: var(--text); }
.fp-bucket-btn.active { background: var(--neon-dim); border-color: var(--neon); color: var(--neon); font-weight: 600; }
.fp-date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fp-date-row > div { display: flex; flex-direction: column; gap: 6px; }
.fp-tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-tag-opt { cursor: pointer; user-select: none; }
.filter-tag-opt .tag-chip { transition: outline var(--transition); }
.filter-tag-opt.selected .tag-chip { outline: 2px solid rgba(255,255,255,0.5); }
.fp-state-row { display: flex; flex-wrap: wrap; gap: 6px; }
.fp-state-btn {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text2);
  border-radius: 20px; padding: 4px 14px; font-size: 0.78rem; cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  font-family: var(--font-body);
}
.fp-state-btn:hover { border-color: var(--border-bright); color: var(--text); }
.fp-state-btn.active { background: color-mix(in srgb, var(--sc, var(--neon)) 15%, transparent); border-color: var(--sc, var(--neon)); color: var(--sc, var(--neon)); font-weight: 600; }
.fp-result-count { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text3); margin-bottom: 12px; }
.fp-results { }

/* ===== KANBAN ===== */
.kanban-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.kanban-state-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.kanban-board {
  display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px;
  align-items: flex-start;
}
.kanban-board::-webkit-scrollbar { height: 5px; }
.kanban-col {
  min-width: 240px; max-width: 260px; flex-shrink: 0;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 0; overflow: hidden;
  transition: border-color var(--transition);
}
.kanban-col.drag-over { border-color: var(--neon); box-shadow: 0 0 0 1px var(--neon-dim); }
.kanban-col-header {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); background: var(--bg3); position: sticky; top: 0;
}
.kanban-state-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-title { flex: 1; font-family: var(--font-display); font-size: 0.9rem; font-weight: 700; letter-spacing: 0.5px; }
.kanban-col-count {
  background: var(--surface2); color: var(--text3); font-size: 0.68rem;
  padding: 1px 7px; border-radius: 10px; font-family: var(--font-mono);
}
.kanban-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; cursor: pointer; transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  user-select: none;
}
.kanban-card:hover { border-color: var(--border-bright); background: var(--surface2); box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.kanban-card.dragging { opacity: 0.4; border-color: var(--neon); }
.kanban-card.completed-card { opacity: 0.55; }
.kcard-title { font-size: 0.85rem; font-weight: 500; color: var(--text); margin-bottom: 6px; line-height: 1.4; }
.kcard-due { font-size: 0.72rem; font-family: var(--font-mono); margin-bottom: 6px; }
.kcard-due.overdue { color: var(--danger); }
.kcard-due.today { color: var(--amber); }
.kcard-due.upcoming { color: var(--neon); }
.kcard-footer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kcard-tags { display: flex; gap: 3px; flex-wrap: wrap; flex: 1; }
.kcard-check {
  width: 16px; height: 16px; border: 1.5px solid var(--border-bright); border-radius: 3px;
  flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), border-color var(--transition); background: transparent;
}
.kcard-check.checked { background: var(--neon); border-color: var(--neon); }
.kcard-check.checked::after { content:'✓'; font-size: 0.6rem; color: #000; font-weight: 700; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 620px; max-height: 90vh; display: flex; flex-direction: column;
  animation: modalIn 0.2s ease; overflow: hidden;
}
.sm-card { max-width: 420px; }
@keyframes modalIn { from { opacity:0; transform:scale(0.95) translateY(10px); } to { opacity:1; transform:none; } }
.modal-header {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-heading { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: var(--text); flex: 1; }
.modal-title-input {
  flex: 1; background: transparent; border: none; outline: none; color: var(--text);
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; letter-spacing: 0.3px;
}
.modal-title-input::placeholder { color: var(--text3); }
.modal-close { color: var(--text3); font-size: 1.1rem; }
.modal-body { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-row { display: flex; flex-direction: column; gap: 6px; }
.modal-section-header { display: flex; align-items: center; justify-content: space-between; }
.modal-footer {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 20px;
  border-top: 1px solid var(--border); gap: 8px; flex-shrink: 0;
}
.modal-actions-left, .modal-actions-right { display: flex; gap: 8px; }

/* ===== STATE PILLS (MODAL) ===== */
.state-pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.state-pill {
  background: var(--surface); border: 1px solid var(--border); color: var(--text2);
  border-radius: 20px; padding: 5px 14px; font-size: 0.8rem; cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  font-family: var(--font-body); font-weight: 500;
}
.state-pill:hover { border-color: var(--sc, var(--border-bright)); color: var(--sc, var(--text)); }
.state-pill.selected {
  background: color-mix(in srgb, var(--sc, var(--neon)) 15%, transparent);
  border-color: var(--sc, var(--neon)); color: var(--sc, var(--neon)); font-weight: 700;
}

/* ===== RICH EDITOR ===== */
.rich-editor {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; min-height: 80px; max-height: 160px; overflow-y: auto;
  font-size: 0.88rem; line-height: 1.6; color: var(--text); outline: none;
  transition: border-color var(--transition);
}
.rich-editor:focus { border-color: var(--neon); }
.rich-editor:empty::before { content: attr(data-placeholder); color: var(--text3); pointer-events: none; }
.rich-editor ul, .rich-editor ol { padding-left: 20px; }
.rich-toolbar { display: flex; gap: 4px; flex-wrap: wrap; }
.rtb-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text2);
  border-radius: 4px; padding: 4px 8px; font-size: 0.78rem; cursor: pointer;
  transition: background var(--transition), color var(--transition); font-family: var(--font-body);
}
.rtb-btn:hover { background: var(--surface2); color: var(--text); }

/* ===== TAGS ===== */
.tags-area {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  min-height: 44px; cursor: text; align-items: center;
}
.tags-area:focus-within { border-color: var(--neon); }
.tag-option {
  font-size: 0.75rem; padding: 3px 10px; border-radius: 10px; cursor: pointer;
  font-weight: 600; transition: outline var(--transition), transform var(--transition); user-select: none;
}
.tag-option:hover { transform: scale(1.05); }
.tag-option.selected { outline: 2px solid rgba(255,255,255,0.4); }
.tag-option.add-tag-btn {
  background: var(--surface2); color: var(--text3); border: 1px dashed var(--border-bright); font-weight: 400;
}
.tag-option.add-tag-btn:hover { color: var(--text); }

/* ===== SUBTASKS ===== */
.subtask-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 6px; transition: border-color var(--transition);
}
.subtask-item.drag-over-subtask { border-color: var(--neon); background: var(--neon-dim); }
.subtask-item.dragging-subtask { opacity: 0.4; }
.subtask-drag {
  color: var(--text3); cursor: grab; font-size: 1rem; line-height: 1;
  padding: 0 2px; user-select: none; flex-shrink: 0;
}
.subtask-drag:active { cursor: grabbing; }
.subtask-check {
  width: 16px; height: 16px; border: 1.5px solid var(--border-bright); border-radius: 3px; flex-shrink: 0;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), border-color var(--transition); background: transparent;
}
.subtask-check.checked { background: var(--neon); border-color: var(--neon); }
.subtask-check.checked::after { content:'✓'; font-size: 0.6rem; color: #000; font-weight: 700; }
.subtask-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 0.85rem; font-family: var(--font-body);
}
.subtask-input::placeholder { color: var(--text3); }
.subtask-del { color: var(--text3); font-size: 0.9rem; padding: 3px; border-radius: 4px; cursor: pointer; flex-shrink: 0; }
.subtask-del:hover { color: var(--danger); background: var(--danger-dim); }

/* ===== TAGS MANAGER ===== */
.tags-manager-grid { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 12px; }
.tag-manage-item {
  display: flex; align-items: center; gap: 6px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 20px; padding: 5px 12px 5px 8px;
}
.tag-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tag-manage-name { font-size: 0.82rem; color: var(--text); }
.tag-del-btn { color: var(--text3); cursor: pointer; font-size: 0.8rem; }
.tag-del-btn:hover { color: var(--danger); }
.color-picker-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; transition: transform var(--transition); border: 2px solid transparent; }
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected { border-color: #fff; }

/* ===== CONFIRM / EDIT FORMS ===== */
.confirm-box { padding: 10px 0; }
.confirm-box p { font-size: 0.88rem; color: var(--text2); margin-bottom: 16px; line-height: 1.5; }
.confirm-box .confirm-input-wrap { margin-bottom: 12px; }
.confirm-box .danger-text { color: var(--danger); font-family: var(--font-mono); font-size: 0.78rem; background: var(--danger-dim); padding: 6px 10px; border-radius: 6px; margin-bottom: 8px; user-select: all; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.edit-collection-form { display: flex; flex-direction: column; gap: 12px; }
.edit-collection-form .form-group { display: flex; flex-direction: column; gap: 6px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); z-index: 100;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,0.6); }
  .sidebar-close-btn { display: flex !important; }
  .hamburger { display: flex !important; }
  #content-area { padding: 14px; }
  .top-bar { padding: 12px 16px; }
  .task-table th.hide-mobile, .task-table td.hide-mobile { display: none; }
  .modal-card { max-height: 95vh; border-radius: 14px 14px 0 0; align-self: flex-end; margin: 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .sm-card { max-width: 100%; border-radius: 14px 14px 0 0; align-self: flex-end; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-coll-row { flex-direction: column; align-items: flex-start; }
  .fp-bucket-grid { grid-template-columns: repeat(2, 1fr); }
  .fp-date-row { grid-template-columns: 1fr; }
  .kanban-board { flex-direction: column; overflow-x: visible; }
  .kanban-col { min-width: unset; max-width: unset; width: 100%; }
}

@media (max-width: 480px) {
  .fp-bucket-grid { grid-template-columns: 1fr 1fr; }
}
