@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Source+Sans+3:wght@300;400;500;600&display=swap');

/* ═══════════════════════════════════════════════
   WARM NOIR — Design System (Desktop)
   ═══════════════════════════════════════════════ */

:root {
  /* Base */
  --bg-primary: #0D0D0D;
  --bg-secondary: #141414;
  --bg-card: #1A1A1A;
  --bg-elevated: #222222;
  --bg-input: #1E1E1E;
  --bg-sidebar: #111111;

  /* Warm Amber Palette */
  --amber-primary: #D4956A;
  --amber-light: #E8A87C;
  --amber-dark: #B87A52;
  --copper: #C4764E;
  --copper-muted: #8B5E3C;

  /* Accents */
  --green-active: #6ABF6A;
  --green-muted: #3D6B3D;
  --red-danger: #D46A6A;
  --blue-info: #6A9FD4;

  /* Text */
  --text-primary: #F0E6DC;
  --text-secondary: #9E8E7E;
  --text-muted: #6B5F53;
  --text-inverse: #0D0D0D;

  /* Borders */
  --border-subtle: #2A2520;
  --border-default: #3A332C;

  /* Effects */
  --glow-amber: 0 0 20px rgba(212, 149, 106, 0.15);
  --glow-green: 0 0 12px rgba(106, 191, 106, 0.2);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.5);

  /* Typography */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Source Sans 3', sans-serif;

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Layout */
  --sidebar-width: 240px;
  --content-max: 1200px;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-base: 250ms var(--ease-out);
  --transition-slow: 400ms var(--ease-out);

  /* Grain opacity */
  --grain-opacity: 0.03;
}

/* ═══════════════════════════════════════════════
   LIGHT THEME — Warm Linen
   ═══════════════════════════════════════════════ */

[data-theme="light"] {
  --bg-primary: #FAF6F1;
  --bg-secondary: #F2ECE4;
  --bg-card: #FFFFFF;
  --bg-elevated: #F7F3ED;
  --bg-input: #FFFFFF;
  --bg-sidebar: #F5F0E9;

  --amber-primary: #C07D4F;
  --amber-light: #D4956A;
  --amber-dark: #A0683F;
  --copper: #B06840;
  --copper-muted: #7A5333;

  --green-active: #4A9E4A;
  --green-muted: #C4E5C4;
  --red-danger: #C45555;
  --blue-info: #4A7FC4;

  --text-primary: #2C241E;
  --text-secondary: #7A6E62;
  --text-muted: #A89B8E;
  --text-inverse: #FFFFFF;

  --border-subtle: #E8E0D6;
  --border-default: #D9CFC3;

  --glow-amber: 0 0 20px rgba(192, 125, 79, 0.1);
  --glow-green: 0 0 12px rgba(74, 158, 74, 0.15);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.08);

  --grain-opacity: 0.015;
}

/* ═══════════════════════════════════════════════
   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);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth theme transitions on key elements */
.sidebar, .card, .stat-card, .group-card, .member-card,
.ranking-item, .subject-item, .task-section, .group-banner,
.top-bar, .modal, input, select, textarea, .btn {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Grain texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

a { color: var(--amber-primary); text-decoration: none; }
a:hover { color: var(--amber-light); }

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
}

/* ═══════════════════════════════════════════════
   APP SHELL — Sidebar + Main Content
   ═══════════════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* No-sidebar layout (landing, auth pages) */
.app-container {
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* ═══════════════════════════════════════════════
   SIDEBAR NAVIGATION
   ═══════════════════════════════════════════════ */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar__brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.sidebar__logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: radial-gradient(circle at 40% 40%, var(--amber-primary), var(--copper));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar__logo-icon svg {
  width: 20px;
  height: 20px;
  color: var(--text-inverse);
}

.sidebar__logo-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.sidebar__nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.sidebar__item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar__item:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.sidebar__item.active {
  color: var(--amber-primary);
  background: rgba(212, 149, 106, 0.08);
}

.sidebar__divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 12px 0;
}

