:root {
  --font-display: "Geologica", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, monospace;

  --paper: #f7f1e6;
  --paper-deep: #f0e6d3;
  --paper-elevated: #fdfbf7;
  --ink: #3d3a35;
  --ink-soft: #6b655d;
  --ink-muted: #9a948a;
  --accent: #84684b;
  --accent-hover: #9a7a5a;
  --on-accent: #fdf9f1;
  --danger: #9a3d3d;
  --danger-soft: #c45050;
  --success: #90b183;
  --warning: #d9ad67;
  --tile: #faf4ea;
  --tile-edge: rgba(138, 116, 93, 0.35);
  --tile-edge-soft: rgba(138, 116, 93, 0.18);
  --border: rgba(138, 116, 93, 0.25);
  --hover-overlay: rgba(132, 104, 75, 0.08);
  --dock-selected: #d1bc9f;

  --sleep: #86a3bc;
  --reading: #d9ad67;
  --activity: #90b183;
  --study: #bd8477;

  --mood-0: #e8e0d2;
  --mood-1: #bfe0ae;
  --mood-2: #d8e6a0;
  --mood-3: #f4e5a8;
  --mood-4: #f0caa0;
  --mood-5: #e3b3a9;

  --status-success: #90b183;
  --status-warning: #d9ad67;
  --status-error: #9a3d3d;

  --sidebar-width: 280px;
  --header-height: 64px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(61, 58, 53, 0.04);
  --shadow-sm: 0 2px 4px rgba(61, 58, 53, 0.06), 0 1px 2px rgba(61, 58, 53, 0.04);
  --shadow-md: 0 4px 12px rgba(61, 58, 53, 0.08), 0 2px 4px rgba(61, 58, 53, 0.04);
  --shadow-lg: 0 8px 24px rgba(61, 58, 53, 0.1), 0 4px 8px rgba(61, 58, 53, 0.06);
  --shadow-xl: 0 16px 48px rgba(61, 58, 53, 0.12), 0 8px 16px rgba(61, 58, 53, 0.08);
  --shadow-inner: inset 0 2px 4px rgba(61, 58, 53, 0.06);
  --shadow-glow: 0 0 20px rgba(132, 104, 75, 0.2);

  --transition-fast: 100ms ease;
  --transition-normal: 180ms ease;
  --transition-slow: 280ms ease;
  --transition-slower: 400ms ease;

  --focus-ring: 0 0 0 3px rgba(132, 104, 75, 0.35);
  --scrim: rgba(0, 0, 0, 0.55);
  --scrim-dark: rgba(0, 0, 0, 0.7);

  --z-sidebar: 100;
  --z-header: 200;
  --z-dropdown: 500;
  --z-modal: 1000;
  --z-toast: 1100;
  --z-tooltip: 1200;
}

body.theme-dark {
  --paper: #13110e;
  --paper-deep: #1a1714;
  --paper-elevated: #201c17;
  --ink: #ede3d1;
  --ink-soft: #b8a994;
  --ink-muted: #7a7065;
  --accent: #cfa674;
  --accent-hover: #e0bb8f;
  --on-accent: #1a150f;
  --danger: #d45555;
  --danger-soft: #e06666;
  --success: #90c07f;
  --warning: #e5c570;
  --tile: #1e1a16;
  --tile-edge: rgba(160, 135, 100, 0.3);
  --tile-edge-soft: rgba(160, 135, 100, 0.15);
  --border: rgba(160, 135, 100, 0.2);
  --hover-overlay: rgba(207, 166, 116, 0.1);
  --dock-selected: #4d3d2a;

  --sleep: #7aa8c9;
  --reading: #e5c570;
  --activity: #7cb86f;
  --study: #d08878;

  --mood-0: #3d3630;
  --mood-1: #5a9a52;
  --mood-2: #6a9a48;
  --mood-3: #908048;
  --mood-4: #906848;
  --mood-5: #904848;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.35), 0 4px 8px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.4), 0 8px 16px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 24px rgba(207, 166, 116, 0.15);

  --scrim: rgba(0, 0, 0, 0.65);
  --scrim-dark: rgba(0, 0, 0, 0.8);
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.no-scroll {
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: var(--space-4) 0;
}

.material-symbols-rounded {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 22;
  font-size: 22px;
  line-height: 1;
  vertical-align: middle;
  user-select: none;
  display: inline-block;
}

.hidden { display: none !important; }
.invisible { visibility: hidden !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app-shell {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

.desktop-layout {
  display: flex;
  width: 100%;
  height: 100%;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--tile);
  border-right: 1px solid var(--tile-edge);
  position: relative;
  z-index: var(--z-sidebar);
  overflow: hidden;
}

.sidebar-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--tile-edge-soft);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.brand-logo-box {
  width: 140px;
  height: auto;
}

.brand-logo {
  width: 100%;
  height: auto;
  display: block;
}

.brand-logo-dark { display: none; }
body.theme-dark .brand-logo-dark { display: block; }
body.theme-dark .brand-logo-light { display: none; }

.brand-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.sidebar-user {
  margin: var(--space-4) var(--space-4);
  padding: var(--space-4);
  background: var(--paper);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, #000) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-accent);
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius-full);
  background: var(--tile);
  border: 1px solid var(--tile-edge);
  color: var(--ink-muted);
}

