/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

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

:root {
  /* Dark theme colors - default theme */
  --background-primary: linear-gradient(
    180deg,
    lch(4.8 0.7 272) 0%,
    lch(4 0.7 272) 100%
  );
  --background-secondary: rgba(255, 255, 255, 0.01);
  --background-tertiary: rgba(255, 255, 255, 0.04);
  --input-background: rgba(255, 255, 255, 0.06);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.15);
  
  --text-primary: rgba(255, 255, 255, 0.9);
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-tertiary: rgba(255, 255, 255, 0.4);
  
  --accent-primary: #4A72F5;
  --accent-primary-hover: #5B80F6;
  
  /* Mood rating colors (1-5) */
  --mood-1: #FF6B6B;  /* Vibrant coral red */
  --mood-2: #FFA07A;  /* Warm light salmon */
  --mood-3: #FFD93D;  /* Bright golden yellow */
  --mood-4: #95D5B2;  /* Fresh mint green */
  --mood-5: #2ECC71;  /* Vivid emerald green */
  
  /* Spacing system */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

/* Light theme */
[data-theme="light"] {
  --background-primary: linear-gradient(
    180deg,
    rgb(252, 252, 252) 0%,
    rgb(248, 248, 248) 100%
  );
  --background-secondary: rgba(0, 0, 0, 0.02);
  --background-tertiary: rgba(0, 0, 0, 0.03);
  --input-background: white;
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(0, 0, 0, 0.16);
  
  --text-primary: rgba(0, 0, 0, 0.87);
  --text-secondary: rgba(0, 0, 0, 0.66);
  --text-tertiary: rgba(0, 0, 0, 0.45);

  /* Table overrides for light theme */
  table {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  }

  th {
    background: rgba(0, 0, 0, 0.01);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.45);
    font-weight: 500;
  }

  td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.7);
  }

  tr:hover {
    background: rgba(0, 0, 0, 0.01);
  }

  tr:hover td {
    color: rgba(0, 0, 0, 0.9);
  }

  /* Button overrides for light theme */
  .button-secondary {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
  }
  
  .button-secondary:hover {
    background: rgba(0, 0, 0, 0.05);
  }

  /* Nav header overrides for light theme */
  .nav-header {
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
  }

  .nav-link {
    color: var(--text-secondary);
  }

  .nav-link:hover {
    color: var(--text-primary);
  }

  .nav-link.active {
    color: var(--text-primary);
  }

  .nav-link.brand {
    color: var(--text-primary);
  }
}

/* Theme toggle switch styles */
.theme-toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.theme-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--background-tertiary);
  border: 1px solid var(--border-color);
  transition: .4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-primary);
  transition: .4s;
  border-radius: 50%;
}

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

input:checked + .toggle-slider:before {
  transform: translateX(24px);
  background-color: white;
}

/* Base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--background-primary);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding: 0;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;  
  color: var(--text-primary);

}

a:hover {
  color: var(--accent-primary);
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}

/* Typography */
h1 {
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-md);
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--text-secondary);
}

/* Button System */
.button {
  height: 36px;
  padding: 0 var(--space-md);
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.button:hover {
  background: var(--background-secondary);
  border-color: var(--border-color-hover);
}

.button-primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.button-primary:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  color: white;
}

.button-primary:disabled {
  background: var(--background-tertiary);
  border-color: var(--border-color);
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.7;
}

.button-primary:disabled:hover {
  background: var(--background-tertiary);
  border-color: var(--border-color);
}

/* Disabled link buttons (rendered as spans) */
.button-primary.disabled {
  background: var(--background-tertiary);
  border-color: var(--border-color);
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.7;
}

.button-primary.disabled:hover {
  background: var(--background-tertiary);
  border-color: var(--border-color);
}

/* Secondary - Ghost button with border */
.button-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
}

.button-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.button-secondary.disabled {
  background: var(--background-tertiary);
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.7;
}

.button-secondary.disabled:hover {
  background: var(--background-tertiary);
}