.sidebar__footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.sidebar__user:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.sidebar__user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar__user-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
}

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

/* ═══════════════════════════════════════════════
   MAIN CONTENT AREA
   ═══════════════════════════════════════════════ */

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.main-content__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px 32px 40px;
}

/* Top Bar (inside main content) */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.top-bar__total {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
}

.top-bar__streak {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--amber-primary);
}

.top-bar__streak .flame {
  font-size: 1.1rem;
}

.top-bar__date {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.top-bar__right {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* ═══════════════════════════════════════════════
   TAB BAR
   ═══════════════════════════════════════════════ */

.tab-bar {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow-x: auto;
  width: fit-content;
}

.tab-bar__item {
  padding: 8px 20px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: none;
  background: none;
}

.tab-bar__item.active {
  background: var(--amber-primary);
  color: var(--text-inverse);
}

.tab-bar__item:hover:not(.active) {
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

.card--elevated {
  background: var(--bg-elevated);
  box-shadow: var(--shadow-elevated);
}

.card__title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.card__subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════
   TIMER DISPLAY
   ═══════════════════════════════════════════════ */

.timer-display {
  text-align: center;
  padding: 32px 20px;
}

.timer-display__time {
  font-family: var(--font-display);
  font-size: 4.5rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-primary);
  transition: color var(--transition-base);
}

.timer-display__time.active {
  color: var(--amber-primary);
  text-shadow: var(--glow-amber);
}

.timer-display__label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Focus mode timer ring */
.timer-ring {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 24px auto;
}

.timer-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring__bg {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 6;
}

.timer-ring__progress {
  fill: none;
  stroke: var(--amber-primary);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.timer-ring__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-ring__time {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 700;
}

.timer-ring__subject {
  font-size: 0.9rem;
  color: var(--amber-primary);
  margin-top: 6px;
}

/* Timer controls */
.timer-controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 24px;
}

.timer-controls__btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  background: var(--bg-card);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.timer-controls__btn:hover {
  border-color: var(--amber-primary);
  background: var(--bg-elevated);
}

.timer-controls__btn--primary {
  width: 72px;
  height: 72px;
  background: var(--amber-primary);
  border-color: var(--amber-primary);
  color: var(--text-inverse);
}

.timer-controls__btn--primary:hover {
  background: var(--amber-light);
  border-color: var(--amber-light);
}

.timer-controls__btn--danger {
  border-color: var(--red-danger);
  color: var(--red-danger);
}

/* ═══════════════════════════════════════════════
   DASHBOARD GRID LAYOUT
   ═══════════════════════════════════════════════ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

.dashboard-grid__main {
  min-width: 0;
}

.dashboard-grid__side {
  position: sticky;
  top: 100px;
}

/* ═══════════════════════════════════════════════
   SUBJECT LIST
   ═══════════════════════════════════════════════ */

.subject-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.subject-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  animation: slideUp var(--transition-slow) both;
}

.subject-item:nth-child(1) { animation-delay: 0ms; }
.subject-item:nth-child(2) { animation-delay: 50ms; }
.subject-item:nth-child(3) { animation-delay: 100ms; }
.subject-item:nth-child(4) { animation-delay: 150ms; }
.subject-item:nth-child(5) { animation-delay: 200ms; }

.subject-item:hover {
  border-color: var(--border-default);
  transform: translateY(-1px);
}

.subject-item__color {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}

.subject-item__info {
  flex: 1;
}

.subject-item__name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
}

.subject-item__time {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.subject-item__play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-inverse);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.subject-item__play:hover {
  transform: scale(1.1);
  filter: brightness(1.15);
}

.subject-item__play svg {
  width: 16px;
  height: 16px;
}

/* ═══════════════════════════════════════════════
   GROUPS
   ═══════════════════════════════════════════════ */

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-fast);
  animation: slideUp var(--transition-slow) both;
}

.group-card:hover {
  border-color: var(--amber-dark);
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}

.group-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.group-card__name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}

