/* ============================================================
   Dayflow — Main Stylesheet
   Soft, minimal, distraction-free design system
   ============================================================ */

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

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Colors — Light */
  --bg-base:       #f7f5f2;
  --bg-surface:    #ffffff;
  --bg-sidebar:    #faf9f7;
  --bg-hover:      #f0ede9;
  --bg-input:      #f7f5f2;

  --text-primary:  #1a1917;
  --text-secondary:#6b6760;
  --text-muted:    #a8a39c;
  --text-on-accent:#ffffff;

  --accent:        #6366f1;      /* Indigo */
  --accent-light:  #ede9fe;
  --accent-hover:  #4f46e5;

  --success:       #16a34a;
  --success-light: #dcfce7;
  --danger:        #dc2626;
  --danger-light:  #fee2e2;
  --warning:       #d97706;
  --warning-light: #fef3c7;

  --border:        rgba(0,0,0,0.07);
  --border-focus:  #6366f1;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 28px rgba(99,102,241,0.15), 0 2px 8px rgba(0,0,0,0.05);

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --sidebar-width: 220px;

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark theme */
[data-theme="dark"] {
  --bg-base:       #111010;
  --bg-surface:    #1c1b1a;
  --bg-sidebar:    #161514;
  --bg-hover:      #252422;
  --bg-input:      #252422;

  --text-primary:  #f0ede9;
  --text-secondary:#a8a39c;
  --text-muted:    #6b6760;

  --accent:        #818cf8;
  --accent-light:  #1e1d3f;
  --accent-hover:  #6366f1;

  --success:       #4ade80;
  --success-light: #052e16;
  --danger:        #f87171;
  --danger-light:  #450a0a;
  --warning:       #fbbf24;
  --warning-light: #451a03;

  --border:        rgba(255,255,255,0.07);

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.2);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
  --shadow-hover: 0 8px 28px rgba(129,140,248,0.2), 0 2px 8px rgba(0,0,0,0.3);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition-slow), color var(--transition-slow);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* ---------- Utility ---------- */
.hidden { display: none !important; }

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

/* ============================================================
   HOME PAGE
   ============================================================ */

.home-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  transition: background var(--transition-slow);
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon { font-size: 1.4rem; }

.brand-name {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Hero */
.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem 3rem;
  gap: 3.5rem;
}

.home-hero {
  text-align: center;
  max-width: 480px;
}

.home-title {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.home-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.6;
}

/* Module Grid */
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  width: 100%;
  max-width: 860px;
}

.module-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: 2rem 1.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background var(--transition-slow),
    border-color var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.module-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-light) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: inherit;
}

.module-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.module-card:hover::before { opacity: 1; }

.card-icon {
  font-size: 2rem;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.card-body {
  flex: 1;
  position: relative;
  z-index: 1;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

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

.card-arrow {
  font-size: 1.1rem;
  color: var(--text-muted);
  align-self: flex-end;
  position: relative;
  z-index: 1;
  transition: color var(--transition), transform var(--transition);
}

.module-card:hover .card-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* Footer */
.home-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ============================================================
   MODULE PAGES — SHARED LAYOUT
   ============================================================ */

.module-page {
  height: 100vh;
  overflow: hidden;
}

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

/* ---------- Sidebar ---------- */
.module-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  gap: 0;
  transition: background var(--transition-slow);
  overflow-y: auto;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  margin-bottom: 1.5rem;
}

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

.back-arrow {
  font-size: 0.9rem;
  transition: transform var(--transition);
}

.back-link:hover .back-arrow { transform: translateX(-3px); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.6rem;
  margin-bottom: 1.5rem;
}

.sidebar-icon { font-size: 1.4rem; }

.sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

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

.sidebar-nav-item.active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 500;
}

.sidebar-spacer { flex: 1; }

.sidebar-theme-btn {
  align-self: flex-start;
  margin-top: 1rem;
}

/* ---------- Module Content ---------- */
.module-content {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem 2.75rem;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .module-content { padding: 1.5rem 1.25rem; }
}

/* Loading Screen */
.loading-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

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

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

.loading-text {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* View */
.view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

/* Content Header */
.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.content-eyebrow {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.content-title {
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 4rem 2rem;
  text-align: center;
}

.empty-icon { font-size: 2.5rem; }

.empty-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.6;
}

/* ============================================================
   SHARED UI COMPONENTS
   ============================================================ */

/* Card */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-slow), border-color var(--transition);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition),
              box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
}
.btn-primary:hover { background: var(--accent-hover); }

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { filter: brightness(0.9); }

.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1rem;
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Form Elements */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

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

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.65rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition),
              background var(--transition-slow);
  outline: none;
  appearance: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
}

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