.plan-badge.pro {
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, #000) 100%);
  border-color: transparent;
  color: var(--on-accent);
}

.sidebar-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 var(--space-4);
  overflow: hidden;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-2);
  margin-bottom: var(--space-2);
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}

.sidebar-section-action {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-section-action:hover {
  background: var(--hover-overlay);
  color: var(--ink);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: var(--space-2);
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--tile-edge-soft);
  border-radius: var(--radius-full);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--tile-edge);
}

.nav-group {
  margin-bottom: var(--space-4);
}

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  margin-bottom: var(--space-1);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-item:hover {
  background: var(--hover-overlay);
  color: var(--ink);
  border-color: var(--tile-edge-soft);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--dock-selected) 0%, color-mix(in srgb, var(--dock-selected) 85%, var(--accent)) 100%);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--tile-edge));
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-item-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.nav-item.active .nav-item-icon {
  background: var(--paper-elevated);
}

.nav-item-content {
  flex: 1;
  min-width: 0;
}

.nav-item-label {
  font-weight: 600;
  margin-bottom: 1px;
}

.nav-item-meta {
  font-size: 11px;
  color: var(--ink-muted);
}

.nav-item-badge {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--tile-edge-soft);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
  height: 100%;
}

.header {
  height: var(--header-height);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  background: var(--paper);
  border-bottom: 1px solid var(--tile-edge);
  position: relative;
  z-index: var(--z-header);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}

.header-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.streak-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--tile);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.streak-indicator:hover {
  background: var(--paper-deep);
  transform: translateY(-1px);
}

.streak-indicator.alert {
  border-color: color-mix(in srgb, var(--danger) 60%, var(--tile-edge));
  color: var(--danger);
}

.streak-indicator.alert .material-symbols-rounded {
  animation: fire-pulse 0.6s ease-in-out infinite;
}

@keyframes fire-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.content-area {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.content-main {
  flex: 1;
  padding: var(--space-6);
  overflow-y: auto;
  overflow-x: hidden;
}

.content-main::-webkit-scrollbar {
  width: 12px;
}

.content-main::-webkit-scrollbar-track {
  background: var(--paper-deep);
  border-left: 1px solid var(--tile-edge);
}

.content-main::-webkit-scrollbar-thumb {
  background: var(--tile-edge);
  border-radius: var(--radius-full);
  border: 3px solid var(--paper-deep);
}

.content-main::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.content-aside {
  width: 380px;
  min-width: 380px;
  padding: var(--space-6);
  background: var(--tile);
  border-left: 1px solid var(--tile-edge);
  overflow-y: auto;
}

.content-aside::-webkit-scrollbar {
  width: 8px;
}

.content-aside::-webkit-scrollbar-track {
  background: transparent;
}

.content-aside::-webkit-scrollbar-thumb {
  background: var(--tile-edge-soft);
  border-radius: var(--radius-full);
}

.page-container {
  max-width: 1200px;
  margin: 0 auto;
}

.panel {
  background: var(--tile);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-elevated {
  background: var(--paper-elevated);
  box-shadow: var(--shadow-md);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--tile-edge-soft);
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
}

.panel-subtitle {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.panel-body {
  padding: var(--space-6);
}

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--tile-edge-soft);
  background: color-mix(in srgb, var(--paper-deep) 30%, var(--tile));
}

.card {
  background: var(--paper);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-fast);
}

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

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

.card-title {
  font-size: 14px;
  font-weight: 700;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
}