.group-card__category {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--amber-primary);
  border: 1px solid var(--border-default);
}

.group-card__meta {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.group-card__meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.group-card__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 10px;
  line-height: 1.4;
}

.group-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* Group detail layout */
.group-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.group-detail-layout--full {
  grid-template-columns: 1fr;
}

.group-banner {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  text-align: center;
}

.group-banner__name {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.group-banner__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.studying-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(106, 191, 106, 0.1);
  border: 1px solid var(--green-muted);
  border-radius: var(--radius-full);
  color: var(--green-active);
  font-size: 0.85rem;
  margin-top: 14px;
}

.studying-badge .dot {
  width: 8px;
  height: 8px;
  background: var(--green-active);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.member-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: all var(--transition-fast);
}

.member-card.studying {
  border-color: var(--amber-dark);
  box-shadow: var(--glow-amber);
}

.member-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  font-size: 1.5rem;
}

.member-card__name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
}

.member-card__time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Rankings */
.ranking-list {
  max-width: 600px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.ranking-item__rank {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  width: 28px;
  text-align: center;
  color: var(--text-muted);
}

.ranking-item:nth-child(1) .ranking-item__rank { color: var(--amber-primary); }
.ranking-item:nth-child(2) .ranking-item__rank { color: var(--amber-light); }
.ranking-item:nth-child(3) .ranking-item__rank { color: var(--copper-muted); }

.ranking-item__avatar {
  font-size: 1.4rem;
}

.ranking-item__name {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 500;
}

.ranking-item__time {
  font-size: 0.85rem;
  color: var(--amber-primary);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════
   AMBIENT SOUNDS
   ═══════════════════════════════════════════════ */

.ambient-panel {
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

.ambient-toggle {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s;
}

.ambient-toggle:hover {
  border-color: var(--amber-primary);
}

.ambient-toggle__indicator {
  color: var(--amber-primary);
  font-weight: 600;
}

.ambient-list {
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}

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

.ambient-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 7px 16px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.ambient-chip.active {
  background: var(--amber-primary);
  border-color: var(--amber-primary);
  color: var(--text-inverse);
}

.ambient-volume {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.ambient-volume input[type="range"] {
  flex: 1;
  accent-color: var(--amber-primary);
  height: 4px;
}

/* ═══════════════════════════════════════════════
   CHAT
   ═══════════════════════════════════════════════ */

.chat-container {
  display: flex;
  flex-direction: column;
  height: 520px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 0.9rem;
}

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 80%;
  align-self: flex-start;
}

.chat-msg--own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg__avatar {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-msg__body {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 8px 12px;
  min-width: 0;
}

.chat-msg--own .chat-msg__body {
  background: rgba(212, 149, 106, 0.15);
}

.chat-msg__header {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 2px;
}

.chat-msg__name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--amber-primary);
}

.chat-msg--own .chat-msg__name {
  color: var(--amber-light);
}

.chat-msg__time {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.chat-msg__text {
  font-size: 0.88rem;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.4;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 8px 16px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--amber-primary);
}

.chat-send {
  padding: 8px 20px;
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════
   INSIGHTS
   ═══════════════════════════════════════════════ */

.insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.insights-grid__full {
  grid-column: 1 / -1;
}

.period-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}

.period-filters__btn {
  padding: 7px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.period-filters__btn.active {
  background: var(--amber-primary);
  border-color: var(--amber-primary);
  color: var(--text-inverse);
}

/* Heatmap */
.heatmap {
  margin-bottom: 20px;
}

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

.heatmap__cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--bg-elevated);
  transition: background var(--transition-fast);
}

.heatmap__cell[data-level="1"] { background: #3D2E1E; }
.heatmap__cell[data-level="2"] { background: #6B4E2E; }
.heatmap__cell[data-level="3"] { background: #9B6E3E; }
.heatmap__cell[data-level="4"] { background: var(--amber-primary); }
.heatmap__cell[data-level="5"] { background: var(--copper); box-shadow: 0 0 8px rgba(196, 118, 78, 0.3); }

[data-theme="light"] .heatmap__cell[data-level="1"] { background: #EDE0D2; }
[data-theme="light"] .heatmap__cell[data-level="2"] { background: #DBBFA3; }
[data-theme="light"] .heatmap__cell[data-level="3"] { background: #CCA07A; }
[data-theme="light"] .heatmap__cell[data-level="4"] { background: var(--amber-primary); }
[data-theme="light"] .heatmap__cell[data-level="5"] { background: var(--copper); box-shadow: 0 0 8px rgba(176, 104, 64, 0.2); }

.heatmap__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stats-grid--half {
  grid-template-columns: 1fr 1fr;
}

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

.stat-card__label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 4px;
  color: var(--amber-primary);
}

/* Hourly grid */
.hourly-grid {
  display: grid;
  grid-template-columns: auto repeat(24, 1fr);
  gap: 2px;
  margin-bottom: 20px;
}

.hourly-grid__label {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding-right: 6px;
}

.hourly-grid__cell {
  height: 24px;
  border-radius: 3px;
  background: var(--bg-elevated);
}

/* Chart container */
.chart-container {
  margin-bottom: 20px;
}

.chart-container canvas {
  width: 100% !important;
  height: 240px !important;
}

/* ═══════════════════════════════════════════════
   PLANNER
   ═══════════════════════════════════════════════ */

.planner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.task-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.task-section__title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.task-item:last-of-type {
  border-bottom: none;
}

.task-item:hover {
  background: transparent;
}

.task-item__check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: transparent;
}

.task-item__check:hover {
  border-color: var(--amber-primary);
}

.task-item.completed .task-item__check {
  background: var(--green-active);
  border-color: var(--green-active);
  color: #fff;
}

.task-item.completed .task-item__title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-item__title {
  flex: 1;
  font-size: 0.95rem;
}

.task-item__delete {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-fast);
}

.task-item:hover .task-item__delete {
  opacity: 1;
}

.task-item__delete:hover {
  color: var(--red-danger);
  background: rgba(212, 106, 106, 0.1);
}

/* Add task */
.add-task {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.add-task input {
  flex: 1;
}

/* ═══════════════════════════════════════════════
   FORMS & INPUTS
   ═══════════════════════════════════════════════ */

input, select, textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--amber-primary);
  box-shadow: 0 0 0 3px rgba(212, 149, 106, 0.1);
}

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

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */

.btn {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.btn--primary {
  background: var(--amber-primary);
  color: var(--text-inverse);
}

.btn--primary:hover {
  background: var(--amber-light);
  color: var(--text-inverse);
}

.btn--secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn--secondary:hover {
  border-color: var(--amber-primary);
}

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

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

.btn--danger {
  background: rgba(212, 106, 106, 0.1);
  color: var(--red-danger);
  border: 1px solid rgba(212, 106, 106, 0.2);
}

.btn--small {
  font-size: 0.8rem;
  padding: 6px 14px;
}

.btn--full {
  width: 100%;
}

.btn--round {
  border-radius: var(--radius-full);
}

/* ═══════════════════════════════════════════════
   LANDING PAGE
   ═══════════════════════════════════════════════ */

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

.landing__emblem {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, var(--amber-primary), var(--copper));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 36px;
  box-shadow: 0 0 80px rgba(212, 149, 106, 0.2);
  animation: breathe 4s ease-in-out infinite;
}

.landing__emblem svg {
  width: 90px;
  height: 90px;
  color: var(--text-inverse);
}

.landing__title {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 800;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--text-primary), var(--amber-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing__subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 44px;
}

.landing__actions {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 400px;
}

.landing__actions .btn {
  flex: 1;
  padding: 14px 24px;
}

/* ═══════════════════════════════════════════════
   AUTH PAGES
   ═══════════════════════════════════════════════ */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-page__title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 28px;
}

.auth-form {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form__error {
  background: rgba(212, 106, 106, 0.1);
  border: 1px solid rgba(212, 106, 106, 0.3);
  color: var(--red-danger);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.auth-form__link {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════
   PROFILE
   ═══════════════════════════════════════════════ */

.profile-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 32px;
  align-items: start;
}

.profile-header {
  text-align: center;
  padding: 28px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  position: sticky;
  top: 100px;
}

.profile-header__avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 2.8rem;
  border: 2px solid var(--border-default);
}

.profile-header__name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
}

.profile-header__level {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.avatar-grid__item {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.avatar-grid__item:hover,
.avatar-grid__item.selected {
  border-color: var(--amber-primary);
  box-shadow: var(--glow-amber);
}

/* ═══════════════════════════════════════════════
   SETTINGS
   ═══════════════════════════════════════════════ */

.settings-layout {
  max-width: 600px;
}

.settings-group {
  margin-bottom: 28px;
}

.settings-group__title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-item__label {
  font-size: 0.95rem;
}

.settings-item__desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input { display: none; }

.toggle__slider {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border-radius: 12px;
  border: 1px solid var(--border-default);
  transition: all var(--transition-fast);
}

.toggle__slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-secondary);
  top: 2px;
  left: 2px;
  transition: all var(--transition-fast);
}

.toggle input:checked + .toggle__slider {
  background: var(--amber-primary);
  border-color: var(--amber-primary);
}

.toggle input:checked + .toggle__slider::before {
  transform: translateX(20px);
  background: var(--text-inverse);
}

/* ═══════════════════════════════════════════════
   SEARCH BAR
   ═══════════════════════════════════════════════ */

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  max-width: 500px;
}

.search-bar input {
  flex: 1;
}

.filter-pills {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}

.filter-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.filter-pill.active,
.filter-pill:hover {
  background: var(--amber-primary);
  border-color: var(--amber-primary);
  color: var(--text-inverse);
}

/* ═══════════════════════════════════════════════
   SECTION HEADERS
   ═══════════════════════════════════════════════ */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 12px;
  margin-bottom: 4px;
}

