:root {
  --bg: #0c0d10;
  --surface: #14161b;
  --surface-hover: #1b1e25;
  --border: rgba(255, 255, 255, 0.07);
  --text: #ededf0;
  --text-muted: #7e8494;
  --accent: #f59e0b;
  --danger: #f87171;
  --radius: 14px;
  --font-scale: 1;
  --pad-card: 15px 16px;
  --gap-stack: 14px;
}

body[data-theme="oled"] {
  --bg: #000000;
  --surface: #0a0a0c;
  --surface-hover: #141418;
  --border: rgba(255, 255, 255, 0.09);
  --text: #f5f5f7;
  --text-muted: #86868b;
}

body[data-theme="nord"] {
  --bg: #1e222a;
  --surface: #272c36;
  --surface-hover: #313744;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eceff4;
  --text-muted: #9aa5b8;
}

body[data-theme="light"] {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-hover: #f0f2f5;
  --border: rgba(0, 0, 0, 0.08);
  --text: #141619;
  --text-muted: #68707d;
}

body[data-density="compact"] {
  --pad-card: 10px 12px;
  --gap-stack: 9px;
}

body[data-density="spacious"] {
  --pad-card: 20px 22px;
  --gap-stack: 20px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  font-size: calc(14px * var(--font-scale));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 720px;
  margin: 0 auto;
  padding-top: calc(env(safe-area-inset-top, 0px) + 20px);
  padding-right: calc(env(safe-area-inset-right, 0px) + 18px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 44px);
  padding-left: calc(env(safe-area-inset-left, 0px) + 18px);
}

@media (max-width: 640px) {
  .shell {
    padding-top: max(calc(env(safe-area-inset-top, 0px) + 16px), 52px);
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* Header & Navigation */
.nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab-menu {
  display: flex;
  gap: 5px;
  background: var(--surface);
  padding: 4px;
  border-radius: calc(var(--radius) * 0.8);
  border: 1px solid var(--border);
}

.tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 6px 14px;
  border-radius: calc(var(--radius) * 0.55);
  font-size: 0.93rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  background: var(--surface-hover);
  color: var(--text);
  font-weight: 600;
}

.win-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 13px;
}

.icon-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.14s ease;
}

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

.focus-container {
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap-stack);
}

.hidden {
  display: none !important;
}

/* Date Navigation & Hero */
.today-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px;
}

.date-nav-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.today-title-group h1 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.ghost-icon-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  width: 26px;
  height: 26px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.ghost-icon-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

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

.muted-sm {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.mini-ring-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.mini-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.mini-ring-track {
  fill: none;
  stroke: var(--surface-hover);
  stroke-width: 4.5;
}

.mini-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s ease;
}

.mini-ring-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
}

/* Minimal Cards */
.minimal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad-card);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wrap-gap {
  flex-wrap: wrap;
}

.row-gap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.card-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Buttons */
button {
  font-family: inherit;
}

.accent-btn {
  background: var(--accent);
  color: #090a0c;
  border: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 7px 14px;
  border-radius: calc(var(--radius) * 0.65);
  cursor: pointer;
}

.accent-btn.small {
  padding: 5px 11px;
  font-size: 0.85rem;
}

.ghost-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.ghost-btn:hover {
  color: var(--text);
}

.ghost-pill {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.ghost-pill.small {
  padding: 3px 9px;
  font-size: 0.78rem;
}

.file-label {
  display: inline-flex;
  align-items: center;
}

/* Wake Edit Drawer */
.wake-edit-drawer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.input-pair {
  display: flex;
  gap: 10px;
}

.input-pair label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

input[type="time"],
input[type="text"],
input[type="number"],
input[type="password"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 0.92rem;
  font-family: inherit;
}

/* Habit Checklist */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.habit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.85);
  padding: var(--pad-card);
  cursor: pointer;
  transition: background 0.12s ease;
}

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

.habit-row.unscheduled {
  opacity: 0.55;
}

.habit-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--text-muted);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #090a0c;
  flex-shrink: 0;
  transition: all 0.14s ease;
}

.habit-row.done .habit-check {
  background: var(--accent);
  border-color: var(--accent);
}

.habit-emoji {
  font-size: 1.05rem;
}

.habit-text {
  flex: 1;
  min-width: 0;
}

.habit-name {
  font-size: 0.98rem;
  font-weight: 500;
}

