/* Octoclock: mobile-first, portrait. No inline styles anywhere (strict CSP), so
   anything dynamic is driven through CSS variables set from script. */

:root {
  --primary: #1f6f8b;
  --secondary: #f08a4b;
  --on-primary: #ffffff;
  --font-scale: 1;

  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --text: #2a2438;
  --muted: #6d6680;
  --line: rgba(60, 40, 100, 0.14);
  --scrim: rgba(255, 250, 252, 0.55);
  --accent: var(--primary);
  --tint: color-mix(in srgb, var(--primary) 12%, var(--surface-solid));
  --tint-2: color-mix(in srgb, var(--secondary) 16%, var(--surface-solid));
  --danger: #c23b57;
  --ok: #2e8b6a;
  --shadow: 0 6px 24px rgba(60, 40, 100, 0.14);
  --radius: 20px;
  --tab-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --surface: rgba(30, 26, 44, 0.82);
  --surface-solid: #1f1b2d;
  --text: #f1edf8;
  --muted: #b2aac6;
  --line: rgba(255, 255, 255, 0.14);
  --scrim: rgba(14, 11, 24, 0.62);
  --accent: color-mix(in srgb, var(--primary) 62%, white);
  --tint: color-mix(in srgb, var(--primary) 24%, var(--surface-solid));
  --tint-2: color-mix(in srgb, var(--secondary) 22%, var(--surface-solid));
  --danger: #ff8aa0;
  --ok: #6fd3b0;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: calc(16px * var(--font-scale)); -webkit-text-size-adjust: 100%; overflow-x: clip; overscroll-behavior-x: none; }
/* Double-tap never zooms and the page can't be dragged sideways; vertical scroll and pinch still work.
   (Wide tables below opt back in to sideways scrolling inside their own box.) */
*, *::before, *::after { touch-action: pan-y pinch-zoom; }
.table-wrap { touch-action: pan-x pan-y pinch-zoom; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface-solid);
  color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  overflow-x: clip;
  max-width: 100vw;
  -webkit-tap-highlight-color: transparent;
}
.sprite { position: absolute; width: 0; height: 0; }
.icon { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.8rem; }

/* ---------- Background art + scrim ---------- */
.app-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 60% at 10% 0%, color-mix(in srgb, var(--secondary) 35%, transparent), transparent 60%),
    radial-gradient(100% 60% at 100% 100%, color-mix(in srgb, var(--primary) 30%, transparent), transparent 60%),
    var(--surface-solid);
  background-size: cover;
  background-position: center;
}
.app-bg::after { content: ""; position: absolute; inset: 0; background: var(--scrim); }
.app-bg[data-bg="none"]::after { background: transparent; }
.app-bg[data-bg="aurora"] { background-image: url("assets/backgrounds/aurora.webp"); }
.app-bg[data-bg="sunrise"] { background-image: url("assets/backgrounds/sunrise.webp"); }
.app-bg[data-bg="ocean"] { background-image: url("assets/backgrounds/ocean.webp"); }
.app-bg[data-bg="garden"] { background-image: url("assets/backgrounds/garden.webp"); }
.app-bg[data-bg="twilight"] { background-image: url("assets/backgrounds/twilight.webp"); }
.app-bg[data-bg="blossom"] { background-image: url("assets/backgrounds/blossom.webp"); }
.app-bg[data-bg="steel"] { background-image: url("assets/backgrounds/steel.webp"); }
.app-bg[data-bg="mountains"] { background-image: url("assets/backgrounds/mountains.webp"); }
.app-bg[data-bg="workshop"] { background-image: url("assets/backgrounds/workshop.webp"); }
.app-bg[data-bg="octopus"] { background-image: url("assets/backgrounds/octopus.webp"); }
.app-bg[data-bg="reef"] { background-image: url("assets/backgrounds/reef.webp"); }
.app-bg[data-bg="jellyfish"] { background-image: url("assets/backgrounds/jellyfish.webp"); }
.app-bg[data-bg="turtle"] { background-image: url("assets/backgrounds/turtle.webp"); }