.section-header__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.section-header__action {
  font-size: 0.85rem;
  color: var(--amber-primary);
  cursor: pointer;
}

/* ═══════════════════════════════════════════════
   MODAL — Centered for desktop
   ═══════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 28px;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-slow);
}

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

.modal__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ═══════════════════════════════════════════════
   BADGE / CHIP
   ═══════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}

.badge--amber {
  background: rgba(212, 149, 106, 0.15);
  color: var(--amber-primary);
}

.badge--green {
  background: rgba(106, 191, 106, 0.15);
  color: var(--green-active);
}

/* ═══════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: 14px;
  opacity: 0.5;
}

.empty-state__text {
  font-size: 0.95rem;
  margin-bottom: 20px;
}

/* ═══════════════════════════════════════════════
   FOCUS PAGE — Desktop centered
   ═══════════════════════════════════════════════ */

.focus-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
}

.focus-layout .tab-bar {
  margin: 0 auto 16px;
}

.focus-layout select {
  max-width: 300px;
}

/* ═══════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════ */

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

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes timerTick {
  0% { transform: scale(1); }
  50% { transform: scale(1.01); }
  100% { transform: scale(1); }
}

/* ═══════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════ */

.px-20 { padding-left: 20px; padding-right: 20px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-amber { color: var(--amber-primary); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* ═══════════════════════════════════════════════
   THEME TOGGLE — Sidebar
   ═══════════════════════════════════════════════ */

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  width: 100%;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.theme-toggle__sun,
.theme-toggle__moon {
  display: none;
}

[data-theme="dark"] .theme-toggle__sun { display: block; }
[data-theme="dark"] .theme-toggle__moon { display: none; }
[data-theme="light"] .theme-toggle__sun { display: none; }
[data-theme="light"] .theme-toggle__moon { display: block; }

.theme-toggle__label::after {
  content: 'Light Mode';
}

[data-theme="light"] .theme-toggle__label::after {
  content: 'Dark Mode';
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
