@font-face {
  font-family: "Inter Variable";
  src: url("/vendor/inter/InterVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-soft: #f2f2f7;
  --surface-hover: #e9e9ee;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #a1a1a6;
  --line: rgba(60, 60, 67, 0.12);
  --line-strong: rgba(60, 60, 67, 0.24);
  --accent: #ff9500;
  --accent-solid: #ff9500;
  --accent-soft: #fff4df;
  --on-accent: #ffffff;
  --link: #007aff;
  --link-soft: #eaf3ff;
  --success: #248a3d;
  --success-solid: #34c759;
  --success-soft: #edf9f0;
  --on-success: #ffffff;
  --danger: #ff3b30;
  --danger-soft: #fff1f0;
  --morning: #ff9500;
  --day: #0a84ff;
  --evening: #5856d6;
  --habit-alcohol: #ff9500;
  --habit-tobacco: #ff3b30;
  --habit-sugar: #ff2d55;
  --habit-food: #34c759;
  --habit-salt: #32ade6;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.82);
  --card-border: rgba(60, 60, 67, 0.06);
  --ambient-orange: rgba(255, 149, 0, 0.24);
  --ambient-pink: rgba(255, 45, 85, 0.16);
  --ambient-purple: rgba(175, 82, 222, 0.1);
  --shadow: 0 16px 44px rgba(63, 48, 42, 0.08);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-soft: #2c2c2e;
  --surface-hover: #353538;
  --text: #f5f5f7;
  --muted: #98989d;
  --faint: #636366;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --accent: #ff9f0a;
  --accent-solid: #ff9f0a;
  --accent-soft: #332511;
  --on-accent: #ffffff;
  --link: #0a84ff;
  --link-soft: #102a43;
  --success: #30d158;
  --success-solid: #30d158;
  --success-soft: #122b19;
  --on-success: #001a06;
  --danger: #ff453a;
  --danger-soft: #3a1b1b;
  --morning: #ff9f0a;
  --day: #0a84ff;
  --evening: #5e5ce6;
  --habit-alcohol: #ff9f0a;
  --habit-tobacco: #ff453a;
  --habit-sugar: #ff375f;
  --habit-food: #30d158;
  --habit-salt: #64d2ff;
  --glass: rgba(28, 28, 30, 0.76);
  --glass-border: rgba(255, 255, 255, 0.1);
  --card-border: rgba(255, 255, 255, 0.08);
  --ambient-orange: rgba(255, 159, 10, 0.15);
  --ambient-pink: rgba(255, 55, 95, 0.11);
  --ambient-purple: rgba(191, 90, 242, 0.08);
  --shadow: 0 20px 58px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Inter Variable", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga" 1, "calt" 1;
  font-optical-sizing: auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 560px at 58% -120px, var(--ambient-orange), transparent 70%),
    radial-gradient(760px 520px at 82% -100px, var(--ambient-pink), transparent 72%),
    radial-gradient(700px 520px at 34% -190px, var(--ambient-purple), transparent 72%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  display: block;
}

.lucide-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-layout {
  position: relative;
  z-index: 1;
  width: min(1260px, calc(100% - 40px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.side-panel {
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  min-height: 700px;
  padding: 0;
  background: transparent;
  border-radius: 28px;
}

.side-panel-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  backdrop-filter: saturate(180%) blur(28px);
}

.brand {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.brand-sign {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--on-accent);
  background: linear-gradient(145deg, #ff5d75, #ff2d55 54%, #ff3b30);
  border-radius: 11px;
  box-shadow: 0 8px 22px rgba(255, 45, 85, 0.24);
}

.brand-sign svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-day {
  margin-top: 31px;
}

.date-label,
.ui-label {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-transform: none;
}

.side-day h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.06;
}

.day-message {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.side-progress {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.side-progress-head,
.side-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.side-progress-head .ui-label,
.side-section-head .ui-label {
  margin: 0;
}

.side-progress-head > span:last-child {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.side-progress > strong {
  display: block;
  margin-top: 9px;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}

.score-bar,
.budget-track,
.history-mini-track {
  overflow: hidden;
  background: color-mix(in srgb, var(--muted) 13%, transparent);
  border: 0;
  border-radius: 999px;
}

.score-bar {
  height: 7px;
  margin-top: 13px;
}

.score-bar span,
.history-mini-track i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-solid), #ff2d55);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.score-bar span.has-violation,
.history-day.violation .history-mini-track i {
  background: var(--danger);
}

.period-summary {
  display: grid;
  gap: 6px;
  margin-top: 19px;
}

.period-nav-item {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.period-nav-item:hover {
  background: var(--surface-hover);
}

.period-nav-item.active {
  background: color-mix(in srgb, var(--period-color) 11%, transparent);
  border-color: transparent;
}

.period-nav-item.complete {
  background: var(--success-soft);
  border-color: transparent;
}

.period-nav-item.violation {
  background: var(--danger-soft);
}

.period-nav-item[data-period="morning"] { --period-color: var(--morning); }
.period-nav-item[data-period="day"] { --period-color: var(--day); }
.period-nav-item[data-period="evening"] { --period-color: var(--evening); }

.period-nav-dot {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
}

.period-nav-item.active .period-nav-dot {
  color: var(--on-accent);
  background: var(--period-color);
  border-color: var(--period-color);
}

.period-nav-item.complete .period-nav-dot {
  color: var(--on-success);
  background: var(--success-solid);
  border-color: var(--success-solid);
}

.period-nav-item.violation .period-nav-dot {
  color: var(--on-accent);
  background: var(--danger);
  border-color: var(--danger);
}

.period-nav-dot svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.period-nav-copy,
.period-nav-copy strong,
.period-nav-copy small {
  display: block;
  min-width: 0;
}

.period-nav-copy strong {
  font-size: 13px;
  font-weight: 600;
}

.period-nav-copy small {
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-nav-count {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.side-metrics {
  margin-top: 23px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
}

.save-state {
  color: var(--success);
  font-size: 11px;
  font-weight: 600;
}

.metrics-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 12px;
}

.metrics-form > label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px;
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 12px;
}

.metric-icon {
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: var(--evening);
  background: color-mix(in srgb, var(--evening) 13%, transparent);
  border-radius: 8px;
}

.metrics-form > label:nth-of-type(2) .metric-icon {
  color: #00a6a6;
  background: color-mix(in srgb, #00a6a6 13%, transparent);
}

[data-theme="dark"] .metrics-form > label:nth-of-type(2) .metric-icon {
  color: #66d4cf;
  background: color-mix(in srgb, #66d4cf 14%, transparent);
}

.metric-icon svg {
  width: 14px;
  height: 14px;
}

.metric-copy,
.metric-copy small,
.metric-copy > span {
  min-width: 0;
  display: block;
}

.metric-copy small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.metric-copy > span {
  display: flex;
  align-items: baseline;
}

.metric-copy input {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 20px;
  font-weight: 650;
}

.metric-copy em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.secondary-button {
  grid-column: 1 / -1;
  height: 34px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 64%, transparent);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.secondary-button:hover {
  background: var(--surface-hover);
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.side-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.moscow-time {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 64%, transparent);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 11px;
}

.moscow-time strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.theme-button,
.utility-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin-left: auto;
  padding: 0;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 64%, transparent);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}

.utility-button {
  margin: 0;
}

.utility-button svg,
.theme-button svg {
  width: 15px;
  height: 15px;
}

.utility-button.active {
  color: var(--link);
  background: var(--link-soft);
  border-color: color-mix(in srgb, var(--link) 20%, transparent);
}

.utility-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.theme-icon {
  width: 15px;
  height: 15px;
}

.theme-icon-sun {
  display: none;
}

[data-theme="dark"] .theme-icon-sun {
  display: block;
}

[data-theme="dark"] .theme-icon-moon {
  display: none;
}

.main-content {
  min-width: 0;
  padding: 54px 0 38px;
}

.main-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.main-heading h2,
.section-heading h2 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.main-heading p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.main-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-badge,
.ghost-button {
  padding: 6px 9px;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.ghost-button {
  color: var(--link);
  cursor: pointer;
}

.notice {
  min-height: 70px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 25px;
  padding: 14px 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(63, 48, 42, 0.05);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
}

.notice-dot {
  width: 10px;
  height: 10px;
  background: var(--accent-solid);
  border-radius: 50%;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent-solid) 16%, transparent);
}

.notice strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.notice p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.notice.complete .notice-dot {
  background: var(--success-solid);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--success-solid) 16%, transparent);
}

.notice.violation .notice-dot {
  background: var(--danger);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 14%, transparent);
}

.notice-action {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--link);
  background: color-mix(in srgb, var(--surface) 66%, transparent);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.notice-action svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.day-timeline {
  position: relative;
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.day-timeline::before {
  content: "";
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: 20px;
  width: 1px;
  background: var(--line-strong);
}

.period-block {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 16px;
}

.timeline-node {
  position: relative;
  z-index: 2;
  padding-top: 20px;
}

.timeline-node > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--period-color, var(--muted));
  background: color-mix(in srgb, var(--period-color, var(--muted)) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--period-color, var(--muted)) 18%, var(--card-border));
  border-radius: 50%;
  font-size: 12px;
  font-weight: 650;
}