/* ---------- Loading screen ---------- */
.splash {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem;
  background:
    radial-gradient(90% 55% at 50% 0%, color-mix(in srgb, var(--primary) 28%, transparent), transparent 70%),
    var(--surface-solid);
  transition: opacity 0.35s ease;
}
.splash.is-leaving { opacity: 0; pointer-events: none; }
.splash-logo { border-radius: 28px; box-shadow: var(--shadow); animation: float 2.6s ease-in-out infinite; }
.splash p { color: var(--muted); }
.spinner {
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  border: 4px solid color-mix(in srgb, var(--primary) 20%, transparent);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 50% { transform: translateY(-8px); } }

/* ---------- Shared controls ---------- */
.card {
  background: var(--surface);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface-solid); color: var(--text);
  font: inherit; font-weight: 600; padding: 0.7rem 1.1rem; border-radius: 999px; min-height: 44px; cursor: pointer;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 78%, white)); color: var(--on-primary); border-color: transparent; }
.btn-block { width: 100%; }
.btn-danger { color: var(--danger); }
.link { appearance: none; background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; padding: 0.6rem; min-height: 44px; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.85rem; }
.field > span { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  font: inherit; font-size: max(16px, 1rem); color: var(--text);
  background: var(--surface-solid); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 0.65rem 0.8rem; width: 100%; min-height: 44px;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 1px;
}
.form-error { color: var(--danger); font-size: 0.9rem; min-height: 1.2em; margin-bottom: 0.5rem; }
.form-error:empty { display: none; }

/* ---------- Sign in ---------- */
.auth {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  padding: 0 1rem calc(2rem + env(safe-area-inset-bottom));
  justify-content: center;
}
.auth-logo { border-radius: 32px; box-shadow: var(--shadow); border: 3px solid var(--surface-solid); margin-bottom: 0.3rem; }
.brand-name {
  font-size: 2rem; letter-spacing: 0.01em;
  background: linear-gradient(90deg, var(--primary), var(--secondary)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { color: var(--muted); margin-bottom: 0.9rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .link { display: block; margin: 0.25rem auto 0; }
.auth-card > p:not(.form-error) { margin-bottom: 0.9rem; }

/* ---------- App shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 0.7rem;
  padding: calc(0.6rem + env(safe-area-inset-top)) 1rem 0.6rem;
  background: var(--surface); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand-mark { border-radius: 11px; box-shadow: 0 2px 8px rgba(60, 40, 100, 0.2); }
.topbar-text { flex: 1; min-width: 0; line-height: 1.15; }
.topbar h1 { font-size: 1.2rem; }
.brand-small { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sync { font-size: 0.78rem; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 0.3rem; }
.sync.is-saving { color: var(--accent); }
.sync.is-saved { color: var(--ok); }
.sync.is-error { color: var(--danger); }

.view { flex: 1; padding: 0.9rem 0.5rem calc(var(--tab-h) + 4.5rem + env(safe-area-inset-bottom)); outline: none; }
.view > * + * { margin-top: 0.9rem; }

/* Collapsible bottom menu: labels hide when collapsed, icons stay. */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: stretch; justify-content: space-around;
  padding: 0.25rem 0.5rem calc(0.25rem + env(safe-area-inset-bottom));
  background: var(--surface); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  min-height: var(--tab-h);
}
.tab {
  appearance: none; background: none; border: 0; color: var(--muted); font: inherit;
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  padding: 0.35rem 0.25rem; border-radius: 16px; min-height: 48px; cursor: pointer;
}
.tab span { font-size: 0.72rem; font-weight: 700; }
.tab[aria-current="page"] { color: var(--accent); background: var(--tint); }
.tab-toggle {
  appearance: none; background: var(--surface-solid); border: 1px solid var(--line); color: var(--muted);
  position: absolute; left: 50%; top: -14px; transform: translateX(-50%);
  width: 44px; height: 24px; border-radius: 999px; padding: 0; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.tab-toggle .icon { width: 1rem; height: 1rem; transition: transform 0.2s ease; }
.tabbar.is-collapsed { min-height: 0; }
.tabbar.is-collapsed .tab span { display: none; }
.tabbar.is-collapsed .tab { min-height: 44px; }
.tabbar.is-collapsed .tab-toggle .icon { transform: rotate(180deg); }
.tabbar.is-collapsed ~ .view, .shell:has(.tabbar.is-collapsed) .view { padding-bottom: calc(3.4rem + 4rem + env(safe-area-inset-bottom)); }

/* ---------- Time view ---------- */
.summary { display: flex; align-items: center; gap: 1rem; background: linear-gradient(135deg, var(--tint), var(--tint-2)); }
.ring {
  --pct: 0;
  width: 4.6rem; height: 4.6rem; border-radius: 50%; flex: none;
  background: conic-gradient(var(--primary) calc(var(--pct) * 1%), color-mix(in srgb, var(--primary) 16%, transparent) 0);
  display: grid; place-items: center;
}
.ring-inner { width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--surface-solid); display: grid; place-items: center; font-weight: 800; font-size: 0.95rem; }
.summary-text strong { font-size: 1.5rem; display: block; line-height: 1.1; }
.summary-text span { color: var(--muted); font-size: 0.88rem; }

.today-card h2 { font-size: 1rem; }
.today-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.6rem; }
input.today-input { font-weight: 800; font-size: max(1.4rem, 16px); }
.chip {
  appearance: none; border: 1.5px solid var(--line); background: var(--surface-solid); color: var(--text);
  font: inherit; font-weight: 700; border-radius: 999px; padding: 0.5rem 0.7rem; min-height: 44px; min-width: 52px; cursor: pointer;
}
.chip:active { background: var(--tint); }

.list-controls { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.list-controls label { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.9rem; }
.list-controls select { width: auto; padding-right: 1.6rem; }

.week { padding: 0.8rem 0.35rem; }
.week.is-current { border: 2px solid color-mix(in srgb, var(--primary) 60%, transparent); }
.week-head { display: flex; align-items: center; gap: 0.5rem; padding: 0 0.4rem 0.55rem; }
.week-head h3 { font-size: 1rem; flex: 1; }
.badge { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; background: var(--primary); color: var(--on-primary); border-radius: 999px; padding: 0.15rem 0.55rem; }
.week-total { font-weight: 800; background: var(--tint); border-radius: 999px; padding: 0.15rem 0.65rem; font-variant-numeric: tabular-nums; }
.progress { height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--primary) 14%, transparent); margin: 0 0.4rem 0.6rem; overflow: hidden; }
.progress-bar { --pct: 0; height: 100%; width: calc(var(--pct) * 1%); background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 99px; transition: width 0.25s ease; }

