/* Google Tasks visual styles */
.tasks-v2 {
  border-radius: 16px;
  padding: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  margin-top: 12px;
  margin-bottom: 12px;
}
.tasks-v2-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; }
.tasks-v2-title { font-size:13px; font-weight:700; display:flex; align-items:center; gap:8px; }
.tasks-v2-actions { display:flex; align-items:center; gap:8px; }
.tasks-v2-list { display:flex; flex-direction:column; gap:8px; }
.task-item { font-size:13px; padding:10px 12px; border-radius:12px; background: var(--panel-bg); border:1px solid var(--border); color: var(--text); display:flex; align-items:center; gap:10px; }
.task-item:hover { border-color: rgba(var(--accent-green-r), 0.28); }
.task-title { font-weight:500; }
.tasks-status { font-size:12px; color: var(--muted); margin-left:8px; }
.task-item.completed .task-title { color: var(--muted); text-decoration: line-through; }
.task-complete-checkbox { width: 16px; height: 16px; accent-color: var(--accent-green); }
.tasks-count-pill { display:inline-flex; align-items:center; justify-content:center; min-width:20px; height:20px; padding:0 6px; border-radius:999px; background: var(--panel-bg); border:1px solid var(--border); font-size:12px; color: var(--muted); }

/* Goals list styling (Year / Month / Week) */
.goals-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 8px;
  margin-top: 8px;
}
.goals-input-row input {
  flex: 1;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  padding: 8px 12px;
  font-size: 13px;
}
.goals-add-btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 0;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  font-size: 18px;
  margin: 0;
}
.goals-list { display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.goal-item {
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--text);
  display:flex;
  align-items:center;
  gap: 8px;
}
.goal-item:hover { border-color: rgba(var(--accent-green-r), 0.28); }
.goal-title { flex:1; font-weight:500; }
.goal-item.completed .goal-title { color: var(--muted); text-decoration: line-through; }
.goal-complete-checkbox { width:16px; height:16px; accent-color: var(--accent-green); }
.goal-remove-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  color: var(--muted);
}
.goal-remove-btn:hover { color: #b00; }
.goals-empty { font-size:12px; color: var(--muted); padding:6px 2px; }
.goals-northstar-display {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.goals-northstar-placeholder { color: var(--muted); font-size: 13px; margin-top:6px; }
.goals-northstar-edit { display:flex; align-items:center; gap:8px; margin-top:10px; }
.goals-northstar-edit input {
  flex: 1;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  padding: 8px 10px;
  font-size: 13px;
}
/* Remove button for workout logs */
.wo-remove-btn {
  margin-top: 10px;
  float: right;
  transition: background 0.15s, color 0.15s, border 0.15s;
}
.wo-remove-btn.btn-danger:hover {
  background: #ffeaea;
  color: #b00;
  border-color: #fbb;
}
/* ========== RESET ========== */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", system-ui, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: background var(--transition-fast), color var(--transition-fast);
}

:root {
  /* Primary accent (blue) */
  --accent-green: #3a6ff8; /* using blue everywhere */
  --accent-green-r: 58,111,248; /* rgb for JS rgba shortcuts */

  /* Core theme variables (light mode defaults) */
  --bg: #f5f6f7;
  --text: #1b1b1d;
  --muted: #6e6e73;
  --panel-bg: rgba(255,255,255,0.92);
  --surface: rgba(255,255,255,0.95);
  --border: rgba(15,15,18,0.06);
  --glass: rgba(255,255,255,0.72);
  --input-bg: rgba(255,255,255,0.9);
  --shadow: 0 6px 20px rgba(0,0,0,0.06);
  --transition-fast: 160ms ease;
  
  /* Solid backgrounds for overlays/panels that should not show through */
  --settings-bg: #ffffff;
  --tasks-bg: #ffffff;
  /* Card backgrounds (e.g., schedule events) */
  --card-bg: #ffffff;
}

/* Dark theme overrides (applied when .theme-dark is present on <html>) */
.theme-dark {
  --bg: #0f1112;
  --text: #e9eef6;
  --muted: #9aa0a6;
  --panel-bg: rgba(12,13,14,0.6);
  --surface: rgba(18,19,20,0.6);
  --border: rgba(255,255,255,0.04);
  --glass: rgba(18,19,20,0.32);
  --input-bg: rgba(255,255,255,0.03);
  --shadow: 0 8px 28px rgba(0,0,0,0.6);
  
  /* Solid variants in dark mode */
  --settings-bg: #121314;
  --tasks-bg: #141516;
  --card-bg: #141516;
}

/* Ensure form controls inherit site font */
button, input, textarea, select { font-family: inherit; font-size: inherit; }

/* Generic button styles */
.btn { border-radius: 10px; padding: 8px 10px; border: 1px solid rgba(15,15,18,0.08); background: transparent; cursor: pointer; }
.btn-small { padding: 6px 8px; font-size: 12px; }
.btn-danger { color: #d44; border-color: rgba(212,68,68,0.12); background: transparent; }
.btn-ghost { background: transparent; border-color: rgba(15,15,18,0.06); color: inherit; }

/* File input styling (improve default ugly look) */
input[type="file"] { padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
input[type="file"]::-webkit-file-upload-button { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
input[type="file"]::-ms-browse { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }

/* ========== OS SHELL ========== */
.os {
  min-height: 100%;
  padding: 20px 22px 26px;
}

/* ========== TOPBAR ========== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  position: relative; /* allow dropdown positioning */
}

/* Weather dropdown */
.weather-dropdown { position: absolute; top: calc(100% + 8px); right: 0; background: var(--panel-bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,0.08); padding: 10px; min-width: 220px; z-index: 40; }
.weather-dropdown { max-width: 92vw; }
.weather-dropdown-title { font-size: 12px; color: #6e6e73; margin-bottom: 8px; }
.weather-forecast { display: flex; gap: 8px; justify-content: space-between; }
.weather-forecast .fw-item { display:flex; flex-direction:column; align-items:center; gap:6px; padding:4px; flex:1; }
.weather-forecast .fw-day { font-size:12px; color:#6e6e73; }
.weather-forecast .fw-icon { font-size:18px; }
.weather-forecast .fw-temp { font-weight:600; }
.weather-pill[aria-expanded="true"] .weather-dropdown { display:block; }


.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.clock {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.dot-sep {
  color: #9a9aa1;
  font-size: 14px;
  transform: translateY(-1px);
}

.date {
  font-size: 14px;
  color: #6e6e73;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
}

.weather-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.weather-icon { font-size: 14px; line-height: 1; }
.weather-temp { font-weight: 600; font-size: 13px; }
.weather-pill.loading { opacity: 0.7; }
.weather-pill.error { opacity: 0.6; color: #9a9aa1; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9a9aa1;
  box-shadow: 0 0 0 3px rgba(154, 154, 161, 0.15);
}

.status-text {
  font-size: 12px;
  color: #6e6e73;
}

/* Right section of topbar */
.topbar-right { display:flex; align-items:center; gap:8px; }

/* Day divider inside Schedule */
.day-divider {
  margin: 6px 0 4px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

/* ========== GRID ========== */
.grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 320px 1fr 360px;
  gap: 14px;
  min-height: calc(100vh - 116px);
}

/* ========== PANELS ========== */
.panel {
  border-radius: 18px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  padding: 16px;
  overflow: hidden;
}

.panel-title {
  font-size: 12px;
  letter-spacing: 0.2px;
  color: #6e6e73;
  margin-bottom: 12px;
}

.panel-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom: 12px; }

/* Modal for Add/Edit Event */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.28); }
.modal-content { position: relative; background: var(--panel-bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; width: min(560px, 92vw); max-height: 80vh; overflow: auto; }
.modal-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }

/* ========== LEFT: TODAY ========== */
.focus-card {
  border-radius: 16px;
  padding: 14px 14px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.75));
  border: 1px solid rgba(15, 15, 18, 0.06);
}

.focus-label {
  font-size: 12px;
  color: #6e6e73;
  margin-bottom: 6px;
}

.focus-text {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.7px;
  line-height: 1.12;
  white-space: nowrap;
  overflow: hidden;
}

.focus-sub {
  margin-top: 8px;
  font-size: 12px;
  color: #6e6e73;
}

/* `.micro` removed from HTML; styles intentionally dropped. */

.connect {
  margin-top: 14px;
  width: 100%;
  border-radius: 14px;
  padding: 12px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.2px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}
.connect:hover { border-color: rgba(58, 111, 248, 0.35); }
.connect:active { transform: translateY(1px); }

.hint {
  margin-top: 12px;
  font-size: 12px;
  color: #8a8a90;
  line-height: 1.35;
}

/* ========== CENTER: TIMELINE ========== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 2px;
}

.event {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
}

.event-past {
  opacity: 0.6;
}

.event-current {
  border-color: rgba(var(--accent-green-r), 0.35);
  box-shadow: 0 0 0 4px rgba(var(--accent-green-r), 0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(245,246,247,0.65));
}

.event-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 120px;
}

.event-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(58, 111, 248, 0.9);
  box-shadow: 0 0 0 4px rgba(58, 111, 248, 0.14);
}

.event-current .event-dot {
  background: var(--accent-green);
  box-shadow: 0 0 0 4px rgba(var(--accent-green-r), 0.18);
}

.event-time {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.event-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text);
  line-height: 1.25;
}

/* Local (unsynced) event styling */
.event-local .event-dot {
  background: #9a9aa1;
  box-shadow: 0 0 0 4px rgba(154, 154, 161, 0.14);
}
.event-local .event-title {
  opacity: 0.9;
}

/* Event action buttons */
.event-actions { margin-left:auto; display:flex; align-items:center; gap:6px; }
.event-action-btn { height:26px; padding:4px 8px; border-radius:8px; font-size:12px; }

.empty {
  padding: 14px 12px;
  border-radius: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

/* ========== RIGHT: WORKOUTS ========== */
.workout-card {
  border-radius: 16px;
  padding: 14px;
  background: rgba(245, 246, 247, 0.65);
  border: 1px solid rgba(15, 15, 18, 0.06);
  margin-bottom: 12px;
  overflow: hidden;
}

/* WHOOP recovery glow states (exact brand colors) */
.whoop-glow-good { border-color: rgba(22, 199, 132, 0.35) !important; box-shadow: 0 0 0 6px rgba(22, 199, 132, 0.14) !important; }
.whoop-glow-okay { border-color: rgba(245, 200, 76, 0.35) !important; box-shadow: 0 0 0 6px rgba(245, 200, 76, 0.14) !important; }
.whoop-glow-bad  { border-color: rgba(229, 83, 61, 0.35) !important; box-shadow: 0 0 0 6px rgba(229, 83, 61, 0.14) !important; }

/* WHOOP recovery ring + advice layout */
.recovery-row { display:flex; align-items:center; gap:14px; }
.recovery-ring { width: 120px; height: 120px; display:flex; align-items:center; justify-content:center; }
.recovery-ring svg { width: 100%; height: 100%; display:block; }
.recovery-advice { font-size:16px; font-weight:600; letter-spacing:-0.2px; }

.workout-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.workout-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.workout-sub {
  font-size: 12px;
  color: #8a8a90;
}

.workout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.field {
  display: block;
  margin-bottom: 10px;
}

.field-label {
  display: block;
  font-size: 12px;
  color: #6e6e73;
  margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
input[type="date"],
textarea,
input[type="file"] {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  padding: 10px 10px;
  font-size: 13px;
  outline: none;
}

/* Money inputs: rounded + right-aligned for cleaner currency entry */
#moneyIn,
#moneyOut {
  text-align: right;
  border-radius: 14px;
  height: 40px;
  appearance: textfield;
  -moz-appearance: textfield;
}
/* Hide spin buttons in WebKit to keep the pill look */
#moneyIn::-webkit-outer-spin-button,
#moneyIn::-webkit-inner-spin-button,
#moneyOut::-webkit-outer-spin-button,
#moneyOut::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.35;
}

.workout-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.primary {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.primary:hover { border-color: rgba(58, 111, 248, 0.35); }

.wo-status {
  font-size: 12px;
  color: #6e6e73;
  white-space: nowrap;
}

.workout-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wo-item {
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(15, 15, 18, 0.05);
}

.wo-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

/* Money ledger row layout tweaks */
.money-row-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.money-tag-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-bg);
  font-size: 11px;
  text-transform: capitalize;
}

