/* ==========================================================================
   Move! — Stylesheet
   Dark-first, flat surfaces, two-font system (Baloo 2 / Inter).
   See move-design-spec.md for the source tokens.
   ========================================================================== */

:root {
  --bg: #0E0F12;
  --surface: #181A1F;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.15);
  --text-primary: #F3F4F6;
  --text-secondary: #8B90A0;
  --text-eyebrow: #C7CAD1;
  --accent: #1D9E75;
  --accent-text: #04342C;
  --low-bg: #0C447C;   --low-text: #B5D4F4;
  --mid-bg: #633806;   --mid-text: #FAC775;
  --high-bg: #712B13;  --high-text: #F5C4B3;
  --muted-bg: #181A1F; --muted-border: rgba(255,255,255,0.08);
  --muted-icon: #4B4F58; --muted-text: #5B5F68;
  /* Non-effort categories — deliberately outside the low/mid/high system so
     "Screen Time" is never visually mistaken for a movement effort tier. */
  --non-activity-bg: #4A2E38; --non-activity-text: #E3B8C4;
  --restorative-bg: #2E2565;  --restorative-text: #C7BBFA;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --space-xs: 4px; --space-sm: 8px; --space-md: 12px; --space-lg: 16px; --space-xl: 20px;

  --danger-bg: #712B13;
  --danger-text: #F5C4B3;

  --nav-height: 64px;
  --sidebar-width: 220px;
  --header-height: 64px;
}

/* ---------------------------------------------------------------------- */
/* Reset                                                                   */
/* ---------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
h1, h2, h3, h4 { margin: 0; font-family: 'Baloo 2', sans-serif; font-weight: 800; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input, select, textarea { font-family: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }

/* ---------------------------------------------------------------------- */
/* Layout                                                                  */
/* ---------------------------------------------------------------------- */
.app-shell {
  max-width: 1080px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  padding: var(--space-xl);
  padding-bottom: calc(var(--nav-height) + var(--space-xl));
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl) var(--space-sm);
}

.app-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.2px;
}
.app-title .dot { color: var(--accent); }

.eyebrow {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-eyebrow);
  margin-bottom: var(--space-md);
}

.eyebrow-muted {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

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

/* Desktop: main content + sidebar nav */
@media (min-width: 860px) {
  .app-shell { flex-direction: row-reverse; max-width: none; }
  .screen-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
  }
  .screen {
    max-width: 900px;
    padding-bottom: var(--space-xl);
  }
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--space-xl);
    align-items: start;
  }
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 17px;
  background: transparent;
  color: var(--text-primary);
  transition: transform 0.08s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  width: 100%;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 12px;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 18px;
}

/* ---------------------------------------------------------------------- */
/* Cards / list items                                                     */
/* ---------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

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

.item-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.item-meta {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  color: var(--text-secondary);
  font-size: 13px;
}

/* ---------------------------------------------------------------------- */
/* Icon tiles                                                              */
/* ---------------------------------------------------------------------- */
.icon-tile {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  font-size: 18px;
}
.icon-tile.lg { width: 48px; height: 48px; font-size: 20px; }

.icon-tile.effort-low  { background: var(--low-bg);  color: var(--low-text); }
.icon-tile.effort-mid  { background: var(--mid-bg);  color: var(--mid-text); }
.icon-tile.effort-high { background: var(--high-bg); color: var(--high-text); }
.icon-tile.category-non_activity { background: var(--non-activity-bg); color: var(--non-activity-text); }
.icon-tile.category-restorative  { background: var(--restorative-bg); color: var(--restorative-text); }
.icon-tile.accent { background: var(--accent); color: var(--accent-text); }
.icon-tile.muted { background: var(--muted-bg); border: 1px solid var(--muted-border); color: var(--muted-icon); }

/* ---------------------------------------------------------------------- */
/* Effort chips                                                            */
/* ---------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 4px 9px;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.chip.effort-low  { background: var(--low-bg);  color: var(--low-text); }
.chip.effort-mid  { background: var(--mid-bg);  color: var(--mid-text); }
.chip.effort-high { background: var(--high-bg); color: var(--high-text); }
.chip.category-non_activity { background: var(--non-activity-bg); color: var(--non-activity-text); }
.chip.category-restorative  { background: var(--restorative-bg); color: var(--restorative-text); }

/* ---------------------------------------------------------------------- */
/* Progress ring                                                           */
/* ---------------------------------------------------------------------- */
.progress-ring-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto;
}
.progress-ring-wrap svg { transform: rotate(-90deg); }
.progress-ring-track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 8; }
.progress-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s ease;
}
.progress-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.progress-ring-value {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 22px;
}
.progress-ring-caption {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

/* ---------------------------------------------------------------------- */
/* Badge tiles                                                             */
/* ---------------------------------------------------------------------- */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: var(--space-md);
}
.badge-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  text-align: center;
}
.badge-tile .icon-tile {
  border-radius: var(--radius-sm);
}
.badge-tile .badge-label {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-primary);
}
.badge-tile.locked .badge-label { color: var(--muted-text); }