.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 14px; padding: 4px 0 2px; }
.day.is-today { background: var(--tint); }
.day-label { display: flex; flex-direction: column; align-items: center; font-size: 0.68rem; font-weight: 700; color: var(--muted); line-height: 1.15; }
.day-label b { font-size: 0.95rem; color: var(--text); }
.day.is-today .day-label b { color: var(--accent); }
input.hours {
  width: 100%; min-width: 0; padding: 0.5rem 0; text-align: center; font-weight: 600; font-size: max(16px, 1rem);
  font-variant-numeric: tabular-nums; border-radius: 11px;
}
input.hours.has-value { background: color-mix(in srgb, var(--primary) 9%, var(--surface-solid)); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.note-btn {
  appearance: none; border: 0; background: none; color: var(--muted); cursor: pointer;
  width: 100%; min-height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 10px; position: relative;
}
.note-btn .icon { width: 1rem; height: 1rem; }
.note-btn.has-note { color: var(--accent); }
.note-btn.has-note::after { content: ""; position: absolute; top: 5px; right: 28%; width: 7px; height: 7px; border-radius: 50%; background: var(--secondary); }
.week.is-wide .days { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }

.week-foot { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 0.55rem; padding: 0 0.3rem; }
.week-notes { padding: 0.55rem 0.8rem; }
.week-foot-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.week-foot .link { padding: 0.3rem 0.4rem; min-height: 36px; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 0.35rem; }
.week-foot .icon { width: 1rem; height: 1rem; }
.save-state { font-size: 0.75rem; color: var(--muted); }

.more { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; padding-top: 0.2rem; }

/* ---------- Reports ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.stat { padding: 0.8rem; }
.stat b { font-size: 1.35rem; display: block; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 0.8rem; }
.section-title { font-size: 1rem; margin-bottom: 0.5rem; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 9px; font-family: inherit; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--primary); cursor: pointer; }
.chart .bar.alt { fill: var(--secondary); }
.chart .bar.is-picked, .chart .bar:focus { fill: var(--accent); stroke: var(--text); stroke-width: 1; outline: none; }
.chart .target { stroke: var(--secondary); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart-caption { min-height: 1.4em; font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; }
.table-wrap { overflow-x: auto; margin: 0 -0.25rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.note-item { padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.note-item small { color: var(--muted); display: block; }
.empty { text-align: center; color: var(--muted); padding: 1.2rem 0.5rem; }

/* ---------- Settings ---------- */
.set-card h2 { font-size: 1rem; margin-bottom: 0.7rem; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--tint); padding: 4px; border-radius: 999px; }
.seg button { appearance: none; border: 0; background: none; color: var(--text); font: inherit; font-weight: 700; padding: 0.5rem; border-radius: 999px; min-height: 40px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-bottom: 0.7rem; }
.color-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
input[type="color"] { width: 100%; height: 48px; border: 1.5px solid var(--line); border-radius: 14px; padding: 3px; background: var(--surface-solid); cursor: pointer; }
.presets { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.preset { appearance: none; border: 2px solid var(--line); border-radius: 50%; width: 44px; height: 44px; padding: 0; cursor: pointer; background: linear-gradient(135deg, var(--p1) 50%, var(--p2) 50%); }
.preset[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface-solid) inset; }
.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.bg-choice { appearance: none; border: 2px solid var(--line); border-radius: 14px; padding: 0; overflow: hidden; cursor: pointer; background: var(--tint); aspect-ratio: 2 / 3; position: relative; color: var(--text); font: inherit; }
.bg-choice img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bg-choice span { position: absolute; left: 0; right: 0; bottom: 0; padding: 0.2rem; font-size: 0.7rem; font-weight: 700; background: var(--surface); }
.bg-choice[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 40%, transparent); }
.bg-none { display: grid; place-items: center; font-weight: 700; }
input[type="range"] { width: 100%; accent-color: var(--primary); min-height: 36px; }
.font-preview { margin-top: 0.4rem; padding: 0.6rem 0.8rem; border-radius: 14px; background: var(--tint); }
.row-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.stack > * + * { margin-top: 0.7rem; }