.money-del-btn {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

/* Money monthly net coloring */
.money-net-positive {
  color: #0a7b34;
}

.money-net-negative {
  color: #c62828;
}

.money-net-label {
  margin-left: 6px;
  font-size: 12px;
}

.wo-item-date {
  font-size: 12px;
  color: #6e6e73;
  font-variant-numeric: tabular-nums;
}

.wo-item-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.wo-item-notes {
  font-size: 12px;
  color: var(--text);
  opacity: 0.92;
  white-space: pre-wrap;
  word-break: break-word;
}

.wo-item-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: #3a6ff8;
  text-decoration: none;
}

.footer-note {
  margin-top: 8px;
  font-size: 12px;
  color: #9a9aa1;
}

/* ========== DAILY SUMMARY STYLES ========== */
.daily-stats { font-size: 13px; color: var(--text); }
.metric-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.daily-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric-card { border-radius: 12px; padding: 10px; background: var(--card-bg); border: 1px solid var(--border); }
.metric-title { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.metric-value { font-size: 14px; font-weight: 700; letter-spacing: -0.2px; }
.metric-divider { margin: 10px 0 8px; font-size: 12px; color: var(--muted); }

/* Daily controls */
.daily-controls { display:flex; flex-direction:column; gap:8px; }
.daily-controls-row { display:flex; align-items:center; gap:8px; flex-wrap: wrap; }
.daily-controls-row .field { min-width: 160px; flex: 1 1 160px; }
.daily-controls-row .primary, .daily-controls-row .btn { flex: 0 0 auto; }

/* Goals row layout to avoid overlap */
.goals-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; align-items: end; }
.goals-row .primary { justify-self: start; }

