/* ============================================================
   Tracker — Core Layout Engine
   Consumes CSS variables from theme files in /css/themes/
   ============================================================ */

/* ---- Layout tokens ---- */
:root {
  --sidebar-width: 240px;
  --bottom-bar-height: 64px;
}

/* ---- Reset / Base ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  max-width: none;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body > .app-shell { max-width: none; margin: 0; padding: 0; }

/* Subtle ambient glow for dark themes */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 600px 600px at 15% 50%, rgba(var(--accent-rgb, 0,255,204), 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 500px 500px at 85% 20%, rgba(var(--accent-secondary-rgb, 139,92,246), 0.04) 0%, transparent 70%);
}

/* ---- Typography ---- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

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

small, .text-sm { font-size: 0.8125rem; }

/* ---- Glass Card (replaces PicoCSS article) ---- */
article, .card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

article:hover, .card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

article > header {
  margin: -1.25rem -1.25rem 1rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

article > footer {
  margin: 1rem -1.25rem -1.25rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* ---- Buttons ---- */
button, [type="submit"], [role="button"] {
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.55rem 1.1rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

button:not(.outline):not(.secondary), [type="submit"]:not(.outline) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--btn-text);
  font-weight: 700;
}
button:not(.outline):not(.secondary):hover, [type="submit"]:not(.outline):hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--btn-text);
  box-shadow: 0 0 20px rgba(var(--accent-rgb, 0,255,204), 0.25);
}

.outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}
.outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

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

/* ---- Form Elements ---- */
input:not([type="checkbox"]):not([type="radio"]),
select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: 0.6rem 0.85rem;
  transition: all var(--transition-fast);
  width: 100%;
  display: block;
}

/* Checkbox / Radio */
input[type="checkbox"], input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* Select dropdown styling */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

select option {
  background: var(--bg-card-solid, #141925);
  color: var(--text-primary);
  padding: 0.5rem;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 0,255,204), 0.15);
  outline: none;
}

/* Form labels (inside forms/details only) */
details label,
form label,
.form-group label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

details label > input,
details label > select,
details label > textarea,
form label > input,
form label > select,
form label > textarea {
  margin-top: 0.3rem;
}

/* ---- Tables ---- */
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 0.8125rem;
}

th {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

tbody tr { transition: background var(--transition-fast); }
tbody tr:hover { background: rgba(var(--accent-rgb, 0,255,204), 0.04); }

figure { margin: 0; overflow-x: auto; }

/* ---- Progress ---- */
progress {
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  border: none;
  background: var(--border);
}
progress::-webkit-progress-bar { background: var(--border); border-radius: 3px; }
progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary, #8b5cf6));
  border-radius: 3px;
}
progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary, #8b5cf6));
  border-radius: 3px;
}

/* ---- Details/Accordion ---- */
details {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
details > summary {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  color: var(--text-primary);
  text-transform: uppercase;
}
details[open] > summary {
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}
details > form { padding: 0 1.1rem 1.1rem; }

/* ---- Textarea ---- */
textarea {
  width: 100%;
  resize: vertical;
  min-height: 5rem;
}

/* ---- Form Grids ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: end;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: end;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: end;
}

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

/* ============================================================
   App Shell
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  overflow: hidden;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--text-sidebar-active);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 0.75rem 0.625rem; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  text-decoration: none;
  color: var(--text-sidebar);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all var(--transition-fast);
  margin-bottom: 2px;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: var(--text-sidebar-active);
}

.sidebar-nav a.active {
  background: var(--sidebar-accent);
  color: var(--text-sidebar-active);
  box-shadow: var(--shadow-glow);
}

.sidebar-nav .nav-icon {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem 2.5rem;
  min-height: 100vh;
  position: relative;
}

/* ---- Sidebar Select Dropdowns (Theme / Language) ---- */
.sidebar-select-group {
  width: 100%;
}

.theme-select,
.lang-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-sidebar);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 7px 28px 7px 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.theme-select:hover,
.lang-select:hover {
  border-color: var(--accent);
  color: var(--text-sidebar-active);
}

.theme-select:focus,
.lang-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 0,255,204), 0.15);
  outline: none;
}

.theme-select option,
.lang-select option {
  background: var(--bg-card-solid, #141925);
  color: var(--text-primary);
}

/* ---- Bottom Tabs ---- */
.bottom-tabs { display: none; }

/* ---- Mobile Settings Overlay ---- */
.mobile-settings-overlay { display: none; }
.mobile-settings-overlay.open { display: block; }

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---- Cards Grid ---- */
/* Flex grid: cards wrap naturally, grow to fill, last card expands */
.cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.cards-grid > * {
  flex: 1 1 300px;
  min-width: 280px;
}

/* ---- Stat Card ---- */
.stat-card {
  padding: 1.25rem;
  position: relative;
}

/* Left accent — use border instead of ::before to avoid overflow clip issues */
.stat-card {
  border-left: 3px solid var(--accent);
}

.stat-card h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-heading);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.stat-card .value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.stat-card .subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}

