/* ============================================
   PSIS Dashboard — Modern Indigo Design System
   Clean white, cool tones, professional
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Backgrounds — чистый белый/серый */
  --bg-base: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fb;
  --bg-elevated: #ffffff;
  --bg-input: #f0f2f5;

  /* Borders — нейтральные серые */
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
  --border-accent: rgba(99, 102, 241, 0.3);

  /* Text — холодные тона */
  --text-primary: #1e1e2e;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-accent: #6366f1;

  /* Accent — индиго */
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.08);
  --accent-glow: rgba(99, 102, 241, 0.04);

  /* Semantic */
  --success: #40c464;
  --success-soft: rgba(64, 196, 100, 0.1);
  --warning: #e0a030;
  --warning-soft: rgba(224, 160, 48, 0.1);
  --danger: #e05252;
  --danger-soft: rgba(224, 82, 82, 0.08);

  /* Emotional States */
  --state-red: #e05252;
  --state-orange: #e08a52;
  --state-yellow: #d4b240;
  --state-green: #40c464;
  --state-turquoise: #40c4b0;
  --state-blue: #4a7ae0;
  --state-purple: #8a52e0;

  /* Typography */
  --font-display: 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows — чуть заметнее для "парящего" эффекта */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 200ms;

  /* Ambient */
  --ambient-color: var(--accent);
  --ambient-glow: rgba(99, 102, 241, 0.03);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-base);
  line-height: 1.6;
  min-height: 100vh;
}

/* Subtle texture */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 10%, var(--ambient-glow) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(74, 111, 165, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: 2rem; line-height: 1.2; }
h2 { font-size: 1.5rem; line-height: 1.3; }
h3 { font-size: 1.2rem; line-height: 1.4; }
h4 { font-size: 1.05rem; line-height: 1.4; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}
a:hover { color: var(--accent-hover); }

/* --- Layout --- */
.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding-bottom: var(--space-2xl);
}

.page-header {
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  max-width: 1400px;
  margin: 0 auto;
}

.page-header h1 {
  font-size: 2.2rem;
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
}

.page-header h1 .date-subtitle {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.page-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

/* --- Navigation --- */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(240, 242, 245, 0.9);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  height: 56px;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: var(--space-xs);
}

.nav-link {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.03);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-logout {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
}

.nav-logout:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration) var(--ease);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-accent {
  border-color: var(--border-accent);
}

/* --- Section wrapper --- */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration) var(--ease);
}

.section-card:hover {
  box-shadow: var(--shadow-md);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.01);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-primary);
}

.section-body {
  padding: var(--space-lg);
}

/* --- Buttons --- */
.btn {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: rgba(0, 0, 0, 0.02);
}

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

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(196, 80, 64, 0.25);
}

.btn-danger:hover {
  background: var(--danger-soft);
}

/* --- Habit rows --- */
.habit-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  user-select: none;
}

.habit-row:hover {
  background: rgba(0, 0, 0, 0.02);
}

.habit-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: transparent;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}

.habit-check.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.habit-name {
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: all var(--duration) var(--ease);
}

.habit-name.done {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* --- Chips --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-base);
  transition: all var(--duration) var(--ease);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.chip.active {
  border-color: var(--border-accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* --- State Badge --- */
.state-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid;
}

.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: statePulse 3s ease-in-out infinite;
}

@keyframes statePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.3); }
}

/* --- Task Card --- */
.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.task-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.task-card-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  line-height: 1.4;
}

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.task-card .urgency-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.task-card .project-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.task-card .due-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.task-card .due-date.overdue {
  color: var(--danger);
}

.task-card-compact {
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.task-card-compact .task-card-title {
  font-size: 0.8rem;
  margin-bottom: 0;
  flex: 1;
}

/* --- Kanban --- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  align-items: start;
}

.kanban-column {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 200px;
}

.kanban-column-header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-column-title {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.kanban-column-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 8px;
  border-radius: 10px;
}

.kanban-column-body {
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-height: 120px;
}

.sortable-ghost { opacity: 0.3; }
.sortable-chosen { box-shadow: var(--shadow-lg); border-color: var(--accent) !important; transform: rotate(1deg); }
.sortable-drag { transform: rotate(2deg) scale(1.02); }

/* --- Forms --- */
input, textarea, select {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  outline: none;
  transition: all var(--duration) var(--ease);
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #fff;
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group { margin-bottom: var(--space-md); }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 30, 46, 0.3);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  opacity: 0;
  visibility: hidden;
  transition: all 300ms var(--ease);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform 300ms var(--ease);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--duration) var(--ease);
  border: none;
  background: none;
  font-size: 1.2rem;
}

.modal-close:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.04);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

/* --- Calendar Mini --- */
.calendar-mini { width: 100%; }

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.calendar-nav-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
  font-size: 0.8rem;
}