.section-subtitle {
  font-size: 14px;
  color: var(--ink-muted);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.row-nowrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.grid-2, .grid-3, .grid-4, .grid-5 {
  display: grid;
  gap: var(--space-4);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.stack-sm { gap: var(--space-2); }
.stack-lg { gap: var(--space-6); }

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
}

.field-row > .field {
  flex: 1;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field-hint {
  font-size: 11px;
  color: var(--ink-muted);
}

.input, .select, .textarea {
  width: 100%;
  height: 42px;
  padding: 0 var(--space-4);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: all var(--transition-fast);
}

.input:hover, .select:hover, .textarea:hover {
  border-color: var(--tile-edge);
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

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

.input-lg {
  height: 48px;
  font-size: 15px;
}

.textarea {
  height: auto;
  min-height: 100px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
  line-height: 1.5;
}

.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b655d' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.input-group {
  display: flex;
}

.input-group .input {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group .input-addon {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  border-left: none;
}

.btn, .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.btn {
  height: 38px;
  padding: 0 var(--space-4);
  white-space: nowrap;
}

.btn-lg {
  height: 44px;
  padding: 0 var(--space-5);
  font-size: 14px;
}

.btn-sm {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: 12px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
}

.icon-btn-sm {
  width: 32px;
  height: 32px;
}

.icon-btn-lg {
  width: 44px;
  height: 44px;
}

.btn:hover, .icon-btn:hover {
  background: var(--hover-overlay);
  border-color: var(--tile-edge);
  transform: translateY(-1px);
}

.btn:active, .icon-btn:active {
  transform: translateY(0);
}

.btn:disabled, .icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 80%, #000) 100%);
  border-color: color-mix(in srgb, var(--accent) 60%, #000);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, color-mix(in srgb, var(--accent-hover) 80%, #000) 100%);
  box-shadow: var(--shadow-sm), var(--shadow-glow);
}

.btn-secondary {
  background: var(--tile);
  border-color: var(--tile-edge);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--hover-overlay);
  border-color: transparent;
}

.btn-danger {
  background: color-mix(in srgb, var(--danger) 12%, var(--paper));
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  color: var(--danger);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 20%, var(--paper));
  border-color: var(--danger);
}

.switch {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--paper-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--tile);
  border: 1px solid var(--tile-edge-soft);
  border-radius: var(--radius-full);
  transition: all var(--transition-normal);
}

.switch.active {
  background: color-mix(in srgb, var(--accent) 35%, var(--paper-deep));
  border-color: var(--accent);
}

.switch.active::after {
  transform: translateX(22px);
  background: var(--accent);
  border-color: var(--accent);
}

.mood-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.mood-btn {
  flex: 1;
  min-width: 80px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mood-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.mood-btn.active {
  border-width: 3px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}

.metric-card {
  padding: var(--space-4);
  background: var(--paper);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.metric-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

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

.metric-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tile);
  border-radius: var(--radius-md);
  color: var(--ink-muted);
}

.metric-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.metric-trend.up {
  background: color-mix(in srgb, var(--success) 15%, var(--paper));
  color: var(--success);
}

.metric-trend.down {
  background: color-mix(in srgb, var(--danger) 15%, var(--paper));
  color: var(--danger);
}

.metric-trend.same {
  background: var(--tile);
  color: var(--ink-muted);
}

.metric-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: var(--space-1);
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.metric-comparison {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: var(--space-3);
}

.metric-bar {
  height: 6px;
  background: var(--tile);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  border-radius: inherit;
  transition: width var(--transition-slow);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.timeline-row {
  display: grid;
  grid-template-columns: 36px 1fr 90px;
  align-items: center;
  gap: var(--space-4);
}

.timeline-day {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  text-align: center;
}

.timeline-track {
  position: relative;
  height: 22px;
  background: var(--paper-deep);
  border: 1px solid var(--tile-edge-soft);
  border-radius: var(--radius-full);
  cursor: pointer;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.timeline-track:hover {
  border-color: var(--accent);
  transform: scaleY(1.1);
}

.timeline-goal {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: repeating-linear-gradient(
    180deg,
    var(--ink-muted) 0,
    var(--ink-muted) 4px,
    transparent 4px,
    transparent 8px
  );
  opacity: 0.5;
  z-index: 2;
}

.timeline-fill, .timeline-range {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  border-radius: var(--radius-full);
  z-index: 1;
}

.timeline-value {
  font-size: 12px;
  color: var(--ink-muted);
  text-align: right;
}

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

.calendar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.calendar-month-input {
  width: 140px;
}

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

.calendar-weekday {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  text-align: center;
  padding: var(--space-2) 0;
}

.calendar-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-2);
  background: var(--paper);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.calendar-cell:hover {
  border-color: var(--accent);
  transform: scale(1.05);
  z-index: 1;
  box-shadow: var(--shadow-sm);
}

.calendar-cell.today {
  border-color: var(--accent);
  border-width: 2px;
  box-shadow: var(--shadow-sm), 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.calendar-cell.empty {
  visibility: hidden;
  pointer-events: none;
}

.calendar-cell-number {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  align-self: flex-end;
}

.calendar-cell-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  text-align: center;
  line-height: 1.2;
  color: var(--ink);
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 180px;
  padding: var(--space-2);
  background: var(--paper-elevated);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px);
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--hover-overlay);
}

.dropdown-divider {
  height: 1px;
  background: var(--tile-edge-soft);
  margin: var(--space-2) 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  background: var(--scrim);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

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

.modal {
  width: min(900px, calc(100vw - var(--space-16)));
  max-height: calc(100vh - var(--space-16));
  background: var(--paper);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(20px);
  transition: transform var(--transition-normal);
}

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

.modal-lg {
  width: min(1100px, calc(100vw - var(--space-16)));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--tile-edge-soft);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-body {
  flex: 1;
  padding: var(--space-6);
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--tile-edge-soft);
  background: var(--tile);
}