/* Tertiary - Smaller, minimal button */
.button-tertiary {
  padding: 0 var(--space-sm);
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.button-tertiary:hover {
  background: var(--background-secondary);
  color: var(--text-primary);
  border-color: var(--border-color-hover);
}

.button.button-tertiary.deactivated {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Select System - Inline selects that match button height */
.select {
  height: 36px;
  padding: 0 32px 0 12px;
  font-size: 0.875rem;
  font-weight: 400;
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  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='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all 0.2s ease;
}

.select:hover {
  background-color: var(--background-secondary);
  border-color: var(--border-color-hover);
}

.select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.select-small {
  height: 32px;
  padding: 0 28px 0 10px;
  font-size: 0.8125rem;
}

/* Forms */
.form-group {
  margin-bottom: var(--space-md);
  position: relative;
}

.form-label {
  position: absolute;
  left: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.875rem;
  transition: all 0.15s ease;
  pointer-events: none;
}

.form-input, .form-select {
  width: 100%;
  padding: var(--space-md);
  background-color: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  height: 42px;
  transition: all 0.2s ease;
  max-width: 500px;
}

textarea.form-input {
  height: auto;
  min-height: 80px;
  resize: vertical;
}

.form-input:hover, .form-select:hover {
  border-color: var(--border-color-hover);
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(74, 114, 245, 0.2);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

/* Hide label when input is focused or has content */
.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label {
  opacity: 0;
}

/* Cards */
.card {
  background-color: var(--background-secondary);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.card:last-child {
  margin-bottom: 0;
}

.card h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-lg);
  letter-spacing: -0.01em;
}

.card .form-field:last-child {
  margin-bottom: 0;
}

.form-fields {
  display: flex;
  flex-direction: column;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

/* Navigation Bar Styles */
.nav-header {
  background: var(--background-primary);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.nav-container {
  max-width: 95vw;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: rgba(255, 255, 255, 0.9);
}

.nav-link.active {
  color: #fff;
}

.nav-link.brand {
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}

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

.nav-search-icon {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-search-icon:hover {
  color: var(--text-primary);
}

.nav-search-icon svg {
  width: 18px;
  height: 18px;
}

/* Page Header Styles */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
}

.page-title {
  margin: 0;
}

.page-actions {
  display: flex;
  gap: var(--space-sm);
}

/* Responsive Navigation */
@media (max-width: 768px) {
  .nav-header {
    position: fixed;
    width: 100%;
  }

  .nav-container {
    padding: 0 var(--space-sm);
  }

  .nav-menu {
    gap: var(--space-sm);
  }
}


/* Responsive styles */
@media (max-width: 768px) {
  .main-header {
    position: fixed;
    width: 100%;
  }

  .header-content {
    padding: 0 var(--space-sm);
  }

  .main-nav {
    gap: var(--space-md);
  }

  /* Adjust main content to account for fixed header */
  body {
    padding-top: 48px;
  }

  /* Ensure container padding doesn't cause horizontal scroll */
  .container {
    padding: var(--space-xl) var(--space-sm);
  }

  .container,
  .nav-container {
    padding: 0 var(--space-sm);
  }
  
  .container {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
  }
}

/* Shared Layout Components */
.narrow-page {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}

.date-type {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: var(--space-md);
  letter-spacing: -0.02em;
}

.pill {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-lg);
  gap: var(--space-md);
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.page-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entry-meta-inline {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-actions {
  display: flex;
  gap: 2px;
  align-items: center;
}

.word-count-inline {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.button-tertiary {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.button-tertiary:hover {
  background: var(--background-tertiary);
  color: var(--text-secondary);
}

.button-ghost {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button-ghost:hover {
  background: var(--background-tertiary);
  color: var(--text-secondary);
}

.button-ghost.deactivated {
  opacity: 0.3;
  pointer-events: none;
}

.button-ghost i {
  width: 14px;
  height: 14px;
}

/* Icon button - square button with icon only */
.button-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button-icon:hover {
  background: var(--background-secondary);
  border-color: var(--border-color-hover);
  color: var(--text-primary);
}

.button-icon.deactivated {
  opacity: 0.3;
  pointer-events: none;
}

.button-icon i,
.button-icon svg {
  width: 12px !important;
  height: 12px !important;
}

.inline-form {
  display: inline;
}

.header-actions .inline-form {
  margin-right: 6px;
}

/* Shared Entry Components */
.entry-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.meta-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.meta-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.entry-content {
  margin: var(--space-xl) 0;
  padding: var(--space-xl);
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.9375rem;
}

/* Shared Form Elements */
.form-select {
  display: block;
  width: 100%;
  height: 42px;
  padding: 8px 12px;
  padding-right: 36px;
  background-color: rgb(20, 20, 20);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='rgba(255,255,255,0.6)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  appearance: none;
}

.form-select:hover {
  border-color: var(--border-color-hover);
}

.form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(74, 114, 245, 0.2);
}

/* Light theme override */
[data-theme="light"] .form-select {
  background-color: rgba(0, 0, 0, 0.05);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='rgba(0,0,0,0.6)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* Shared Mood Selector */
.mood-selector {
  display: flex;
  gap: 2px;
  font-size: 0.75rem;
}

.mood-radio {
  display: none;
}

.mood-dot {
  cursor: pointer;
  transition: all 0.2s ease;
  color: #6b7280;
  opacity: 0.7;
  user-select: none;
  text-shadow: none;
}

/* Mood colors based on level */
[data-mood="1"] .mood-dot.filled { color: var(--mood-1); opacity: 1; }
[data-mood="2"] .mood-dot.filled { color: var(--mood-2); opacity: 1; }
[data-mood="3"] .mood-dot.filled { color: var(--mood-3); opacity: 1; }
[data-mood="4"] .mood-dot.filled { color: var(--mood-4); opacity: 1; }
[data-mood="5"] .mood-dot.filled { color: var(--mood-5); opacity: 1; }

/* Mood Indicator */
.mood-indicator {
  display: flex;
  gap: 1px;
  font-size: 1rem;
  color: #6b7280;
  align-items: center;
}

.mood-indicator .mood-dot {
  user-select: none;
  line-height: 1;
  color: #6b7280;
  opacity: 0.7;
}

.mood-indicator .mood-dot.filled {
  opacity: 1;
}

/* Activity Indicator */
.activity-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--background-tertiary);
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.activity-indicator.checked {
  color: var(--accent-primary);
  background: var(--background-tertiary);
}

/* Shared Activity Pills */
.activity-checkbox {
  display: none;
}

.activity-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  background: var(--background-tertiary);
  color: var(--text-tertiary);
}

.activity-pill:hover {
  border-color: var(--border-color-hover);
  background: var(--background-secondary);
}

.activity-checkbox:checked + span {
  color: var(--accent-primary);
}

.activity-checkbox:checked ~ .activity-pill {
  background: rgba(94, 106, 210, 0.1);
  border-color: rgba(94, 106, 210, 0.2);
}

/* Shared Editor Styles */
.journal-entry-editor {
  width: 100%;
  min-height: 200px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.9375rem;
  font-family: inherit;
  resize: none;
  padding: 0;
  box-sizing: border-box;
  display: block;
}

.journal-entry-editor:focus {
  outline: none;
}

/* TipTap Editor Heading Styles */
.journal-entry-editor h1,
.journal-entry-editor h2,
.journal-entry-editor h3 {
  margin-top: 1.25em;
  margin-bottom: 0.25em;
  font-weight: 600;
  line-height: 1.3;
}

.journal-entry-editor h1 {
  font-size: 1.875em;
}

.journal-entry-editor h2 {
  font-size: 1.5em;
}

.journal-entry-editor h3 {
  font-size: 1.25em;
}

.journal-entry-editor h1:first-child,
.journal-entry-editor h2:first-child,
.journal-entry-editor h3:first-child {
  margin-top: 0;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .narrow-page {
    padding: var(--space-lg) var(--space-sm);
  }

  .date-type {
    gap: var(--space-sm);
  }

  h1 {
    font-size: 1.25rem;
  }

  .entry-meta {
    margin: 0 calc(var(--space-sm) * -1);
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .entry-content {
    margin: var(--space-lg) calc(var(--space-sm) * -1);
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  /* Responsive Table Styles */
  .table-wrapper {
    margin: 0 calc(var(--space-sm) * -1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
  }

  table {
    border-radius: 0;
    border-left: none;
    border-right: none;
    font-size: 0.8125rem; /* Slightly smaller font on mobile */
  }

  th, td {
    padding: var(--space-sm);
    min-width: 100px; /* Ensure columns don't get too narrow */
  }

  /* Optional: Hide less important columns on mobile */
  .hide-on-mobile {
    display: none;
  }
}

/* Analysis Styles */
.analysis-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}

.analysis-item {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.analysis-link {
  display: block;
  padding: var(--space-lg);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.analysis-link:hover {
  background: var(--background-tertiary);
}


.analysis-entries {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Markdown Content */
.markdown {
  color: var(--text-secondary);
  line-height: 1.6;
}

.markdown h2 {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
  margin: var(--space-xl) 0 var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-color);
}

.markdown h2:first-child {
  margin-top: 0;
}

.markdown p {
  margin-bottom: var(--space-md);
}

.markdown ul {
  margin: var(--space-md) 0;
  padding-left: var(--space-xl);
}

.markdown li {
  margin-bottom: var(--space-xs);
}

.markdown strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* Analysis Header */
.analysis-header {
  margin-bottom: var(--space-xl);
}

.analysis-meta {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: var(--space-xs);
}

.analysis-content {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin: var(--space-xl) 0;
}

.analysis-actions {
  margin-top: var(--space-xl);
}

.date-range .form-select {
  width: 150px;
  padding: var(--space-sm) var(--space-md);
}


.filter-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  height: 32px;
  padding: 0 var(--space-sm);
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-button:hover {
  background: var(--background-secondary);
  border-color: var(--border-color-hover);
  color: var(--text-primary);
}

.filter-button svg {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}


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

.header-actions {
  display: flex;
  gap: 2px;
  align-items: center;
}

.search-and-filter-form {
  display: flex;
  align-items: center;
}

.action-buttons {
  display: flex;
  gap: var(--space-sm);
}

/* Table Styles */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 0;
  outline: 1px solid var(--border-color);
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

thead {
  background: var(--background-tertiary);
  position: sticky;
  top: 0;
  z-index: 1;
}

thead tr:hover {
  background: transparent;
}

th {
  text-align: left;
  padding: var(--space-md);
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
}

tbody tr {
  cursor: pointer;
  transition: all 0.1s ease;
  opacity: 0.7;
}

tbody tr:hover {
  background-color: var(--background-tertiary);
  opacity: 1;
}

tbody tr:hover td {
  color: #e5e7eb;
}

tr:last-child td {
  border-bottom: none;
}

td {
  padding: var(--space-md);
  color: #6b7280;
  border-bottom: 1px solid var(--border-color);
  line-height: 1.4;
  font-size: 0.875rem;
  font-weight: 400;
  vertical-align: middle;
  text-align: center;
}

/* Light theme overrides */
[data-theme="light"] table {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

[data-theme="light"] thead {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] th {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.45);
}

[data-theme="light"] td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.45);
}

[data-theme="light"] tbody tr:hover {
  background: rgba(0, 0, 0, 0.01);
}

[data-theme="light"] tbody tr:hover td {
  color: rgba(0, 0, 0, 0.9);
}

/* Dashboard cards layout */
.dashboard-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  align-items: stretch;
}

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

/* Chart spacing */
.mood-chart {
  margin-bottom: 0; /* Remove bottom margin since it's now in a grid */
}

/* Entry type pill in tables */
.entry-type {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  line-height: 1;
}

/* Word count in tables */
.word-count {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Activity indicators in tables */
.activity-cell {
  text-align: center;
}

/* Table habit icons */
.table-habit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 2px;
  border: none;
  border-radius: 3px;
  background: transparent;
  transition: all 0.15s ease;
  font-size: 11px;
  color: #6b7280;
  opacity: 0.7;
  line-height: 0;
  margin: 0 auto;
}

.table-habit-icon i {
  width: 11px;
  height: 11px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.table-habit-icon i[data-lucide] {
  opacity: 1;
}

.table-habit-icon.completed {
  color: #e5e7eb;
  opacity: 1;
}

.table-habit-icon.completed i {
  color: #e5e7eb;
}

/* Table habit more indicator */
.table-habit-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 2px;
  border: none;
  border-radius: 3px;
  background: transparent;
  font-size: 9px;
  font-weight: 500;
  color: #6b7280;
  opacity: 0.8;
  line-height: 1;
}

/* Legacy activity indicators (kept for compatibility) */
.activity-check {
  color: var(--accent-primary);
}

.activity-cross {
  color: var(--text-tertiary);
}

.hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Chart styles */
.mood-chart {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
}

.mood-chart-header {
  margin-bottom: var(--space-md);
}

.mood-chart-header h3 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mood-chart canvas {
  width: 100% !important;
}

/* Chart theme styles */
[data-theme="dark"] .mood-chart {
  --chart-grid-color: rgba(255, 255, 255, 0.08);
  --chart-text-color: rgba(255, 255, 255, 0.6);
}

[data-theme="light"] .mood-chart {
  --chart-grid-color: rgba(0, 0, 0, 0.06);
  --chart-text-color: rgba(0, 0, 0, 0.6);
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

/* Chart.js styles */
.mood-chart .chartjs-text {
  fill: var(--chart-text-color) !important;
  color: var(--chart-text-color) !important;
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
  font-size: 12px !important;
}

.mood-chart .chartjs-grid-line {
  stroke: var(--chart-grid-color) !important;
}

/* Memory snippet styles */
.memory-snippet {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
}

.memory-snippet-header {
  margin-bottom: var(--space-md);
}

.memory-snippet-header h3 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.memory-snippet-date {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
  font-weight: 400;
}

.memory-snippet-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.memory-snippet-content p {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 400;
}

.memory-snippet-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.2s ease;
  align-self: flex-start;
}

.memory-snippet-link:hover {
  color: var(--accent-primary-hover);
}

/* Light theme styles for memory snippet */
[data-theme="light"] .memory-snippet {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

/* Auth pages styling */
@media (min-width: 768px) {
  .auth-container {
    max-width: 360px;
    padding: 0 var(--space-lg);
  }
}

.auth-container {
  margin: 120px auto 0;
  text-align: center;
  padding: 0 var(--space-sm);
}

.auth-logo {
  margin-bottom: var(--space-xl);
}

.auth-favicon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.auth-container h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: var(--space-xl);
  color: var(--text-primary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

/* Unified form inputs in auth context - use .form-input and .button classes with full-width override */
.auth-container .form-input,
.auth-container .button {
  width: 100%;
}

.auth-container .form-input {
  padding: 12px 14px;
}

.auth-input-group {
  text-align: left;
}

.auth-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--input-background);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.auth-input:hover {
  border-color: var(--border-color-hover);
}

.auth-input:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(74, 114, 245, 0.2);
}

.auth-button {
  width: 100%;
  padding: 10px;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.auth-button:hover {
  background: var(--accent-primary-hover);
}

.auth-footer {
  color: var(--text-secondary);
  font-size: 14px;
}

.auth-footer a {
  color: var(--text-primary);
  font-weight: 500;
  text-decoration: none;
}

.auth-footer a:hover {
  color: var(--accent-primary);
}

/* Passkey Authentication Styles */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: var(--text-secondary);
}

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

.auth-divider span {
  padding: 0 1rem;
  font-size: 0.875rem;
}

.auth-button-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-button-secondary:hover {
  background: var(--bg-tertiary);
}

.auth-status {
  text-align: center;
  font-size: 0.875rem;
  margin-top: 1rem;
  color: var(--text-secondary);
}

.auth-status.error {
  color: var(--color-error, #ef4444);
}

.auth-status.hidden {
  display: none;
}

/* Returning user login state */
.auth-returning-user {
  margin-bottom: var(--space-lg);
}

.auth-returning-email {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs) 0;
}

.auth-switch-link {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.auth-switch-link:hover {
  color: var(--accent-primary);
}

/* Auth sections and toggle links */
.auth-section {
  margin-top: var(--space-lg);
}

.auth-toggle-section {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.auth-toggle-link {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.auth-toggle-link:hover {
  color: var(--accent-primary);
}

/* Settings Passkey Styles */
.settings-status {
  font-size: 0.875rem;
  margin-top: 0.5rem;
  color: var(--text-secondary);
}

.settings-status.error {
  color: var(--color-error, #ef4444);
}

.settings-status.hidden {
  display: none;
}

.alert {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  margin-bottom: 0;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  max-width: 400px;
  z-index: 1000;
  backdrop-filter: blur(8px);
  animation: slideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1),
             fadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) 5.7s forwards;
  transform-origin: bottom;
}

@keyframes slideIn {
  from {
    transform: translateY(16px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  to {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
  }
}

.alert-success {
  border: 1px solid rgba(46, 160, 67, 0.2);
  border-left: 4px solid #2EA043;
}

.alert-error {
  border: 1px solid rgba(248, 81, 73, 0.2);
  border-left: 4px solid #F85149;
}


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

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

/* Mobile responsive styles for habits header */
@media (max-width: 768px) {
  .habits-page .habits-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-md);
  }

  .habits-page .habits-header .header-title {
    justify-content: center;
  }

  .habits-page .habits-header .header-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
  }

  .habits-page .habits-header .header-actions .button {
    width: 100%;
    justify-content: center;
  }
}

/* Form Fields */
.form-fields {
  display: flex;
  flex-direction: column;
  margin-top: var(--space-lg);
}

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

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

.field-label h4 {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.field-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
  font-weight: 400;
}

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

.form-input {
  padding: var(--space-md);
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: all 0.2s ease;
  height: 42px;
}

textarea.form-input {
  height: auto;
  min-height: 80px;
}

select.form-input {
  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 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='rgba(255,255,255,0.6)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.9);
  -webkit-text-fill-color: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] select.form-input {
  color: rgba(0, 0, 0, 0.87);
  -webkit-text-fill-color: rgba(0, 0, 0, 0.87);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='rgba(0,0,0,0.6)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

select.form-input option {
  background-color: var(--background-secondary);
  color: var(--text-primary);
}

.form-input:hover, .form-select:hover {
  border-color: var(--border-color-hover);
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(74, 114, 245, 0.2);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* Remove any form-actions borders unless explicitly needed */
.form-actions.with-border {
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-color);
}

/* Light theme overrides */
[data-theme="light"] .form-input,
[data-theme="light"] .form-select {
  background-color: rgba(0, 0, 0, 0.05);
}

.radio-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

.radio-card {
  position: relative;
  padding: var(--space-md);
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.radio-card:hover {
  background: var(--background-secondary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.radio-card.selected {
  background: rgba(74, 114, 245, 0.1);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-card-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.radio-card-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.radio-card-example {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  padding: var(--space-sm);
  background: var(--background-tertiary);
  border-radius: var(--radius-sm);
}

[data-theme="light"] .radio-card {
  background-color: white;
}

[data-theme="light"] .radio-card:hover {
  background-color: rgba(74, 114, 245, 0.02);
}

[data-theme="light"] .radio-card.selected {
  background-color: rgba(74, 114, 245, 0.05);
}

.frequency-input {
  margin-top: var(--space-sm);
}

.frequency-input .form-input {
  width: 100%;
  max-width: 200px;
  margin: 0;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.empty-state-content {
  text-align: center;
  max-width: 320px;
  padding: var(--space-xl);
}

.empty-state h3 {
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: 500;
  margin: 0 0 var(--space-xs);
  letter-spacing: -0.01em;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0 0 var(--space-lg);
}

.empty-state .button {
  min-width: 120px;
}

/* Light theme overrides */
[data-theme="light"] .empty-state {
  background: white;
}

.habits-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.habit-value-input {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--background-primary);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.habit-value-input label {
  color: var(--text-primary);
  font-size: 0.875rem;
  white-space: nowrap;
}

.habit-value-input .form-input {
  width: 80px;
  text-align: center;
}

[data-theme="light"] .habit-value-input {
  background: var(--background-tertiary);
}

/* Journal Entry Styles */
.journal-meta-row {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--space-lg);
  position: relative;
}

.journal-meta-row .journal-meta-group:first-child {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.journal-meta-row .journal-meta-group:last-child {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.journal-meta-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
}

.journal-meta-group:not(.mood-group):not(.habit-icons-group) {
  align-items: center;
}

.journal-meta-group.mood-group {
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
}

.journal-meta-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Habit Icons */
.habit-icons-group {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: row;
}

.habit-icons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.habit-icon-container {
  position: relative;
  line-height: 0;
}

.habit-icon-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 10px;
  color: var(--text-tertiary);
  opacity: 0.7;
  line-height: 0;
}

.habit-icon-button i {
  width: 14px;
  height: 14px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.habit-icon-button i[data-lucide] {
  opacity: 1;
}

.habit-icon-button:hover {
  opacity: 1;
  color: var(--text-secondary);
}

.habit-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Habit selected states - both CSS :checked and server-rendered .completed */
.habit-icon-button.boolean-habit.completed,
.habit-icon-button.boolean-habit:has(.habit-checkbox:checked) {
  color: var(--accent-primary) !important;
  opacity: 1 !important;
}

.habit-icon-button.boolean-habit.completed i,
.habit-icon-button.boolean-habit:has(.habit-checkbox:checked) i,
.habit-icon-button.boolean-habit .habit-checkbox:checked + i {
  color: var(--accent-primary) !important;
}



@media (max-width: 768px) {
  .journal-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: var(--space-lg);
  }
  
  /* Reset all positioning overrides */
  .journal-meta-row .journal-meta-group:first-child,
  .journal-meta-row .journal-meta-group:last-child {
    position: static;
    transform: none;
  }
  
  /* Hide word count on mobile */
  .journal-meta-group:has(.word-count-display) {
    display: none;
  }
  
  /* Mood group - left aligned */
  .mood-group {
    flex: 0 0 auto;
  }
  
  .mood-selector {
    display: flex;
    flex-direction: row;
    gap: var(--space-xs);
  }
  
  /* Habit icons - right aligned - override desktop centering */
  .habit-icons-group {
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    flex: 0 0 auto;
    justify-content: flex-end !important;
  }
  
  .habit-icons {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
  }
  
  /* Align nudge controls and button horizontally on mobile */
  .nudge-controls {
    align-items: flex-start;
    margin-top: 0;
  }
  
  .nudge-controls-left {
    align-items: flex-start;
  }
  
  .form-actions {
    align-items: flex-start;
    margin-top: 0 !important;
  }
}

/* Habit Styles */
.habits-list {
  display: flex;
  flex-direction: column;
}

.habits-empty {
  padding: var(--space-md) 0;
  color: var(--text-tertiary);
  font-size: 0.875rem;
  text-align: center;
}

.habit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-color);
}

.habit-row:last-child {
  border-bottom: none;
}

.habit-info {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: var(--space-sm);
}

.habit-name {
  font-size: 0.9375rem;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.habit-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--background-tertiary);
  border-radius: 20px;
  transition: .2s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: .2s;
}

.toggle-input:checked + .toggle-slider {
  background-color: var(--accent-primary);
}

.toggle-input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

/* Number Input */
.number-input-group {
  display: flex;
  align-items: center;
  background: var(--background-tertiary);
  border-radius: var(--radius-md);
  padding: 4px;
  min-width: 120px;
}

.number-adjust {
  border: none;
  background: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.125rem;
  padding: 0;
  border-radius: var(--radius-sm);
}

.number-adjust:hover {
  color: var(--text-primary);
  background: var(--background-secondary);
}

.number-input {
  width: 48px;
  text-align: center;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  padding: 0;
  -moz-appearance: textfield;
}

.number-input::-webkit-outer-spin-button,
.number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.habit-value {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Add responsive adjustments for mobile */
@media (max-width: 768px) {
  .alert {
    bottom: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
    max-width: none;
    padding: var(--space-md);
  }
}

/* Hamburger Menu Styles */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1000; /* Ensure it's above other elements */
}

.hamburger-line {
  height: 3px;
  width: 100%;
  background-color: #fff; /* Change to your desired color */
  transition: all 0.3s ease;
}

/* Sidebar Styles */
#sidebar-menu {
  position: fixed;
  top: 0;
  left: -250px; /* Hide off-screen */
  width: 250px;
  height: 100%;
  background: var(--background-primary); /* Use your theme color */
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
  transition: left 0.3s ease;
  z-index: 999; /* Ensure it's above other elements */
}

#sidebar-menu.active {
  left: 0; /* Show the sidebar */
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none; /* Hidden by default */
  z-index: 998; /* Below the sidebar */
}

.overlay.active {
  display: block; /* Show overlay when active */
}

/* Mobile Navigation Styles */
.nav-header.mobile {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--background-primary);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
}

.nav-header.mobile .nav-content {
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-brand {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  letter-spacing: -0.01em;
}

/* Two-line Hamburger Menu */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 18px;
  height: 14px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.hamburger-line {
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
  transition: all 0.3s ease;
}

/* Hamburger to X animation */
.hamburger.active .hamburger-line:first-child {
  transform: translateY(6px) rotate(45deg);
}

.hamburger.active .hamburger-line:last-child {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu {
  position: fixed;
  top: 48px; /* Height of header */
  left: 0;
  width: 100%;
  height: calc(100vh - 48px);
  background: var(--background-primary);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.mobile-menu.active {
  opacity: 1;
  visibility: visible;
}

.mobile-nav {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.mobile-nav-link {
  color: var(--text-secondary);
  font-size: 2rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

.mobile-nav-link.active {
  color: var(--text-primary);
}

/* Prevent body scroll when menu is open */
body.menu-open {
  overflow: hidden;
}


.nudge-text {
  margin-top: var(--space-md);
  margin-bottom: 0;
  text-align: left;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: opacity 0.3s ease;
  opacity: 0; /* Start hidden */
  min-height: 3rem; /* Reserve space to prevent layout shift */
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.nudge-text.fade-out {
  opacity: 0 !important;
}

.nudge-text.fade-in {
  opacity: 1 !important;
}

/* Light theme overrides */
[data-theme="light"] .hamburger-line {
  background-color: var(--text-primary);
}

/* Nudge card styles */
.nudge-card {
  padding: var(--space-lg);
}

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

.nudge-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}

.nudge-title h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.nudge-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.nudge-content {
  margin-top: var(--space-md);
}

.nudge-content p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 0.9375rem;
}

/* Nudge form styles */
.nudge-form {
  padding: var(--space-xl);
}

.nudge-form .form-field {
  margin-bottom: var(--space-xl);
}

.nudge-form .form-field:last-child {
  margin-bottom: 0;
}

.nudge-form .field-label {
  margin-bottom: var(--space-md);
}

.nudge-form .field-label h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.nudge-form .field-description {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.nudge-form .form-input {
  margin-top: var(--space-sm);
  max-width: none;
  width: 100%;
}

.nudge-form textarea.form-input {
  min-height: 400px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  font-size: 0.9375rem;
}

.nudge-form .form-actions {
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-color);
}

.error-message {
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.2);
  border-radius: var(--radius-sm);
  color: #F85149;
  font-size: 0.875rem;
}

/* Nudge controls styles */
.nudge-controls {
  margin-top: var(--space-md);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nudge-controls-left {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  opacity: 0.7;
}

.nudge-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

.nudge-toggle-form {
  display: inline-block;
}

.toggle-switch-small {
  transform: scale(0.8);
}

.form-actions-simple {
  margin: var(--space-sm) 0;
}

/* Entry filter tabs */
.entries-filter {
  margin-bottom: var(--space-lg);
}

.filter-tabs {
  display: flex;
  gap: 2px;
  background: var(--background-tertiary);
  border-radius: var(--radius-md);
  padding: 2px;
  width: fit-content;
}

.filter-tab {
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.filter-tab:hover {
  color: var(--text-primary);
  background: var(--background-secondary);
}

.filter-tab.active {
  background: var(--background-primary);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Light theme overrides */
[data-theme="light"] .filter-tabs {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .filter-tab.active {
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Dashboard Styles - Minimalist Reflection View */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.dashboard-date {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.dashboard-actions {
  display: flex;
  gap: var(--space-sm);
}

.dashboard-entries {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.dashboard-entry {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dashboard-entry:hover {
  border-color: var(--border-color-hover);
}

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

.dashboard-entry-date {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.entry-type-badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
}

.dashboard-entry-content p {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.dashboard-entry-more {
  display: inline-block;
  margin-top: var(--space-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent-primary);
}

.dashboard-empty-state {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-xl);
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-secondary);
}

.dashboard-empty-state p {
  margin: 0;
}

.dashboard-footer {
  display: flex;
  justify-content: center;
  padding: var(--space-xl) 0;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.dashboard-footer-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.dashboard-footer-link:hover {
  color: var(--accent-primary);
}

/* Light theme overrides */
[data-theme="light"] .dashboard-entry {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .dashboard-entry:hover {
  border-color: rgba(0, 0, 0, 0.12);
}

/* Responsive dashboard */
@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .dashboard-date {
    font-size: 1.25rem;
  }

  .dashboard-actions {
    width: 100%;
  }

  .dashboard-actions .button {
    width: 100%;
  }
}

/* Table column widths to prevent layout shifts */
th:nth-child(1), td:nth-child(1) { /* Date column */
  min-width: 120px;
  width: 120px;
}

th:nth-child(2), td:nth-child(2) { /* Type column */
  min-width: 60px;
  width: 60px;
}

/* Habits table column widths */
.habits-list th:nth-child(1), 
.habits-list td:nth-child(1) { /* Icon column */
  width: 40px;
  min-width: 40px;
  text-align: center;
}

.habits-list th:nth-child(2), 
.habits-list td:nth-child(2) { /* Name column */
  width: 200px;
  min-width: 150px;
  text-align: left;
}

.habits-list th:nth-child(3), 
.habits-list td:nth-child(3) { /* Description column */
  width: auto;
  min-width: 200px;
  text-align: left;
}

/* Journal entry text in table - single line only */
.entry-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
  text-align: left;
  margin-bottom: var(--space-sm);
}

/* Words column alignment - left align title and content */
th:nth-child(4), td:nth-child(4) { /* Words column */
  text-align: left;
  width: 100px;
  min-width: 80px;
}

/* Mood column - left align and consistent width */
th:nth-child(5), td:nth-child(5) { /* Mood column */
  width: 100px;
  min-width: 80px;
  text-align: left;
}

/* Habits column - consistent width with other columns */
th:nth-child(6), td:nth-child(6) { /* Habits column */
  width: 120px;
  min-width: 100px;
}

/* Habits column header - left aligned */
th:nth-child(6) { /* Habits column header */
  text-align: left;
}

/* Habits column content - center aligned for icons */
td:nth-child(6) { /* Habits column content */
  text-align: center;
}

/* Habits column in journal entries table */
.habits-cell {
  text-align: center;
  padding: var(--space-md);
  width: 120px;
  min-width: 100px;
}

.table-habits-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
  min-height: 24px;
}

/* Table cell content alignment overrides */
td .entry-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Word count left aligned */
td .word-count {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
}

/* ===========================================
   Entries Page - Combined Search & Entries
   =========================================== */
.entries-page {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}

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

.entries-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

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

/* Search Toggle Button */
.search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.search-toggle.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.search-toggle svg {
  width: 16px;
  height: 16px;
}

/* Expandable Search Panel */
.search-panel {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.3s ease;
  margin-bottom: 0;
}

.search-panel.expanded {
  max-height: 80px;
  opacity: 1;
  margin-bottom: var(--space-lg);
}

.search-form {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.search-input-container {
  position: relative;
  flex: 1;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 var(--space-md);
  padding-right: 40px;
  font-size: 1rem;
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(74, 114, 245, 0.2);
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-clear {
  position: absolute;
  right: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--text-tertiary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.search-clear:hover {
  color: var(--text-primary);
  background: var(--background-tertiary);
}

.search-clear svg {
  width: 14px;
  height: 14px;
}

.search-results-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

/* Entries Grid */
.entries-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

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

.load-more-button {
  min-width: 160px;
}

/* Entry Card */
.entry-card {
  display: block;
  padding: var(--space-sm) 0;
  text-decoration: none;
  color: inherit;
}

.entry-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.entry-card-date {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
}

.entry-card-content {
  color: var(--text-primary);
  font-size: 0.9375rem;
  line-height: 1.6;
  transition: opacity 0.15s ease;
}

.entry-card-mood {
  display: flex;
  gap: 2px;
}

.entry-card-mood .mood-dot {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.entry-card-mood .mood-dot.filled {
  color: var(--accent-primary);
}

.entry-card-habits {
  display: flex;
  gap: 4px;
  align-items: center;
}

.entry-card-habit-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: transparent;
  color: var(--text-tertiary);
  transition: all 0.15s ease;
}

.entry-card-habit-icon.completed {
  color: var(--text-primary);
}

.entry-card-habit-icon svg,
.entry-card-habit-icon i {
  width: 14px;
  height: 14px;
}

.entry-card-habit-more {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 0 4px;
}

/* Entries Empty State */
.entries-empty-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-secondary);
}

.entries-empty-state p {
  margin: 0;
}

/* Light theme overrides */
[data-theme="light"] .search-input {
  background: white;
}

/* Responsive */
@media (max-width: 768px) {
  .entries-page {
    padding: var(--space-lg) var(--space-sm);
  }

  .entries-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .entries-title {
    font-size: 1.25rem;
  }

  .entries-header-actions {
    width: 100%;
  }

  .entries-header-actions .button {
    flex: 1;
    justify-content: center;
  }

  .search-form {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .search-input-container {
    width: 100%;
  }

  .date-range {
    width: 100%;
  }

  .date-range .form-select {
    width: 100%;
  }

  .search-panel.expanded {
    max-height: 120px;
  }
}

/* ===========================================
   Nav Icon Link (Settings Cog)
   =========================================== */
.nav-icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.nav-icon-link:hover {
  color: var(--text-primary);
  background: var(--background-tertiary);
}

.nav-icon-link.active {
  color: var(--text-primary);
}

.nav-icon-link svg {
  width: 18px;
  height: 18px;
}

/* ===========================================
   Settings Page - Linear-style Layout
   =========================================== */

/* Override container styles when settings layout is present */
.container:has(.settings-layout) {
  max-width: none;
  padding: 0;
  margin: 0;
}

.settings-layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

/* Settings Sidebar */
.settings-sidebar {
  width: 240px;
  flex-shrink: 0;
  padding: var(--space-xl) var(--space-lg);
  /* Align left padding with nav-container (2.5vw margin + 16px padding - 8px nav-item padding) */
  padding-left: calc(2.5vw + var(--space-md) - var(--space-sm));
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

/* Extend sidebar border to connect with nav */
.settings-sidebar::before {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  width: 1px;
  height: 1px;
  background: var(--border-color);
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.settings-nav-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.settings-nav-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 0 var(--space-sm);
  margin-bottom: var(--space-xs);
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.settings-nav-item:hover {
  color: var(--text-primary);
  background: var(--background-tertiary);
}

.settings-nav-item.active {
  color: var(--text-primary);
  background: var(--background-tertiary);
}

.settings-nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.settings-nav-item.active svg,
.settings-nav-item:hover svg {
  opacity: 1;
}

/* Settings Content Area */
.settings-layout > turbo-frame {
  flex: 1;
  display: flex;
}

.settings-content {
  flex: 1;
  padding: var(--space-2xl) var(--space-xl) var(--space-xl);
}

.settings-section {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  animation: settingsFadeIn 0.2s ease;
}

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

.settings-section.hidden {
  display: none;
}

.settings-section-header {
  margin-bottom: var(--space-lg);
}

.settings-section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs);
  letter-spacing: -0.02em;
}

.settings-section-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

.settings-section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
}

.settings-section-header-row .button {
  flex-shrink: 0;
}

.settings-section-header-row .button svg {
  margin-right: var(--space-xs);
}

/* Settings Card */
.settings-card {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.settings-card-flush {
  padding: 0;
  overflow: hidden;
}

/* Settings Item */
.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
}

.settings-item.stacked {
  flex-direction: column;
  align-items: flex-start;
}

.settings-item-info {
  flex: 1;
}

.settings-item-info h4 {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs);
}

.settings-item-info p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}


/* Settings Forms */
.settings-inline-form {
  width: 100%;
  margin-top: var(--space-md);
}

.settings-form-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.settings-form-row .form-input {
  flex: 1;
  max-width: none;
}

.settings-password-form {
  width: 100%;
}

.settings-form-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.settings-form-actions {
  margin-top: var(--space-lg);
  display: flex;
  justify-content: flex-end;
}

/* Settings Table (used for habits, nudges, etc.) */
.settings-table {
  display: flex;
  flex-direction: column;
}

.settings-table-row-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
  border-bottom: 1px solid var(--border-color);
}

.settings-table-row-link:last-child {
  border-bottom: none;
}

.settings-table-row-link:hover {
  background: var(--background-tertiary);
}

.settings-table-row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--background-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.settings-table-row-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-table-row-name-container {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.settings-table-row-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-table-row-description {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-table-row-arrow {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.settings-table-row-link:hover .settings-table-row-arrow {
  color: var(--text-secondary);
}

/* Settings table row with radio selection */
.settings-table-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.settings-table-row:last-child {
  border-bottom: none;
}

.settings-table-row-radio {
  padding-left: var(--space-lg);
  flex-shrink: 0;
}

.radio-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.radio-indicator:hover {
  border-color: var(--accent-primary);
}

.radio-indicator.selected {
  border-color: var(--accent-primary);
  cursor: default;
}

.radio-indicator .radio-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.15s ease;
}

.radio-indicator:hover .radio-dot {
  background: var(--accent-primary);
  opacity: 0.4;
}

.radio-indicator.selected .radio-dot {
  background: var(--accent-primary);
  opacity: 1;
}

.settings-table-row-link-content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg) var(--space-md) var(--space-md);
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
  transition: background 0.15s ease;
}

.settings-table-row:hover {
  background: var(--background-tertiary);
}

/* Legacy habits-table classes (aliased to settings-table) */
.habits-table {
  display: flex;
  flex-direction: column;
}

.habit-row-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
  border-bottom: 1px solid var(--border-color);
}

.habit-row-link:last-child {
  border-bottom: none;
}

.habit-row-link:hover {
  background: var(--background-tertiary);
}

.habit-row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--background-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.habit-row-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.habit-row-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
}

.habit-row-description {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.habit-row-arrow {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.habit-row-link:hover .habit-row-arrow {
  color: var(--text-secondary);
}

/* Settings Entity Form */
.settings-entity-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.settings-form-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

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

.settings-form-field label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-form-field .field-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0 0 var(--space-sm);
}

.settings-form-field .form-input {
  max-width: none;
  width: 100%;
}

/* Settings Form Actions Bar */
.settings-form-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-lg);
}

.settings-form-actions-left {
  display: flex;
  gap: var(--space-sm);
}

.settings-form-actions-right {
  display: flex;
  gap: var(--space-sm);
}

.active-nudge-note {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  font-style: italic;
}

/* Settings Error Card */
.settings-error-card {
  background: rgba(248, 81, 73, 0.05);
  border-color: rgba(248, 81, 73, 0.2);
}

.settings-error-card .error-messages h4 {
  font-size: 0.875rem;
  font-weight: 500;
  color: #F85149;
  margin: 0 0 var(--space-sm);
}

.settings-error-card .error-messages ul {
  margin: 0;
  padding-left: var(--space-lg);
}

.settings-error-card .error-messages li {
  font-size: 0.8125rem;
  color: #F85149;
  margin-bottom: var(--space-xs);
}

/* Light theme overrides */
[data-theme="light"] .settings-table-row-link:hover {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .settings-table-row-icon {
  background: rgba(0, 0, 0, 0.04);
}

/* Responsive Settings Form */
@media (max-width: 768px) {
  .settings-form-actions-bar {
    flex-direction: column-reverse;
    gap: var(--space-md);
  }

  .settings-form-actions-left,
  .settings-form-actions-right {
    width: 100%;
  }

  .settings-form-actions-left .button,
  .settings-form-actions-right .button {
    flex: 1;
    justify-content: center;
  }
}

/* Settings Row (for export/import/nudges style lists) */
.settings-rows {
  display: flex;
  flex-direction: column;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-row-info h4 {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

.settings-row-info p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0;
}

.settings-row-action {
  flex-shrink: 0;
}

/* Settings Empty State */
.settings-empty-state {
  text-align: center;
  padding: var(--space-xl);
}

.settings-empty-icon {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-md);
  color: var(--text-tertiary);
}

.settings-empty-state h4 {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs);
}

.settings-empty-state p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0 0 var(--space-lg);
}

/* Passkeys list spacing */
#passkeys-list {
  margin-top: var(--space-lg);
}

/* Tooltip styles */
.tooltip-container {
  position: relative;
  display: inline-flex;
  cursor: default;
  margin-right: var(--space-sm);
}

.tooltip-container .tooltip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-sm) var(--space-md);
  background: var(--background-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tooltip-container .tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border-color);
}

.tooltip-container .tooltip-content::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--background-primary);
  z-index: 1;
}

.tooltip-container:hover .tooltip-content {
  opacity: 1;
  visibility: visible;
}

.tooltip-content a {
  color: var(--text-accent);
  text-decoration: underline;
}

.tooltip-content a:hover {
  color: var(--text-primary);
}

/* Light theme overrides for Settings */
[data-theme="light"] .settings-card {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .settings-sidebar {
  border-right-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .settings-nav-item:hover,
[data-theme="light"] .settings-nav-item.active {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .habit-row-link:hover {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .habit-row-icon {
  background: rgba(0, 0, 0, 0.04);
}

/* Responsive Settings - All mobile styles consolidated here */
@media (max-width: 768px) {
  .settings-layout {
    flex-direction: column;
  }

  .settings-sidebar {
    width: 100%;
    position: relative;
    top: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-sm) var(--space-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .settings-nav {
    flex-direction: row;
    gap: var(--space-xs);
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: var(--space-xs);
  }

  .settings-nav-section {
    flex-direction: row;
    gap: var(--space-xs);
    flex-shrink: 0;
  }

  .settings-nav-title {
    display: none;
  }

  .settings-nav-item {
    white-space: nowrap;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8125rem;
    min-width: max-content;
  }

  .settings-nav-item svg {
    width: 14px;
    height: 14px;
  }

  /* Consistent content padding for all settings pages */
  .settings-content {
    padding: var(--space-md);
  }

  .settings-section {
    max-width: none;
    margin: 0;
  }

  .settings-section-header h2 {
    font-size: 1.25rem;
  }

  .settings-section-description {
    font-size: 0.8125rem;
  }

  .settings-section-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }

  .settings-section-header-row .button {
    width: 100%;
    justify-content: center;
    margin-top: 0;
  }

  /* Settings rows - stack on mobile */
  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-sm);
  }

  .settings-row-action {
    width: 100%;
  }

  .settings-row-action .button {
    width: 100%;
    justify-content: center;
  }

  .settings-row-action .form-select {
    width: 100%;
  }

  /* Settings forms */
  .settings-form-row {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .settings-form-row .form-input {
    width: 100%;
    max-width: none;
  }

  .settings-form-row .button {
    width: 100%;
    justify-content: center;
  }

  .settings-inline-form .settings-form-row {
    flex-direction: column;
  }

  .settings-item.stacked .settings-form-row {
    flex-direction: column;
  }

  .settings-form-field .form-input {
    max-width: none;
  }

  /* Settings table rows */
  .settings-table-row-link {
    padding: var(--space-sm);
  }

  .settings-table-row-info {
    min-width: 0;
  }

  .settings-table-row-name {
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .settings-table-row-description {
    font-size: 0.75rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Prevent table overflow */
  .settings-table {
    width: 100%;
    overflow: hidden;
  }

  .settings-card-flush {
    overflow: hidden;
  }

  /* Ensure content doesn't overflow */
  .settings-table-row-content {
    overflow: hidden;
  }

  /* Habit rows */
  .habit-row-link {
    padding: var(--space-sm);
  }

  .habit-row-info {
    min-width: 0;
    gap: 2px;
  }

  .habit-row-name {
    font-size: 0.875rem;
  }

  .habit-row-description {
    font-size: 0.75rem;
  }

  /* Password form */
  .settings-password-form .settings-form-fields {
    gap: var(--space-md);
  }

  /* Ensure settings section fills width */
  .settings-section {
    width: 100%;
  }

  /* Settings cards - full width, reduce border radius */
  .settings-card {
    border-radius: var(--radius-md);
    width: 100%;
  }

  /* All form inputs in settings - full width */
  .settings-section .form-input,
  .settings-section .form-select {
    width: 100%;
    max-width: none;
  }

  /* Settings table with radio - compact padding */
  .settings-table-row {
    flex-wrap: wrap;
  }

  .settings-table-row-radio {
    padding: var(--space-md) var(--space-md) var(--space-md) var(--space-lg);
  }

  .settings-table-row-link-content {
    flex: 1;
    min-width: 0;
    padding: var(--space-md) var(--space-lg) var(--space-md) var(--space-sm);
  }

  .settings-table-row-content {
    min-width: 0;
  }

  .settings-table-row-arrow {
    margin-left: auto;
  }

  /* Form actions - full width button */
  .settings-form-actions {
    width: 100%;
  }

  .settings-form-actions .button {
    width: 100%;
    justify-content: center;
  }
}

/* ===========================================
   Inline Nudge Management in Settings
   =========================================== */

/* Secondary section header for nudges list */
.settings-section-header-secondary {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

.settings-section-header-secondary h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs);
  letter-spacing: -0.01em;
}

/* Inline form container */
.inline-form-container {
  margin-top: var(--space-md);
  width: 100%;
}

.inline-form-container.hidden {
  display: none;
}

.inline-form-header {
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.inline-form-header h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Inline nudge form styles */
.inline-nudge-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

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

.inline-form-field label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.inline-form-field .form-input {
  max-width: none;
  width: 100%;
}

.inline-form-field .journal-entry-editor {
  min-height: 150px;
}

.inline-form-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
}

/* Nudges list */
.nudges-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Nudge item display */
.nudge-item {
  padding: var(--space-lg);
}

.nudge-item.hidden {
  display: none;
}

.nudge-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
}

.nudge-item-info {
  flex: 1;
  min-width: 0;
}

.nudge-item-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.nudge-item-title h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.pill-active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.pill-subtle {
  background: transparent;
  color: var(--text-tertiary);
  border-color: var(--border-color);
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
}

.nudge-item-preview {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nudge-item-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

/* Small button variant */
.button-small {
  height: 32px;
  padding: 0 var(--space-sm);
  font-size: 0.8125rem;
}

/* Danger button variant */
.button-danger {
  color: #F85149;
}

.button-danger:hover {
  background: rgba(248, 81, 73, 0.1);
  border-color: rgba(248, 81, 73, 0.3);
  color: #F85149;
}

/* Nudge item edit mode */
.nudge-item-edit {
  padding: var(--space-lg);
}

.nudge-item-edit.hidden {
  display: none;
}

/* Light theme overrides */
[data-theme="light"] .inline-form-container .settings-card {
  background: white;
}

[data-theme="light"] .nudge-item:hover {
  background: rgba(0, 0, 0, 0.01);
}

/* Responsive nudge management */
@media (max-width: 768px) {
  .nudge-item-header {
    flex-direction: column;
    gap: var(--space-md);
  }

  .nudge-item-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .nudge-item-actions .button {
    flex: 1;
    justify-content: center;
  }

  .inline-form-actions {
    flex-direction: column;
  }

  .inline-form-actions .button {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================
   Focus Mode - Distraction-free writing
   ========================================== */

/* Elements that fade during focus mode */
.nav-header,
.page-header,
.last-week-section,
[data-focus-mode-target="fadeOut"] {
  transition: opacity 2.5s ease;
}

/* Subtle fade - not fully invisible */
.focus-mode-hidden {
  opacity: 0.08 !important;
  pointer-events: none;
}

/* Nudge Log Styles */
.nudge-log-status {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.nudge-log-status-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--mood-5);
}

.nudge-log-status-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--mood-1);
}

/* Dense detail page styles */
.nudge-log-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.nudge-log-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-decoration: none;
}

.nudge-log-back-link:hover {
  color: var(--text-primary);
}

.nudge-log-header-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Inconsolata', monospace;
}

.nudge-log-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--mood-1);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

.nudge-log-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 0.375rem;
}

.nudge-log-output-section {
  margin-bottom: 1.25rem;
}

.nudge-log-output {
  font-size: 0.9375rem;
  color: var(--text-primary);
  font-style: italic;
  padding: 0.5rem 0.75rem;
  background: var(--background-tertiary);
  border-left: 2px solid var(--accent-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nudge-log-prompts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 800px) {
  .nudge-log-prompts-grid {
    grid-template-columns: 1fr;
  }
}

.nudge-log-prompt-section {
  min-width: 0;
}

.nudge-log-prompt {
  margin: 0;
  padding: 0.75rem;
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Inconsolata', monospace;
  font-size: 0.6875rem;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 500px;
  overflow-y: auto;
}

.nudge-log-context-details-section {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--background-secondary);
}

.nudge-log-context-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
}

.nudge-log-context-summary::-webkit-details-marker {
  display: none;
}

.nudge-log-context-summary::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid var(--text-tertiary);
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  margin-right: 0.5rem;
  transition: transform 0.15s ease;
}

.nudge-log-context-details-section[open] .nudge-log-context-summary::before {
  transform: rotate(90deg);
}

.nudge-log-context-badges {
  display: flex;
  gap: 0.5rem;
}

.nudge-log-context-badges span {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  background: var(--background-tertiary);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
}

.nudge-log-context-content {
  padding: 0 0.75rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.nudge-log-context-item {
  /* No extra styling needed */
}

.nudge-log-context-pre {
  margin: 0;
  padding: 0.5rem;
  background: var(--background-tertiary);
  border-radius: var(--radius-sm);
  font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Inconsolata', monospace;
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.nudge-log-context-list {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.nudge-log-context-list div {
  margin-bottom: 0.25rem;
}

.nudge-log-context-list div:last-child {
  margin-bottom: 0;
}

.nudge-log-context-list strong {
  color: var(--text-primary);
}

/* Nudge Log Navigation */
.nudge-log-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.nudge-log-nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nudge-log-position {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.nudge-log-nav-arrows {
  display: flex;
  gap: 0.25rem;
}

.nudge-log-nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--background-tertiary);
  transition: all 0.15s ease;
}

.nudge-log-nav-arrow:hover {
  background: var(--input-background);
  color: var(--text-primary);
}

.nudge-log-nav-arrow.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* Status and Context Badges */
.status-badge {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--mood-5);
}

.status-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--mood-1);
}

.context-badges {
  display: flex;
  gap: 0.25rem;
  flex-wrap: nowrap;
}

.context-badges .badge {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  background: var(--background-tertiary);
  color: var(--text-tertiary);
}

/* Call Type Badges */
.call-type-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 500;
}