.form-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6760' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.form-hint a { color: var(--accent); }
.form-hint a:hover { text-decoration: underline; }
.form-hint code {
  font-size: 0.78rem;
  background: var(--bg-hover);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

.form-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 0.6rem 0.875rem;
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

/* Theme Toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  font-size: 1rem;
  transition: background var(--transition), transform var(--transition);
}

.theme-toggle:hover {
  background: var(--accent-light);
  transform: rotate(15deg);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  animation: slideUp 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.modal-sm { max-width: 340px; }

@keyframes slideUp { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: none; } }

.modal-header {
  padding: 1.75rem 1.75rem 0;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.3rem;
}

.modal-subtitle {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.modal-body {
  padding: 1.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.75rem 1.75rem;
}

/* Save Toast */
.save-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.45rem 1rem;
  box-shadow: var(--shadow-md);
  font-size: 0.8rem;
  color: var(--text-secondary);
  z-index: 200;
  transition: opacity var(--transition), transform var(--transition);
}

.save-toast.hidden { opacity: 0; pointer-events: none; }

.toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

.toast-dot.success { background: var(--success); animation: none; }
.toast-dot.error   { background: var(--danger);  animation: none; }

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

/* ============================================================
   HABITS MODULE
   ============================================================ */

/* Progress Bar */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.progress-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width var(--transition-slow);
  width: 0%;
}

.progress-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
}

/* Habit List */
.habit-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.habit-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.1rem;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--transition),
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
  cursor: pointer;
}

.habit-item:hover { box-shadow: var(--shadow-sm); }

.habit-item.checked {
  border-color: var(--success);
  background: var(--success-light);
}

.habit-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: transparent;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

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

.habit-name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-primary);
  transition: color var(--transition);
}

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

.habit-streak {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.streak-fire { font-size: 0.85rem; }

/* Add habit form */
.add-habit-form {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  align-items: center;
}

.add-habit-form .form-input { flex: 1; }

/* Manage list */
.habit-manage-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.habit-manage-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), background var(--transition);
}

.habit-manage-name {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* ============================================================
   IDEAS MODULE
   ============================================================ */

.idea-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.idea-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    border-color var(--transition),
    background var(--transition-slow);
}

.idea-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: rgba(99,102,241,0.2);
}

.idea-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.45rem;
}

.idea-status-dot.idea        { background: var(--warning); }
.idea-status-dot.in-progress { background: var(--accent); }
.idea-status-dot.completed   { background: var(--success); }

.idea-body { flex: 1; min-width: 0; }

.idea-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.idea-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.idea-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.idea-badge {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.18em 0.55em;
  border-radius: 99px;
  letter-spacing: 0.02em;
}

.idea-badge.idea        { background: var(--warning-light); color: var(--warning); }
.idea-badge.in-progress { background: var(--accent-light);  color: var(--accent);  }
.idea-badge.completed   { background: var(--success-light); color: var(--success); }

.idea-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.idea-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.idea-card:hover .idea-actions { opacity: 1; }

/* ============================================================
   JOURNAL MODULE
   ============================================================ */

.journal-editor {
  padding: 0;
  overflow: hidden;
}

.journal-textarea {
  display: block;
  width: 100%;
  min-height: 420px;
  padding: 1.5rem;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-weight: 300;
}

.journal-textarea::placeholder { color: var(--text-muted); }

.journal-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Month Navigation */
.month-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.month-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  font-size: 1rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.month-btn:hover { background: var(--accent-light); color: var(--accent); }

.month-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 100px;
  text-align: center;
}

/* Past Entries */
.past-entries-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.past-entry-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition), background var(--transition-slow);
}

.past-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.1rem;
  cursor: pointer;
  transition: background var(--transition);
}

.past-entry-header:hover { background: var(--bg-hover); }

.past-entry-date {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.past-entry-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.past-entry-chevron {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.past-entry-card.open .past-entry-chevron { transform: rotate(180deg); }

.past-entry-body {
  display: none;
  padding: 0 1.1rem 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.75;
  white-space: pre-wrap;
  border-top: 1px solid var(--border);
  padding-top: 0.875rem;
}

.past-entry-card.open .past-entry-body { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 860px) {
  .module-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
  }
}

@media (max-width: 680px) {
  .home-header { padding: 1.25rem 1.5rem; }
  .home-main   { padding: 3rem 1.25rem 2rem; gap: 2.5rem; }

  .module-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 0.75rem 1rem;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 50;
    overflow-x: auto;
    gap: 0.5rem;
  }

  .module-page { overflow: auto; }
  .module-layout { flex-direction: column; height: auto; min-height: 100vh; }
  .module-content { padding-bottom: 100px; overflow-y: unset; }

  .sidebar-brand, .sidebar-spacer, .sidebar-theme-btn { display: none; }

  .back-link { margin-bottom: 0; }
  .sidebar-nav { flex-direction: row; gap: 0.35rem; }
  .sidebar-nav-item { padding: 0.4rem 0.7rem; white-space: nowrap; }

  .idea-actions { opacity: 1; }
  .module-content { padding: 1.25rem 1rem; }
}
