/* ─── CSS Variables ──────────────────────────────────────────────────────── */
:root {
  --bg-primary:    #0f172a;
  --bg-secondary:  #131e30;
  --card-bg:       #1e293b;
  --card-bg-light: #243347;
  --accent:        #6366f1;
  --accent-2:      #8b5cf6;
  --accent-grad:   linear-gradient(135deg, #6366f1, #8b5cf6);
  --text-primary:  #e2e8f0;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;
  --border:        rgba(99,102,241,0.15);
  --border-hover:  rgba(99,102,241,0.35);
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #38bdf8;
  --sidebar-w:     240px;
  --topbar-h:      64px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 24px rgba(0,0,0,0.35);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.45);
}

/* ─── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Google Sans', 'Google Sans Text', sans-serif;
  background: linear-gradient(160deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ─── Typography ─────────────────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { font-family: 'Google Sans Display', 'Google Sans', sans-serif; line-height: 1.3; color: var(--text-primary); }
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
p  { color: var(--text-secondary); font-size: 0.9rem; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.sidebar::before {
  content: '';
  display: block; height: 3px;
  background: var(--accent-grad);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  font-size: 22px;
  background: var(--accent-grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-name {
  font-family: 'Google Sans Display', 'Google Sans', sans-serif;
  font-weight: 700; font-size: 0.95rem;
  letter-spacing: 0.01em;
}

/* ─── Sidebar Nav ────────────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1; padding: 12px 10px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.18s ease;
  position: relative;
}
.nav-item:hover {
  background: rgba(99,102,241,0.08);
  color: var(--text-primary);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(139,92,246,0.1));
  color: #a5b4fc;
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 14px 10px 20px; }
.btn-quick-add {
  width: 100%; padding: 10px;
  background: var(--accent-grad);
  color: #fff; border-radius: 10px;
  font-size: 0.875rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: filter 0.18s, transform 0.18s;
}
.btn-quick-add:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn-quick-add span { font-size: 18px; line-height: 1; }

/* ─── Hamburger ──────────────────────────────────────────────────────────── */
.hamburger {
  display: none; position: fixed; top: 16px; left: 16px; z-index: 200;
  flex-direction: column; gap: 5px; padding: 8px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer;
}
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text-secondary); border-radius: 2px;
  transition: all 0.2s;
}

/* ─── Main Content ───────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ─── Top Bar ────────────────────────────────────────────────────────────── */
.top-bar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: rgba(15,23,42,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
}

/* ─── Search ─────────────────────────────────────────────────────────────── */
.search-wrapper { position: relative; flex: 1; max-width: 400px; }
.search-wrapper::before {
  content: '⌕';
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 16px; pointer-events: none;
}
.search-input {
  width: 100%; padding: 9px 14px 9px 36px;
  background: rgba(30,41,59,0.7);
  border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-primary);
  font-size: 0.875rem; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.search-input::placeholder { color: var(--text-muted); }
.search-results {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px; max-height: 320px; overflow-y: auto;
  box-shadow: var(--shadow-lg); z-index: 300;
}
.search-results.open { display: block; }
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer; font-size: 0.85rem;
  transition: background 0.15s;
}
.search-result-item:hover { background: rgba(99,102,241,0.1); }
.search-result-icon { font-size: 14px; flex-shrink: 0; }
.search-result-title { font-weight: 500; color: var(--text-primary); }
.search-result-type { font-size: 11px; color: var(--text-muted); margin-left: auto; }

/* ─── Page Container ─────────────────────────────────────────────────────── */
.page-container { padding: 28px 24px; max-width: 1200px; width: 100%; }