.calendar-nav-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.calendar-month-label {
  font-family: var(--font-display);
  font-size: 1rem;
}

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

.calendar-dow {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  position: relative;
}

.calendar-day:hover { background: rgba(0, 0, 0, 0.03); color: var(--text-primary); }
.calendar-day.today { color: var(--accent); font-weight: 600; }
.calendar-day.selected { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border-accent); }
.calendar-day.has-note::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}
.calendar-day.other-month { color: var(--text-muted); opacity: 0.4; }

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}

.tab {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--duration) var(--ease);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* --- Markdown Body --- */
.markdown-body {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  font-family: var(--font-display);
  margin: 1.2em 0 0.5em;
}

.markdown-body h1 { font-size: 1.4rem; }
.markdown-body h2 { font-size: 1.2rem; }
.markdown-body h3 { font-size: 1.05rem; }
.markdown-body p { margin: 0.6em 0; }
.markdown-body ul, .markdown-body ol { padding-left: 1.5em; margin: 0.5em 0; }
.markdown-body li { margin: 0.3em 0; }

.markdown-body code {
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.82em;
}

.markdown-body pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  overflow-x: auto;
  margin: 0.8em 0;
}

.markdown-body pre code { background: none; padding: 0; }

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-md);
  color: var(--text-secondary);
  margin: 0.8em 0;
  font-style: italic;
}

.markdown-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }
.markdown-body strong { font-weight: 600; }

/* --- Digest --- */
.digest-content {
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-primary);
  opacity: 0.85;
}

.digest-content p { margin: 0.8em 0; }

/* --- Activity Timeline --- */
.timeline-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  position: relative;
}

.timeline-time {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  width: 45px;
  flex-shrink: 0;
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}

.timeline-content {
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex: 1;
  border-left: 1px solid var(--border);
  padding-left: var(--space-md);
}

.timeline-content::before {
  content: '';
  position: absolute;
  left: 55px;
  top: 12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-left: -3px;
}

/* --- Empty & Spinner --- */
.empty-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.spinner-container {
  display: flex;
  justify-content: center;
  padding: var(--space-xl);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.18); }

/* --- Animations --- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fadeInUp 0.4s var(--ease) both; }
.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
.stagger-5 { animation-delay: 250ms; }
.stagger-6 { animation-delay: 300ms; }

/* --- Notes layout --- */
.notes-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-lg);
  min-height: calc(100vh - 140px);
}

.notes-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  overflow-y: auto;
  max-height: calc(100vh - 140px);
  position: sticky;
  top: 72px;
  box-shadow: var(--shadow-sm);
}

.notes-main { min-width: 0; }

