@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Geist:wght@400;500;600;700;800&display=swap');

:root {
  font-family: 'DM Sans', system-ui, sans-serif;
  color-scheme: light;
  color: var(--ink);
  background: var(--page-bg);
  font-synthesis: none;
  --page-bg: #f8f7fb;
  --ink: #251f35;
  --muted: #706a81;
  --line: #e9e5f0;
  --purple: #6848cb;
  --deep-purple: #5736bb;
  --lavender: #f0eafd;
  --sidebar-bg: #fff;
  --mobile-scrim: #291b3e66;
  --sidebar-width: 232px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #13111b;
  --ink: #f1ebf9;
  --muted: #b8adc9;
  --line: #382e49;
  --purple: #bea6ff;
  --deep-purple: #d0bbff;
  --lavender: #35274e;
  --surface: #211b2e;
  --surface-inset: #191522;
  --sidebar-bg: var(--surface-inset);
  --mobile-scrim: #0e0a15a8;
  --surface-raised: #2b223b;
  --surface-hover: #38294c;
  --field-border: #6e5d83;
  --text-soft: #d7cce6;
  --accent-line: #665184;
  --peach-ink: #f7bea1;
  --peach-surface: #412a2c;
  --mint-ink: #a0dfc5;
  --mint-surface: #203832;
  background-image: radial-gradient(ellipse at 88% 0, #21182e 0, transparent 62%);
  background-size: 100% 720px;
  background-repeat: no-repeat;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: default; opacity: .55; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
svg { flex-shrink: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #aa95f3; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, .brand, .week-metric strong, .city-identity strong {
  font-family: 'Geist', 'DM Sans', system-ui, sans-serif;
}
h2 { font-size: 17px; font-weight: 800; letter-spacing: -.027em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 3;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  padding: 29px 17px 16px;
  overflow-y: auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.065em;
  color: #251b37;
  line-height: 1;
  white-space: nowrap;
  width: fit-content;
}
.sidebar .brand { margin: 0 5px 36px; }
.sidebar .brand:has(+ .builder-switch) { margin-bottom: 17px; }
.brand img { margin-right: 9px; }
.brand span { color: var(--purple); }
.builder-switch {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--page-bg);
}
.sidebar .builder-switch { margin: 0 1px 15px; }
.builder-option {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 32px;
  padding: 4px 3px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.builder-option.current {
  background: var(--sidebar-bg);
  box-shadow: 0 1px 3px #24183818;
  color: var(--ink);
}
a.builder-option:hover { background: var(--lavender); color: var(--deep-purple); }
.entry-card .builder-switch { width: 100%; }
.entry-card .builder-option { font-size: 12px; }
.entry-card p { color: var(--muted); font-size: 14px; }
.workspace {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  padding: 7px 9px;
  margin: 0 1px 27px;
  min-height: 48px;
}
.workspace-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  color: var(--purple);
  border-radius: 8px;
  background: #f2edfb;
  flex: 0 0 auto;
}
.workspace select, .sound-select select {
  appearance: none;
  border: 0;
  background: transparent;
  min-width: 0;
  padding: 5px 4px;
  color: #392e49;
  flex: 1;
  font-size: 13px;
  font-weight: 700;
}
.nav { display: grid; gap: 5px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 45px;
  border-radius: 9px;
  padding: 0 13px;
  color: #635d75;
  font-size: 13.5px;
  font-weight: 650;
  transition: background .16s, color .16s;
}
.nav a:hover { background: #f7f4fc; color: var(--deep-purple); }
.nav a[aria-current] { background: #eee8fc; color: var(--deep-purple); font-weight: 800; }
.sidebar-footer { margin-top: auto; padding-top: 35px; }
.duo-card {
  border: 1px solid #ece4fa;
  border-radius: 14px;
  background: linear-gradient(150deg, #f7f2ff, #fbf9ff);
  padding: 13px;
  margin-bottom: 16px;
}
.duo-card .tile-icon { width: 33px; height: 33px; border-radius: 9px; background: #eee4fc; }
.duo-head { display: flex; align-items: center; justify-content: space-between; }
.duo-head .icon-button { width: 29px; height: 29px; }
.duo-card h3 { font-size: 14px; margin-top: 9px; font-weight: 800; overflow-wrap: anywhere; }
.members { display: grid; gap: 6px; margin-top: 7px; font-size: 12px; color: var(--muted); }
.members span { overflow-wrap: anywhere; }
.member-destination { display: block; margin-left: 13px; font-size: 11px; }
.presence { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #898590; }
.presence.focused { background: #3a986e; }
.presence.paused { background: #b5840a; }
.presence.external { background: #6848cb; }
.sidebar-account {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 13px 2px 1px;
}
.profile {
  border: 0;
  flex: 1;
  min-width: 0;
  padding: 0;
  background: none;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 0;
}
.profile .avatar {
  width: 35px; height: 35px;
  flex: 0 0 35px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--deep-purple);
  background: #eee8fa;
  font-weight: 800;
}
.profile span:nth-child(2) { flex: 1; min-width: 0; }
.profile strong, .profile small { display: block; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.profile strong { font-size: 13px; }
.profile small { font-size: 11px; color: var(--muted); margin-top: 2px; }
.mobile-top, .mobile-scrim { display: none; }
.mobile-actions, .entry-heading { display: flex; align-items: center; gap: 8px; }
.entry-heading { width: 100%; justify-content: space-between; }
.theme-toggle span { display: flex; }
.theme-toggle .theme-sun, :root[data-theme="dark"] .theme-toggle .theme-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-sun { display: flex; }

.private-entry {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(#21163658, #211636a8), url('/cities/toquio.webp') center / cover;
}
.entry-card { display: grid; justify-items: start; gap: 16px; width: min(100%, 398px); padding: 27px; }
.entry-card h1 { font-size: 32px; line-height: 1.13; letter-spacing: -.055em; }
.entry-card .button { width: 100%; }
.entry-card .text-button { justify-self: center; }

.main { margin-left: var(--sidebar-width); padding: 42px 35px 38px; max-width: 1680px; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}
.today {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #746686;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 9px;
}
.today span::first-letter { text-transform: uppercase; }
.today svg { color: #866abf; }
.page-head h1 { font-size: clamp(30px, 3.1vw, 45px); letter-spacing: -.062em; line-height: 1.12; font-weight: 800; }
.head-actions { display: flex; gap: 9px; align-items: center; flex: 0 0 auto; margin-bottom: 1px; }
.button, .icon-button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .16s, color .16s, border-color .16s, box-shadow .16s;
}
.button {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0 13px;
  min-height: 39px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.button.primary { background: var(--purple); color: #fff; box-shadow: 0 2px 4px #5736bb24; }
.button.primary:hover { background: var(--deep-purple); }
.button.danger { background: #a53d59; color: #fff; }
.button.danger:hover { background: #8e304b; }
.button.secondary { background: #fff; color: #504761; border-color: #e5dfed; }
.button.secondary:hover, .icon-button:hover { background: #f3eefc; border-color: #e8dcfa; color: var(--deep-purple); }
.icon-button {
  border: 1px solid #eeeaf2;
  border-radius: 9px;
  width: 34px;
  height: 34px;
  color: #756c84;
  background: #fff;
  padding: 0;
  flex: 0 0 auto;
}
.text-button {
  background: none;
  color: var(--deep-purple);
  border: 0;
  padding: 0;
  font-size: 13px;
  font-weight: 800;
  gap: 5px;
}
.text-button:hover { color: #44268e; text-decoration: underline; }

.dashboard-grid, .lower-grid, .settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 17px;
}
.card {
  background: #fff;
  border: 1px solid #e9e4f0;
  border-radius: 16px;
  box-shadow: 0 2px 5px #2d194505;
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 17px 18px 14px;
}
.card-head > div { flex: 1; min-width: 0; }
.card-head > .project-actions { flex: 0 0 auto; display: flex; gap: 6px; }
.delete-project:hover, .delete-space:hover { color: #9e3753; border-color: #f1d3df; background: #fff3f7; }
.card-head p { margin-top: 3px; font-size: 12px; color: var(--muted); }
.tile-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex: 0 0 auto;
}
.lavender { color: #6947c1; background: #f0e9fc; }
.peach { color: #a34c2d; background: #fceee7; }
.mint { color: #237556; background: #e6f6ee; }

.timer-card { display: flex; flex-direction: column; }
.timer-other-room { display: grid; flex: 1; align-content: center; justify-items: center; gap: 14px; padding: 24px 18px; text-align: center; }
.timer-other-room p { overflow-wrap: anywhere; }
.timer-connection { margin-top: 10px; color: var(--muted); font-size: 12px; text-align: center; }
.timer-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  padding: 2px 15px 16px;
  min-height: 342px;
}
.phase-control {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: #f3f0f8;
  border-radius: 8px;
  width: fit-content;
}
.phase-control :is(button, a) {
  border: 0;
  background: transparent;
  min-width: 62px;
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  color: #736881;
}
.phase-control :is(button[aria-pressed=true], a[aria-current="page"]) {
  color: #5e3bb8;
  background: #fff;
  box-shadow: 0 1px 3px #32194817;
}
.dial {
  position: relative;
  width: 205px;
  height: 205px;
  border-radius: 50%;
  background: conic-gradient(#805ce4 0%, #b79af8 min(58%, var(--remaining)), #8359df var(--remaining), #eee8f8 var(--remaining));
  display: grid;
  place-items: center;
  margin: 13px 0 10px;
}
.dial.rest { background: conic-gradient(#409a77 0%, #86cbb1 min(58%, var(--remaining)), #56a887 var(--remaining), #e6f4ed var(--remaining)); }
.dial-inner {
  position: absolute;
  inset: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 34%, #fff 28%, #fcfaff 78%);
  color: var(--ink);
}
.dial-label { color: #7959b5; font-size: 10px; font-weight: 800; letter-spacing: .135em; }
.dial.rest .dial-label { color: #357a5e; }
.dial output {
  font-family: 'Geist', 'DM Sans', system-ui, sans-serif;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 53px;
  line-height: 1.05;
  letter-spacing: -.075em;
}
.dial-caption { color: var(--muted); font-size: 12px; font-weight: 500; }
.activity-name { display: flex; justify-content: center; align-items: center; gap: 6px; width: min(100%, 320px); margin: 2px 0 12px; }
.activity-picker { position: relative; flex: 1; min-width: 0; }
.activity-picker input {
  width: 100%;
  min-height: 42px;
  padding: 8px 36px 8px 38px;
  border: 1px solid #e4d9f4;
  border-radius: 11px;
  background: #f7f3fe;
  color: #3a2b52;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
}
.activity-picker input:hover { border-color: #d2c0f0; }
.activity-picker input:focus { border-color: var(--purple); background: #fff; outline: none; box-shadow: 0 0 0 3px #6848cb22; }
.activity-picker input::placeholder { color: #8a7c9f; font-weight: 600; opacity: 1; }
.activity-picker input[readonly] { cursor: default; padding-right: 12px; }
.picker-icon { position: absolute; left: 12px; top: 50%; translate: 0 -50%; display: flex; color: var(--purple); pointer-events: none; }
.picker-toggle { position: absolute; right: 5px; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 7px; background: none; color: #7a6c90; cursor: pointer; }
.picker-toggle svg { transition: rotate .15s; }
.activity-picker:has(input[aria-expanded="true"]) .picker-toggle svg { rotate: 180deg; }
.picker-toggle:hover { background: #ece4fa; }
.picker-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 248px;
  overflow-y: auto;
  margin: 0;
  padding: 5px;
  list-style: none;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 34px #2d19452b;
}
.picker-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.picker-list li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-list li svg { flex: none; color: #9a8bb3; }
.picker-list li[hidden] { display: none; }
.picker-list [role="option"]:hover, .picker-list [aria-selected="true"] { background: #f2ecfc; }
.picker-list .picker-heading, .picker-list .picker-empty { cursor: default; padding: 6px 10px 4px; font-size: 11px; font-weight: 700; color: var(--muted); }
.picker-list .picker-create { color: var(--purple); }
.picker-list .picker-create svg { color: var(--purple); }
dialog .activity-picker { margin-top: 5px; font-weight: 400; }
dialog .field-label { display: grid; font-size: 13px; font-weight: 700; }
.study-destination { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; width: min(100%, 320px); margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.study-destination select { min-width: 0; width: 100%; padding-block: 4px; font-size: 12px; }
.timer-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; margin-top: auto; }
.timer-actions .button { min-height: 40px; }
.timer-button { min-width: 115px; }
.timer-button[hidden] { display: none; }
.timer-tool { height: 40px; width: 40px; }
.timer-extensions { display: flex; justify-content: center; gap: 5px; margin-top: 8px; }
.timer-extensions .button { min-height: 32px; padding: 4px 10px; font-size: 12px; }
.dial-label { text-align: center; max-width: 90%; }
.sound-bar {
  display: grid;
  grid-template-columns: max-content minmax(0, 175px);
  justify-content: space-between;
  align-items: center;
  gap: 4px 12px;
  /* In a wide card (alone in its row) the controls stay under the dial instead of at the edges. */
  padding: 9px max(17px, calc((100% - 380px) / 2));
  border-top: 1px solid #eee9f4;
  border-radius: 0 0 16px 16px;
  background: #fbf9fe;
  font-size: 12px;
  font-weight: 700;
  color: #675b77;
}
.sound-bar label { display: flex; align-items: center; gap: 8px; }
.sound-icon { color: #8464bb; display: flex; }
.sound-select select { width: 100%; font-size: 12px; color: #635178; border-radius: 7px; background-color: #f1ebf9; }
.sound-bar .sound-resume { grid-column: 1 / -1; justify-self: start; min-height: 32px; margin-top: 3px; font-size: 12px; }
.volume-control { display: grid; grid-template-columns: minmax(0, 1fr) 4ch; gap: 7px; align-items: center; }
.volume-control input { width: 100%; height: 28px; margin: 0; accent-color: var(--purple); cursor: pointer; }
.volume-control span { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }

.city-card { display: flex; flex-direction: column; }
.city-scene {
  position: relative;
  isolation: isolate;
  background: #17132b;
  min-height: 265px;
  flex: 1;
  overflow: hidden;
  border-radius: 11px;
  margin: 0 17px;
  color: #fff;
}
.city-canvas, .city-shade { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.city-canvas[tabindex] { cursor: grab; touch-action: pan-y; }
.city-canvas[tabindex]:active { cursor: grabbing; }
.city-canvas:focus-visible { outline-offset: -4px; }
.city-shade { background: linear-gradient(180deg, #1c123c35, transparent 20%, transparent 70%, #140e2cce); pointer-events: none; }
.city-pill {
  position: absolute;
  left: 13px;
  top: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 20px;
  background: #25183ce8;
  border: 1px solid #e6d1ff40;
  padding: 6px 9px;
  color: #f3ebfd;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .085em;
}
.city-pill i { width: 6px; height: 6px; border-radius: 50%; background: #e6ab89; }
.city-pill.finished i { background: #88dcb3; }
.city-identity {
  position: absolute;
  left: 17px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 57%;
}
.city-identity strong { font-size: 30px; letter-spacing: -.045em; font-weight: 800; }
.city-identity span { display: flex; align-items: center; gap: 3px; font-size: 12px; color: #e9dbf4; }
.city-phase {
  position: absolute;
  right: 13px;
  bottom: 15px;
  color: #f7dec8;
  font-size: 11px;
  font-weight: 650;
  max-width: 42%;
  text-align: right;
}
.city-tools { position: absolute; right: 13px; top: 13px; display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.city-tools .city-control { min-height: 34px; color: #fcf5ff; background: #211a36df; border-color: #f0dcff4d; }
.city-tools .city-control:hover, .city-tools .city-control[aria-pressed=true] { color: #fff; background: #654487; border-color: #b08ad9; }
.city-progress { padding: 16px 17px 18px; }
.progress-label, .progress-footer { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.progress-label { font-size: 12.5px; color: #41354f; }
.progress-label strong:last-child { color: #6a46c2; font-weight: 800; }
.area-progress { display: flex; gap: 4px; margin: 9px 0 11px; }
.area-progress span { display: block; flex: 1; height: 7px; border-radius: 8px; background: #eee7f7; overflow: hidden; }
.area-progress i { display: block; height: 100%; border-radius: 8px; background: #956be8; }
.step-label { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
.step-label strong { color: var(--deep-purple); }
.step-progress .area-progress { margin: 5px 0 10px; }
.step-progress .area-progress span { height: 5px; }
.step-progress .area-progress .current-step { outline: 1px solid #b59bec; outline-offset: 1px; }
.progress-footer { color: var(--muted); font-size: 12px; }
.city-empty { flex: 1; min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 25px; gap: 13px; }

/* Overview: a narrower focus column leaves room for the construction; the week's numbers share one card. */
.dashboard-grid.focus-first { grid-template-columns: minmax(310px, .74fr) minmax(0, 1.26fr); }
.week-card { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 18px 30px; align-items: stretch; margin: 17px 0; padding: 17px 18px 18px; }
.week-summary { display: grid; align-content: space-between; gap: 18px; min-width: 0; }
.week-title { display: flex; align-items: center; gap: 11px; }
.week-title p { margin-top: 3px; font-size: 12px; color: var(--muted); }
.week-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.week-metric h3 { font-family: 'DM Sans', system-ui, sans-serif; font-size: 12px; font-weight: 700; letter-spacing: 0; color: #61566f; }
.week-metric strong { display: block; margin-top: 3px; font-size: 30px; line-height: 1.12; letter-spacing: -.045em; font-weight: 800; }
.week-metric small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.team-hours { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.team-hours thead { background: none; }
.team-hours caption { text-align: left; padding-bottom: 5px; font-weight: 700; color: #61566f; }
.team-hours th, .team-hours td { padding: 5px 0; border-top: 1px solid var(--line); text-align: right; font-weight: 700; color: var(--ink); }
.team-hours thead th { border-top: 0; padding-top: 0; font-size: 11px; color: var(--muted); font-weight: 600; }
.team-hours th[scope="row"] { text-align: left; overflow-wrap: anywhere; }
.team-hours td, .team-hours thead th:not(:first-child) { width: 92px; padding-left: 12px; white-space: nowrap; }
.team-hours small { margin-left: 4px; color: var(--purple); font-size: 10px; font-weight: 700; }
.week-progress { display: grid; grid-template-rows: 1fr auto auto; gap: 9px; min-width: 0; }
.week-card .chart { min-height: 120px; padding: 0; }
.goal-track { height: 8px; border-radius: 99px; background: #f1ebfa; overflow: hidden; }
.goal-track i { display: block; height: 100%; border-radius: inherit; background: var(--purple); transition: width .4s ease; }
.goal-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; color: var(--muted); font-size: 12px; }
.goal-footer span { margin-right: auto; }
.week-card .chart-day .bar, .week-card .chart-day.current .bar { background: #d9cbf7; }
.week-card .chart-day.reached .bar { background: var(--purple); }
.bar-check { position: absolute; top: 5px; left: 50%; translate: -50% 0; display: flex; color: #fff; }
.rest-days { display: grid; gap: 6px; margin: 14px 0 0; padding: 0; border: 0; min-width: 0; }
.rest-days legend { padding: 0; font-size: 13px; font-weight: 700; }
.rest-days p { margin: 0; color: var(--muted); font-size: 12px; }
.rest-day-options { flex-wrap: wrap; }
.rest-day-options span { padding-inline: 8px; }
.bank-chip { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-top: 12px; padding: 8px 11px; border-radius: 10px; background: #f3eefc; color: #5a3fae; font-size: 12px; }
.bank-chip strong { font-weight: 800; }
.bank-chip .text-button { margin-left: auto; color: var(--purple); font-size: 12px; }
.city-empty .bank-chip { margin-top: 4px; }
.stat-unit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--deep-purple);
  background: #f3edf9;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.stat-unit:hover { border-color: #e4d4f5; background: #ede2f7; }
.history-card { min-height: 207px; }
.chart { min-height: 130px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 13px; padding: 0 18px 14px; }
.chart-day { display: grid; grid-template-rows: 1fr auto; text-align: center; gap: 8px; }
.chart-day small { color: #726782; font-size: 11px; text-transform: capitalize; }
.chart-day.current small { color: #5e3bb8; font-weight: 800; }
.bar-track { position: relative; overflow: hidden; border-radius: 5px; background: #f6f2fb; }
.bar { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 5px; background: #b194ef; min-height: 3px; }
.chart-day.current .bar { background: var(--purple); }
.empty { display: grid; justify-items: center; align-content: center; gap: 6px; min-height: 125px; text-align: center; padding: 12px 20px 19px; }
.empty strong { font-size: 13px; }
.empty .tile-icon { margin-bottom: 2px; }
.recent-logs { margin: 0; padding: 0 18px 13px; list-style: none; }
.recent-logs li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 9px 0; font-size: 13px; }
.recent-logs li:last-child { border-bottom: 0; }
.recent-logs li strong { overflow-wrap: anywhere; }
.recent-logs small { display: block; color: var(--muted); margin-top: 3px; }
.recent-logs b { white-space: nowrap; }

.list-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 19px 20px 11px; }
.list-top p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 8px 20px 16px; }
.filters input[type=search] { flex: 1 1 150px; max-width: 330px; }
.filter-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; flex: 0 1 292px; min-width: 0; }
.filter-dates label { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-dates input { width: 100%; }
.filter-actions { display: flex; align-items: center; gap: 10px; min-height: 39px; }
.filters .form-error { flex-basis: 100%; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
thead { color: var(--muted); background: #fbf9fe; }
td, th { border-top: 1px solid var(--line); padding: 13px 10px; }
td:first-child, th:first-child { padding-left: 20px; overflow-wrap: anywhere; }
td:last-child, th:last-child { padding-right: 20px; }
td, thead th { white-space: nowrap; }
.activity-destinations { min-width: 10rem; white-space: normal; }
.activity-destinations ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.activity-destinations small, .log-destinations small, .activity-full-time { display: block; margin-top: 2px; color: var(--muted); }
.log-actions { display: flex; justify-content: flex-end; gap: 4px; }
.session-timeline { display: grid; gap: 10px; margin: 0 0 16px; font-size: 13px; }
.session-timeline div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.session-timeline dt { color: var(--muted); }
.session-timeline dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.log-destinations { margin: 12px 0 0; }
.list-card > .empty { min-height: 220px; }
.trophy-card .city-scene { height: clamp(320px, 40vw, 530px); }
.city-scene-large .city-identity strong { font-size: clamp(25px, 4.5vw, 44px); }
.trophy-details { display: grid; grid-template-columns: 1.5fr 1fr; align-items: center; gap: 22px; padding: 17px; }
.trophy-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.collection { margin-top: 20px; }
.collection-grid { display: grid; gap: 13px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; }
.collection-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left; }
.collection-card[aria-pressed=true] { border-color: #aa91e9; }
.project-cover { width: 100%; height: auto; aspect-ratio: 1.85; object-fit: cover; background: #eee5dc; }
.collection-card > span { display: grid; flex: 1; grid-template-rows: 1fr auto; gap: 4px; padding: 11px; overflow-wrap: anywhere; }
.collection-card small { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px; color: var(--muted); }
.collection-destination { overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.library-toolbar { display: flex; margin-bottom: 15px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr)); gap: 14px; }
.library-card { overflow: hidden; }
.library-cover { width: 100%; height: auto; aspect-ratio: 1.85; object-fit: cover; background: #eee5dc; }
.library-cover:is([data-destination="toquio"], [data-destination="paris"], [data-destination="londres"],
  [data-destination="novayork"], [data-destination="rio"], [data-destination="praca"]) { object-position: center top; }
.library-card-body { padding: 13px; }
.library-card h2 { font-size: 16px; margin-bottom: 9px; }
.library-city-title { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; }
button.library-city-title { padding: 3px 0; background: transparent; border: 0; color: var(--purple); cursor: pointer; }
.library-city-name { flex: 1; }
.library-city-count { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.library-parts { list-style: none; padding: 0; margin: 0; }
.library-parts li + li { border-top: 1px solid #eee9f2; }
.library-part { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 6px;
  width: 100%; min-height: 35px; padding: 5px 2px; border: 0; background: transparent; text-align: left; font-size: 12px; color: #584e67; }
.library-part small { font-size: 11px; white-space: nowrap; }
button.library-part:hover, button.library-city-title:hover { background: #f5f1f8; border-radius: 5px; }
.library-part.unlocked { color: #386c56; }
.settings-card { align-self: start; }
.settings-tabs { margin-bottom: 16px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.settings-tabs a { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; }
.settings-tabs a svg { flex: none; }
.settings-tabs .tab-count { font-size: 11px; font-weight: 700; opacity: .7; }
.settings-stack { display: grid; gap: 17px; max-width: 760px; }
.settings-stack > .space-sign-in { margin: 0; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 11px; margin: 0 17px; padding: 15px 0; border-top: 1px solid var(--line); font-size: 13px; }
.setting-row p { font-size: 12px; line-height: 1.5; color: var(--muted); margin-top: 4px; }
.setting-row .volume-control { width: min(42%, 175px); }
.space-group { align-self: start; }
.space-list { list-style: none; padding: 0; margin: 0 17px 5px; }
.space-row, .space-sign-in { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 9px 14px; }
.space-row { border-top: 1px solid var(--line); padding: 13px 0; }
.space-row-body { flex: 1 1 150px; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.space-row-body small { color: var(--muted); display: block; margin-top: 4px; font-size: 12px; }
.space-current { display: inline-block; margin-left: 6px; padding: 3px 7px; border-radius: 6px; color: var(--deep-purple);
  background: var(--lavender); font-size: 10px; font-weight: 750; white-space: nowrap; }
.space-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.space-row-actions .text-button { margin-right: 6px; font-size: 12px; }
.space-review { flex: 1 0 100%; display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap;
  gap: 6px 12px; padding: 9px 11px; color: var(--muted); background: var(--lavender); border-radius: 8px; font-size: 12px; }
.space-review-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--purple); }
.space-empty { margin: 0 18px 17px; color: var(--muted); font-size: 13px; }
.space-sign-in { padding: 12px 17px; margin-bottom: 14px; color: var(--muted); font-size: 13px; }

.ambient {
  position: fixed;
  inset: 0;
  overflow: auto;
  z-index: 5;
  display: grid;
  grid-template-rows: clamp(260px, 41dvh, 460px) auto;
  justify-items: center;
  padding: 0 15px 24px;
  isolation: isolate;
  background: #1f1733;
}
.ambient .city-canvas { z-index: 0; }
.ambient-top, .ambient-timer { z-index: 1; }
.ambient-top {
  position: absolute;
  top: 18px;
  left: 22px;
  right: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
}
.ambient-top > span { justify-self: start; display: flex; align-items: center; gap: 5px; padding: 9px 12px; border-radius: 9px; background: #251a3adc; }
.ambient-top > span svg { flex: 0 0 auto; }
.ambient-camera { display: flex; gap: 5px; }
.ambient-top .city-control, .ambient-top .ambient-close { min-height: 38px; background: #251a3adc; color: #fff; border-color: #e6d0fa5e; }
.ambient-top .city-control:hover, .ambient-top .city-control[aria-pressed=true], .ambient-top .ambient-close:hover { background: #654487; }
.ambient-timer { grid-row: 2; align-self: start; position: relative; width: min(100%, 402px); box-shadow: 0 15px 85px #150c32a3; border-radius: 16px; }
.ambient-timer .card { background: #fffc; backdrop-filter: blur(16px); }
@media (max-width: 650px) {
  .ambient-timer .timer-main { min-height: 310px; }
  .ambient-timer .dial { width: 178px; height: 178px; }
}
@media (max-width: 520px) {
  .ambient-top { left: 15px; right: 15px; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .ambient-top > span { font-size: 13px; }
  .ambient-top .ambient-close { grid-area: 1 / 2; }
  .ambient-camera { grid-column: 1 / -1; justify-content: center; }
}
@media (min-width: 820px) {
  .ambient { grid-template-rows: auto; align-content: center; justify-items: start; padding: 75px clamp(24px, 5vw, 84px) 24px; }
  .ambient-timer { grid-row: 1; width: min(35vw, 402px); }
}

dialog {
  width: min(520px, calc(100% - 30px));
  max-height: calc(100dvh - 35px);
  padding: 23px;
  border: 1px solid #e9e0f4;
  border-radius: 16px;
  box-shadow: 0 25px 90px #20153943;
  color: var(--ink);
}
dialog::backdrop { background: #1e132b7d; backdrop-filter: blur(2px); }
dialog:has(.project-preview) { width: min(920px, calc(100% - 30px)); }
.project-preview { display: grid; gap: 14px; }
.project-preview .city-scene { height: min(53vh, 490px); min-height: 280px; margin: 0; }
.project-preview .preview-fields { grid-template-columns: minmax(0, 1.25fr) minmax(0, .85fr) auto; align-items: end; }
dialog[open]:has(.preview-expanded) {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border-radius: 0;
  padding: clamp(10px, 2vw, 23px);
}
.project-preview:fullscreen, .project-preview.preview-expanded {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}
.project-preview:fullscreen { background: var(--page-bg); padding: clamp(10px, 2vw, 23px); }
.project-preview.preview-expanded { flex: 1; }
.project-preview:is(:fullscreen, .preview-expanded) #preview-viewport {
  min-height: 0;
}
.completed-preview:is(:fullscreen, .preview-expanded) { grid-template-rows: minmax(0, 1fr); }
.project-preview:is(:fullscreen, .preview-expanded) .city-scene {
  height: 100%;
  min-height: 0;
}
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 13px; margin-bottom: 18px; }
.dialog-head h2 { font-size: 22px; }
.dialog-head p { color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 4px; }
dialog form { display: grid; gap: 13px; }
dialog label { display: grid; gap: 5px; font-size: 13px; font-weight: 700; min-width: 0; }
input, select { min-width: 0; color: var(--ink); }
dialog input:not([type=radio]), dialog select, .filters input, .filters select {
  display: block;
  border: 1px solid #e5ddec;
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  font-size: 13px;
  min-height: 39px;
}
select:not([multiple]) {
  appearance: none;
  padding-inline-end: 27px;
  background-image:
    linear-gradient(45deg, transparent 50%, #826ca5 50%),
    linear-gradient(135deg, #826ca5 50%, transparent 50%);
  background-repeat: no-repeat;
  background-position: right 14px center, right 10px center;
  background-size: 4px 4px, 4px 4px;
  transition: border-color .15s, background-color .15s;
}
select:not([multiple]):hover { border-color: #bfaada; background-color: #faf7ff; }
@supports (appearance: base-select) {
  select:not([multiple]), select::picker(select) { appearance: base-select; }
  select:not([multiple]) {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-inline-end: 9px;
    background-image: none;
  }
  select::picker-icon {
    content: '';
    flex: none;
    inline-size: 6px;
    block-size: 6px;
    border-right: 1.5px solid #8068a9;
    border-bottom: 1.5px solid #8068a9;
    margin: 0 2px 3px auto;
    align-self: center;
    rotate: 45deg;
    transition: rotate .15s;
  }
  select:open::picker-icon { rotate: 225deg; }
  select::picker(select) {
    border: 1px solid #e6ddef;
    border-radius: 12px;
    margin-block: 5px;
    padding: 5px;
    background: #fff;
    color: var(--ink);
    font: 600 13px 'DM Sans', system-ui, sans-serif;
    box-shadow: 0 10px 32px #2d19451f;
    max-height: min(318px, 55dvh);
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #dac9ed transparent;
  }
  select option { padding: 8px 9px; min-height: 34px; border-radius: 6px; }
  select option:hover, select option:focus-visible { background: #f5effb; color: var(--deep-purple); }
  select option:checked { background: #eee6fa; color: var(--deep-purple); font-weight: 750; }
  select option::checkmark { color: var(--purple); }
  select optgroup { color: var(--muted); font-size: 11px; padding: 4px 2px; }
  select optgroup option { color: var(--ink); font-size: 13px; }
}
.segments-field { margin: 0; padding: 0; border: 0; min-width: 0; }
.segments { display: flex; gap: 3px; padding: 3px; border-radius: 9px; background: #f0ebf7; }
.segments label { position: relative; display: block; flex: 1 1 auto; min-width: 0; cursor: pointer; }
.segments input { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.segments span {
  display: block;
  text-align: center;
  border-radius: 7px;
  padding: 8px 10px;
  color: #6e627d;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.segments input:checked + span { background: #fff; color: var(--deep-purple); box-shadow: 0 1px 3px #32194817; }
.segments input:focus-visible + span { outline: 2px solid #a58bdf; outline-offset: -1px; }
dialog input::placeholder, .filters input::placeholder { color: #82768c; }
dialog label small { color: var(--muted); font-size: 11px; font-weight: 500; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.net-preview { display: flex; justify-content: space-between; padding: 11px; border-radius: 8px; background: #f5f0fb; color: #6743b1; font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 3px; }
.form-error { font-size: 13px; color: #a32646; }
.form-error:empty { display: none; }
.form-note { font-size: 12px; color: var(--muted); }
.city-field { margin: 0; padding: 0; border: 0; }
.project-fields { display: grid; gap: 12px; }
form .bank-maximum { display: flex; align-items: center; gap: 8px; }
.bank-maximum input { min-height: 0; accent-color: var(--purple); }
.bank-maximum output { margin-left: auto; }
.weekly-field { display: grid; align-content: start; gap: 5px; min-width: 0; }
.weekly-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.minutes-field { display: grid; gap: 5px; min-width: 0; }
.split-hint, .split-end { margin: 0; color: var(--muted); font-size: 13px; }
.split-parts { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.split-part { display: grid; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; }
.split-part-head { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.split-part-head .split-net { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
[data-action="split-add"] { justify-self: start; display: inline-flex; align-items: center; gap: 6px; }
.number-stepper { display: grid; grid-template-columns: minmax(0, 1fr) repeat(2, 34px); }
dialog .number-stepper input:not([type=radio]) { border-radius: 8px 0 0 8px; }
.number-stepper input[type=number] { appearance: textfield; }
.number-stepper input::-webkit-inner-spin-button { appearance: none; margin: 0; }
.number-stepper button {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #e4dbed;
  border-left: 0;
  background: #f8f4fc;
  color: var(--deep-purple);
}
.number-stepper button:last-child { border-radius: 0 8px 8px 0; }
.number-stepper button:last-child svg { rotate: 180deg; }
.number-stepper button:not([aria-disabled=true]):hover { background: #eee6fa; }
.number-stepper button[aria-disabled=true] { opacity: .55; cursor: default; }
.number-stepper :focus-visible { z-index: 1; }
.weekly-controls .segments span { padding-inline: 8px; }
.weekly-field output { color: var(--muted); font-size: 12px; }
.city-field legend { margin: 0 0 6px; padding: 0; font-size: 13px; font-weight: 700; }
.auth-switch { margin-top: 16px; }
.auth-forgot { margin-top: 16px; margin-right: 14px; }
.provider-buttons { display: grid; gap: 9px; }
.provider-button { justify-content: center; width: 100%; gap: 9px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 4px; color: var(--muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.setting-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.account-email { min-width: 0; }
.account-email strong { overflow-wrap: anywhere; }
.provider-name { display: flex; align-items: center; gap: 11px; }
.provider-name svg { flex: none; }
.copy-label { margin-bottom: 13px; }
#notice {
  z-index: 10;
  position: fixed;
  bottom: 20px;
  right: 22px;
  display: none;
  align-items: center;
  gap: 8px;
  max-width: min(420px, calc(100% - 32px));
  background: #2b2141;
  color: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: 0 6px 20px #2b214146;
  font-size: 13px;
  pointer-events: none;
}
#notice.visible { display: flex; }
#notice.error { background: #812d4b; }

:where([data-theme="dark"]) :focus-visible { outline-color: var(--deep-purple); }
:where([data-theme="dark"]) .brand { color: var(--ink); }
:where([data-theme="dark"]) .workspace { background: var(--surface); }
:where([data-theme="dark"]) .workspace-icon,
:where([data-theme="dark"]) .duo-card .tile-icon,
:where([data-theme="dark"]) .profile .avatar { background: var(--lavender); }
:where([data-theme="dark"]) .workspace select,
:where([data-theme="dark"]) .sound-select select { color: var(--text-soft); }
:where([data-theme="dark"]) .nav a,
:where([data-theme="dark"]) .today { color: var(--muted); }
:where([data-theme="dark"]) .nav a:hover,
:where([data-theme="dark"]) .nav a[aria-current] { color: var(--deep-purple); background: var(--lavender); }
:where([data-theme="dark"]) .duo-card { border-color: var(--line); background: linear-gradient(155deg, var(--surface-raised), var(--surface)); }
:where([data-theme="dark"]) .presence.focused { background: #78cea1; }
:where([data-theme="dark"]) .presence.paused { background: #efc775; }
:where([data-theme="dark"]) .presence.external { background: #bea6ff; }
:where([data-theme="dark"]) .today svg,
:where([data-theme="dark"]) .activity-name,
:where([data-theme="dark"]) .sound-icon { color: var(--purple); }

:where([data-theme="dark"]) .card,
:where([data-theme="dark"]) dialog { background: var(--surface); border-color: var(--line); box-shadow: 0 2px 12px #09061030; }
:where([data-theme="dark"]) dialog { box-shadow: 0 26px 90px #07050db3; }
:where([data-theme="dark"]) dialog::backdrop { background: #0e0a15b3; }
:where([data-theme="dark"]) .timer-card { background: linear-gradient(155deg, #2a2039, var(--surface) 64%); }
:where([data-theme="dark"]) .ambient-timer .card { background: #211a2ff5; }
:where([data-theme="dark"]) .button.primary { background: #7755ce; box-shadow: 0 2px 5px #10091d66; }
:where([data-theme="dark"]) .button.primary:hover { background: #6845c0; }
:where([data-theme="dark"]) .button.secondary,
:where([data-theme="dark"]) .icon-button { background: var(--surface-raised); border-color: var(--line); color: var(--text-soft); }
:where([data-theme="dark"]) .button.secondary:hover,
:where([data-theme="dark"]) .icon-button:hover { background: var(--surface-hover); border-color: var(--accent-line); color: var(--deep-purple); }
:where([data-theme="dark"]) .text-button:hover { color: #ede0ff; }
:where([data-theme="dark"]) :is(.delete-project, .delete-space, [data-action="delete-log"]):hover { color: #ffb3bf; border-color: #7a4658; background: #41263a; }
:where([data-theme="dark"]) .lavender { color: var(--deep-purple); background: var(--lavender); }
:where([data-theme="dark"]) .peach { color: var(--peach-ink); background: var(--peach-surface); }
:where([data-theme="dark"]) .mint { color: var(--mint-ink); background: var(--mint-surface); }

:where([data-theme="dark"]) .phase-control,
:where([data-theme="dark"]) .segments { background: var(--surface-inset); }
:where([data-theme="dark"]) .phase-control :is(button, a),
:where([data-theme="dark"]) .segments span { color: var(--muted); }
:where([data-theme="dark"]) .phase-control :is(button[aria-pressed=true], a[aria-current="page"]),
:where([data-theme="dark"]) .segments input:checked + span { color: var(--deep-purple); background: var(--lavender); }
:where([data-theme="dark"]) .dial {
  background: conic-gradient(#8460db 0%, #c8aaff min(58%, var(--remaining)), #a880ee var(--remaining), #382d48 var(--remaining));
  box-shadow: 0 10px 36px #170d2680;
}
:where([data-theme="dark"]) .dial.rest {
  background: conic-gradient(#4c9d88 0%, #a1e6ce min(58%, var(--remaining)), #62b89c var(--remaining), #2a3d3c var(--remaining));
}
:where([data-theme="dark"]) .dial-inner { background: radial-gradient(circle at 50% 25%, #322343, #21192f 76%); }
:where([data-theme="dark"]) .dial-label { color: var(--deep-purple); }
:where([data-theme="dark"]) .dial.rest .dial-inner { background: radial-gradient(circle at 50% 25%, #273838, #1e2230 76%); }
:where([data-theme="dark"]) .dial.rest .dial-label { color: var(--mint-ink); }
:where([data-theme="dark"]) .activity-picker input { color: var(--ink); background: var(--surface-inset); border-color: var(--line); }
:where([data-theme="dark"]) .activity-picker input:hover { border-color: var(--accent-line); }
:where([data-theme="dark"]) .activity-picker input:focus { border-color: var(--purple); background: var(--surface-inset); box-shadow: 0 0 0 3px #bea6ff26; }
:where([data-theme="dark"]) .picker-toggle { color: var(--muted); }
:where([data-theme="dark"]) .picker-toggle:hover { background: var(--surface-hover); }
:where([data-theme="dark"]) .picker-list { background: var(--surface-raised); border-color: var(--line); box-shadow: 0 16px 38px #07050d99; }
:where([data-theme="dark"]) .picker-list [role="option"]:hover,
:where([data-theme="dark"]) .picker-list [aria-selected="true"] { background: var(--surface-hover); }
:where([data-theme="dark"]) .picker-list li svg { color: var(--muted); }
:where([data-theme="dark"]) .activity-picker input::placeholder,
:where([data-theme="dark"]) dialog input::placeholder,
:where([data-theme="dark"]) .filters input::placeholder { color: var(--muted); }
:where([data-theme="dark"]) .sound-bar,
:where([data-theme="dark"]) thead { background: var(--surface-inset); color: var(--muted); border-color: var(--line); }
:where([data-theme="dark"]) .sound-select select { background-color: var(--surface-raised); }
:where([data-theme="dark"]) .stat-unit { background: var(--surface-raised); }
:where([data-theme="dark"]) .stat-unit:hover { border-color: var(--accent-line); background: var(--surface-hover); }
:where([data-theme="dark"]) .team-hours caption,
:where([data-theme="dark"]) .week-metric h3,
:where([data-theme="dark"]) .chart-day small { color: var(--muted); }
:where([data-theme="dark"]) .chart-day.current small,
:where([data-theme="dark"]) .progress-label strong:last-child { color: var(--deep-purple); }
:where([data-theme="dark"]) .progress-label { color: var(--text-soft); }
:where([data-theme="dark"]) .goal-track,
:where([data-theme="dark"]) .area-progress span,
:where([data-theme="dark"]) .bar-track { background: var(--surface-raised); }
:where([data-theme="dark"]) .area-progress i,
:where([data-theme="dark"]) .bar { background: #ae8bf4; }
:where([data-theme="dark"]) .collection-card[aria-pressed=true] { border-color: #a281dc; }
:where([data-theme="dark"]) .project-cover,
:where([data-theme="dark"]) .library-cover { background: var(--surface-inset); }
:where([data-theme="dark"]) .library-parts li + li { border-color: var(--line); }
:where([data-theme="dark"]) .library-part { color: var(--text-soft); }
:where([data-theme="dark"]) button.library-part:hover,
:where([data-theme="dark"]) button.library-city-title:hover { background: var(--surface-hover); }
:where([data-theme="dark"]) .library-part.unlocked { color: var(--mint-ink); }

:where([data-theme="dark"]) dialog input:not([type=radio]),
:where([data-theme="dark"]) dialog select,
:where([data-theme="dark"]) .filters input,
:where([data-theme="dark"]) .filters select,
:where([data-theme="dark"]) .study-destination select { background-color: var(--surface-inset); border-color: var(--field-border); }
:where([data-theme="dark"]) select:not([multiple]):hover { background-color: var(--surface-hover); border-color: var(--accent-line); }
:where([data-theme="dark"]) .number-stepper button { background: var(--surface-raised); border-color: var(--field-border); }
:where([data-theme="dark"]) .number-stepper button:not([aria-disabled=true]):hover { background: var(--surface-hover); }
:where([data-theme="dark"]) .net-preview { color: var(--deep-purple); background: var(--lavender); }
:where([data-theme="dark"]) .form-error { color: #ffafc1; }
:where([data-theme="dark"]) #notice { background: #342650; border: 1px solid var(--accent-line); }
:where([data-theme="dark"]) #notice.error { background: #562938; border-color: #8d4f64; }

@supports (appearance: base-select) {
  :where([data-theme="dark"]) select::picker-icon { border-color: var(--purple); }
  :where([data-theme="dark"]) select::picker(select) {
    background: var(--surface-raised);
    border-color: var(--accent-line);
    box-shadow: 0 12px 32px #0b0815a8;
    scrollbar-color: var(--accent-line) transparent;
  }
  :where([data-theme="dark"]) select option:hover,
  :where([data-theme="dark"]) select option:focus-visible,
  :where([data-theme="dark"]) select option:checked { color: var(--deep-purple); background: var(--surface-hover); }
}

@media (min-width: 1450px) {
  .main { padding-inline: 44px; }
  .city-scene { min-height: 310px; }
  .timer-main { min-height: 365px; }
  .dial { width: 221px; height: 221px; }
}
@media (max-width: 1170px) {
  .sidebar .builder-option { gap: 3px; font-size: 9px; }
  :root { --sidebar-width: 201px; }
  .main { padding-inline: 24px; }
  .sidebar { padding-inline: 13px; }
  .head-actions { flex-wrap: wrap; justify-content: flex-end; }
  .page-head { align-items: flex-start; }
  .card-head { padding-inline: 13px; }
  .city-scene { margin-inline: 13px; }
  .city-progress { padding-inline: 13px; }
}
@media (max-width: 930px) {
  .sidebar { transform: translateX(-102%); transition: transform .18s ease; inset-block-start: 0; z-index: 8; }
  .sidebar-open { transform: none; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 18px; background: var(--sidebar-bg); border-bottom: 1px solid var(--line); }
  .mobile-scrim { display: block; position: fixed; inset: 0; border: 0; background: var(--mobile-scrim); z-index: 7; }
  .main { margin-left: 0; padding: 24px 18px 30px; }
}
@media (max-width: 820px) {
  .week-card { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 650px) {
  .page-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 13px; margin-bottom: 17px; }
  .head-actions { justify-content: flex-start; }
  .page-head h1 { font-size: 34px; }
  .dashboard-grid, .lower-grid, .settings-grid { grid-template-columns: 1fr; gap: 12px; }
  .week-card { margin: 12px 0; }
  .week-metric strong { font-size: 22px; }
  .city-card { min-height: 350px; }
  .city-scene { min-height: 240px; }
  .trophy-card .city-scene { height: 305px; min-height: 0; }
  .city-tools { top: 44px; left: 13px; }
  .project-preview .city-scene { min-height: 260px; }
  .project-preview .preview-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-fields .segments-field { grid-column: 1 / -1; }
  .trophy-details { grid-template-columns: 1fr; gap: 11px; }
  .collection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-top, .filters { padding-inline: 12px; }
  .list-top { align-items: flex-start; flex-wrap: wrap; }
  .filters input[type=search] { max-width: none; }
  .filter-dates { flex-basis: 100%; }
}
@media (max-width: 410px) {
  body { min-width: 0; }
  .mobile-top { padding-inline: 12px; }
  .mobile-actions { gap: 6px; }
  .builder-switch-compact .current { display: none; }
  .builder-switch-compact .builder-option { padding-inline: 4px; }
  .field-grid { grid-template-columns: 1fr; }
  .main { padding-inline: 12px; }
  .button { padding-inline: 10px; }
  .trophy-card .city-scene { height: 285px; }
  .city-identity strong { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Watching the site in ambient mode: the scene is centered and the timer becomes a compact bar. */
.sound-toggle { display: none; }
.ambient.site-focus .ambient-timer {
  position: fixed;
  left: 50%;
  bottom: 18px;
  top: auto;
  width: auto;
  max-width: calc(100% - 24px);
  transform: translateX(-50%);
  border-radius: 14px;
}
.ambient.site-focus .timer-card { overflow: visible; border-radius: 14px; }
.ambient.site-focus .timer-card > .card-head,
.ambient.site-focus :is(.phase-control, .activity-name, .study-destination, .timer-extensions, .timer-connection, .dial-label, .dial-caption) { display: none; }
.ambient.site-focus .timer-main { flex-direction: row; gap: 10px; min-height: 0; padding: 7px 8px 7px 16px; }
.ambient.site-focus .dial {
  width: auto;
  height: auto;
  margin: 0;
  border-radius: 0;
  padding-bottom: 4px;
  background: linear-gradient(90deg, #8359df var(--remaining), #e2d8f6 var(--remaining)) bottom / 100% 3px no-repeat;
}
.ambient.site-focus .dial.rest { background: linear-gradient(90deg, #56a887 var(--remaining), #d6eee3 var(--remaining)) bottom / 100% 3px no-repeat; }
.ambient.site-focus .dial-inner { position: static; background: none; gap: 0; }
.ambient.site-focus .dial output { font-size: 28px; letter-spacing: -.05em; }
.ambient.site-focus .timer-actions { flex-wrap: nowrap; margin: 0; gap: 5px; }
.ambient.site-focus .timer-actions .button { min-height: 36px; padding-inline: 12px; }
.ambient.site-focus .timer-button { min-width: 0; }
.ambient.site-focus .timer-tool { width: 36px; height: 36px; }
.ambient.site-focus .sound-toggle { display: inline-grid; }
.ambient.site-focus .sound-toggle[aria-expanded="true"] { background: var(--lavender); color: var(--purple); }
.ambient.site-focus .sound-bar {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: min(320px, calc(100vw - 24px));
  grid-template-columns: max-content minmax(0, 1fr);
  border: 1px solid #eee9f4;
  border-radius: 12px;
  box-shadow: 0 12px 40px #150c3255;
}
.ambient.site-focus .timer-card:not(.sound-open) .sound-bar { display: none; }
@media (max-width: 520px) {
  .ambient.site-focus .timer-main { padding-left: 12px; gap: 6px; }
  .ambient.site-focus .dial output { font-size: 23px; }
  .ambient.site-focus .timer-actions .button { padding-inline: 9px; font-size: 13px; }
}

/* Dragging on the terrain moves the view; around it the model turns. */
.city-canvas[data-drag="pan"] { cursor: grab; }
.city-canvas[data-drag="panning"] { cursor: grabbing; }
.city-canvas[data-drag="turn"], .city-canvas[data-drag="turning"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 24 24' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg stroke='%23fff' stroke-width='4.5'%3E%3Cpath d='M20 12a8 8 0 0 1-14.3 4.9M4 12a8 8 0 0 1 14.3-4.9'/%3E%3Cpath d='M18.5 3v4.3h-4.3M5.5 21v-4.3h4.3'/%3E%3C/g%3E%3Cg stroke='%23261b3d' stroke-width='2'%3E%3Cpath d='M20 12a8 8 0 0 1-14.3 4.9M4 12a8 8 0 0 1 14.3-4.9'/%3E%3Cpath d='M18.5 3v4.3h-4.3M5.5 21v-4.3h4.3'/%3E%3C/g%3E%3C/svg%3E") 13 13, ew-resize;
}

/* Reminders: a soft card at the top that leaves by itself. */
.reminder-toast {
  position: fixed; z-index: 12; top: 16px; left: 50%;
  display: grid; grid-auto-flow: column; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px;
  width: min(440px, calc(100% - 24px)); padding: 11px 12px 13px; overflow: hidden;
  border: 1px solid #e6dcf5; border-radius: 14px; background: #fffffff0; backdrop-filter: blur(14px);
  box-shadow: 0 10px 34px #2b214126; color: var(--ink);
  opacity: 0; pointer-events: none; transform: translate(-50%, -14px); transition: opacity .45s ease, transform .45s ease;
}
.reminder-toast.visible { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.reminder-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--lavender); color: var(--purple); }
.reminder-text { display: grid; gap: 2px; font-size: 13px; }
.reminder-text small { color: var(--muted); font-size: 11px; }
.reminder-toast .text-button { font-size: 12px; }
.reminder-toast .icon-button { width: 32px; height: 32px; }
.reminder-progress { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: #b79af8; transform-origin: left; }
.reminder-toast.visible .reminder-progress { animation: reminder-time var(--reminder-duration, 10s) linear forwards; }
.reminder-toast.paused .reminder-progress { animation-play-state: paused; }
@keyframes reminder-time { to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .reminder-toast { transition: opacity .2s; transform: translate(-50%, 0); } }
:where([data-theme="dark"]) .reminder-toast { background: #241c35f0; border-color: var(--accent-line); }
.reminder-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto auto; gap: 8px; }
.reminder-switch { display: flex; align-items: center; gap: 8px; min-width: 0; }
@media (max-width: 640px) {
  .reminder-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; }
  .reminder-switch { grid-column: 1 / -1; }
}
.reminder-row select { width: 100%; min-width: 0; }
.reminder-row .icon-button { width: 34px; height: 34px; }
.reminder-name { min-width: 0; flex: 1; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; background: none; color: inherit; font: inherit; font-weight: 700; }
.reminder-name:hover, .reminder-name:focus { border-color: var(--line); }
.reminder-row select { font-size: 12px; }

/* Water bottle: the level rises smoothly, with a gentle wave and a few bubbles. */
.sky { color: #2f78b5; background: #e4f2fc; }
.water-card { --water-top: #a9def7; --water-deep: #4c9ddc; --water-back: #7cc3ec; --glass: #eef6fc; --glass-line: #b9d6ea; }
.water-body { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 6px 18px 18px; }
.water-bottle { --fill: 0; flex: 0 0 auto; width: 104px; }
.water-bottle svg { display: block; width: 100%; height: auto; overflow: visible; }
.bottle-glass { fill: var(--glass); }
.bottle-outline { fill: none; stroke: var(--glass-line); stroke-width: 2.5; }
.bottle-shine { fill: #fff; opacity: .55; }
.bottle-cap { fill: #6aa8d8; }
.bottle-cap-lines { stroke: #ffffff70; stroke-width: 1.5; }
.bottle-ticks { stroke: var(--glass-line); stroke-width: 1.5; font: 700 7px system-ui, sans-serif; fill: #8aa9c0; }
.bottle-ticks text { stroke: none; }
.water-level { transform: translateY(calc((1 - var(--fill)) * 168px)); transition: transform 1.1s cubic-bezier(.22, .9, .3, 1.15); }
.water-wave { animation: water-drift 3.6s linear infinite; }
.water-wave.back { fill: var(--water-back); opacity: .55; animation-duration: 5.2s; animation-direction: reverse; transform: translateY(-3px); }
@keyframes water-drift { from { translate: 0 0; } to { translate: -60px 0; } }
.water-bubble { fill: #ffffffb0; animation: water-bubble 3.9s ease-in infinite; animation-delay: var(--delay); opacity: 0; }
@keyframes water-bubble { 0% { opacity: 0; transform: translateY(0); } 15% { opacity: .9; } 85% { opacity: .6; } 100% { opacity: 0; transform: translateY(-120px); } }
.water-info { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.water-total { font-family: 'Geist', 'DM Sans', system-ui, sans-serif; font-size: 34px; font-weight: 800; letter-spacing: -.05em; line-height: 1; color: #2f6f9f; }
.water-goal { color: var(--muted); font-size: 12px; font-weight: 700; }
.water-left { display: flex; align-items: center; gap: 5px; margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
.water-card.done .water-left { color: #2f8a74; font-weight: 700; }
.water-amount { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.water-amount strong { min-width: 58px; text-align: center; font-variant-numeric: tabular-nums; font-size: 14px; }
.water-amount .icon-button { width: 32px; height: 32px; font-size: 18px; line-height: 1; }
.water-add { width: 100%; justify-content: center; }
.water-remove { font-size: 12px; justify-self: center; }
.water-remove:disabled { opacity: .45; cursor: default; text-decoration: none; }
@media (prefers-reduced-motion: reduce) {
  .water-level { transition: none; }
  .water-wave, .water-bubble { animation: none; }
}
:where([data-theme="dark"]) .sky { color: #9fd0f2; background: #1f3346; }
:where([data-theme="dark"]) .water-card { --glass: #ffffff0d; --glass-line: #ffffff2e; }
:where([data-theme="dark"]) .water-total { color: #a9d9f6; }
:where([data-theme="dark"]) .water-card.done .water-left { color: #8fdcc6; }
:where([data-theme="dark"]) .bottle-shine { opacity: .18; }

/* Floating thermal bottle: breathes quietly, waves at water reminders and wilts when ignored.
   Its colors come from the app (violet for StudyBuilder, terracotta for WorkBuilder) and the theme. */
.check-field { display: flex; align-items: center; gap: 9px; margin: 4px 0 6px; font-size: 13px; font-weight: 600; }
.water-mascot {
  --m-body-light: #a58cf6; --m-body: #7656dc; --m-body-dark: #4d32a8; --m-base: #3e2a86;
  --m-lid-light: #4a3a7c; --m-lid-dark: #241a44; --m-steel: #f2eff8; --m-steel-dark: #b8b1c9;
  --m-gauge: #2a1f52; --m-water-top: #a8d8ff; --m-water-deep: #4f9cf0;
  --m-face: #1f163d; --m-cheek: #ff9ec7; --m-tongue: #f27c9f; --m-shadow: #3a256e38;
  position: fixed; z-index: 9; right: 22px; bottom: 16px;
  pointer-events: none;
}
:root[data-theme="dark"] .water-mascot {
  --m-body-light: #b9a4ff; --m-body: #8a6cf0; --m-body-dark: #5c41c4; --m-base: #4a339e;
  --m-lid-light: #5c4a96; --m-lid-dark: #2c2154; --m-steel: #e6e1f2; --m-steel-dark: #9e95b5;
  --m-face: #1d1438; --m-shadow: #00000070;
}
:root[data-builder="work"] .water-mascot {
  --m-body-light: #f3a46d; --m-body: #cf6527; --m-body-dark: #963f0f; --m-base: #7c330c;
  --m-lid-light: #6b3a20; --m-lid-dark: #3a1c0c; --m-steel: #f7f0e8; --m-steel-dark: #c8b6a6;
  --m-gauge: #4a2310; --m-water-top: #a8d8ff; --m-water-deep: #4f9cf0;
  --m-face: #2c160a; --m-cheek: #ffb59a; --m-tongue: #ee8a74; --m-shadow: #5a2a0e38;
}
:root[data-builder="work"][data-theme="dark"] .water-mascot {
  --m-body-light: #ffbd8c; --m-body: #e0793b; --m-body-dark: #a8501b; --m-base: #8a3f12;
  --m-lid-light: #7a4529; --m-lid-dark: #40210f; --m-steel: #efe4d9; --m-steel-dark: #a8917f;
  --m-shadow: #00000070;
}
.water-mascot[hidden] { display: none; }
.water-mascot :is(button, .mascot-bubble) { pointer-events: auto; }
.mascot-button { display: block; width: 70px; padding: 0; border: 0; background: none; cursor: grab; touch-action: none; filter: drop-shadow(0 4px 8px var(--m-shadow)); }
.water-mascot.dragging .mascot-button { cursor: grabbing; }
.water-mascot.dragging .mascot-figure { animation: none; transform: rotate(-6deg) scale(1.05); }
.water-mascot.dragging .mascot-bubble { opacity: 0 !important; }
.mascot-button svg { display: block; width: 100%; height: auto; overflow: visible; }
.mascot-button:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; border-radius: 14px; }
.mascot-shadow { fill: var(--m-shadow); transform-origin: 40px 117px; animation: mascot-shadow 4.2s ease-in-out infinite; }
.mascot-figure { transform-origin: 40px 112px; animation: mascot-breathe 4.2s ease-in-out infinite; transition: transform .2s; }
.mascot-outline { fill: none; stroke: var(--m-body-dark); stroke-width: 1.2; opacity: .6; }
.mascot-arm ellipse { fill: var(--m-body); stroke: var(--m-body-dark); stroke-width: 1.2; }
.mascot-arm { transform-box: fill-box; }
.mascot-arm.left { transform-origin: 70% 10%; --lift: 50deg; }
.mascot-arm.right { transform-origin: 30% 10%; --lift: -50deg; }
.mascot-base { fill: var(--m-base); }
.mascot-seam { stroke: #ffffff40; stroke-width: 1; }
.mascot-mark path { fill: none; stroke: #ffffffd0; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.mascot-shine { fill: #fff; opacity: .38; }
.mascot-shine.soft { opacity: .22; }
.mascot-gauge { fill: var(--m-gauge); opacity: .85; }
.mascot-gauge-ticks { stroke: #ffffffa0; stroke-width: 1; stroke-linecap: round; }
.mascot-water { transform: translateY(calc((1 - var(--level)) * 52px)); transition: transform 1s cubic-bezier(.22, .9, .3, 1.15); }
.mascot-wave { animation: mascot-drift 2.6s linear infinite; }
.mascot-loop { fill: none; stroke: var(--m-lid-dark); stroke-width: 4; stroke-linecap: round; }
.mascot-lid-shine { fill: #ffffff38; }
.mascot-face { fill: var(--m-face); stroke: var(--m-face); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mascot-face path { fill: none; }
.mascot-face .mascot-mouth { fill: var(--m-face); stroke-width: 1.2; }
.mascot-face .mascot-tongue { fill: var(--m-tongue); stroke: none; }
.mascot-face .mascot-lid { stroke-width: 2.4; }
.mascot-eye { stroke: none; transform-box: fill-box; transform-origin: center; animation: mascot-blink 5.5s infinite; }
.mascot-glint { fill: #fff; stroke: none; }
.mascot-cheek { fill: var(--m-cheek); opacity: .75; }
.mascot-face .mascot-pant { stroke: none; transform-box: fill-box; transform-origin: center; animation: mascot-pant 1.8s ease-in-out infinite; }
.mascot-tear { fill: var(--m-water-top); stroke: var(--m-water-deep); stroke-width: .6; animation: mascot-tear 2.4s ease-in infinite; }
.mascot-bubble {
  position: absolute; right: 0; bottom: calc(100% + 2px); width: max-content; max-width: 200px; margin: 0;
  padding: 8px 11px; border-radius: 13px 13px 4px 13px;
  background: var(--surface, #fff); color: var(--ink); border: 1px solid var(--line);
  font-size: 12px; font-weight: 600; line-height: 1.35;
  box-shadow: 0 8px 22px #1a10301f; opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s;
}
.water-mascot[data-side="left"] .mascot-bubble { right: auto; left: 0; border-radius: 13px 13px 13px 4px; }
.water-mascot[data-edge="top"] .mascot-bubble { bottom: auto; top: calc(100% + 4px); transform: translateY(-6px); border-radius: 4px 13px 13px 13px; }
.water-mascot[data-edge="top"]:not([data-side="left"]) .mascot-bubble { border-radius: 13px 4px 13px 13px; }
.water-mascot:hover .mascot-bubble, .water-mascot:focus-within .mascot-bubble, .water-mascot[data-react] .mascot-bubble,
.water-mascot[data-mood="fainted"] .mascot-bubble { opacity: 1; transform: none; }
.water-mascot[data-edge="top"]:is(:hover, :focus-within, [data-react], [data-mood="fainted"]) .mascot-bubble { transform: none; }
.mascot-hide { position: absolute; right: -6px; top: 2px; width: 22px; height: 22px; min-height: 0; padding: 0; border-radius: 50%; opacity: 0; transition: opacity .2s; }
.water-mascot[data-side="left"] .mascot-hide { right: auto; left: -6px; }
.water-mascot:hover .mascot-hide, .mascot-hide:focus-visible { opacity: 1; }

.water-mascot[data-mood="thirsty"] .mascot-figure { animation-duration: 5.5s; }
.water-mascot[data-mood="sad"] .mascot-figure { animation: mascot-droop 6s ease-in-out infinite; filter: saturate(.7); }
.water-mascot[data-mood="sad"] .mascot-arm { transform: rotate(10deg); }
.water-mascot[data-mood="fainted"] .mascot-figure { animation: none; transform: translate(6px, 12px) rotate(-84deg); filter: saturate(.2) brightness(.97); }
.water-mascot[data-mood="fainted"] .mascot-shadow { animation: none; transform: scaleX(1.7); }
.water-mascot[data-mood="fainted"] :is(.mascot-eye, .mascot-wave) { animation: none; }
.water-mascot[data-react="ask"] .mascot-figure { animation: mascot-hop .9s ease-in-out infinite; }
.water-mascot[data-react="ask"] .mascot-arm.right { animation: mascot-wave-arm .45s ease-in-out infinite alternate; }
.water-mascot[data-react="cheer"] .mascot-figure { animation: mascot-cheer .7s ease-in-out 3; filter: none; transform: none; }
.water-mascot[data-react="cheer"] .mascot-arm { animation: mascot-arms-up .35s ease-in-out 6 alternate; }
.water-mascot[data-react="sigh"] .mascot-figure { animation: mascot-sigh 1.6s ease-in-out 2; }

@keyframes mascot-drift { from { translate: 0 0; } to { translate: -11px 0; } }
@keyframes mascot-breathe { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-2px) scale(1.012, .988); } }
@keyframes mascot-shadow { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.9); } }
@keyframes mascot-blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes mascot-droop { 0%, 100% { transform: rotate(-4deg) translateY(1px); } 50% { transform: rotate(-6deg) translateY(2px) scale(1, .97); } }
@keyframes mascot-tear { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(15px); opacity: 0; } }
@keyframes mascot-pant { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.1, .7); } }
@keyframes mascot-hop { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-10px) rotate(-5deg); } 60% { transform: translateY(0) rotate(4deg) scale(1.03, .96); } }
@keyframes mascot-wave-arm { from { transform: rotate(-10deg); } to { transform: rotate(-70deg); } }
@keyframes mascot-arms-up { from { transform: rotate(0); } to { transform: rotate(var(--lift, 40deg)); } }
@keyframes mascot-cheer { 0%, 100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-13px) scale(.96, 1.05); } 70% { transform: translateY(0) scale(1.06, .94); } }
@keyframes mascot-sigh { 0%, 100% { transform: scale(1, 1); } 50% { transform: translateY(3px) scale(1.04, .92) rotate(-3deg); } }
@media (prefers-reduced-motion: reduce) {
  .water-mascot :is(.mascot-figure, .mascot-shadow, .mascot-wave, .mascot-eye, .mascot-tear, .mascot-arm, .mascot-pant) { animation: none !important; }
  .mascot-water { transition: none; }
}
@media (max-width: 760px) { .water-mascot { right: 12px; bottom: 76px; } .mascot-button { width: 54px; } }

:where([data-theme="dark"]) .bank-chip { background: var(--surface-raised); color: var(--text-soft); }
:where([data-theme="dark"]) .bank-chip .text-button { color: var(--purple); }
@media (max-width: 1100px) and (min-width: 651px) {
  .dashboard-grid.focus-first { grid-template-columns: minmax(290px, .9fr) minmax(0, 1.1fr); }
}
@media (max-width: 650px) {
  .dashboard-grid.focus-first { grid-template-columns: minmax(0, 1fr); }
}

:where([data-theme="dark"]) .week-card .chart-day .bar, :where([data-theme="dark"]) .week-card .chart-day.current .bar { background: #4a3d66; }
:where([data-theme="dark"]) .week-card .chart-day.reached .bar { background: var(--purple); }
:where([data-theme="dark"]) .week-card .bar-check { color: #21192f; }
:where([data-theme="dark"]) .team-hours thead { background: none; }

/* Friends: list, simplified status and conversations. */
.presence.online { background: #2f9e6a; }
:where([data-theme="dark"]) .presence.online { background: #78cea1; }
.nav-badge { margin-left: auto; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center;
  background: var(--purple); color: #fff; font-size: 11px; font-weight: 750; }
:where([data-theme="dark"]) .nav-badge { color: #1b1427; }
.friends-layout { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 17px; align-items: start; }
.friends-side { max-width: none; }
.friends-side .card-head p { display: flex; align-items: center; }
.friend-form, .chat-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 17px 17px; }
.friend-form input, .chat-form input { flex: 1 1 160px; min-width: 0; padding: 10px 12px; border: 1px solid var(--field-border, #dcd5e8);
  border-radius: 9px; background: var(--surface-inset, #fff); color: var(--ink); }
.friend-form .form-error, .chat-form .form-error { flex-basis: 100%; margin: 0; }
.friend-form .form-error:empty, .chat-form .form-error:empty { display: none; }
.friend-list { list-style: none; margin: 0 9px 9px; padding: 0; }
.friend-main { width: 100%; display: flex; align-items: center; gap: 11px; padding: 9px 8px; border: 0; border-radius: 10px;
  background: none; text-align: left; }
.friend-main:hover { background: var(--surface-hover, #f5f1f8); }
.friend-open .friend-main { background: var(--lavender); }
.friend-body { flex: 1; min-width: 0; display: grid; gap: 3px; font-size: 13px; }
.friend-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-body small { display: flex; align-items: center; color: var(--muted); font-size: 12px; }
.unread-count { min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center;
  background: var(--purple); color: #fff; font-size: 11px; font-weight: 750; }
:where([data-theme="dark"]) .unread-count { color: #1b1427; }
.request-sent { color: var(--muted); font-size: 12px; margin-right: 6px; }
.chat-card { display: flex; flex-direction: column; height: min(680px, calc(100vh - 170px)); min-height: 380px; position: sticky; top: 20px; }
.chat-placeholder { align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }
.chat-placeholder p { color: var(--ink); font-weight: 600; }
.chat-placeholder small { max-width: 320px; line-height: 1.5; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.chat-back { display: none; }
.chat-back svg { transform: scaleX(-1); }
.chat-log { flex: 1; list-style: none; margin: 0; padding: 14px 17px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.chat-empty { margin: auto; color: var(--muted); font-size: 13px; }
.chat-day { align-self: center; color: var(--muted); font-size: 11px; font-weight: 600; padding: 4px 0; }
.chat-message { align-self: flex-start; max-width: min(78%, 520px); padding: 8px 11px; border-radius: 13px 13px 13px 4px;
  background: var(--surface-raised, #f1eef6); font-size: 13px; line-height: 1.45; }
.chat-message p { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message small { display: block; margin-top: 3px; color: var(--muted); font-size: 10.5px; text-align: right; }
.chat-message.own { align-self: flex-end; border-radius: 13px 13px 4px 13px; background: var(--purple); color: #fff; }
.chat-message.own small { color: #ffffffc4; }
:where([data-theme="dark"]) .chat-message.own { color: #1b1427; }
:where([data-theme="dark"]) .chat-message.own small { color: #1b1427b0; }
.chat-hint { margin: 0 17px; color: var(--muted); font-size: 12px; }
.chat-hint:empty { display: none; }
.chat-form { margin-top: 10px; }
.message-toast { top: auto; bottom: 18px; transform: translate(-50%, 14px); }
.message-toast .reminder-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) {
  .friends-layout { grid-template-columns: 1fr; }
  .friends-layout.chat-active .friends-side { display: none; }
  .friends-layout:not(.chat-active) .chat-card { display: none; }
  .chat-card { position: static; height: calc(100vh - 150px); }
  .chat-back { display: inline-grid; }
}

/* Focus among friends is red ("busy"): stronger than the green available. */
.presence.busy { background: #d23c3c; }
:where([data-theme="dark"]) .presence.busy { background: #ff7b7b; }

/* Floating friends button (bottom right) and its small window. */
body.has-friends-dock .water-mascot { bottom: 68px; }
body.has-friends-dock #notice { bottom: 72px; }
.friends-dock { position: fixed; z-index: 11; right: 22px; bottom: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.dock-pill { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 20px; background: var(--surface, #fff); color: var(--ink); font-size: 13px; font-weight: 700;
  box-shadow: 0 6px 20px #2b21412a; }
.dock-pill:hover { border-color: var(--purple); }
.friends-dock.open .dock-pill { border-color: var(--purple); color: var(--deep-purple); }
.dock-pill .presence { margin: 0; }
.dock-hidden-self { display: inline-flex; color: var(--muted); }
.dock-unread { min-width: 19px; height: 19px; font-size: 10.5px; }
.dock-panel { width: min(300px, calc(100vw - 32px)); display: flex; flex-direction: column; max-height: min(440px, calc(100vh - 110px));
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface, #fff); box-shadow: 0 12px 36px #2b214130; overflow: hidden; }
.dock-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 14px; border-bottom: 1px solid var(--line); }
.dock-head > div { flex: 1; display: grid; gap: 2px; font-size: 14px; }
.dock-head small { color: var(--muted); font-size: 12px; font-weight: 500; }
.dock-head small.has-unread { color: var(--deep-purple); font-weight: 700; }
.dock-head .icon-button { width: 30px; height: 30px; }
.dock-visibility { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 14px; border: 0; border-bottom: 1px solid var(--line);
  background: none; text-align: left; font-size: 12.5px; }
.dock-visibility:hover { background: var(--surface-hover, #f7f4fc); }
.dock-visibility > span:first-child { flex: 1; display: flex; align-items: center; gap: 9px; color: var(--muted); }
.dock-visibility > span:first-child > span { display: grid; gap: 1px; }
.dock-visibility strong { color: var(--ink); font-size: 13px; }
.dock-visibility small { font-size: 11.5px; }
.dock-switch { flex: none; position: relative; width: 34px; height: 20px; border-radius: 10px; background: var(--line); transition: background .2s; }
.dock-switch i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px #0003; transition: transform .2s; }
.dock-visibility[aria-checked="true"] .dock-switch { background: var(--purple); }
.dock-visibility[aria-checked="true"] .dock-switch i { transform: translateX(14px); }
.dock-list { flex: 1; min-height: 0; list-style: none; margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.dock-friend { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 8px; border: 0; border-radius: 9px; background: none; text-align: left; }
.dock-friend:hover { background: var(--surface-hover, #f7f4fc); }
.dock-friend.offline .friend-body strong { color: var(--muted); font-weight: 600; }
.dock-friend .avatar { position: relative; flex: none; }
.dock-friend .avatar .presence { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; margin: 0;
  border: 2px solid var(--surface, #fff); box-sizing: content-box; }
.dock-empty { padding: 14px 10px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.dock-expand { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 11px; border: 0; border-top: 1px solid var(--line);
  background: none; color: var(--purple); font-size: 13px; font-weight: 700; }
.dock-expand:hover { background: var(--surface-hover, #f7f4fc); }
.dock-arrival { display: flex; align-items: center; gap: 7px; max-width: 260px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface, #fff); color: var(--muted); font-size: 12px; box-shadow: 0 4px 14px #2b21411f;
  opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .35s, transform .35s; }
.dock-arrival.visible { opacity: 1; transform: none; }
.dock-arrival span { color: var(--ink); font-weight: 600; }
@media (max-width: 760px) {
  .friends-dock { right: 12px; bottom: 12px; }
  body.has-friends-dock .water-mascot { bottom: 64px; }
}
@media (prefers-reduced-motion: reduce) { .dock-arrival, .dock-switch, .dock-switch i { transition: none; } }
.friend-main .avatar, .dock-friend .avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--lavender); color: var(--deep-purple); font-size: 13px; font-weight: 750; }

.dock-section { padding: 8px 8px 4px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.dock-request { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 10px; padding: 8px; margin-bottom: 4px;
  border-radius: 10px; background: var(--lavender); }
.dock-request .avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface, #fff); color: var(--deep-purple); font-size: 13px; font-weight: 750; }
.dock-request .friend-body small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-request-actions { grid-column: 2; display: flex; align-items: center; gap: 10px; }
.dock-request-actions .button { min-height: 0; height: 30px; padding: 0 12px; font-size: 12.5px; }
.dock-request-actions .text-button { font-size: 12.5px; }
.dock-head [data-dock="add"].active { background: var(--lavender); color: var(--deep-purple); }
.dock-add { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); background: var(--surface-inset, #faf8fd); }
.dock-add-row { display: flex; align-items: center; gap: 6px; }
.dock-add-at { color: var(--muted); font-weight: 700; font-size: 13px; }
.dock-add input { flex: 1; min-width: 0; height: 32px; padding: 0 9px; border: 1px solid var(--field-border, #dcd5e8); border-radius: 8px;
  background: var(--surface, #fff); color: var(--ink); font-size: 13px; }
.dock-add input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px #6848cb22; }
.dock-add .button { min-height: 0; height: 32px; padding: 0 11px; font-size: 12.5px; white-space: nowrap; }
.dock-add-message { margin: 6px 2px 0; font-size: 12px; color: var(--muted); }
.dock-add-message:empty { display: none; }
.dock-add-message.success { color: #2f8a5e; }
.dock-add-message.error { color: #a32646; }
:where([data-theme="dark"]) .dock-add-message.success { color: #8fdcc6; }
:where([data-theme="dark"]) .dock-add-message.error { color: #ffafc1; }

/* Streak flame: active days in a row with 1 h or more. */
.streak { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; padding: 1px 6px 1px 4px; border-radius: 9px;
  font-size: 11.5px; font-weight: 800; vertical-align: 1px; line-height: 1.4; }
.streak svg { width: 13px; height: 13px; }
.streak.lit { background: #fff0e3; color: #d4570f; }
.streak.lit svg { fill: #ff9a3d; stroke: #d4570f; }
.streak.pending { background: var(--lavender); color: var(--muted); }
:where([data-theme="dark"]) .streak.lit { background: #43281a; color: #ffb07a; }
:where([data-theme="dark"]) .streak.lit svg { fill: #f08a3c; stroke: #ffb07a; }
.own-streak { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.own-streak .streak { margin-left: 0; }
.dock-head strong { display: flex; align-items: center; }
/* Your own flame next to your name (sidebar) and in the mobile top bar. */
.profile strong.profile-name { display: flex; align-items: center; min-width: 0; }
.profile-name > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile .profile-name .streak { flex: none; }
.mobile-streak { display: inline-flex; align-items: center; }
.mobile-streak:empty { display: none; }
.mobile-streak .streak { margin-left: 0; padding: 3px 8px 3px 6px; font-size: 12.5px; }
/* Narrow phones: the app switch keeps only its icons so the flame fits next to the logo. */
@media (max-width: 420px) {
  .builder-switch-compact .builder-option span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .mobile-top { gap: 8px; }
}

/* Free layout of the focus space: the palette under the title toggles the cards; the cards move
   between the center flow and a vertical column on each side. */
.focus-palette { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.focus-palette .icon-button { width: 36px; height: 36px; }
.palette-toggle[aria-pressed="true"] { background: var(--lavender); border-color: color-mix(in srgb, var(--purple) 22%, transparent); color: var(--deep-purple); }
.palette-toggle[aria-pressed="false"] { color: #a39bb2; background: transparent; border-style: dashed; }
.palette-toggle[aria-pressed="false"] svg { opacity: .7; }
.palette-reset:disabled { opacity: .45; cursor: default; }
.palette-reset:disabled:hover { background: #fff; border-color: #eeeaf2; color: #756c84; }
.palette-divider { width: 1px; height: 22px; margin-inline: 3px; background: var(--line); }

.focus-layout { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 17px; align-items: start; }
.focus-layout.has-left { grid-template-columns: minmax(280px, 330px) minmax(0, 1fr); }
.focus-layout.has-right { grid-template-columns: minmax(0, 1fr) minmax(280px, 330px); }
.focus-layout.has-left.has-right { grid-template-columns: minmax(270px, 310px) minmax(0, 1fr) minmax(270px, 310px); }
.focus-center, .focus-side { display: flex; flex-direction: column; gap: 17px; min-width: 0; }
.focus-center:empty { min-height: 120px; }
.focus-layout .week-card { margin: 0; }
.dashboard-grid.focus-last { grid-template-columns: minmax(0, 1.26fr) minmax(310px, .74fr); }
.layout-row.single { grid-template-columns: minmax(0, 1fr); }
.focus-empty { display: flex; align-items: center; gap: 9px; padding: 22px; border: 1px dashed #d9cff0; border-radius: 16px; color: var(--muted); font-size: 14px; }

.layout-card { position: relative; }
.layout-grip {
  position: absolute; top: 3px; left: 50%; translate: -50% 0; z-index: 2;
  display: grid; place-items: center; width: 34px; height: 14px; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: #b4abc3;
  cursor: grab; touch-action: none; opacity: .55; transition: opacity .15s, background .15s;
}
.layout-grip svg { rotate: 90deg; }
.layout-card:hover .layout-grip, .layout-grip:focus-visible { opacity: 1; }
.layout-grip:hover { background: #f3eefc; color: var(--deep-purple); }
.layout-card :is(.card-head, .week-title) { cursor: grab; }
.layout-card :is(.card-head, .week-title) :is(button, a, input, select) { cursor: pointer; }
.layout-pressed { outline: 2px solid #b59bec; outline-offset: 2px; }
.layout-dragging { z-index: 20; opacity: .92; box-shadow: 0 18px 50px #2d194540; cursor: grabbing; pointer-events: none; transition: none; }
.layout-drag-active, .layout-drag-active * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.layout-marker { position: absolute; z-index: 15; border-radius: 4px; background: var(--purple); box-shadow: 0 0 0 3px #6848cb2b; pointer-events: none; }
.layout-zone {
  position: absolute; top: 0; bottom: 0; z-index: 14; width: 40px;
  display: grid; place-items: center; border: 2px dashed #cdbdf2; border-radius: 16px;
  background: #f6f2fdcc; color: var(--deep-purple); pointer-events: none; transition: background .15s, width .15s;
}
.layout-zone.left { left: -30px; }
.layout-zone.right { right: -30px; }
.layout-zone span { writing-mode: vertical-rl; font-size: 12px; font-weight: 700; }
.layout-zone.left span { rotate: 180deg; }
.layout-zone.active { width: 58px; background: #ece3fdee; border-color: var(--purple); }
.focus-side.drop-target { outline: 2px dashed var(--purple); outline-offset: 6px; border-radius: 16px; }

/* On a side, the week stacks its numbers above the chart. */
.week-card.layout-vertical { grid-template-columns: minmax(0, 1fr); }
.week-card.layout-vertical .week-metric strong { font-size: 24px; }
.layout-vertical .water-body { flex-wrap: wrap; justify-content: center; }

:where([data-theme="dark"]) .palette-toggle[aria-pressed="true"] { background: var(--lavender); border-color: var(--accent-line); color: var(--deep-purple); }
:where([data-theme="dark"]) .palette-toggle[aria-pressed="false"] { background: transparent; color: var(--muted); }
:where([data-theme="dark"]) .palette-reset:disabled:hover { background: var(--surface-raised); border-color: var(--line); color: var(--text-soft); }
:where([data-theme="dark"]) .layout-grip { color: var(--muted); }
:where([data-theme="dark"]) .layout-grip:hover { background: var(--surface-hover); color: var(--deep-purple); }
:where([data-theme="dark"]) .layout-zone { background: #2b223bdd; border-color: var(--accent-line); }
:where([data-theme="dark"]) .layout-zone.active { background: #38294cee; border-color: var(--purple); }
:where([data-theme="dark"]) .focus-empty { border-color: var(--line); }

/* Without room for side columns, they join the single flow: left above the center, right below. */
@media (max-width: 1100px) {
  .focus-layout.has-left, .focus-layout.has-right, .focus-layout.has-left.has-right { grid-template-columns: minmax(0, 1fr); }
  .week-card.layout-vertical { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); }
}
@media (max-width: 1100px) and (min-width: 651px) {
  .dashboard-grid.focus-last { grid-template-columns: minmax(0, 1.1fr) minmax(290px, .9fr); }
}
@media (max-width: 820px) {
  .week-card.layout-vertical { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 650px) {
  .focus-layout, .focus-center, .focus-side { gap: 12px; }
  .dashboard-grid.focus-last { grid-template-columns: minmax(0, 1fr); }
  .focus-palette { margin-top: 10px; }
}
@media (pointer: coarse) { .layout-grip { opacity: 1; width: 44px; height: 18px; top: 1px; } }
@media (prefers-reduced-motion: reduce) { .layout-grip, .layout-zone { transition: none; } }

/* Construction crew: wallet, team, shop and inventory (#5). */
.crew-wallet { display: flex; align-items: center; gap: 13px; padding: 15px 18px; margin-bottom: 16px; flex-wrap: wrap; }
.crew-wallet strong { font-size: 20px; }
.crew-page { display: grid; gap: 17px; }
.crew-figure, .crew-machine, .crew-icon { flex: none; display: block; }
.crew-figure { width: 64px; height: 96px; }
.crew-machine { width: 96px; height: 72px; }
.crew-team { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 17px; }
.crew-worker { display: grid; gap: 13px; padding: 17px 18px; align-content: start; }
.crew-worker-head { display: flex; align-items: center; gap: 12px; }
.crew-worker-head p { margin-top: 3px; font-size: 12px; color: var(--muted); }
.crew-gender button { min-width: 0; flex: 1; }
.crew-gender { width: 100%; }
.crew-slots { display: grid; gap: 9px; }
.crew-slot { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.crew-slot select { width: 100%; min-width: 0; padding: 7px 9px; border: 1px solid #ddd6e8; border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; }
.crew-machine-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; padding: 0 18px 18px; }
.crew-machine-row { display: flex; align-items: flex-start; gap: 12px; }
.crew-machine-row > div { flex: 1; min-width: 0; display: grid; gap: 7px; }
.crew-machine-row h3 { font-size: 14px; }
.crew-filters { display: grid; gap: 10px; }
.crew-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.crew-chip { padding: 5px 11px; border: 1px solid #ddd6e8; border-radius: 999px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 700; }
.crew-chip[aria-pressed="true"] { border-color: var(--purple); background: var(--purple); color: #fff; }
.crew-filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.crew-sort { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--muted); }
.crew-sort select { padding: 6px 9px; border: 1px solid #ddd6e8; border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; }
.crew-item-funny { box-shadow: inset 0 0 0 2px #f6b6cf; }
.crew-empty { padding: 18px; color: var(--muted); font-size: 13px; }
.crew-group { display: grid; gap: 4px; }
.crew-group > .card-head { padding: 4px 2px 8px; }
.crew-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 13px; }
.crew-item { display: flex; gap: 12px; padding: 13px 14px; align-items: center; }
.crew-item-art { position: relative; display: grid; place-items: center; width: 78px; height: 82px; border: 0; border-radius: 12px; background: #f6f3fa; flex: none; padding: 0; }
.crew-item-art:hover { background: #efe9f9; }
.crew-play { position: absolute; right: 5px; bottom: 5px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; background: var(--purple); }
.crew-item-body { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.crew-item-body small { font-size: 12px; color: var(--muted); }
.crew-price { font-size: 13px; font-weight: 800; color: #a34c2d; }
.crew-item-body .button { padding: 6px 12px; font-size: 12px; }
.crew-owned, .crew-locked { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: #237556; }
.crew-locked { color: var(--muted); }
.crew-item-locked .crew-item-art { filter: grayscale(.8); opacity: .65; }
.crew-inventory { padding-bottom: 8px; }
.crew-dress { display: flex; align-items: center; gap: 18px; padding: 17px 18px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.crew-dress p { margin: 3px 0 10px; font-size: 12px; color: var(--muted); }
.crew-dress .crew-dress-preview { flex: none; width: 180px; height: 200px; }
.crew-inventory .card-head { padding-bottom: 4px; }
.crew-inventory-group { padding: 6px 18px 10px; }
.crew-inventory-group h3 { font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.crew-tiles { display: flex; flex-wrap: wrap; gap: 9px; }
.crew-tile { position: relative; width: 104px; border: 1px solid #e9e4f0; border-radius: 12px; background: #fff; }
.crew-tile:hover { border-color: #cbbcf0; }
.crew-tile-on { border-color: var(--purple); box-shadow: 0 0 0 2px #6848cb24; }
.crew-tile-use { display: grid; justify-items: center; gap: 4px; width: 100%; padding: 9px 6px; border: 0; background: none; color: var(--ink); font-size: 12px; font-weight: 700; text-align: center; }
.crew-tile-preview { position: absolute; top: 5px; right: 5px; display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; color: #fff; background: var(--purple); opacity: .85; }
.crew-tile-preview:hover { opacity: 1; }
.crew-preview-dialog { width: min(560px, calc(100vw - 24px)); }
.crew-preview { display: grid; gap: 12px; }
.crew-stage { display: block; width: 100%; border-radius: 14px; background: #251b3d; }
.crew-preview .crew-stage { height: min(320px, 56vh); }
.crew-stage-caption { font-size: 12px; color: var(--muted); text-align: center; }
.crew-preview-options { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.crew-preview-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.crew-preview-foot strong { color: var(--ink); }
.crew-tile small { display: inline-flex; align-items: center; gap: 3px; color: var(--purple); font-size: 11px; }
:where([data-theme="dark"]) .crew-item-art { background: var(--surface-inset); }
:where([data-theme="dark"]) .crew-tile, :where([data-theme="dark"]) .crew-slot select, :where([data-theme="dark"]) .crew-chip, :where([data-theme="dark"]) .crew-sort select { background: var(--surface-raised); border-color: var(--line); color: var(--ink); }
:where([data-theme="dark"]) .crew-price { color: var(--peach-ink); }
:where([data-theme="dark"]) .crew-owned { color: var(--mint-ink); }
:where([data-theme="dark"]) .crew-chip[aria-pressed="true"] { background: var(--purple); border-color: var(--purple); color: #fff; }
@media (max-width: 520px) {
  .crew-tile { width: calc(50% - 5px); }
}