.timeline-node svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.period-block.active .timeline-node > span,
.period-block.complete .timeline-node > span {
  color: var(--on-accent);
  background: var(--period-color, var(--accent-solid));
  border-color: var(--period-color, var(--accent-solid));
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--period-color, var(--accent-solid)) 12%, transparent);
}

.period-block.violation .timeline-node > span {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--danger) 12%, transparent);
}

.period-block.complete .timeline-node > span {
  color: var(--on-success);
  background: var(--success-solid);
  border-color: var(--success-solid);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--success-solid) 12%, transparent);
}

.period-card {
  min-width: 0;
  padding: 21px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.period-block.active .period-card {
  border-color: color-mix(in srgb, var(--period-color, var(--accent)) 24%, var(--card-border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--period-color, var(--accent)) 7%, transparent), var(--shadow);
}

.period-block.complete .period-card {
  border-color: color-mix(in srgb, var(--success) 25%, var(--line));
}

.period-block.violation .period-card {
  border-color: color-mix(in srgb, var(--danger) 23%, var(--line));
}

.period-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.period-time {
  color: var(--period-color, var(--accent));
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
}

.period-card h3 {
  margin: 4px 0 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.period-card-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.period-score {
  padding: 5px 8px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.period-score.violation {
  color: var(--danger);
  background: var(--danger-soft);
}

.period-habits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 17px;
}

.period-habit {
  min-width: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: default;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.period-habit:has(.habit-decision:not(:disabled)):hover {
  background: color-mix(in srgb, var(--habit-color, var(--accent)) 5%, var(--surface-soft));
  border-color: color-mix(in srgb, var(--habit-color, var(--accent)) 14%, transparent);
}

.habit-symbol {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--habit-color, var(--muted));
  background: color-mix(in srgb, var(--habit-color, var(--muted)) 12%, var(--surface));
  border: 0;
  border-radius: 11px;
}

.period-block#period-morning { --period-color: var(--morning); }
.period-block#period-day { --period-color: var(--day); }
.period-block#period-evening { --period-color: var(--evening); }

.period-habit[data-habit="alcohol"] { --habit-color: var(--habit-alcohol); }
.period-habit[data-habit="tobacco"] { --habit-color: var(--habit-tobacco); }
.period-habit[data-habit="sugar"] { --habit-color: var(--habit-sugar); }
.period-habit[data-habit="clean_food"] { --habit-color: var(--habit-food); }
.period-habit[data-habit="intentional_salt"] { --habit-color: var(--habit-salt); }

.habit-symbol svg {
  width: 17px;
  height: 17px;
}

.habit-copy,
.habit-copy strong,
.habit-copy small {
  min-width: 0;
  display: block;
}

.habit-copy strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.habit-copy small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-habit.status-completed {
  background: var(--success-soft);
  border-color: transparent;
}

.period-habit.status-completed .habit-symbol,
.period-habit.status-violation .habit-symbol {
  color: var(--habit-color);
}

.period-habit.status-violation {
  background: var(--danger-soft);
  border-color: transparent;
}

.habit-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.habit-decision {
  min-width: 42px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 7px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.habit-decision svg {
  width: 13px;
  height: 13px;
}

.habit-decision:hover:not(:disabled) {
  transform: translateY(-1px);
}

.habit-decision.completed:hover:not(:disabled),
.habit-decision.completed.selected {
  color: var(--on-success);
  background: var(--success-solid);
  border-color: var(--success-solid);
}

.habit-decision.violation:hover:not(:disabled),
.habit-decision.violation.selected {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.habit-decision:disabled:not(.selected) {
  cursor: not-allowed;
  opacity: 0.28;
}

.expense-section,
.insights-section,
.history-section {
  margin-left: 58px;
  margin-top: 34px;
  padding: 23px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.budget-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.budget-value strong {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.budget-value span {
  color: var(--muted);
  font-size: 12px;
}

.budget-track {
  height: 7px;
  margin: 17px 0 8px;
}

.budget-track span.over {
  background: var(--danger);
}

.budget-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--success-solid);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.expense-section .ui-label {
  color: var(--success);
}

.budget-caption {
  margin: 0 0 17px;
  color: var(--muted);
  font-size: 12px;
}

.budget-caption.over {
  color: var(--danger);
}

.expense-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px auto;
  align-items: end;
  gap: 9px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.expense-form label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.expense-form label > span small {
  color: var(--faint);
  font-size: 10px;
  font-weight: 400;
}

.expense-form input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 11px;
  outline: 0;
  font-size: 14px;
}

.expense-form input:focus {
  border-color: color-mix(in srgb, var(--link) 45%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 12%, transparent);
}

.add-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 15px;
  color: var(--on-accent);
  background: var(--link);
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.add-button svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.add-button:disabled,
.expense-form:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.4;
}

.form-message {
  min-height: 16px;
  margin: 7px 0 0;
  color: var(--success);
  font-size: 11px;
}

.form-message.error {
  color: var(--danger);
}

.expense-list {
  max-height: 160px;
  overflow-y: auto;
}

.expense-row {
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.expense-row > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-expense {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.delete-expense:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.delete-expense svg {
  width: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.empty-expenses {
  margin: 0;
  padding-top: 10px;
  color: var(--faint);
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.history-heading {
  align-items: center;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
  margin-top: 16px;
}

.history-day {
  min-width: 0;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
}

.history-day:disabled {
  cursor: default;
}

.history-day:hover {
  background: var(--surface-hover);
}

.history-day.selected {
  background: var(--link-soft);
  border-color: color-mix(in srgb, var(--link) 22%, transparent);
}

.history-day.complete {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 30%, var(--line));
}

.history-day.violation {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 24%, var(--line));
}

.history-day strong,
.history-day small,
.history-day span {
  display: block;
}

.history-day > span > strong {
  font-size: 19px;
}

.history-day small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.history-progress {
  width: 100%;
  color: var(--muted);
  font-size: 10px;
}

.history-mini-track {
  height: 3px;
  margin-top: 5px;
}

.insights-section .ui-label {
  color: var(--link);
}

.insight-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.insight-summary article {
  min-width: 0;
  padding: 13px;
  background: var(--surface-soft);
  border-radius: 14px;
}

.insight-summary span,
.insight-summary strong,
.insight-summary small {
  display: block;
}

.insight-summary span {
  min-height: 30px;
  color: var(--muted);
  font-size: 10px;
}

.insight-summary strong {
  overflow: hidden;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.trend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.trend-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 14px;
  background: var(--surface-soft);
  border-radius: 14px;
}

.trend-card > div:first-child span,
.trend-card > div:first-child strong {
  display: block;
}

.trend-card > div:first-child span {
  color: var(--muted);
  font-size: 10px;
}

.trend-card > div:first-child strong {
  margin-top: 4px;
  font-size: 16px;
  letter-spacing: -0.025em;
}

.sparkline {
  height: 50px;
  color: var(--link);
}

.trend-card:nth-child(2) .sparkline {
  color: var(--evening);
}

.sparkline svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.empty-chart {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--faint);
  border-bottom: 1px dashed var(--line-strong);
  font-size: 9px;
  text-align: center;
}

.habit-insights {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.habit-insights h3 {
  margin: 0 0 11px;
  font-size: 13px;
  font-weight: 650;
}

.habit-insight {
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(145px, 1.2fr) minmax(100px, 1fr) 35px;
  align-items: center;
  gap: 12px;
}

.habit-insight > div:first-child {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.habit-insight strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.habit-insight > div:first-child span,
.habit-insight b {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  white-space: nowrap;
}

.habit-insight b {
  text-align: right;
}

.insight-rate {
  height: 5px;
  overflow: hidden;
  background: color-mix(in srgb, var(--muted) 13%, transparent);
  border-radius: 999px;
}

.insight-rate span {
  display: block;
  height: 100%;
  background: var(--success-solid);
  border-radius: inherit;
}

.month-navigation {
  display: grid;
  grid-template-columns: 30px minmax(125px, auto) 30px;
  align-items: center;
  gap: 6px;
}

.month-navigation button,
.dialog-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--link);
  background: var(--surface-soft);
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}

.month-navigation button:disabled {
  color: var(--faint);
  cursor: not-allowed;
  opacity: 0.45;
}

.month-navigation svg,
.dialog-close svg {
  width: 15px;
  height: 15px;
}

.month-navigation strong {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
  margin-top: 17px;
}

.calendar-weekdays span {
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

.history-grid {
  margin-top: 7px;
}

.history-day {
  min-height: 70px;
}

.history-day > strong {
  font-size: 16px;
  line-height: 1;
}

.history-day.unavailable {
  color: var(--faint);
  background: transparent;
  border-color: transparent;
  opacity: 0.42;
}

.calendar-status {
  overflow: hidden;
  width: 100%;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-spacer {
  min-height: 1px;
}

.login-screen {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 390px);
  padding: 30px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 26px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  backdrop-filter: saturate(180%) blur(28px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 650;
}

.login-copy {
  margin-top: 42px;
}

.login-copy h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.login-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-form,
.password-form {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

.login-form label > span,
.password-form label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.login-form input,
.password-form input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 11px;
  outline: 0;
}

.login-form input:focus,
.password-form input:focus {
  border-color: color-mix(in srgb, var(--link) 45%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 12%, transparent);
}

.primary-button {
  height: 44px;
  margin-top: 5px;
  color: #fff;
  background: var(--link);
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.account-dialog {
  width: min(calc(100% - 32px), 410px);
  padding: 22px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}

.account-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.dialog-head h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.035em;
}

.password-form {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.password-form h3 {
  margin: 0;
  font-size: 14px;
}

.logout-button {
  width: 100%;
  height: 40px;
  margin-top: 20px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

footer {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-left: 58px;
  color: var(--faint);
  font-size: 11px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: min(360px, calc(100% - 48px));
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  font-size: 13px;
}

.toast > span {
  min-width: 0;
}

.toast > button {
  margin-left: auto;
  padding: 0;
  color: var(--link);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  color: var(--danger);
  background: var(--danger-soft);
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

@media (max-width: 1050px) {
  .app-layout {
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 24px;
  }

  .side-panel-inner {
    padding: 18px;
  }

  .period-habits {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .app-layout {
    width: min(100% - 24px, 640px);
    display: block;
  }

  .side-panel {
    position: static;
    height: auto;
    min-height: 0;
    margin-top: 12px;
  }

  .side-panel-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }

  .brand,
  .side-footer {
    grid-column: 1 / -1;
  }

  .side-day,
  .side-progress,
  .side-metrics,
  .period-summary {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .side-day {
    align-self: center;
  }

  .period-summary {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
  }

  .side-metrics {
    grid-column: 1 / -1;
  }

  .side-footer {
    margin-top: 0;
  }

  .main-content {
    padding-top: 38px;
  }

  .insight-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .app-layout {
    width: calc(100% - 20px);
  }

  .side-panel-inner {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .brand,
  .side-footer,
  .period-summary,
  .side-metrics {
    grid-column: 1;
  }

  .side-day h1 {
    font-size: 32px;
  }

  .period-summary {
    grid-template-columns: 1fr;
  }

  .main-heading h2 {
    font-size: 32px;
  }

  .notice {
    margin-top: 20px;
  }

  .day-timeline::before {
    left: 16px;
  }

  .period-block {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
  }

  .timeline-node > span {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .period-card {
    padding: 17px;
    border-radius: 17px;
  }

  .period-habits {
    grid-template-columns: 1fr;
  }

  .habit-copy small {
    display: none;
  }

  .expense-section,
  .insights-section,
  .history-section,
  footer {
    margin-left: 44px;
  }

  .expense-section,
  .insights-section,
  .history-section {
    padding: 17px;
  }

  .expense-form {
    grid-template-columns: 1fr 100px;
  }

  .expense-title-field {
    grid-column: 1 / -1;
  }

  .trend-grid {
    grid-template-columns: 1fr;
  }

  .history-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
  }

  .calendar-weekdays {
    gap: 4px;
  }

  .history-heading {
    display: grid;
    gap: 14px;
  }

  .month-navigation {
    width: 100%;
    grid-template-columns: 30px minmax(0, 1fr) 30px;
  }

  .history-day {
    min-height: 50px;
    padding: 7px 5px;
    border-radius: 9px;
  }

  .history-day > strong {
    font-size: 13px;
  }

  .calendar-status {
    display: none !important;
  }

  .habit-insight {
    grid-template-columns: minmax(120px, 1fr) minmax(70px, 0.8fr) 30px;
    gap: 8px;
  }

  .habit-insight > div:first-child span {
    display: none;
  }

  .habit-decision span {
    display: none;
  }

  .habit-decision {
    min-width: 32px;
    width: 32px;
    padding: 0;
  }

  .login-card {
    padding: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