.habit-row.done .habit-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.habit-note {
  font-size: 0.83rem;
  color: var(--text-muted);
}

.streak-tag {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Reels Budget Bar & Stepper */
.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 0.83rem;
  cursor: pointer;
}

.stepper-val {
  font-weight: 600;
  min-width: 34px;
  text-align: center;
}

.budget-bar-track {
  height: 5px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.budget-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.budget-bar-fill.over {
  background: var(--danger);
}

/* Energy & Note */
.energy-dots {
  display: flex;
  gap: 4px;
}

.energy-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  cursor: pointer;
}

.energy-btn.active {
  background: var(--accent);
  color: #090a0c;
  border-color: var(--accent);
  font-weight: 700;
}

.note-input {
  width: 100%;
  margin-top: 10px;
}

/* ================================================================= */
/* GRAPHS TAB                                                        */
/* ================================================================= */
.graphs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.range-pills,
.seg-group {
  display: flex;
  gap: 3px;
  background: var(--bg);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border);
}

.range-btn,
.seg-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.83rem;
  cursor: pointer;
}

.range-btn.active,
.seg-btn.active {
  background: var(--surface-hover);
  color: var(--text);
  font-weight: 600;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.25rem;
  font-weight: 600;
}

.kpi-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.graphs-stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap-stack);
}

.graph-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.graph-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.tag {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.svg-chart-box {
  width: 100%;
  height: 145px;
}

.svg-chart-box.small-chart {
  height: 115px;
}

.svg-chart-box svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Per-Habit Breakdown Bars */
.bar-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.breakdown-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.breakdown-track {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.breakdown-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* Heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 6px;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.heat-cell:hover {
  transform: scale(1.13);
  border-color: var(--text-muted);
}

/* ================================================================= */
/* HABITS & CUSTOMIZE TABS                                           */
/* ================================================================= */
.add-habit-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.habit-input-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 8px;
}

.emoji-input {
  text-align: center;
}

.day-picker {
  display: flex;
  gap: 4px;
}

.day-pill {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.day-pill.active {
  background: var(--accent);
  color: #090a0c;
  border-color: var(--accent);
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 0;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.swatch-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}

.swatch.active {
  border-color: var(--text);
  transform: scale(1.1);
}

.color-picker-input {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.toggle-row,
.target-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 0.88rem;
}

.lan-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  word-break: break-all;
}

/* Modal & Breather */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  z-index: 200;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 380px;
}

.center-card {
  text-align: center;
}

.breather-circle {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  margin: 20px auto 12px;
  border: 3px solid var(--accent);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 600;
  animation: pulseBreath 8s ease-in-out infinite;
}

@keyframes pulseBreath {
  0%, 100% { transform: scale(0.88); opacity: 0.75; }
  50% { transform: scale(1.08); opacity: 1; }
}

.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  right: 18px;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.86rem;
  z-index: 300;
}

/* Interactive Tutorial Modal */
.tutorial-card {
  max-width: 420px;
}

.tutorial-icon {
  font-size: 1.8rem;
  margin-top: 10px;
}

.tutorial-tips {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.tutorial-tip-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.84rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.tutorial-tip-key {
  background: var(--surface-hover);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.tutorial-dots {
  display: flex;
  gap: 6px;
}

.tut-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.15s ease;
}

.tut-dot.active {
  background: var(--accent);
  width: 18px;
  border-radius: 999px;
}

/* ================================================================= */
/* OFF-PHONE FOCUS TIMER & DAILY PRIORITIES                          */
/* ================================================================= */
.focus-timer-card.running {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.focus-live-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  animation: pulseBadge 1.8s ease-in-out infinite;
}

@keyframes pulseBadge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.focus-clock {
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  margin-right: 4px;
}

.focus-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.focus-label-input {
  flex: 1;
  min-width: 0;
}

.focus-goal-fill.complete {
  background: var(--good);
}

.focus-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.focus-session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 7px;
  padding: 5px 9px;
}

.focus-session-item strong {
  color: var(--text);
  font-weight: 600;
}

.task-input-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.task-input-row input {
  flex: 1;
  min-width: 0;
}

.priority-toggle.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

.priority-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 5px;
}

.removing {
  opacity: 0 !important;
  transform: scale(0.96) translateX(8px);
  max-height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease, max-height 0.18s ease, margin 0.18s ease, padding 0.18s ease !important;
}