.call-type-nudge {
  background: rgba(74, 114, 245, 0.15);
  color: var(--accent-primary);
}

.call-type-memory_extraction {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.call-type-analysis {
  background: rgba(34, 197, 94, 0.15);
  color: var(--mood-5);
}

.call-type-other {
  background: var(--background-tertiary);
  color: var(--text-tertiary);
}

/* Table Cell Helpers */
.truncate-cell {
  max-width: 400px;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Developer Layout - matches settings layout */
.container:has(.developer-layout) {
  max-width: none;
  padding: 0;
  margin: 0;
}

.developer-layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

/* Developer Sidebar - matches settings-sidebar */
.developer-sidebar {
  width: 240px;
  flex-shrink: 0;
  padding: var(--space-xl) var(--space-lg);
  /* Align left padding with nav-container (2.5vw margin + 16px padding - 8px nav-item padding) */
  padding-left: calc(2.5vw + var(--space-md) - var(--space-sm));
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.developer-sidebar::before {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  width: 1px;
  height: calc(100% + 2px);
  background: var(--border-color);
}

.developer-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.developer-nav-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.developer-nav-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 0 var(--space-sm);
  margin-bottom: var(--space-xs);
}

.developer-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.developer-nav-item:hover {
  color: var(--text-primary);
  background: var(--background-tertiary);
}

.developer-nav-item.active {
  color: var(--text-primary);
  background: var(--background-tertiary);
}

.developer-nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.developer-nav-item.active svg,
.developer-nav-item:hover svg {
  opacity: 1;
}

/* Developer Content Area */
.developer-content {
  flex: 1;
  padding: var(--space-xl) var(--space-2xl);
  padding-right: calc(2.5vw + var(--space-md));
  max-width: 100%;
  overflow-x: auto;
}

.developer-content-detail {
  max-width: 1200px;
}

.developer-header {
  margin-bottom: 1.5rem;
}

.developer-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  color: var(--text-primary);
}

.developer-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Developer Monthly Cards */
.developer-monthly-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.developer-monthly-card {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  transition: all 0.15s ease;
}

.developer-monthly-card:hover {
  border-color: var(--border-color-hover);
}

.developer-monthly-card.active {
  border-color: var(--accent-primary);
  background: var(--background-tertiary);
}

.developer-monthly-card-header {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.developer-monthly-card-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.developer-monthly-card-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
}

/* Developer Filters */
.developer-filters {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
}

.developer-filter-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Developer Tables - Full Width */
.developer-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.developer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.developer-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 500;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.developer-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
}