/* ---- Quick Actions ---- */
.quick-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-info { background: var(--info-light); color: var(--info); }

/* ---- Streak Badge ---- */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--warning-light);
  color: var(--warning);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
}

/* ---- Delete / Action Links ---- */
.btn-delete {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.75rem;
  padding: 0.25rem 0.35rem;
  border-radius: 4px;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.btn-delete:hover {
  color: var(--danger);
  background: var(--danger-light);
}

/* ---- Color Utilities ---- */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent) !important; }

/* ---- Live Indicator ---- */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.5);
  animation: livePulse 2s ease-in-out infinite;
}

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

/* ---- Mobile ---- */
@media (max-width: 768px) {
  .sidebar { display: none; }

  .bottom-tabs {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-bar-height);
    background: var(--bg-card-solid, #0d1117);
    backdrop-filter: blur(20px) saturate(1.4);
    border-top: none;
    z-index: 100;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    /* Top border glow effect */
    box-shadow:
      0 -1px 0 0 rgba(var(--accent-rgb, 0,255,204), 0.25),
      0 -4px 15px rgba(var(--accent-rgb, 0,255,204), 0.06),
      0 -8px 30px rgba(0, 0, 0, 0.4);
  }

  .bottom-tabs::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(var(--accent-rgb, 0,255,204), 0.4) 20%,
      rgba(var(--accent-rgb, 0,255,204), 0.6) 50%,
      rgba(var(--accent-rgb, 0,255,204), 0.4) 80%,
      transparent 100%
    );
  }

  .bottom-tabs a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.575rem;
    font-weight: 600;
    padding: 6px 2px;
    flex: 1;
    min-width: 0;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: relative;
    border-radius: 0;
  }

  .bottom-tabs a:hover {
    color: var(--text-primary);
    background: transparent;
  }

  .bottom-tabs a.active {
    color: var(--accent);
  }

  .bottom-tabs a.active .nav-icon {
    filter: drop-shadow(0 0 6px rgba(var(--accent-rgb, 0,255,204), 0.5));
  }

  .bottom-tabs a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(var(--accent-rgb, 0,255,204), 0.5);
  }

  .bottom-tabs .nav-icon {
    font-size: 1.25rem;
    line-height: 1;
    transition: filter 0.2s ease;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
    padding-bottom: calc(var(--bottom-bar-height) + 1.5rem);
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Prevent wide tables / figures from causing horizontal scroll */
  table { display: block; overflow-x: auto; }
  figure { max-width: 100%; }

  /* Collapse grid-2 to single column on small screens */
  .grid-2 { grid-template-columns: 1fr; }

  /* Page header stacks vertically */
  .page-header { flex-direction: column; align-items: flex-start; }

  /* ---- Mobile Settings Overlay ---- */
  .mobile-settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
  }

  .mobile-settings-overlay.open {
    display: block;
  }

  .mobile-settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
  }

  .mobile-settings-drawer {
    position: absolute;
    bottom: var(--bottom-bar-height);
    left: 0;
    right: 0;
    background: var(--bg-card-solid, #0d1117);
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    padding: 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.25s ease;
  }

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

  .mobile-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .mobile-settings-close {
    background: none !important;
    border: none !important;
    color: var(--text-muted);
    font-size: 1.4rem;
    padding: 0 !important;
    margin: 0;
    cursor: pointer;
    line-height: 1;
    width: auto;
    min-width: 0;
    text-transform: none;
    box-shadow: none !important;
  }

  .mobile-settings-close:hover {
    color: var(--text-primary);
    background: none !important;
    box-shadow: none !important;
  }

  .mobile-settings-body {
    padding: 1rem 1.25rem 1.5rem;
  }

  .mobile-settings-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
    margin-top: 0.75rem;
  }

  .mobile-settings-label:first-child {
    margin-top: 0;
  }

  .mobile-settings-body .theme-select,
  .mobile-settings-body .lang-select {
    margin-bottom: 0.25rem;
  }

  .mobile-settings-link {
    display: block;
    margin-top: 1rem;
    padding: 0.7rem;
    text-align: center;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.15s ease;
  }

  .mobile-settings-link:hover {
    background: rgba(var(--accent-rgb, 0,255,204), 0.08);
    border-color: var(--accent);
  }
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card-solid);
  border-left: 3px solid var(--accent);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 350px;
  font-size: 0.8125rem;
  font-weight: 500;
  backdrop-filter: var(--glass-blur);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Utility: Layout ---- */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 0.75rem; }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: 0.35rem; }