/* Tools row layout to avoid overlap */
.tools-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; align-items: end; }
.tools-row .primary, .tools-row .btn { justify-self: start; min-width: max-content; }
.daily-preset-group { display:flex; align-items:center; gap:6px; }
.daily-dropzone { margin-top:8px; border:1px dashed var(--border); border-radius:10px; padding:10px; font-size:12px; color: var(--muted); text-align:center; background: var(--panel-bg); width: 100%; }

/* Trends */
.daily-trends { display:grid; grid-template-columns: 1fr; gap:8px; }
.trend-row { display:flex; align-items:center; gap:10px; }
.trend-label { font-size:12px; color: var(--muted); min-width:90px; }
.trend-spark { flex:1; height:36px; border-radius:10px; background: var(--panel-bg); border:1px solid var(--border); display:flex; align-items:center; overflow: hidden; }
.trend-spark svg { width:100%; height:100%; }
.trend-current { font-size:12px; color: var(--text); min-width:90px; text-align:right; }
.trend-badge { display:inline-flex; align-items:center; gap:6px; padding:4px 8px; border-radius:999px; border:1px solid var(--border); font-size:12px; color: var(--muted); }

/* Compliance */
.daily-compliance { display:grid; grid-template-columns: 1fr; gap:8px; }
.compliance-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px; border-radius:12px; background: var(--card-bg); border:1px solid var(--border); }
.comp-label { font-size:12px; color: var(--muted); }
.comp-value { font-size:14px; font-weight:700; }
.comp-pill { border-radius:999px; padding:6px 10px; border:1px solid var(--border); background: var(--panel-bg); font-size:12px; }