/* ---------- Note sheet, toast ---------- */
.sheet {
  border: 0; padding: 1.1rem; width: 100%; max-width: 520px; margin: auto auto 0; border-radius: 24px 24px 0 0;
  background: var(--surface-solid); color: var(--text); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
}
.sheet::backdrop { background: rgba(20, 12, 40, 0.45); }
.sheet h2 { font-size: 1.05rem; margin-bottom: 0.6rem; }
.sheet-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 0.7rem; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 1.6rem + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--surface-solid); padding: 0.6rem 1rem; border-radius: 999px; font-weight: 600; font-size: 0.9rem;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; z-index: 60; max-width: 90vw; text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.noscript { padding: 2rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .splash-logo, .spinner { animation-duration: 3s; }
  .splash-logo { animation: none; }
  * { transition: none !important; }
}
@media (min-width: 560px) {
  .view { max-width: 560px; margin: 0 auto; width: 100%; }
}

/* Settings: collapsible account forms */
.set-details { border: 1px solid var(--line); border-radius: 16px; padding: 0 0.9rem; background: var(--surface-solid); }
.set-details summary { cursor: pointer; font-weight: 700; padding: 0.85rem 0; min-height: 44px; }
.set-details form { padding-bottom: 0.9rem; }
.btn .icon { width: 1.1rem; height: 1.1rem; vertical-align: -0.2em; }

/* Feedback */
.check { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; font-weight: 600; }
.check input { width: 1.4rem; height: 1.4rem; accent-color: var(--primary); flex: none; }
.set-card > .muted { margin-bottom: 0.8rem; }
.tab span { white-space: nowrap; }