.mb-md { margin-bottom: 0.5rem; }
.m-0 { margin: 0; }
.p-0 { padding: 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.pre-wrap { white-space: pre-wrap; }
.opacity-muted { opacity: 0.7; }
.text-lg { font-size: 1.1rem; }
.dot-unchecked { opacity: 0.35; font-size: 1.25rem; }
.input-narrow { max-width: 120px; }

/* ---- Entry separator ---- */
.entry-separator {
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
}

/* ---- Inline form row ---- */
.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
}

/* ---- Small action buttons ---- */
.btn-sm {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
}

.btn-inline {
  margin: 0;
  padding: 0.3rem 0.75rem;
}

/* ---- Delete link ---- */
.link-danger {
  color: var(--danger);
  font-size: 0.85rem;
  text-decoration: none;
}
.link-danger:hover {
  color: var(--danger);
  opacity: 0.8;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

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

/* ---- Mood Widget ---- */
.mood-widget-form { margin: 0; }

.mood-emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.3rem 0 0.5rem;
}

.mood-emoji-option {
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  transition: all 0.1s;
}

.mood-emoji-option.selected {
  outline: 2px solid var(--accent);
  background: rgba(var(--accent-rgb, 0,255,204), 0.15);
  border-radius: 6px;
}

.mood-energy-row { margin: 0.3rem 0; }

.mood-energy-label { color: var(--text-muted); }

.mood-energy-slider {
  width: 100%;
  accent-color: var(--accent);
}

.mood-submit { width: 100%; }

.mood-today-summary {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---- Mood Page (index) ---- */
.mood-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 0.4rem;
  margin: 0.5rem 0 1rem;
}

button.mood-chip,
button.mood-chip:hover,
button.mood-chip:active,
button.mood-chip:focus {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.6rem;
  border: 2px solid var(--border, #333);
  border-radius: 0.5rem;
  background: var(--bg-card-solid, #141925);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 0;
  width: auto;
  text-transform: none;
  letter-spacing: 0;
  font-weight: normal;
  box-shadow: none;
  flex: 0 0 auto;
}
button.mood-chip:hover {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb, 0,255,204), 0.2);
  background: var(--bg-card-hover, #1f2535);
}
button.mood-chip.active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb, 0,255,204), 0.12);
  box-shadow: 0 0 12px rgba(var(--accent-rgb, 0,255,204), 0.3);
}

.mood-chip-emoji {
  font-size: 1.8rem;
  line-height: 1;
}
.mood-chip-label {
  font-size: 0.7rem;
  margin-top: 0.25rem;
  opacity: 0.7;
}

.energy-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  opacity: 0.5;
  margin-top: 0.25rem;
  width: 100%;
}

.mood-entries {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.mood-entry {
  padding: 0.75rem;
  border-left: 3px solid var(--accent, #0ff);
  background: rgba(var(--accent-rgb, 0, 255, 204), 0.03);
  border-radius: 0 0.25rem 0.25rem 0;
}
.mood-entry-time {
  font-family: var(--font-mono, monospace);
  opacity: 0.6;
  margin-right: 0.5rem;
}
.mood-entry-emoji {
  font-size: 1.3rem;
  margin-right: 0.5rem;
}
.mood-entry-energy .energy-filled {
  color: var(--accent, #0ff);
  font-size: 0.6rem;
}
.mood-entry-energy .energy-empty {
  opacity: 0.2;
  font-size: 0.6rem;
}
.mood-entry-notes {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  opacity: 0.8;
}

.trend-mood {
  font-size: 1.5rem;
}
.trend-energy {
  width: 1.5rem;
  height: 2.5rem;
  margin: 0.25rem auto;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.energy-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--accent, #0ff);
  border-radius: 2px 2px 0 0;
  opacity: 0.7;
  transition: height 0.3s ease;
}

.mt-md { margin-top: 1rem; }

/* ---- Rest Timer (Exercise) ---- */
.rest-timer-display {
  text-align: center;
}
.rest-timer-time {
  font-size: 2.5rem !important;
  font-family: var(--font-mono, monospace);
  margin: 0.5rem 0;
}
.rest-timer-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.rest-timer-bar {
  width: 100%;
  height: 8px;
}
.rest-timer-active {
  border-left-color: var(--warning, #f59e0b);
  animation: timerPulse 1s ease-in-out infinite;
}
@keyframes timerPulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 15px rgba(var(--accent-rgb, 0,255,204), 0.2); }
}

/* ---- Shortcuts (Expenses) ---- */
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}
.shortcut-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 0.75rem;
}
.shortcut-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.shortcut-icon {
  font-size: 1.5rem;
}