/* Simple data table (daily) */
.simple-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.simple-table thead th { position: sticky; top: 0; z-index: 2; background: var(--panel-bg); border-bottom: 1px solid var(--border); padding: 10px; text-align: left; white-space: nowrap; }
.simple-table tbody td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.simple-table tbody tr:hover { background: var(--surface); }
.simple-table th:not(:first-child), .simple-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.simple-table th:first-child, .simple-table td:first-child { text-align: left; color: var(--muted); }
.simple-table caption { text-align: left; padding: 6px 0; font-size: 12px; color: var(--muted); }

/* Status coloring */
.good { color: #2d7a2b; }
.warn { color: #a6761b; }
.bad { color: #b03a3a; }

/* ========== SETTINGS ========== */
.settings { position: relative; display: inline-flex; }
/* Make settings/workout buttons match theme button size/shape */
.settings-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-bg);
  cursor: pointer;
  font-size: 16px;
  transition: transform 120ms ease, background var(--transition-fast), color var(--transition-fast);
}
.settings-toggle:hover { box-shadow: var(--shadow); border-color: rgba(var(--accent-green-r), 0.35); }
.settings-toggle:active { transform: translateY(1px); }
.settings-dropdown { position: absolute; top: calc(100% + 8px); right: 0; background: var(--panel-bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,0.08); padding: 12px; min-width: 240px; z-index: 50; }
.settings-dropdown { max-width: 92vw; }
.settings-title { font-size: 12px; color: #6e6e73; margin-bottom: 8px; }
.settings-section { margin-bottom: 10px; }
.settings-section + .settings-section { border-top: 1px solid var(--border); padding-top: 8px; }
.settings-subtitle { font-size: 12px; color: #6e6e73; margin-bottom: 6px; }
.settings-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; }
.settings-dropdown input[type="checkbox"], .settings-dropdown input[type="radio"] { accent-color: var(--accent-green); }
.settings-row input { margin-right: 6px; }

/* Task list accents */
.tasks-v2 .task-complete-checkbox { accent-color: var(--accent-green); }

/* Theme button alignment to match pills (kept for backward compat; overridden below) */
.theme-toggle { border-radius: 999px; padding: 6px 8px; border: 1px solid var(--border); background: var(--panel-bg); cursor: pointer; }

/* ========== HABITS (v2) ========== */
.habit-v2 {
  border-radius: 16px;
  padding: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  margin-top: 12px;
  margin-bottom: 12px;
}
.settings-dropdown { position: absolute; top: calc(100% + 8px); right: 0; background: var(--settings-bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,0.08); padding: 12px; min-width: 240px; z-index: 50; }
.settings-dropdown { max-width: 92vw; }
.habit-v2-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.habit-v2-title { font-size:13px; font-weight:700; }
.habit-v2-sub { font-size:12px; color:#8a8a90; }
.habit-v2-actions { display:flex; align-items:center; gap:8px; }
.habit-v2-form { display:grid; grid-template-columns: 1fr auto auto; gap:8px; align-items:center; margin-bottom:10px; }
.habit-v2-form input { flex:1; min-width:0; height:38px; border-radius:12px; border:1px solid var(--border); background: var(--input-bg); }
.habit-v2 .primary, .habit-v2 .btn { height:38px; padding: 0 14px; border-radius:12px; display:inline-flex; align-items:center; justify-content:center; }

.habit-v2-list { display:flex; flex-direction:column; gap:8px; }
.habit-card-v2 { display:flex; flex-direction:column; gap:8px; padding:12px; border-radius:12px; background: var(--card-bg); border:1px solid var(--border); }
.habit-card-top { display:flex; align-items:center; gap:12px; }
.habit-card-top .btn-danger { height:28px; padding: 6px 10px; border-radius:10px; }
.habit-title-v2 { font-size:13px; font-weight:700; }
.habit-grid-v2 { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.habit-square { width:22px; height:22px; border-radius:6px; background: var(--panel-bg); border:1px solid var(--border); cursor:pointer; display:inline-flex; align-items:center; justify-content:center; transition:all 120ms ease; }
.habit-square.done { background: var(--accent-green); color:#fff; }
.habit-square:hover { border-color: rgba(var(--accent-green-r), 0.35); }
.habit-square.done { box-shadow: 0 0 0 3px rgba(var(--accent-green-r), 0.12); }
.habit-controls { display:flex; align-items:center; gap:8px; justify-content:flex-end; }
.habit-meta { font-size:12px; color: var(--muted); }

/* ========== END HABITS ========== */

/* ========== RESPONSIVE ========== */
@media (max-width: 1060px) {
  .grid { grid-template-columns: 1fr; }
  .workout-grid { grid-template-columns: 1fr; }
}

/* Smaller topbar for narrow screens */
@media (max-width: 640px) {
  .topbar { padding: 8px; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
  .topbar-left { flex: 1 1 100%; min-width: 0; }
  .topbar-right { flex: 1 1 100%; min-width: 0; justify-content: flex-start; gap: 6px; flex-wrap: wrap; }
  .clock { font-size: 16px; }
  .date { display: none; }
  .grid { gap: 10px; padding-top: 10px; }
  /* Smaller pills/buttons to avoid overlap */
  .weather-pill { padding: 4px 8px; gap: 6px; font-size: 12px; }
  .weather-icon { font-size: 13px; }
  .weather-temp { font-size: 12px; }
  .status-pill { padding: 6px 8px; gap: 6px; }
  .status-text { font-size: 11px; }
  .topbar-right .theme-toggle,
  .topbar-right .settings-toggle,
  .topbar-right a.settings-toggle { width: 32px; height: 32px; font-size: 14px; }
  /* Ensure settings dropdown stays within viewport */
  .settings { position: static; }
  .settings-dropdown { right: 8px; left: auto; max-width: calc(100vw - 16px); }
  /* Stack event rows to prevent squeeze */
  .event { flex-direction: column; align-items: flex-start; }
  .event-left { min-width: 0; }
  .event-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  /* Habit form: stack controls on small screens */
  .habit-v2-form { grid-template-columns: 1fr; }
  .habit-v2 .primary, .habit-v2 .btn { width: 100%; }
}

/* Hide status text on very small screens to prevent wrapping */
@media (max-width: 400px) {
  .status-text { display: none; }
  /* Allow focus text to wrap on very small screens */
  .focus-text { white-space: normal; overflow: visible; }
}

/* Theme toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-bg);
  cursor: pointer;
  font-size: 16px;
  transition: transform 120ms ease, background var(--transition-fast), color var(--transition-fast);
}
.theme-toggle:active { transform: translateY(1px); }
.theme-toggle:hover { box-shadow: var(--shadow); border-color: rgba(var(--accent-green-r), 0.35); }

/* --- ANCHOR/PILL RESETS FOR CONSISTENT STYLE --- */
/* Ensure pill-styled anchors look like buttons, not blue underlined links */
a.settings-toggle { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
a.settings-toggle:link { color: var(--text); text-decoration: none; }
a.settings-toggle:visited { color: var(--text); text-decoration: none; }
a.settings-toggle:hover { box-shadow: var(--shadow); border-color: rgba(var(--accent-green-r), 0.35); }
a.settings-toggle:active { text-decoration: none; }

/* Make primary anchors match button style */
.primary { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; }
.primary:link { color: var(--text); text-decoration: none; }
.primary:visited { color: var(--text); text-decoration: none; }
.primary:active { text-decoration: none; }

/* ========== DARK THEME OVERRIDES ========== */
.theme-dark .weather-dropdown,
.theme-dark .wo-item,
.theme-dark .workout-card,
.theme-dark .panel,
.theme-dark .focus-card,
.theme-dark .habit-v2,
.theme-dark .habit-card-v2,
.theme-dark .empty {
  background: var(--panel-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

/* Dark theme: ensure schedule events are visible (no white gradient) */
.theme-dark .event {
  background: var(--card-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}
.theme-dark .event-current {
  background: var(--card-bg) !important; /* remove light gradient in dark mode */
  border-color: rgba(var(--accent-green-r), 0.35) !important;
  box-shadow: 0 0 0 4px rgba(var(--accent-green-r), 0.12) !important;
}

.theme-dark input,
.theme-dark textarea,
.theme-dark select,
.theme-dark button {
  background: var(--input-bg) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

.theme-dark ::placeholder { color: rgba(255,255,255,0.38) !important; }

.theme-dark .panel-title,
.theme-dark .date,
.theme-dark .micro-k,
.theme-dark .hint,
.theme-dark .workout-sub,
.theme-dark .wo-status,
.theme-dark .footer-note,
.theme-dark .habit-v2-sub,
.theme-dark .status-text,
.theme-dark .weather-dropdown-title,
.theme-dark .weather-forecast .fw-day,
.theme-dark .dot-sep,
.theme-dark .wo-item-date {
  color: var(--muted) !important;
}

.theme-dark .connect,
.theme-dark .primary,
.theme-dark .btn,
.theme-dark .theme-toggle {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

.theme-dark .habit-square { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.04); }
.theme-dark .habit-square.done { background: var(--accent-green); color: #fff; }

.theme-dark .weather-forecast .fw-item { background: transparent !important; }

/* ensure list links remain readable */
.theme-dark a { color: #7ea6ff; }