/* ─── Page Header ────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px; gap: 16px;
}
.page-header-left {}
.page-title {
  font-family: 'Google Sans Display', 'Google Sans', sans-serif;
  font-size: 1.75rem; font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-top: 4px; }
.page-header-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-hover);
}
.card.clickable { cursor: pointer; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.card-title { font-weight: 600; font-size: 0.95rem; color: var(--text-primary); }
.card-body { font-size: 0.875rem; color: var(--text-secondary); }
.card-footer {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.card-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent-grad);
  color: #fff; border-radius: var(--radius-sm);
  padding: 9px 18px; font-size: 0.875rem; font-weight: 600;
  transition: filter 0.18s, transform 0.18s; border: none;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.3);
  color: #a5b4fc; border-radius: var(--radius-sm);
  padding: 9px 18px; font-size: 0.875rem; font-weight: 500;
  transition: all 0.18s;
}
.btn-secondary:hover { background: rgba(99,102,241,0.18); border-color: var(--accent); }

.btn-danger {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5; border-radius: var(--radius-sm);
  padding: 9px 18px; font-size: 0.875rem; font-weight: 500;
  transition: all 0.18s;
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-ghost {
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm); padding: 9px 18px;
  font-size: 0.875rem; font-weight: 500;
  transition: all 0.18s;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-icon {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 14px; transition: all 0.18s;
  background: rgba(255,255,255,0.04); color: var(--text-muted);
}
.btn-icon:hover { background: rgba(99,102,241,0.15); color: var(--text-primary); }
.btn-icon.danger:hover { background: rgba(239,68,68,0.15); color: #fca5a5; }
.btn-create-top {
  background: var(--accent-grad); color: #fff;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600;
  transition: filter 0.18s; white-space: nowrap;
}
.btn-create-top:hover { filter: brightness(1.1); }

/* ─── Badges / Status ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  border-radius: 20px; padding: 3px 10px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
  text-transform: capitalize;
}
.badge-active     { background: rgba(99,102,241,0.15);  color: #a5b4fc; }
.badge-completed  { background: rgba(16,185,129,0.15);  color: #6ee7b7; }
.badge-paused     { background: rgba(100,116,139,0.2);  color: #94a3b8; }
.badge-planned    { background: rgba(245,158,11,0.15);  color: #fcd34d; }
.badge-in_progress{ background: rgba(6,182,212,0.15);   color: #67e8f9; }
.badge-abandoned  { background: rgba(239,68,68,0.12);   color: #fca5a5; }
.badge-blocked    { background: rgba(239,68,68,0.18);   color: #f87171; }
.badge-pending    { background: rgba(148,163,184,0.12); color: #94a3b8; }
.badge-personal   { background: rgba(139,92,246,0.15);  color: #c4b5fd; }
.badge-official   { background: rgba(56,189,248,0.15);  color: #7dd3fc; }
.badge-overdue    {
  background: rgba(239,68,68,0.2); color: #f87171;
  animation: pulse 1.8s ease-in-out infinite;
}

/* ─── Type Chips ─────────────────────────────────────────────────────────── */
.type-chip {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 20px; padding: 2px 9px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em;
}
.type-chip::before { content: '●'; font-size: 7px; }
.type-chip-dream        { background: rgba(139,92,246,0.15);  color: #c4b5fd; }
.type-chip-goal         { background: rgba(56,189,248,0.15);  color: #93c5fd; }
.type-chip-long_term    { background: rgba(56,189,248,0.15);  color: #93c5fd; }
.type-chip-short_term   { background: rgba(6,182,212,0.15);   color: #67e8f9; }
.type-chip-task         { background: rgba(20,184,166,0.15);  color: #5eead4; }
.type-chip-learning_plan{ background: rgba(16,185,129,0.15);  color: #86efac; }
.type-chip-rnd_plan     { background: rgba(245,158,11,0.15);  color: #fdba74; }
.type-chip-project      { background: rgba(234,179,8,0.15);   color: #fde68a; }
.type-chip-personal     { background: rgba(139,92,246,0.12);  color: #c4b5fd; }
.type-chip-official     { background: rgba(56,189,248,0.12);  color: #7dd3fc; }

/* ─── Priority ───────────────────────────────────────────────────────────── */
.priority-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.priority-high   { background: var(--danger); box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.priority-medium { background: var(--warning); box-shadow: 0 0 6px rgba(245,158,11,0.4); }
.priority-low    { background: var(--success); }

/* ─── Grids ──────────────────────────────────────────────────────────────── */
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (max-width: 1024px) { .grid-3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 640px)  { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ─── Section Heading ────────────────────────────────────────────────────── */
.section-heading {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-muted); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-heading::before {
  content: ''; display: block; width: 3px; height: 14px;
  background: var(--accent-grad); border-radius: 2px;
}

/* ─── Divider ────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid rgba(255,255,255,0.06); margin: 18px 0; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px; color: var(--text-primary);
  font-size: 0.875rem; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-select option { background: var(--card-bg); color: var(--text-primary); }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; min-width: 0; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.form-actions .btn-primary,
.form-actions .btn-ghost { min-width: 100px; justify-content: center; display: flex; }

/* ─── Tabs ───────────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 20px; overflow-x: auto;
}
.tab {
  padding: 10px 18px; color: var(--text-muted);
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.18s, border-color 0.18s;
  white-space: nowrap;
}
.tab:hover { color: var(--text-secondary); }
.tab.active { color: #a5b4fc; border-bottom-color: var(--accent); }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
}
.modal-backdrop.open { display: block; }
.modal {
  display: none; position: fixed;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(620px, 95vw); max-height: 88vh; overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
}
.modal.open { display: block; animation: fadeInScale 0.22s ease; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky; top: 0; background: var(--card-bg); z-index: 1;
}
.modal-title { font-family: 'Google Sans Display', 'Google Sans', sans-serif; font-weight: 600; font-size: 1.1rem; }
.modal-close {
  width: 32px; height: 32px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 20px;
  transition: all 0.18s;
}
.modal-close:hover { background: rgba(239,68,68,0.1); color: #fca5a5; }
.modal-body { padding: 20px 24px 24px; }

/* ─── Quick-create tabs inside modal ─────────────────────────────────────── */
.modal-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 6px;
  background: rgba(15,23,42,0.5);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.modal-tab {
  padding: 7px 14px; border-radius: 8px; font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; transition: all 0.18s;
  border: 1px solid transparent;
  background: transparent;
  display: flex; align-items: center; gap: 5px;
}
.modal-tab:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
  border-color: var(--border);
}
.modal-tab.active {
  background: var(--accent-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(99,102,241,0.35);
}

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999; pointer-events: none;
}
.toast {
  pointer-events: all;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 12px 14px;
  min-width: 280px; max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.25s ease;
}
.toast.success  { border-left-color: var(--success); }
.toast.error    { border-left-color: var(--danger); }
.toast.warning  { border-left-color: var(--warning); }
.toast.info     { border-left-color: var(--accent); }
.toast.removing { animation: slideOutRight 0.22s ease forwards; }
.toast-msg  { flex: 1; font-size: 0.875rem; color: var(--text-primary); padding-top: 1px; }
.toast-close {
  color: var(--text-muted); font-size: 16px; line-height: 1;
  cursor: pointer; flex-shrink: 0; transition: color 0.15s;
  margin-top: 1px;
}
.toast-close:hover { color: var(--text-primary); }

/* ─── Dashboard – Guide Banner ───────────────────────────────────────────── */
.guide-banner {
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(139,92,246,0.08));
  border: 1px solid rgba(99,102,241,0.22);
  border-radius: 16px; padding: 24px 28px;
  margin-bottom: 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.guide-greeting { font-family: 'Google Sans Display', 'Google Sans', sans-serif; font-size: 1.3rem; font-weight: 700; }
.guide-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }
.guide-counts { display: flex; gap: 16px; flex-wrap: wrap; }
.guide-count-item {
  text-align: center; padding: 8px 16px;
  background: rgba(15,23,42,0.4); border-radius: 10px;
}
.guide-count-num { font-size: 1.4rem; font-weight: 700; color: #a5b4fc; font-family: 'Google Sans Display', 'Google Sans', sans-serif; }
.guide-count-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ─── Stat Cards ─────────────────────────────────────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(6,1fr); gap: 12px; margin-bottom: 28px; }
@media (max-width: 1100px) { .stat-cards { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 640px)  { .stat-cards { grid-template-columns: repeat(2,1fr); } }
.stat-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; cursor: pointer;
  transition: all 0.2s; text-align: center;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-hover); box-shadow: var(--shadow); }
.stat-icon { font-size: 22px; margin-bottom: 8px; }
.stat-num { font-size: 1.6rem; font-weight: 700; font-family: 'Google Sans Display', 'Google Sans', sans-serif; color: var(--text-primary); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* ─── Focus Task Card ────────────────────────────────────────────────────── */
.task-focus-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 16px 18px;
  transition: all 0.2s;
}
.task-focus-card:hover { box-shadow: var(--shadow); border-color: var(--border-hover); border-left-color: var(--accent); }
.task-focus-card.overdue { border-left-color: var(--danger); background: rgba(239,68,68,0.04); }
.focus-task-title { font-weight: 600; font-size: 0.95rem; margin: 6px 0 4px; }
.focus-task-context { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 10px; line-height: 1.5; }
.focus-task-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ─── Context Chain ──────────────────────────────────────────────────────── */
.context-chain { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.context-chain-item { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 3px; }
.context-chain-sep { color: var(--text-muted); font-size: 10px; opacity: 0.6; }
.context-chain-icon { font-size: 10px; }

/* ─── Alert / Warning cards ──────────────────────────────────────────────── */
.alert-card {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px;
}
.alert-title { font-weight: 600; color: #fca5a5; margin-bottom: 8px; font-size: 0.9rem; }
.alert-list { display: flex; flex-direction: column; gap: 6px; }
.alert-item { font-size: 0.82rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.alert-item .type-chip { flex-shrink: 0; }

/* ─── Deadline ───────────────────────────────────────────────────────────── */
.deadline { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.deadline.overdue { color: var(--danger); font-weight: 600; }
.deadline.soon { color: var(--warning); }

/* ─── Empty State ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 64px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-icon { font-size: 48px; opacity: 0.3; }
.empty-title { font-family: 'Google Sans Display', 'Google Sans', sans-serif; font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.empty-subtitle { font-size: 0.85rem; color: var(--text-muted); max-width: 320px; }

/* ─── Hierarchy Tree ─────────────────────────────────────────────────────── */
.tree { display: flex; flex-direction: column; gap: 10px; }
.tree-dream-card {
  border: 1px solid rgba(139,92,246,0.3);
  background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(99,102,241,0.05));
  border-radius: var(--radius); padding: 18px 20px;
}
.tree-dream-title {
  font-family: 'Google Sans Display', 'Google Sans', sans-serif; font-weight: 700; font-size: 1.05rem;
  color: #c4b5fd; display: flex; align-items: center; gap: 8px;
}
.tree-children { margin-left: 20px; padding-left: 16px; border-left: 2px dashed rgba(99,102,241,0.25); margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.tree-goal-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; cursor: pointer;
  transition: all 0.2s;
}
.tree-goal-card:hover { border-color: var(--border-hover); transform: translateX(3px); }
.tree-goal-title { font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.tree-subchildren { margin-left: 16px; padding-left: 14px; border-left: 2px dashed rgba(99,102,241,0.15); margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.tree-subgoal-card {
  background: rgba(15,23,42,0.5); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; padding: 10px 14px; cursor: pointer; transition: all 0.2s;
}
.tree-subgoal-card:hover { border-color: var(--border); }

/* ─── Links Section ──────────────────────────────────────────────────────── */
.links-section { display: flex; flex-direction: column; gap: 6px; }
.link-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  transition: background 0.15s;
}
.link-item:hover { background: rgba(255,255,255,0.04); }
.link-item-title { flex: 1; font-size: 0.875rem; color: var(--text-primary); }
.link-item-reason { font-size: 0.78rem; color: var(--text-muted); font-style: italic; flex-shrink: 0; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Task list (ordered) ────────────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-row {
  display: flex; align-items: flex-start; gap: 12px;
  background: rgba(15,23,42,0.4); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; transition: all 0.2s;
}
.task-row:hover { border-color: var(--border-hover); background: rgba(15,23,42,0.6); }
.task-row.done { opacity: 0.5; }
.task-order { font-size: 0.75rem; color: var(--text-muted); min-width: 20px; padding-top: 2px; font-weight: 600; }
.task-row-body { flex: 1; min-width: 0; }
.task-row-title { font-weight: 500; font-size: 0.9rem; color: var(--text-primary); }
.task-row-context { font-size: 0.8rem; color: var(--text-secondary); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-row-footer { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.task-row-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }

/* ─── Detail View ────────────────────────────────────────────────────────── */
.detail-header {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px;
}
.detail-back {
  padding: 6px 14px; border-radius: 8px; font-size: 0.82rem;
  background: rgba(255,255,255,0.05); color: var(--text-secondary);
  transition: all 0.18s; white-space: nowrap; flex-shrink: 0; margin-top: 4px;
}
.detail-back:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.detail-title { font-family: 'Google Sans Display', 'Google Sans', sans-serif; font-size: 1.5rem; font-weight: 700; flex: 1; }
.detail-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-field { margin-bottom: 16px; }
.detail-field-label {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 5px;
}
.detail-field-value { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.65; }
.detail-why {
  background: rgba(99,102,241,0.07); border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 0 8px 8px 0; margin-bottom: 16px;
}
.detail-why-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--accent); margin-bottom: 4px; font-weight: 600; }
.detail-why-text { font-size: 0.9rem; color: var(--text-secondary); font-style: italic; line-height: 1.6; }

/* ─── Collapsible Section ────────────────────────────────────────────────── */
.collapsible-section { margin-bottom: 20px; }
.collapsible-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: rgba(255,255,255,0.03);
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  transition: background 0.18s;
}
.collapsible-header:hover { background: rgba(255,255,255,0.05); }
.collapsible-title { font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.collapsible-count {
  background: rgba(99,102,241,0.15); color: #a5b4fc;
  font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 10px;
}
.collapsible-arrow { color: var(--text-muted); transition: transform 0.2s; font-size: 12px; }
.collapsible-header.open .collapsible-arrow { transform: rotate(180deg); }
.collapsible-body { padding: 14px 0 4px; display: none; }
.collapsible-body.open { display: block; }

/* ─── Upcoming deadline items ────────────────────────────────────────────── */
.upcoming-list { display: flex; flex-direction: column; gap: 8px; }
.upcoming-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: rgba(15,23,42,0.4);
  border: 1px solid var(--border); border-radius: 10px;
}
.upcoming-item-title { flex: 1; font-size: 0.875rem; font-weight: 500; }
.upcoming-days {
  font-size: 0.75rem; font-weight: 600; padding: 3px 10px;
  border-radius: 20px; white-space: nowrap;
}
.upcoming-days.today    { background: rgba(239,68,68,0.15); color: #fca5a5; }
.upcoming-days.tomorrow { background: rgba(245,158,11,0.15); color: #fcd34d; }
.upcoming-days.week     { background: rgba(16,185,129,0.12); color: #86efac; }

/* ─── Goal/Project type filter bar ──────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-btn {
  padding: 6px 16px; border-radius: 20px; font-size: 0.8rem; font-weight: 500;
  color: var(--text-muted); cursor: pointer; transition: all 0.18s;
  border: 1px solid transparent; background: none;
}
.filter-btn:hover { color: var(--text-secondary); border-color: var(--border); }
.filter-btn.active {
  background: rgba(99,102,241,0.15); color: #a5b4fc;
  border-color: rgba(99,102,241,0.35);
}

/* ─── Inline expand (task details) ──────────────────────────────────────── */
.inline-detail {
  background: rgba(15,23,42,0.6); border-top: 1px solid var(--border);
  padding: 12px 14px 6px; margin-top: 8px; border-radius: 0 0 10px 10px;
  font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6;
}
.inline-detail-field { margin-bottom: 8px; }
.inline-detail-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 3px; font-weight: 600; }

/* ─── Link Modal candidate list ──────────────────────────────────────────── */
.link-candidate-group { margin-bottom: 16px; }
.link-candidate-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 6px;
}
.link-candidate-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; transition: all 0.18s; margin-bottom: 4px;
}
.link-candidate-item:hover { background: rgba(99,102,241,0.08); border-color: var(--border); }
.link-candidate-item.selected { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.4); }
.link-candidate-title { flex: 1; font-size: 0.875rem; }

/* ─── Loading skeleton ───────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--card-bg) 25%, var(--card-bg-light) 50%, var(--card-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite; border-radius: 6px;
}
.skeleton-text  { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
.skeleton-card  { height: 120px; border-radius: var(--radius); margin-bottom: 12px; }

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeIn       { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInScale  { from { opacity: 0; transform: translate(-50%,-50%) scale(0.96); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOutRight{ from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(24px); } }
@keyframes shimmer      { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes pulse        { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

.animate-fade-in { animation: fadeIn 0.28s ease; }

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.text-primary   { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-accent    { color: #a5b4fc !important; }
.text-success   { color: var(--success) !important; }
.text-danger    { color: var(--danger) !important; }
.text-warning   { color: var(--warning) !important; }
.flex           { display: flex; }
.flex-between   { display: flex; align-items: center; justify-content: space-between; }
.flex-center    { display: flex; align-items: center; justify-content: center; }
.items-center   { align-items: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px;  } .mt-2 { margin-top: 8px;  } .mt-3 { margin-top: 14px; } .mt-4 { margin-top: 20px; }
.mb-1 { margin-bottom: 4px;  } .mb-2 { margin-bottom: 8px;  } .mb-3 { margin-bottom: 14px; } .mb-4 { margin-bottom: 20px; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.italic { font-style: italic; }
.font-mono { font-family: 'Courier New', monospace; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.5); }
  .hamburger { display: flex; }
  .main-content { margin-left: 0; }
  .top-bar { padding: 0 16px 0 56px; }
  .page-container { padding: 20px 16px; }
  .guide-banner { flex-direction: column; }
  .page-header { flex-direction: column; gap: 12px; }
  .form-row { flex-direction: column; }
  .modal { width: 100vw; max-height: 100vh; top: auto; bottom: 0; left: 0; transform: none; border-radius: 16px 16px 0 0; }
  .modal.open { animation: slideUpModal 0.25s ease; }
  .detail-header { flex-wrap: wrap; }
}
@keyframes slideUpModal { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ─── Sidebar overlay on mobile ──────────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 99;
  background: rgba(0,0,0,0.5);
}
.sidebar-overlay.open { display: block; }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE — everything below applies only at ≤768px
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Hide desktop chrome ──────────────────────────────────────────────── */
  .sidebar, .hamburger, .top-bar { display: none !important; }

  /* ── Full-width layout ────────────────────────────────────────────────── */
  .main-content { margin-left: 0; }
  .page-container {
    padding: 16px 14px 100px;
    max-width: 100%;
  }

  /* ── Mobile top header (inside page container) ────────────────────────── */
  .page-header {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
    padding-top: 8px;
  }
  .page-title { font-size: 1.4rem; }
  .page-subtitle { font-size: 0.8rem; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn-primary { width: 100%; justify-content: center; display: flex; }

  /* ── Cards ────────────────────────────────────────────────────────────── */
  .grid-3, .grid-2 { grid-template-columns: 1fr !important; gap: 12px; }
  .card { padding: 16px; border-radius: 12px; }
  .card:hover { transform: none; }

  /* ── Filter bar — horizontal scroll ──────────────────────────────────── */
  .filter-bar, .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-bar::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
  .filter-btn, .tab { white-space: nowrap; flex-shrink: 0; }

  /* ── Touch targets ────────────────────────────────────────────────────── */
  .btn-icon { width: 40px; height: 40px; font-size: 16px; }
  .btn-primary, .btn-secondary, .btn-danger, .btn-ghost { padding: 11px 18px; }
  .btn-sm { padding: 8px 14px; }
  .nav-item, .mobile-nav-item { min-height: 44px; }

  /* ── Stat cards ───────────────────────────────────────────────────────── */
  .stat-cards { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .stat-card { padding: 12px 8px; }
  .stat-num { font-size: 1.3rem; }
  .stat-label { font-size: 0.65rem; }

  /* ── Guide banner ─────────────────────────────────────────────────────── */
  .guide-banner { flex-direction: column; gap: 14px; padding: 18px 16px; }
  .guide-counts { justify-content: space-between; gap: 8px; }
  .guide-count-item { flex: 1; padding: 8px 6px; }

  /* ── Focus task cards ─────────────────────────────────────────────────── */
  .task-focus-card { padding: 14px; }

  /* ── Task rows ────────────────────────────────────────────────────────── */
  .task-row { padding: 12px; }
  .task-row-actions { flex-direction: column; gap: 4px; }

  /* ── Detail view ──────────────────────────────────────────────────────── */
  .detail-header { flex-wrap: wrap; gap: 10px; }
  .detail-title { font-size: 1.25rem; }
  .detail-back { font-size: 0.8rem; padding: 6px 12px; }

  /* ── Forms ────────────────────────────────────────────────────────────── */
  .form-row { flex-direction: column; gap: 0; }
  .form-input, .form-textarea, .form-select {
    font-size: 16px; /* prevents iOS auto-zoom */
    padding: 12px 14px;
  }

  /* ── Modal → bottom sheet ─────────────────────────────────────────────── */
  .modal {
    top: auto !important; bottom: 0 !important;
    left: 0 !important; right: 0 !important;
    transform: none !important;
    width: 100% !important; max-height: 92vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }
  .modal.open { animation: slideUpSheet 0.3s cubic-bezier(0.32,0.72,0,1); }
  .modal-header { padding: 12px 20px 10px; }
  .modal-header::before {
    content: '';
    display: block; width: 40px; height: 4px;
    background: rgba(255,255,255,0.15); border-radius: 2px;
    margin: 0 auto 12px;
  }
  .modal-body { padding: 4px 20px 32px; }

  /* ── Tree view ────────────────────────────────────────────────────────── */
  .tree-children { margin-left: 12px; padding-left: 10px; }
  .tree-subchildren { margin-left: 8px; padding-left: 8px; }

  /* ── Alert ────────────────────────────────────────────────────────────── */
  .alert-card { padding: 12px 14px; }

  /* ── Links section ────────────────────────────────────────────────────── */
  .link-item-reason { display: none; }

  /* ── Collapsible ──────────────────────────────────────────────────────── */
  .collapsible-header { padding: 12px 14px; }
}

/* ── Bottom Navigation Bar ────────────────────────────────────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  align-items: center; justify-content: space-around;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
@media (max-width: 768px) {
  .mobile-bottom-nav { display: flex; }
}

.mobile-nav-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; flex: 1;
  color: var(--text-muted);
  font-size: 0; /* hide label by default, show on active */
  cursor: pointer; background: none; border: none;
  padding: 6px 4px; border-radius: 10px;
  transition: color 0.18s;
  text-decoration: none;
  min-height: 52px;
}
.mobile-nav-item .mobile-nav-icon { font-size: 20px; line-height: 1; }
.mobile-nav-item .mobile-nav-label { font-size: 10px; font-weight: 500; margin-top: 1px; }
.mobile-nav-item:hover { color: var(--text-secondary); }
.mobile-nav-item.active {
  color: #a5b4fc;
}
.mobile-nav-item.active .mobile-nav-icon {
  filter: drop-shadow(0 0 6px rgba(99,102,241,0.6));
}

/* ── Mobile FAB (centre +) ────────────────────────────────────────────────── */
.mobile-fab {
  display: none;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-grad);
  color: #fff; font-size: 26px; line-height: 1;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 18px rgba(99,102,241,0.45);
  border: none; cursor: pointer; flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-bottom: 4px;
}
.mobile-fab:active { transform: scale(0.93); }
@media (max-width: 768px) {
  .mobile-fab { display: flex; }
}

/* ── More bottom sheet ────────────────────────────────────────────────────── */
.mobile-sheet-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 300;
  backdrop-filter: blur(3px);
}
.mobile-sheet-backdrop.open { display: block; }

.mobile-more-sheet {
  display: none; position: fixed;
  bottom: 0; left: 0; right: 0; z-index: 301;
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  padding: 0 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
}
.mobile-more-sheet.open {
  display: block;
  transform: translateY(0);
  animation: slideUpSheet 0.3s cubic-bezier(0.32,0.72,0,1) forwards;
}
.mobile-sheet-handle {
  width: 40px; height: 4px;
  background: rgba(255,255,255,0.15); border-radius: 2px;
  margin: 12px auto 20px;
}
.mobile-more-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; padding-bottom: 8px;
}
.mobile-more-item {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; border-radius: 14px;
  background: rgba(99,102,241,0.07);
  border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 0.9rem; font-weight: 500;
  transition: all 0.18s; text-decoration: none; cursor: pointer;
}
.mobile-more-item:hover, .mobile-more-item:active {
  background: rgba(99,102,241,0.15);
  color: #a5b4fc; border-color: rgba(99,102,241,0.35);
}
.mobile-more-icon { font-size: 20px; }

@keyframes slideUpSheet {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ─── Interests type chip ────────────────────────────────────────────────── */
.type-chip-interest { background: rgba(244,114,182,0.15); color: #f9a8d4; }
.badge-exploring    { background: rgba(56,189,248,0.15);  color: #7dd3fc; }
.badge-deep-diving  { background: rgba(99,102,241,0.2);   color: #a5b4fc; font-weight: 700; }
.badge-on-hold      { background: rgba(100,116,139,0.2);  color: #94a3b8; }
.badge-archived     { background: rgba(71,85,105,0.2);    color: #64748b; }