.developer-table tr {
  transition: background 0.15s ease;
}

.developer-table tr[data-link] {
  cursor: pointer;
}

.developer-table tr:hover {
  background: var(--background-tertiary);
}

.developer-table tr:hover td {
  color: var(--text-primary);
}

/* Developer Empty State */
.developer-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-tertiary);
}

.developer-empty-state svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.developer-empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 0.5rem 0;
}

.developer-empty-state p {
  font-size: 0.875rem;
  margin: 0 0 1.5rem 0;
}

/* Developer Detail Page */
.developer-detail-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.developer-detail-nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.developer-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-decoration: none;
}

.developer-back-link:hover {
  color: var(--text-primary);
}

.developer-position {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.developer-nav-arrows {
  display: flex;
  gap: 0.25rem;
}

.developer-nav-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--background-tertiary);
  transition: all 0.15s ease;
}

.developer-nav-arrow:hover {
  background: var(--input-background);
  color: var(--text-primary);
}

.developer-nav-arrow.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.developer-detail-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Inconsolata', monospace;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.developer-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--mood-1);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

.developer-section {
  margin-bottom: 1.25rem;
}

.developer-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 0.375rem;
}

.developer-output {
  font-size: 0.9375rem;
  color: var(--text-primary);
  font-style: italic;
  padding: 0.5rem 0.75rem;
  background: var(--background-tertiary);
  border-left: 2px solid var(--accent-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.developer-prompts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 1000px) {
  .developer-prompts-grid {
    grid-template-columns: 1fr;
  }
}

.developer-prompt-section {
  min-width: 0;
}

.developer-prompt {
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.5;
  font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Inconsolata', monospace;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
  margin: 0;
}

.developer-context-details {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 1rem;
}

.developer-context-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.developer-context-summary::-webkit-details-marker {
  display: none;
}

.developer-context-summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid var(--text-tertiary);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
}