/* Password eye + live requirements */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 3rem; }
.pw-eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); appearance: none; background: none; border: 0; color: var(--muted); width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; border-radius: 12px; }
.pw-eye[aria-pressed="true"] { color: var(--accent); }
.rules { list-style: none; margin: 0 0 0.85rem; padding: 0.6rem 0.75rem; border-radius: 14px; background: var(--tint); display: grid; gap: 0.3rem; font-size: 0.88rem; }
.rule { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); }
.rule-mark { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid currentColor; flex: none; display: grid; place-items: center; font-size: 0.7rem; line-height: 1; }
.rule.is-met { color: var(--ok); font-weight: 600; }
.rule.is-met .rule-mark { background: var(--ok); border-color: var(--ok); color: var(--surface-solid); }
.rule.is-met .rule-mark::before { content: "\2713"; }
.rules.is-flagged .rule:not(.is-met) { color: var(--danger); font-weight: 600; }
.bg-group { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0.9rem 0 0.5rem; }

/* Saved (locked) weeks */
.btn-sm { min-height: 40px; padding: 0.4rem 1rem; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 0.4rem; }
.btn-sm .icon { width: 1.05rem; height: 1.05rem; }
.badge-saved { display: inline-flex; align-items: center; gap: 0.25rem; background: color-mix(in srgb, var(--ok) 18%, var(--surface-solid)); color: var(--ok); }
.badge-saved .icon { width: 0.8rem; height: 0.8rem; stroke-width: 3; }
.week-foot-row { flex-wrap: wrap; }
.week-foot-row .btn { margin-left: auto; }
.week.is-locked { background: color-mix(in srgb, var(--surface) 55%, #8a8f98); }
.week.is-locked .week-head h3, .week.is-locked .days, .week.is-locked .week-notes, .week.is-locked .progress { filter: grayscale(1); opacity: 0.62; }
.week.is-locked.is-current { border-color: var(--line); }
.today-card.is-locked { filter: grayscale(1); opacity: 0.7; }
input:disabled, button:disabled { cursor: not-allowed; }
input.hours:disabled, input.today-input:disabled, .week-notes:disabled { -webkit-text-fill-color: var(--text); background: transparent; }
.note-btn:disabled { opacity: 0.35; }

/* Mascot picker */
.mascot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.mascot-choice { appearance: none; border: 2px solid var(--line); border-radius: 16px; background: var(--surface-solid); color: var(--text); font: inherit; font-weight: 700; font-size: 0.85rem; padding: 0.4rem 0.3rem 0.3rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.mascot-choice img { width: 100%; height: auto; border-radius: 12px; }
.mascot-choice[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 40%, transparent); }

/* Info bubbles */
.info { position: relative; display: inline-flex; vertical-align: middle; margin-left: 0.3rem; font-weight: 400; text-transform: none; letter-spacing: normal; }
.info-btn { appearance: none; background: none; border: 0; padding: 0; width: 26px; height: 26px; color: var(--muted); display: inline-grid; place-items: center; border-radius: 50%; cursor: pointer; position: relative; }
.info-btn::before { content: ""; position: absolute; inset: -9px; }
.info-btn .icon { width: 1.05rem; height: 1.05rem; stroke-width: 2.2; }
.info-btn[aria-expanded="true"] { color: var(--accent); background: var(--tint); }
.info-bubble { position: absolute; z-index: 30; top: calc(100% + 8px); left: 50%; transform: translateX(calc(-50% + var(--dx, 0px))); width: max-content; max-width: min(260px, calc(100vw - 32px)); padding: 0.65rem 0.8rem; border-radius: 14px; background: var(--text); color: var(--surface-solid); font-size: 0.85rem; font-weight: 500; line-height: 1.4; text-align: left; box-shadow: var(--shadow); white-space: normal; }
.info-bubble::before { content: ""; position: absolute; top: -6px; left: calc(50% - var(--dx, 0px)); width: 12px; height: 12px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.info-bubble.is-above { top: auto; bottom: calc(100% + 8px); }
.info-bubble.is-above::before { top: auto; bottom: -6px; }
.card.info-open { position: relative; z-index: 25; }
.summary .info { margin-left: auto; align-self: flex-start; }
.week-foot-row .info { margin-left: auto; }
.week-foot-row .btn { margin-left: 0; }
.field > span .info { margin-left: 0.15rem; }
