:root {
  color-scheme: light;
  --page: #f5f4f8;
  --panel: #fff;
  --ink: #252239;
  --muted: #615d74;
  --line: #e6e2ee;
  --accent: #6246aa;
  --accent-dark: #4e348e;
  --lilac: #efebfa;
  --sidebar: #211b38;
  --period: #f9dce5;
  --period-ink: #8c2f51;
  --estimate: #e8e0f9;
  --success: #246753;
  --radius: 22px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid #9672e6;
  outline-offset: 3px;
}
button:disabled { cursor: default; opacity: .45; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { letter-spacing: -.035em; }
h2 { font-size: 1.29rem; }
h3 { font-size: 1.08rem; }
.shell { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); min-height: 100svh; }
.sidebar {
  min-height: 100svh; display: flex; flex-direction: column; position: sticky; top: 0;
  height: 100svh; padding: 2.25rem 1rem 1.25rem; background: var(--sidebar); color: #fff;
}
.brand { display: flex; flex-wrap: wrap; align-items: center; column-gap: .6rem; margin: 0 .65rem 2.65rem; font-size: 1.7rem; font-weight: 750; }
.brand-mark { width: 29px; height: 29px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 3px; background: #b7a2f0; }
.brand-mark i { width: 3px; height: 11px; border-radius: 4px; background: #332456; transform: rotate(-20deg); }
.brand-mark i:nth-child(2) { height: 17px; }
.brand-caption { width: 100%; padding-left: 2.45rem; font-size: .83rem; font-weight: 500; color: #cfcae1; }
.sidebar nav { display: grid; gap: .4rem; }
.nav-item { width: 100%; display: flex; align-items: center; gap: .7rem; padding: .72rem .8rem; border: 0; border-radius: 12px; background: transparent; color: #e2ddef; text-align: left; white-space: nowrap; font-weight: 600; }
.nav-item span { flex: 0 0 1.2rem; text-align: center; font-size: 1.13rem; }
.nav-item:hover, .nav-item[aria-current="page"] { color: #fff; background: #40335e; }
.nav-item[aria-current="page"] span { color: #c5abff; }
.sidebar-footer { margin-top: auto; }
.sidebar-footer p { display: flex; align-items: center; gap: .4rem; margin: .75rem .5rem 0; font-size: .78rem; line-height: 1.35; color: #d1c9e4; }
.privacy-dot { width: .5rem; height: .5rem; border-radius: 50%; background: #a4dfc6; flex-shrink: 0; }
.main { width: min(100%, 85rem); padding: 2.75rem clamp(1.3rem, 4vw, 4.2rem) 3rem; margin: 0 auto; }
.page-top, .panel-title, .day-title, .toolbar, .button-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.page-top { margin-bottom: 1.6rem; align-items: flex-end; }
.page-top h1 { font-size: clamp(2.1rem, 4.2vw, 3.5rem); line-height: 1.03; }
.kicker { color: var(--accent-dark); font-size: .87rem; letter-spacing: .025em; font-weight: 700; margin-bottom: .55rem; }
.subtle { color: var(--muted); line-height: 1.55; }
.page-top .subtle { margin-top: .55rem; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: .4rem; min-height: 2.75rem; padding: .62rem .9rem; border: 1px solid transparent; border-radius: 11px; color: var(--accent-dark); background: var(--lilac); font-weight: 700; white-space: nowrap; }
.button:hover:not(:disabled) { background: #e4dcf6; }
.button.primary { color: white; background: var(--accent); }
.button.primary:hover:not(:disabled) { background: var(--accent-dark); }
.button.secondary { border-color: var(--line); background: #fff; }
.button.secondary:hover:not(:disabled) { background: var(--lilac); }
.button.danger { color: #932c48; background: #fae8ee; }
.button.small { min-height: 2.25rem; padding: .42rem .65rem; font-size: .89rem; }
.button.icon { min-width: 2.3rem; min-height: 2.3rem; padding: .35rem; font-size: 1.3rem; line-height: 1; }
.button-row { flex-wrap: wrap; justify-content: flex-start; }
a { color: var(--accent-dark); }
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(12.5rem, .7fr); align-items: center;
  gap: 1rem; overflow: hidden; padding: 1.9rem 2.05rem; margin-bottom: 1.15rem;
  border-radius: var(--radius); background: #342650; color: #fff;
}
.hero h2 { font-size: clamp(1.9rem, 4vw, 3.3rem); line-height: 1.02; }
.hero .kicker { color: #d8c5ff; }
.hero p:not(.kicker) { color: #eee8f9; margin-top: .8rem; line-height: 1.5; }
.hero .button-row { margin-top: 1.25rem; }
.hero .button.primary { background: #d6c5fa; color: #32204d; }
.hero .button.primary:hover { background: #e8dcff; }
.hero .button.secondary { color: #fff; border-color: #776492; background: transparent; }
.hero .button.secondary:hover { background: #51406e; }
.dial {
  width: min(100%, 12.5rem); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  justify-self: center; position: relative; isolation: isolate;
  background: conic-gradient(from 0deg, #e1d4ff 0 var(--progress, 4%), #58466d var(--progress, 4%) 100%);
}
.dial::before { content: ""; position: absolute; inset: .7rem; background: #342650; border-radius: 50%; z-index: -1; }
.dial-content { text-align: center; padding: 1rem; color: #e6d9fd; font-size: .9rem; line-height: 1.25; }
.dial-content strong { display: block; font-size: 3.1rem; line-height: 1; color: #fff; margin: .1rem 0 .25rem; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.15rem; }
.metric, .panel { padding: 1.15rem 1.3rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.metric .label { color: var(--muted); font-size: .87rem; font-weight: 650; }
.metric strong { display: block; font-size: clamp(1.13rem, 2.6vw, 1.45rem); margin: .22rem 0; letter-spacing: -.025em; }
.metric .subtle { font-size: .84rem; }
.overview-grid, .calendar-layout, .insights-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.panel-title { margin-bottom: 1rem; }
.panel-title, .day-title { align-items: flex-start; }
.calendar-panel { padding-bottom: 1.2rem; }
.toolbar { gap: .28rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; }
.weekday { color: var(--muted); font-size: .82rem; text-align: center; margin: 0 0 .22rem; }
.day {
  position: relative; width: 100%; min-height: 2.45rem; height: clamp(2.35rem, 4vw, 3.6rem);
  background: #faf9fc; color: var(--ink); border: 2px solid transparent; border-radius: 10px; font-weight: 650;
}
.day:hover { border-color: #c7b6eb; }
.day.outside { color: #766f87; background: #f8f7fa; }
.day.period { background: var(--period); color: var(--period-ink); }
.day.estimate { background: var(--estimate); color: #4d367a; }
.day[aria-current="date"] { text-decoration: underline; text-underline-offset: .18rem; }
.day[aria-pressed="true"] { border-color: var(--accent); }
.day.logged::after { content: ""; width: .32rem; height: .32rem; background: var(--accent); border-radius: 50%; position: absolute; bottom: .23rem; left: calc(50% - .16rem); }
.legend { display: flex; flex-wrap: wrap; gap: .55rem 1rem; margin-top: .85rem; color: var(--muted); font-size: .83rem; }
.legend span { display: flex; align-items: center; gap: .32rem; }
.swatch { width: .65rem; height: .65rem; display: inline-block; border-radius: .22rem; }
.swatch.period { background: var(--period); border: 1px solid #d2839d; }
.swatch.estimate { background: var(--estimate); border: 1px solid #aa92d7; }
.swatch.logged { background: var(--accent); border-radius: 50%; }
.day-panel .subtle + .button-row { margin-top: 1rem; }
.day-panel .button-row { margin-top: 1.1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .75rem; }
.chip { padding: .32rem .57rem; border-radius: 99px; background: var(--lilac); color: #4e367d; font-size: .87rem; font-weight: 650; }
.chip.period { background: var(--period); color: var(--period-ink); }
.notes { margin-top: .65rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.stack { display: grid; gap: 1rem; }
.data-list { list-style: none; padding: 0; margin: 0; }
.data-list > li { padding: .72rem 0; display: flex; justify-content: space-between; align-items: center; gap: .65rem; border-top: 1px solid var(--line); }
.data-list > li:first-child { border-top: 0; }
.data-list .button-row { justify-content: flex-end; }
.data-label { min-width: 0; }
.data-label strong { display: block; margin: 0 0 .12rem; }
.data-label .subtle { overflow-wrap: anywhere; }
.list-notes { white-space: pre-wrap; }
.chart { display: grid; gap: .7rem; list-style: none; padding: 0; margin: .85rem 0 0; }
.chart li { display: grid; grid-template-columns: minmax(4rem, 5.7rem) minmax(1rem, 1fr) minmax(3.5rem, max-content); align-items: center; gap: .5rem; font-size: .89rem; }
.bar-track { height: .64rem; border-radius: 20px; background: var(--lilac); }
.bar-fill { height: 100%; border-radius: inherit; background: #997bd7; }
.chart-label { overflow-wrap: anywhere; }
.demo-banner { margin-bottom: 1rem; padding: .6rem .85rem; border-radius: 12px; background: #f0ebfc; color: #53378a; display: flex; justify-content: space-between; align-items: center; gap: .6rem; font-weight: 650; }
dialog { width: min(35rem, calc(100% - 1.5rem)); max-height: calc(100svh - 2rem); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 0; background: #fff; color: var(--ink); box-shadow: 0 16px 60px #211b3840; }
dialog::backdrop { background: #211b3888; }
dialog form { padding: 1.35rem; }
dialog h2 { font-size: 1.6rem; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; margin-bottom: .8rem; }
.dialog-head + .subtle { margin-bottom: 1rem; }
.fields { display: grid; gap: .85rem; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.field { display: grid; gap: .3rem; font-weight: 650; min-width: 0; }
.field input, .field select, .field textarea { width: 100%; padding: .63rem .7rem; border: 1px solid #d6cfe3; border-radius: 10px; color: var(--ink); background: #fff; }
.field textarea { min-height: 5rem; resize: vertical; }
fieldset { margin: 0; padding: 0; border: 0; }
legend { font-weight: 650; }
.choices { display: flex; flex-wrap: wrap; gap: .4rem; padding-top: .35rem; }
.choice { position: relative; display: inline-flex; }
.choice input { width: 1px; height: 1px; opacity: 0; position: absolute; }
.choice span { padding: .42rem .6rem; border: 1px solid var(--line); border-radius: 50px; cursor: pointer; }
.choice input:checked + span { border-color: var(--accent); background: var(--lilac); color: var(--accent-dark); }
.choice input:focus-visible + span { outline: 3px solid #9672e6; outline-offset: 2px; }
.dialog-actions { margin-top: 1.05rem; justify-content: flex-end; }
.settings-actions { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: 1rem; }
.form-error { color: #a12948; margin-top: .65rem; font-weight: 600; }
.toast { position: fixed; z-index: 10; bottom: 1.25rem; right: 1.25rem; max-width: calc(100% - 2.5rem); background: #27203a; color: #fff; padding: .72rem .95rem; border-radius: 10px; box-shadow: 0 7px 20px #211b3833; }
@media (max-width: 1000px) {
  .shell { grid-template-columns: 12rem minmax(0, 1fr); }
  .sidebar { padding-inline: .65rem; }
  .main { padding-inline: 1.35rem; }
  .hero { padding-inline: 1.35rem; }
}
@media (max-width: 760px) {
  .shell { display: flex; flex-direction: column; }
  .sidebar { position: static; min-height: auto; height: auto; padding: .78rem .8rem .45rem; }
  .brand { margin: 0 .15rem .55rem; font-size: 1.4rem; }
  .brand-caption { width: auto; padding: 0; margin-left: .3rem; }
  .sidebar nav { grid-template-columns: repeat(4, 1fr); gap: .15rem; }
  .nav-item { font-size: .86rem; padding: .45rem .35rem; gap: .22rem; justify-content: center; }
  .nav-item span { font-size: .95rem; flex-basis: .95rem; }
  .sidebar-footer { display: flex; align-items: center; gap: .4rem; padding-top: .35rem; }
  .sidebar-footer .nav-item { width: auto; }
  .sidebar-footer p { margin: 0; }
  .main { padding: 1.3rem .9rem 2rem; }
  .overview-grid, .calendar-layout, .insights-grid { grid-template-columns: 1fr; }
}
@media (max-width: 470px) {
  .brand-caption { font-size: .77rem; }
  .page-top { align-items: flex-start; flex-wrap: wrap; }
  .hero { padding: 1.15rem; grid-template-columns: minmax(0, 1fr) 5.8rem; gap: .55rem; }
  .hero .button-row { grid-column: 1 / -1; }
  .hero h2 { font-size: 1.62rem; }
  .dial::before { inset: .42rem; }
  .dial-content { font-size: .72rem; padding: .3rem; }
  .dial-content strong { font-size: 1.7rem; }
  .metrics { gap: .42rem; }
  .metric, .panel { padding: .78rem; border-radius: 15px; }
  .metric .label, .metric .subtle { font-size: .77rem; }
  .metric strong { font-size: 1rem; }
  .calendar-grid { gap: .21rem; }
  .day { min-height: 2.18rem; }
  .data-list > li { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