/* ---- Heatmap (Habits) ---- */
.heatmap-container { overflow-x: auto; }

.heatmap-grid {
  display: flex;
  gap: 2px;
}
.heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: rgba(255,255,255,0.06);
}
.heatmap-empty { background: transparent; }
.heatmap-l0 { background: rgba(255,255,255,0.06); }
.heatmap-l1 { background: rgba(var(--accent-rgb, 0,255,204), 0.4); }
.heatmap-l2 { background: rgba(var(--accent-rgb, 0,255,204), 0.85); }
.heatmap-today { outline: 1px solid var(--accent); }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 0.5rem;
  justify-content: flex-end;
}
.heatmap-legend .heatmap-cell {
  width: 10px;
  height: 10px;
}

/* ---- Monthly Calendar (Habits) ---- */
.habit-calendar {
  max-width: 350px;
  margin: 0 auto;
}
.cal-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-day {
  text-align: center;
  padding: 0.4rem 0;
  font-size: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.cal-day:hover:not(.cal-out):not(.cal-future) {
  background: rgba(var(--accent-rgb, 0,255,204), 0.15);
}
.cal-out {
  opacity: 0.2;
  cursor: default;
}
.cal-future {
  opacity: 0.3;
  cursor: default;
}
.cal-logged {
  background: rgba(var(--accent-rgb, 0,255,204), 0.4);
  font-weight: 700;
  color: var(--text-primary);
}
.cal-today {
  outline: 2px solid var(--accent);
  border-radius: 4px;
}

/* ---- Monthly Bars (Habits) ---- */
.monthly-bars {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  height: 120px;
  padding-top: 0.5rem;
}
.monthly-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 2px;
}
.monthly-bar {
  width: 100%;
  max-width: 30px;
  min-height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  opacity: 0.8;
}
.text-accent { color: var(--accent); }

/* ---- Charts ---- */
.charts-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}
.chart-container {
  flex: 0 0 auto;
  max-width: 250px;
}
.chart-container.chart-wide {
  flex: 1;
  max-width: 100%;
  height: 220px;
}
.chart-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.legend-item strong {
  margin-left: auto;
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
}
.legend-color {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .charts-row {
    flex-direction: column;
    align-items: center;
  }
  .chart-container {
    max-width: 200px;
  }
}

/* ---- Utility: Inline Style Replacements ---- */
.m-0-i { margin: 0; }
.p-compact { padding: 0.3rem; }
.font-sm { font-size: 0.9rem; }
.font-xs { font-size: 0.85rem; }
.font-xxs { font-size: 0.75rem; }
.w-full { width: 100%; }
.no-decoration { text-decoration: none; }
.cursor-pointer { cursor: pointer; }
.flex-1 { flex: 1; }
.gap-xs { gap: 0.3rem; }
.mb-xs { margin-bottom: 0.3rem; }
.mb-lg { margin-bottom: 1.5rem; }
.mt-xs { margin-top: 0.4rem; }
.mt-sm { margin-top: 0.5rem; }
.opacity-muted-more { opacity: 0.5; }

/* Widget text sizing */
.widget-text { font-size: 0.9rem; }
.widget-value { font-size: 0.95rem; line-height: 1.6; }

/* Inline edit form pattern */
.inline-edit-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.inline-edit-form label { margin: 0; }
.inline-edit-form input,
.inline-edit-form select { margin: 0; padding: 0.3rem; }
.inline-edit-form button { margin: 0; padding: 0.3rem 0.75rem; }

/* Input compact sizes */
.input-icon { max-width: 60px; }
.input-order { width: 60px; margin: 0; padding: 0.3rem; }
.input-file { max-width: 220px; }

/* Color swatch */
.color-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

/* Section description (settings) */
.section-desc {
  margin-bottom: 1rem;
}

/* Settings data actions row */
.actions-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Widget separator */
.widget-separator {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 0.3rem;
  padding-bottom: 0.3rem;
}

/* Auth form button */
.auth-submit {
  width: 100%;
  margin-top: 0.5rem;
}

/* Sidebar settings link */
.sidebar-settings-link {
  display: block;
  text-align: center;
  margin-bottom: 8px;
  text-decoration: none;
}

/* Mobile module link */
.mobile-module-link {
  display: block;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-primary);
}

/* Recurring pay form */
.recurring-pay-form {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  margin: 0;
}
.recurring-pay-input {
  width: 90px;
  margin: 0;
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
}
.recurring-pay-btn {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  margin: 0;
}