.developer-context-details[open] .developer-context-summary::before {
  transform: rotate(90deg);
}

.developer-context-badges {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.developer-context-badges span {
  font-size: 0.6875rem;
  padding: 0.125rem 0.375rem;
  background: var(--background-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
}

.developer-context-content {
  border-top: 1px solid var(--border-color);
  padding: 1rem;
}

.developer-context-item {
  margin-bottom: 1rem;
}

.developer-context-item:last-child {
  margin-bottom: 0;
}

.developer-context-pre {
  background: var(--background-tertiary);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Inconsolata', monospace;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
  margin: 0;
}

.developer-context-list {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.developer-context-list div {
  margin-bottom: 0.25rem;
}

.developer-context-list div:last-child {
  margin-bottom: 0;
}

.developer-context-list strong {
  color: var(--text-primary);
}

/* Developer responsive */
@media (max-width: 768px) {
  .developer-layout {
    flex-direction: column;
  }

  .developer-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
  }

  .developer-nav {
    position: static;
    display: flex;
    gap: 0.5rem;
    padding: 0 1rem;
  }

  .developer-nav-item {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
  }

  .developer-nav-item.active {
    border-left: none;
  }

  .developer-content {
    padding: 1.5rem;
  }

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

/* ===========================================
   Mobile Optimizations for 375px and below
   =========================================== */

/* Desktop/Mobile Header Toggle - CSS-based responsive navigation */
/* Mobile header hidden by default on desktop */
.nav-header-mobile {
  display: none;
}

/* Desktop header visible by default */
.nav-header-desktop {
  display: block;
}

@media (max-width: 768px) {
  /* Hide desktop header on mobile */
  .nav-header-desktop {
    display: none;
  }

  /* Show mobile header on mobile */
  .nav-header-mobile {
    display: block;
  }

  /* Add body padding for fixed mobile header */
  body {
    padding-top: 48px;
  }
}

/* Entry List Page - Mobile Fixes */
@media (max-width: 480px) {
  .entries-page {
    padding: var(--space-md) var(--space-sm);
  }

  .entries-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
  }

  .entries-header-actions {
    display: flex;
    gap: var(--space-xs);
    width: auto;
  }

  /* Make buttons more compact on mobile */
  .entries-header-actions .button {
    padding: 0 var(--space-sm);
    font-size: 0.8125rem;
  }

  /* Hide "Week Review" text, show icon only or shorter text */
  .entries-header-actions .button-secondary span {
    display: none;
  }

  .entries-header-actions .button-secondary::before {
    content: "Week";
  }

  /* Search panel adjustments */
  .search-panel.expanded {
    max-height: 160px;
  }

  .search-form {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .search-input-container {
    width: 100%;
  }

  .date-range {
    width: 100%;
  }

  .date-range .form-select {
    width: 100%;
  }

  /* Entry cards spacing */
  .entries-grid {
    gap: var(--space-md);
  }

  .entry-card {
    padding: var(--space-xs) 0;
  }

  .entry-card-header {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }

  .entry-card-habits {
    flex-wrap: wrap;
  }
}

/* New Entry Page - Mobile Fixes */
@media (max-width: 480px) {
  .narrow-page {
    padding: var(--space-md) var(--space-sm);
  }

  /* Page header stacking - actions above title on mobile */
  .narrow-page .page-header {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .page-title-group {
    width: 100%;
  }

  .page-title {
    font-size: 1.25rem;
  }

  /* Entry meta inline - stack on very small screens */
  .entry-meta-inline {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  /* Word count hidden on small mobile */
  .word-count-inline {
    display: none;
  }

  /* Header actions - left aligned above date (for show page) */
  .narrow-page .header-actions {
    justify-content: flex-start;
    gap: var(--space-xs);
  }

  /* For new entry page - full width actions with select */
  .narrow-page .header-actions:has(.select) {
    width: 100%;
    justify-content: space-between;
    gap: var(--space-sm);
  }

  .narrow-page .header-actions .select {
    flex: 1;
    min-width: 0;
  }

  .narrow-page .header-actions .button {
    flex-shrink: 0;
  }

  /* Mood selector compact */
  .mood-selector {
    gap: 1px;
  }

  .mood-dot {
    font-size: 0.6875rem;
  }

  /* Habit icons compact */
  .habit-icons {
    gap: 2px;
  }

  .habit-icon-button {
    width: 16px;
    height: 16px;
  }

  .habit-icon-button i {
    width: 12px;
    height: 12px;
  }
}

/* Very small screens (320px) */
@media (max-width: 360px) {
  /* Even more compact settings nav */
  .settings-nav-item {
    padding: var(--space-xs) 6px;
    font-size: 0.6875rem;
  }

  .settings-nav-item svg {
    width: 12px;
    height: 12px;
  }

  /* Entry header - stack search toggle with buttons */
  .entries-header {
    flex-wrap: wrap;
  }

  .entries-header-actions {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }

  .entries-header-actions .button-primary {
    flex: 1;
  }

  /* New entry header - even more compact */
  .narrow-page .header-actions {
    flex-direction: column;
  }

  .narrow-page .header-actions .select {
    width: 100%;
  }

  .narrow-page .header-actions .button {
    width: 100%;
    justify-content: center;
  }

  /* Hide habit icons on very small screens if more than 3 */
  .habit-icons .habit-icon-button:nth-child(n+4) {
    display: none;
  }

  .habit-icons::after {
    content: attr(data-more);
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    display: none;
  }
}

/* Fix for journal entry show page on mobile */
@media (max-width: 480px) {
  .journal-entry-editor {
    min-height: 150px;
    font-size: 0.875rem;
  }

  /* Tiptap editor toolbar */
  .tiptap-toolbar {
    flex-wrap: wrap;
    gap: var(--space-xs);
    padding: var(--space-xs);
  }

  .tiptap-toolbar button {
    padding: var(--space-xs);
  }
}

/* Fix alert position on mobile */
@media (max-width: 480px) {
  .alert {
    bottom: var(--space-sm);
    right: var(--space-sm);
    left: var(--space-sm);
    max-width: none;
    font-size: 0.8125rem;
  }
}

/* Analysis page mobile fixes */
@media (max-width: 480px) {
  .analysis-list {
    gap: var(--space-sm);
    margin: var(--space-md) 0;
  }

  .analysis-link {
    padding: var(--space-md);
  }
}

/* Authentication forms - ensure full width on mobile */
@media (max-width: 480px) {
  .auth-container {
    padding: var(--space-md);
  }

  .auth-container .form-input {
    width: 100%;
    max-width: none;
  }

  .auth-container .button {
    width: 100%;
  }
}

/* ============================================
   Reviews
   ============================================ */

/* Reviews Index */
.page-header-actions {
  display: flex;
  gap: var(--space-sm);
}

.review-draft-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}

.draft-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
}

.reviews-section {
  margin-bottom: var(--space-xl);
}

.reviews-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.reviews-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.review-card {
  display: block;
  padding: var(--space-md);
  background: var(--background-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.review-card:hover {
  border-color: var(--text-tertiary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

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

.review-period {
  font-weight: 500;
  color: var(--text-primary);
}

.review-date {
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

.review-card-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.meta-separator {
  color: var(--text-tertiary);
  margin: 0 var(--space-xs);
}

/* Reviews New Page */
.review-new-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.review-period-info {
  text-align: center;
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border-color);
}

.review-period-info h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs) 0;
}

.period-entries-count {
  color: var(--text-secondary);
  margin: 0;
}

.previous-review-summary {
  padding: var(--space-md);
  background: var(--background-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.previous-review-summary h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 var(--space-xs) 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.previous-period {
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 var(--space-sm) 0;
}

.previous-intentions {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.previous-intentions strong {
  display: block;
  margin-bottom: var(--space-xs);
}

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

.form-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

.period-entries-preview {
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-lg);
}

.period-entries-preview h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 var(--space-md) 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.entries-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.preview-entry-mini {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--background-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.preview-entry-mini .entry-date {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.preview-entry-mini .entry-mood {
  color: var(--text-tertiary);
  white-space: nowrap;
}

.preview-entry-mini .entry-preview {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* Reviews Edit Page */
.wide-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}

.review-edit-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-xl);
}

.review-edit-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.review-edit-prompts {
  padding: var(--space-md);
  background: var(--background-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.review-prompt-hint {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 var(--space-sm) 0;
}

.review-prompts-list {
  margin: 0;
  padding-left: var(--space-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.review-prompts-list li {
  margin-bottom: var(--space-xs);
}

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

.review-form-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.review-edit-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.review-edit-sidebar h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 var(--space-sm) 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-entries-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.sidebar-entry {
  display: block;
  padding: var(--space-sm);
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.sidebar-entry:hover {
  border-color: var(--text-tertiary);
}

.sidebar-entry-date {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.sidebar-entry-mood {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.sidebar-entry-preview {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
  line-height: 1.4;
}

.sidebar-previous-review {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm);
  background: var(--background-secondary);
  border-radius: var(--radius-sm);
}

.button-small {
  font-size: 0.75rem;
  padding: 4px 8px;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 12px;
  text-transform: capitalize;
}

.status-draft {
  background: var(--background-tertiary);
  color: var(--text-secondary);
}

.status-interviewing {
  background: rgba(59, 130, 246, 0.1);
  color: rgb(59, 130, 246);
}

.status-synthesizing {
  background: rgba(168, 85, 247, 0.1);
  color: rgb(168, 85, 247);
}

.status-completed {
  background: rgba(34, 197, 94, 0.1);
  color: rgb(34, 197, 94);
}

.status-failed {
  background: rgba(239, 68, 68, 0.1);
  color: rgb(239, 68, 68);
}

/* Reviews Show Page */
.review-show-header {
  margin-bottom: var(--space-lg);
}

.review-show-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
}

.review-show-date-meta h1 {
  margin-bottom: var(--space-xs);
}

.review-show-meta-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.review-type-badge {
  font-weight: 500;
  color: var(--text-primary);
}

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

.inline-form {
  display: inline;
}

.review-show-detail {
  margin-bottom: var(--space-lg);
}

/* Review processing/status states */
.review-status-message {
  text-align: center;
  padding: var(--space-xl);
}

.review-status-message h2 {
  margin: 0 0 var(--space-sm) 0;
}

.review-status-message p {
  color: var(--text-secondary);
  margin: 0 0 var(--space-md) 0;
}

.review-status-message.error h2 {
  color: rgb(239, 68, 68);
}

.status-text {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.status-detail {
  font-size: 0.875rem;
}

.draft-preview {
  text-align: left;
  padding: var(--space-md);
  background: var(--background-secondary);
  border-radius: var(--radius-md);
  margin: var(--space-md) 0;
}

.draft-preview h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 var(--space-sm) 0;
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--space-md);
}

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

/* Synthesis content */
.synthesis-content {
  padding: var(--space-lg);
  background: var(--background-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.synthesis-content h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 var(--space-md) 0;
  color: var(--text-primary);
}

.synthesis-content h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: var(--space-lg) 0 var(--space-sm) 0;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
}

.synthesis-content h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.synthesis-content p,
.synthesis-content ul,
.synthesis-content ol {
  margin: 0 0 var(--space-md) 0;
  line-height: 1.6;
}

.synthesis-content ul,
.synthesis-content ol {
  padding-left: var(--space-lg);
}

/* Review metadata sections */
.review-show-metadata details {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  background: var(--background-primary);
}

.review-show-metadata summary {
  padding: var(--space-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.review-show-metadata summary:hover {
  background: var(--background-secondary);
}

.review-show-metadata summary h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-secondary);
}

.review-show-metadata details[open] summary {
  border-bottom: 1px solid var(--border-color);
}

.reflection-content,
.interview-content,
.entries-content,
.previous-review-content {
  padding: var(--space-md);
}

.interview-round {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.interview-round:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.interview-round h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 var(--space-md) 0;
}

.qa-pair {
  margin-bottom: var(--space-md);
}

.qa-pair:last-child {
  margin-bottom: 0;
}

.qa-question {
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs) 0;
}

.qa-answer {
  color: var(--text-secondary);
  margin: 0;
  padding-left: var(--space-md);
  border-left: 2px solid var(--border-color);
}

/* Preview entries in review show */
.preview-entry {
  display: block;
  padding: var(--space-md);
  background: var(--background-secondary);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  text-decoration: none;
  transition: background 0.15s ease;
}

.preview-entry:last-child {
  margin-bottom: 0;
}

.preview-entry:hover {
  background: var(--background-tertiary);
}

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

.preview-entry-date {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.preview-entry-mood {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.preview-entry-content {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Interview Actions */
.interview-actions {
  justify-content: flex-start;
}

/* Reviews responsive */
@media (max-width: 900px) {
  .review-edit-container {
    grid-template-columns: 1fr;
  }

  .review-edit-sidebar {
    order: -1;
    max-height: 200px;
    overflow-y: auto;
    padding: var(--space-md);
    background: var(--background-secondary);
    border-radius: var(--radius-md);
  }
}

@media (max-width: 600px) {
  .review-show-header-top {
    flex-direction: column;
  }

  .review-show-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .review-form-actions {
    flex-direction: column;
  }

  .review-form-actions .button {
    width: 100%;
  }
}