.sidebar-item {
  display: block;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item:hover { background: rgba(0, 0, 0, 0.03); color: var(--text-primary); }
.sidebar-item.active { background: var(--accent-soft); color: var(--accent); }

/* --- Analytics --- */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.chart-card canvas { max-height: 250px; }

.period-selector {
  display: flex;
  gap: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.period-btn {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
}

.period-btn:hover { color: var(--text-primary); }
.period-btn.active { background: var(--accent); color: #fff; }

/* --- State Timeline --- */
.state-timeline {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.state-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 44px;
}

.state-day-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  opacity: 0.85;
  transition: all var(--duration) var(--ease);
  cursor: default;
}

.state-day-dot:hover {
  opacity: 1;
  transform: scale(1.15);
}

.state-day-dot.empty {
  background: var(--border) !important;
  opacity: 0.3;
}

.state-day-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.state-day-dow {
  font-size: 0.6rem;
  color: var(--text-muted);
  opacity: 0.7;
  line-height: 1;
}

.state-day-name {
  font-size: 0.6rem;
  color: var(--text-secondary);
  max-width: 54px;
  text-align: center;
  line-height: 1.2;
}

.state-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: center;
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

.state-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.state-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* --- Neurobalance Tracker --- */
.neuro-tracker {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.neuro-table {
  width: 100%;
  border-collapse: collapse;
}

.neuro-table th,
.neuro-table td {
  padding: 3px 1px;
  text-align: center;
}

.neuro-dow {
  font-size: 0.55rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.neuro-label {
  text-align: left !important;
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  padding-right: var(--space-md) !important;
}

.neuro-label-inner {
  display: flex;
  align-items: center;
  gap: 6px;
}

.neuro-label-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.neuro-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  margin: 0 auto;
  transition: all var(--duration) var(--ease);
}

.neuro-dot.filled {
  border-color: transparent;
}

.neuro-week-label {
  font-size: 0.55rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Pomodoro Timer --- */
.pomo-display {
  font-size: 2.8rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
  padding: var(--space-sm) 0;
}

.pomo-type-label {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.pomo-progress {
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  margin: 0 0 var(--space-md);
  overflow: hidden;
}

.pomo-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s linear;
  width: 0%;
}

.pomo-controls {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.pomo-settings {
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
}

.pomo-durations {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.pomo-durations .chip {
  font-size: 0.65rem;
  padding: 2px 8px;
}

/* --- Collapsible sections --- */
.collapse-arrow {
  display: inline-block;
  font-size: 0.65em;
  color: var(--text-muted);
  transition: transform var(--duration) var(--ease);
  margin-right: 4px;
}

.section-header.collapsible {
  cursor: pointer;
  user-select: none;
}

.section-header.collapsible:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .kanban-board { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .notes-layout { grid-template-columns: 1fr; }
  .notes-sidebar { position: static; max-height: none; }
}

@media (max-width: 768px) {
  .page-header { padding: var(--space-lg) var(--space-md) var(--space-md); }
  .page-content { padding: 0 var(--space-md); }
  .nav-inner { padding: 0 var(--space-md); }
  .page-header h1 { font-size: 1.6rem; flex-direction: column; gap: var(--space-xs); }
  .kanban-board { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .nav-link { font-size: 0.7rem; padding: 6px 10px; }
  .card { padding: var(--space-md); }
  /* Neuro tracker: show only current week */
  .neuro-week-0, .neuro-week-1, .neuro-week-2 { display: none; }
  .neuro-tracker { padding: var(--space-sm) var(--space-md); }
}

/* --- Utility --- */
.text-accent { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Task Checklist Progress --- */
.task-progress {
  margin-top: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.task-progress-track {
  flex: 1;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
}
.task-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width 0.3s var(--ease);
}
.task-progress-text {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- Today View --- */
.today-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  min-height: calc(100vh - 200px);
}

.today-column {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.today-column-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.today-column-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.today-column-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(0,0,0,0.04);
  padding: 2px 8px;
  border-radius: 10px;
}

.today-column-body {
  padding: var(--space-sm);
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 300px);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-height: 150px;
}

.time-budget {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.time-budget-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.time-budget-track {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.time-budget-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s var(--ease);
}

.time-budget-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.inbox-highlight {
  background: var(--warning-soft);
  border: 1px dashed rgba(224,160,48,0.3);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
}

.inbox-highlight-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--warning);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-xs);
}

.gcal-event {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--accent-soft);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--accent);
}

.gcal-event-time {
  font-weight: 600;
  font-size: 0.75rem;
}

@media (max-width: 768px) {
  .today-layout { grid-template-columns: 1fr; }
  .today-column-body { max-height: none; }
}

/* --- Eisenhower Matrix --- */
.eisenhower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.eisenhower-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 200px;
  box-shadow: var(--shadow-sm);
}

.eisenhower-label {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
}

.eisenhower-label small {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.ei-do .eisenhower-label { color: var(--danger); }
.ei-schedule .eisenhower-label { color: var(--accent); }
.ei-delegate .eisenhower-label { color: var(--warning); }
.ei-eliminate .eisenhower-label { color: var(--text-muted); }

.eisenhower-body {
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

@media (max-width: 768px) {
  .eisenhower-grid { grid-template-columns: 1fr; }
}

/* --- Week View --- */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.week-nav-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
  font-size: 0.85rem;
}

.week-nav-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.week-nav-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 200px;
  text-align: center;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-sm);
  min-height: calc(100vh - 280px);
}

.week-day {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.week-day.is-today {
  border-color: var(--border-accent);
}

.week-day-header {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.week-day-dow {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.week-day-date {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.week-day.is-today .week-day-date {
  color: var(--accent);
}

.week-day-body {
  padding: var(--space-xs);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-height: 80px;
}

.week-task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: grab;
  transition: all var(--duration) var(--ease);
  font-size: 0.75rem;
  line-height: 1.3;
}

.week-task-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.week-task-title {
  font-weight: 500;
  color: var(--text-primary);
}

.week-task-meta {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 2px;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.week-stats {
  display: flex;
  gap: var(--space-xl);
  justify-content: center;
  padding: var(--space-lg);
  margin-top: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.week-stat {
  text-align: center;
}

.week-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.week-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (max-width: 1024px) {
  .week-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
  .week-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Subscriptions --- */
.subs-totals {
  display: flex;
  gap: var(--space-xl);
  justify-content: center;
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.subs-total-item {
  text-align: center;
}

.subs-total-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.subs-total-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.subs-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-sm) 0;
  margin-top: var(--space-md);
}

.sub-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sub-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.sub-card.sub-upcoming {
  border-color: rgba(224,82,82,0.3);
  background: var(--danger-soft);
}

.sub-card.sub-cancelled {
  opacity: 0.5;
}

.sub-info {
  flex: 1;
}

.sub-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.sub-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sub-price {
  text-align: right;
}

.sub-amount {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.sub-cycle {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sub-next {
  font-size: 0.7rem;
  margin-top: 2px;
}