.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  min-width: 300px;
  max-width: min(420px, calc(100vw - var(--space-12)));
  padding: var(--space-4) var(--space-5);
  background: var(--paper-elevated);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  transform: translateX(calc(100% + var(--space-8)));
  transition: transform var(--transition-slow) cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.visible {
  transform: translateX(0);
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 13px;
  color: var(--ink-soft);
}

.onboarding {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  background: var(--paper);
}

.onboarding-panel {
  width: min(1100px, 100%);
  background: var(--tile);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  overflow: hidden;
}

.onboarding-hero {
  padding: var(--space-10);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--tile)) 0%, var(--tile) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.onboarding-form-side {
  padding: var(--space-10);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--radius-full);
  background: var(--paper);
  border: 1px solid var(--tile-edge);
}

.status-badge.success {
  background: color-mix(in srgb, var(--success) 15%, var(--paper));
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
  color: var(--success);
}

.status-badge.warning {
  background: color-mix(in srgb, var(--warning) 15%, var(--paper));
  border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
  color: var(--warning);
}

.status-badge.error {
  background: color-mix(in srgb, var(--danger) 15%, var(--paper));
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border);
  color: var(--danger);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--paper-deep);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-xs), 0 1px 0 var(--tile-edge);
}

.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: var(--space-2) var(--space-3);
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: var(--radius-md);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: var(--z-tooltip);
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-8px);
}

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-4) 0;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider-text {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.today-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-6);
  min-height: 0;
}

.today-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.today-aside {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.today-header {
  margin-bottom: var(--space-2);
}

.today-greeting {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.today-date {
  font-size: 14px;
  color: var(--ink-muted);
  margin-top: var(--space-1);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-3);
}

.kpi-card {
  padding: var(--space-3);
  background: var(--paper);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-md);
}

.kpi-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-2);
}

.kpi-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.kpi-value {
  font-size: 16px;
  font-weight: 700;
  margin-top: var(--space-1);
}

.entry-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.entry-section {
  padding: var(--space-4);
  background: var(--paper);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-lg);
}

.entry-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  margin-bottom: var(--space-4);
}

.entry-grid {
  display: grid;
  gap: var(--space-3);
}

.entry-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.entry-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--tile-edge-soft);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 2px 6px;
  background: var(--paper-deep);
  border: 1px solid var(--tile-edge-soft);
  border-radius: var(--radius-xs);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tile);
  border-radius: var(--radius-xl);
  color: var(--ink-muted);
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: 14px;
  color: var(--ink-muted);
  max-width: 300px;
}

.icon-btn:focus-visible,
.btn:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible,
.switch:focus-visible,
.nav-item:focus-visible,
.calendar-cell:focus-visible,
.timeline-track:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1400px) {
  .content-aside {
    width: 320px;
    min-width: 320px;
  }
}

@media (max-width: 1200px) {
  :root {
    --sidebar-width: 240px;
  }

  .today-layout {
    grid-template-columns: 1fr;
  }

  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }

  .onboarding-panel {
    grid-template-columns: 1fr;
  }

  .onboarding-hero {
    display: none;
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -100%;
    transition: left var(--transition-slow);
  }

  .sidebar.open {
    left: 0;
  }

  .mobile-nav {
    position: fixed;
    bottom: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - var(--space-8));
    max-width: 500px;
    padding: var(--space-2);
    background: var(--paper-elevated);
    border: 1px solid var(--tile-edge);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(12px);
    z-index: var(--z-header);
    display: flex;
    overflow-x: auto;
    gap: var(--space-1);
  }

  .mobile-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-nav-item {
    flex: 1;
    min-width: 60px;
    height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-2);
    border: none;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--ink-muted);
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
  }

  .mobile-nav-item.active {
    background: var(--dock-selected);
    color: var(--ink);
  }

  .content-aside {
    display: none;
  }

  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .header {
    padding: 0 var(--space-4);
  }

  .header-title {
    font-size: 16px;
  }

  .content-main {
    padding: var(--space-4);
  }

  .streak-indicator {
    display: none;
  }

  .grid-2, .grid-3, .grid-4, .grid-5 {
    grid-template-columns: 1fr;
  }

  .timeline-row {
    grid-template-columns: 32px 1fr;
  }

  .timeline-value {
    display: none;
  }

  .entry-grid-2 {
    grid-template-columns: 1fr;
  }

  .modal {
    width: calc(100vw - var(--space-6));
    margin: var(--space-3);
    max-height: calc(100vh - var(--space-6));
  }
}