/* ---------------------------------------------------------------------- */
/* Bottom nav (mobile) / sidebar (desktop)                                 */
/* ---------------------------------------------------------------------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--nav-height);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 20;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  color: var(--muted-text);
}
.nav-item i { font-size: 20px; }
.nav-item.active { color: var(--accent); }

@media (min-width: 860px) {
  .bottom-nav {
    position: sticky;
    top: 0;
    left: auto; right: auto; bottom: auto;
    height: 100dvh;
    width: var(--sidebar-width);
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: var(--space-sm);
    border-top: none;
    border-right: 1px solid var(--border);
    padding: var(--space-xl) var(--space-md);
  }
  .nav-item {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-md);
    padding: 10px var(--space-md);
    border-radius: var(--radius-md);
    font-size: 13px;
  }
  .nav-item.active { background: rgba(29,158,117,0.12); }
  #logout-btn { margin-top: auto; }
  .nav-brand {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 800;
    font-size: 20px;
    padding: 0 var(--space-md) var(--space-lg);
  }
}
.nav-brand { display: none; }
@media (min-width: 860px) { .nav-brand { display: block; } }

/* ---------------------------------------------------------------------- */
/* Forms                                                                   */
/* ---------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.field label {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}
.field input, .field select, .field textarea {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 13px var(--space-lg);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
}
.field-error {
  font-size: 12px;
  color: var(--high-text);
  font-weight: 600;
}
.field-row { display: flex; gap: var(--space-md); }
.field-row .field { flex: 1; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---------------------------------------------------------------------- */
/* Auth screens                                                            */
/* ---------------------------------------------------------------------- */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}
.auth-card { width: 100%; max-width: 380px; }
.auth-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}
.auth-logo .mark {
  width: 64px; height: 64px;
  margin: 0 auto var(--space-md);
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
.auth-logo h1 { font-size: 26px; }
.auth-logo p { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.auth-switch {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: 13px;
  color: var(--text-secondary);
}
.auth-switch a { color: var(--accent); font-weight: 700; }
.banner {
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-lg);
}
.banner-error { background: rgba(113,43,19,0.35); color: var(--high-text); border: 1px solid rgba(245,196,179,0.2); }
.banner-success { background: rgba(29,158,117,0.15); color: var(--accent); border: 1px solid rgba(29,158,117,0.3); }

/* ---------------------------------------------------------------------- */
/* Modal / sheet                                                           */
/* ---------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal-overlay.hidden { display: none; }
.modal-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  overflow-y: auto;
  padding: var(--space-xl);
}
@media (min-width: 860px) {
  .modal-overlay { align-items: center; }
  .modal-sheet { border-radius: var(--radius-lg); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}
.modal-header h2 { font-size: 19px; }

/* ---------------------------------------------------------------------- */
/* Activity picker grid                                                    */
/* ---------------------------------------------------------------------- */
.picker-search { margin-bottom: var(--space-lg); }
.picker-list { display: flex; flex-direction: column; gap: var(--space-sm); max-height: 50dvh; overflow-y: auto; }
.picker-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: left;
  width: 100%;
  color: var(--text-primary);
}
.picker-item:active { border-color: var(--border-strong); }
.picker-item .item-title { flex: 1; }

/* ---------------------------------------------------------------------- */
/* Timer                                                                   */
/* ---------------------------------------------------------------------- */
.timer-card {
  text-align: center;
  padding: var(--space-xl);
}
.timer-activity { font-size: 15px; font-weight: 700; margin-bottom: var(--space-sm); }
.timer-clock {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 44px;
  margin: var(--space-md) 0;
  letter-spacing: 1px;
}
.timer-actions { display: flex; gap: var(--space-md); margin-top: var(--space-lg); }
.timer-actions .btn { flex: 1; }

/* ---------------------------------------------------------------------- */
/* Tables (admin)                                                          */
/* ---------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.data-table td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot.active { background: var(--accent); }
.status-dot.inactive { background: var(--muted-icon); }

.tabs {
  display: flex;
  gap: var(--space-xs);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin-bottom: var(--space-lg);
  width: fit-content;
}
.tab-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
}
.tab-btn.active { background: var(--accent); color: var(--accent-text); }

.subtabs { display: flex; gap: var(--space-sm); margin-bottom: var(--space-lg); border-bottom: 1px solid var(--border); }
.subtab-btn {
  border: none; background: transparent;
  color: var(--text-secondary);
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800; font-size: 14px;
  padding: var(--space-sm) 4px var(--space-md);
  border-bottom: 2px solid transparent;
  margin-right: var(--space-lg);
}
.subtab-btn.active { color: var(--text-primary); border-bottom-color: var(--accent); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
}
.stat-tile .value {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: 20px;
}
.stat-tile .label {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.chart-card { padding: var(--space-lg); }
.chart-canvas-wrap { position: relative; height: 260px; }

.legend-row { display: flex; gap: var(--space-lg); margin-top: var(--space-md); flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: var(--space-xs); font-size: 12px; color: var(--text-secondary); }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-dot.effort-low { background: var(--low-text); }
.legend-dot.effort-mid { background: var(--mid-text); }
.legend-dot.effort-high { background: var(--high-text); }

/* ---------------------------------------------------------------------- */
/* Toasts                                                                   */
/* ---------------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  top: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: 100;
  width: calc(100% - 2 * var(--space-lg));
  max-width: 360px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  font-size: 13px;
  font-weight: 600;
  box-sizing: border-box;
}
.toast.error { border-color: rgba(245,196,179,0.4); color: var(--high-text); }
.toast.success { border-color: rgba(29,158,117,0.4); color: var(--accent); }

/* ---------------------------------------------------------------------- */
/* Misc utility                                                            */
/* ---------------------------------------------------------------------- */
.flex-row { display: flex; align-items: center; gap: var(--space-md); }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.editable-value {
  cursor: pointer;
  border-bottom: 1px dashed var(--border-strong);
}
.spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--text-primary);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row { display: flex; justify-content: center; padding: var(--space-lg); }
