@font-face { font-family: 'Outfit'; src: url('/static/vendor/outfit/outfit-400.woff2') format('woff2'); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('/static/vendor/outfit/outfit-500.woff2') format('woff2'); font-style: normal; font-weight: 500; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('/static/vendor/outfit/outfit-700.woff2') format('woff2'); font-style: normal; font-weight: 700; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('/static/vendor/outfit/outfit-900.woff2') format('woff2'); font-style: normal; font-weight: 900; font-display: swap; }

:root {
  color-scheme: dark;
  --tblr-primary: #1040c0;
  --tblr-primary-rgb: 16, 64, 192;
  --tblr-link-color: #7898ee;
  --app-bg: #0b0b0b;
  --app-surface: #121212;
  --app-ink: #f0f0f0;
  --app-muted: #a2a2a2;
  --app-line: #353535;
  --app-soft: #152457;
  --app-navy: #121212;
  --bauhaus-red: #d02020;
  --bauhaus-blue: #1040c0;
  --bauhaus-yellow: #f0c020;
  --app-green: #43d492;
  --app-red: #ff7082;
  --app-radius: 0;
  --hard-shadow-sm: 3px 3px 0 #000;
  --hard-shadow: 6px 6px 0 #000;
}

:root[data-bs-theme="dark"] {
  --tblr-body-bg: var(--app-bg);
  --tblr-body-color: var(--app-ink);
  --tblr-bg-surface: var(--app-surface);
  --tblr-bg-surface-secondary: #181818;
  --tblr-border-color: var(--app-line);
  --tblr-secondary-color: var(--app-muted);
  --tblr-heading-color: var(--app-ink);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { background: var(--app-bg); color: var(--app-ink); font-family: 'Outfit', Arial, sans-serif; font-weight: 500; }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgb(49 94 251 / 22%);
  outline-offset: 2px;
}
.small, .text-secondary { color: var(--app-muted) !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -100px; z-index: 100; padding: 12px 18px; color: #111; background: var(--bauhaus-yellow); border: 2px solid #000; font-weight: 700; }
.skip-link:focus { top: 12px; color: #111; }
#main-content { scroll-margin-top: 84px; }
.app-page { min-height: 100vh; min-height: 100dvh; }
.app-container { max-width: 1080px; padding-top: 28px; padding-bottom: 64px; }
.page-body { margin-top: 0; }

/* Application shell */
.app-navbar {
  min-height: 66px;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgb(11 11 11 / 94%);
  border-bottom: 2px solid var(--app-line);
  box-shadow: none;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.app-navbar > .container-xl { max-width: 1080px; min-height: 66px; display: flex; align-items: center; justify-content: space-between; }
.app-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--app-ink); font-size: 15px; font-weight: 900; letter-spacing: .08em; text-decoration: none; text-transform: uppercase; }
.bauhaus-mark { position: relative; display: inline-block; flex: none; width: 38px; height: 28px; }
.bauhaus-mark i { position: absolute; display: block; }
.bauhaus-mark .shape-circle { left: 0; top: 6px; width: 18px; height: 18px; border: 2px solid #000; border-radius: 50%; background: var(--bauhaus-red); }
.bauhaus-mark .shape-square { left: 14px; top: 0; width: 17px; height: 17px; border: 2px solid #000; background: var(--bauhaus-blue); }
.bauhaus-mark .shape-triangle { right: 0; bottom: 0; width: 19px; height: 19px; background: var(--bauhaus-yellow); clip-path: polygon(50% 0, 0 100%, 100% 100%); }
.app-nav { display: flex; flex-direction: row; align-items: center; gap: 4px; }
.app-nav .nav-link { display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 7px 12px; border-radius: 0; color: var(--app-muted); font-size: 12px; font-weight: 700; letter-spacing: .055em; text-decoration: none; text-transform: uppercase; }
.app-nav .nav-link:hover { color: var(--app-ink); background: #181a20; }
.app-nav .nav-link.active { color: var(--tblr-primary); background: var(--app-soft); }
.nav-link-icon { display: inline-flex; width: 18px; height: 18px; margin: 0 !important; }
.nav-link-icon svg, .btn-icon svg, .empty-icon svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-link-icon svg, .empty-icon svg { width: 100%; height: 100%; }

/* Type and shared pieces */
/* Match Tabler's contextual selector so its header margin cannot erase ours. */
.page-wrapper .page-header { min-height: 0; margin: 0 0 24px; }
.page-pretitle { margin-bottom: 6px; color: var(--app-muted); font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.page-title { color: var(--app-ink); font-size: clamp(32px, 5vw, 48px); font-weight: 900; letter-spacing: -.045em; line-height: .95; text-transform: uppercase; }
.page-description { max-width: 630px; margin: 7px 0 0; color: var(--app-muted); font-size: 15px; }
.section-title { margin: 0; color: var(--app-ink); font-size: 16px; font-weight: 900; letter-spacing: .015em; text-transform: uppercase; }
.section-label { margin: 0 0 12px; color: var(--app-muted); font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.card { color: var(--app-ink); background: var(--app-surface); border: 2px solid var(--app-line); border-radius: 0; box-shadow: none; }
.card-header { min-height: 56px; padding: 15px 18px; border-color: var(--app-line); border-width: 0 0 2px; }
.card-body { padding: 20px; }
.btn { min-height: 40px; border-width: 2px; border-radius: 0; box-shadow: var(--hard-shadow-sm); font-weight: 700; letter-spacing: .055em; text-transform: uppercase; transition: transform 160ms ease-out, box-shadow 160ms ease-out, background-color 160ms ease-out; }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn-sm { min-height: 34px; }
.btn-icon { flex: none; width: 40px; height: 40px; padding: 10px; border: 0; box-shadow: none; }
.btn-icon svg { width: 18px; height: 18px; }
.btn-primary { --tblr-btn-bg: var(--bauhaus-blue); --tblr-btn-border-color: #000; --tblr-btn-hover-bg: #173fa9; --tblr-btn-hover-border-color: #000; }
.btn-quiet { color: var(--app-ink); background: var(--app-surface); border: 2px solid #494949; }
.btn-quiet:hover { color: var(--app-ink); background: #1b1e24; border-color: #404650; }
.badge { padding: 5px 9px; border-radius: 9999px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #606878; }
.status-dot.ok { background: #20a66a; box-shadow: 0 0 0 3px rgb(32 166 106 / 11%); }
.status-dot.warn { background: var(--app-red); }
.flash { padding: 12px 15px; margin: 0 0 16px; border: 2px solid #275840; border-radius: 0; color: #8be2ba; background: #10231a; }
.flash.warn { color: #ff9aa8; background: #29151a; border-color: #62303a; }

/* Today */
.today-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 24px; align-items: start; }
.today-main, .today-side { display: grid; gap: 18px; }
.plan-panel { position: relative; isolation: isolate; overflow: hidden; padding: 32px; border: 3px solid #000; border-radius: 0; box-shadow: var(--hard-shadow); color: #fff; background: var(--bauhaus-blue); }
.plan-panel > :not(.plan-art) { position: relative; z-index: 1; }
.plan-art { position: absolute; z-index: 0; right: -8%; bottom: -32%; width: min(58%, 430px); height: auto; opacity: .3; pointer-events: none; -webkit-user-select: none; user-select: none; }
.plan-panel .page-pretitle { color: #fff; }
.plan-panel h1 { max-width: 650px; margin: 0; font-size: clamp(40px, 6vw, 64px); font-weight: 900; letter-spacing: -.055em; line-height: .9; text-transform: uppercase; }
.plan-duration { display: inline-block; margin-left: 7px; color: var(--bauhaus-yellow); font-size: .42em; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.plan-reason { max-width: 620px; margin: 17px 0 0; color: #fff; font-size: 17px; }
.plan-notes { display: grid; gap: 6px; margin: 20px 0 0; padding: 0; list-style: none; color: #e0e4eb; }
.plan-notes li { position: relative; padding-left: 18px; }
.plan-notes li::before { content: ''; position: absolute; left: 0; top: .65em; width: 7px; height: 7px; border-radius: 50%; background: var(--bauhaus-yellow); }
.plan-limit { display: inline-flex; margin-top: 18px; padding: 6px 9px; border: 2px solid #000; border-radius: 0; color: #121212; background: var(--bauhaus-yellow); font-size: 13px; font-weight: 700; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 23px; }
.plan-actions .btn { color: #fff; border-color: rgb(255 255 255 / 25%); background: rgb(255 255 255 / 8%); }
.plan-actions .btn:hover { background: rgb(255 255 255 / 15%); }
.next-panel { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 22px; border: 3px solid #000; border-radius: 0; box-shadow: var(--hard-shadow); color: #121212; background: var(--bauhaus-yellow); }
.next-panel h2 { margin: 2px 0 5px; color: #121212; font-size: 20px; font-weight: 900; letter-spacing: -.025em; }
.next-panel p { margin: 0; color: #292929; }
.next-panel .section-label { margin-bottom: 2px; color: #121212; }
.next-panel .btn-quiet { color: #121212; background: #fff; border-color: #000; }
.next-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.source-list { overflow: hidden; border-top: 1px solid var(--app-line); border-bottom: 1px solid var(--app-line); background: transparent; }
.source-row { display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center; min-height: 54px; padding: 10px 2px; }
.source-row + .source-row { border-top: 1px solid var(--app-line); }
.source-row strong { font-size: 14px; }
.source-row .source-meta { color: var(--app-muted); font-size: 13px; }
.source-identity { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.source-device-icon { width: 22px; height: 22px; fill: none; stroke: var(--bauhaus-yellow); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.source-strava-brand { display: block; width: 88px; height: auto; }
.schedule-panel { padding: 20px; background: var(--app-surface); border: 2px solid var(--app-line); border-radius: 0; }
.schedule-list { position: relative; display: grid; gap: 0; margin-top: 9px; }
.schedule-item { position: relative; display: grid; grid-template-columns: 54px 1fr; gap: 12px; min-height: 53px; padding: 10px 0; }
.schedule-item + .schedule-item { border-top: 1px solid var(--app-line); }
.schedule-item time { color: var(--app-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.schedule-item span { color: var(--app-muted); font-size: 13px; }
.week-panel { overflow: hidden; border: 2px solid var(--app-line); border-radius: 0; background: var(--app-surface); }
.week-panel summary { min-height: 53px; padding: 16px 18px; cursor: pointer; font-weight: 700; list-style-position: inside; }
.week-table { width: 100%; border-collapse: collapse; }
.week-table td { padding: 11px 18px; border-top: 1px solid var(--app-line); vertical-align: middle; }
.week-table td:first-child { width: 64px; color: var(--app-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.week-table td:last-child { width: 90px; color: var(--app-muted); font-size: 12px; text-align: right; }
.week-table tr.today { background: var(--app-soft); }
.week-table tr.today td:first-child { color: var(--tblr-primary); }

/* History */
.history-head { display: flex; flex-direction: row; align-items: end; justify-content: space-between; gap: 18px; }
.phase-strip { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 28px; padding: 22px; border: 3px solid #000; border-radius: 0; box-shadow: var(--hard-shadow); color: #fff; background: var(--bauhaus-red); }
.phase-strip h2 { margin: 2px 0 3px; font-size: 22px; letter-spacing: -.025em; }
.phase-strip p, .phase-strip .page-pretitle { margin: 0; color: #fff; }
.phase-strip .small { color: #fff !important; }
.limit-list { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.limit-list span { padding: 6px 9px; border: 2px solid #000; border-radius: 0; color: #121212; background: #fff; font-size: 12px; font-weight: 700; }
.period-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.period-header h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.period-header p { margin: 3px 0 0; color: var(--app-muted); }
.period-nav { display: flex; gap: 6px; }
.period-nav a { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 10px; border: 2px solid var(--app-line); border-radius: 0; color: #d5d5d5; text-decoration: none; background: var(--app-surface); }
.stat-band { display: grid; grid-template-columns: repeat(3, 1fr); margin: 16px 0 20px; border-top: 1px solid var(--app-line); border-bottom: 1px solid var(--app-line); }
.stat-item { padding: 18px 20px; }
.stat-item + .stat-item { border-left: 1px solid var(--app-line); }
.stat-item strong { display: block; margin-bottom: 2px; font-size: 23px; letter-spacing: -.035em; }
.stat-item span { color: var(--app-muted); font-size: 12px; }
.history-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .7fr); gap: 24px; align-items: start; }
.history-column { display: grid; gap: 18px; }
.session-card { overflow: hidden; }
.session-table { width: 100%; border-collapse: collapse; }
.session-table td { padding: 13px 18px; border-top: 1px solid var(--app-line); }
.session-table td:first-child { width: 72px; color: var(--app-muted); font-size: 12px; }
.session-table td:last-child { width: 105px; color: var(--app-muted); font-size: 12px; text-align: right; }
.detail-panel { border-top: 1px solid var(--app-line); }
.detail-panel summary { padding: 15px 0; cursor: pointer; font-weight: 700; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 0 0 17px; }
.detail-grid p { margin: 0; }
.detail-grid .small { grid-column: 1 / -1; }
.decision-panel { padding: 20px; border-left: 3px solid var(--tblr-primary); background: var(--app-surface); }
.decision-panel h2 { margin: 3px 0 12px; font-size: 19px; }
.feed-card .card-body { display: grid; gap: 15px; }
.feed-item + .feed-item { padding-top: 15px; border-top: 1px solid var(--app-line); }
.feed-item p { margin: 0; }
.history-empty { padding: 18px 0; border-top: 1px solid var(--app-line); border-bottom: 1px solid var(--app-line); }
.review-items { margin-top: 18px; border-color: #3c3c3c; }
.review-list { display: grid; gap: 10px; margin: 0; padding-left: 19px; color: #c7ccd5; }
.review-block { padding-top: 15px; border-top: 1px solid var(--app-line); }

/* Forms */
.form-container { max-width: 820px; }
.form-page-head { margin-bottom: 22px; }
.back-link { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 14px; color: var(--app-muted); font-size: 13px; text-decoration: none; }
.back-link:hover { color: var(--app-ink); }
.checkin-form { display: grid; gap: 18px; }
.form-section { padding: 20px; border: 2px solid var(--app-line); border-radius: 0; background: var(--app-surface); }
.form-section-title { margin: 0 0 16px; font-size: 15px; font-weight: 900; letter-spacing: .055em; text-transform: uppercase; }
.optional-section > summary { cursor: pointer; list-style: none; }
.optional-section > summary::-webkit-details-marker { display: none; }
.optional-section > summary::after { content: '+'; float: right; color: var(--app-muted); font-size: 18px; line-height: .8; }
.optional-section[open] > summary::after { content: '−'; }
.optional-section:not([open]) > summary { margin-bottom: 0; }
.optional-section > summary span { margin-left: 7px; color: var(--app-muted); font-size: 10px; letter-spacing: .08em; }
.required-lock { border-color: #f0c020; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: block; margin: 0; }
.field.full { grid-column: 1 / -1; }
.field .form-label { margin-bottom: 6px; color: #c7ccd5; font-size: 13px; font-weight: 620; }
.form-control, .form-select { min-height: 42px; border-width: 2px; border-color: #3c3c3c; border-radius: 0; color: var(--app-ink); background-color: #0b0b0b; }
.form-control:focus, .form-select:focus { border-color: #85a0ff; box-shadow: 0 0 0 3px rgb(49 94 251 / 11%); }
.field-source { display: block; margin-top: 5px; color: var(--tblr-primary); font-size: 12px; }
.conversation-invite { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 0; border-top: 1px solid var(--app-line); border-bottom: 1px solid var(--app-line); }
.conversation-invite strong { color: var(--app-ink); font-size: 14px; }
.conversation-invite p { margin: 3px 0 0; max-width: 520px; color: var(--app-muted); font-size: 13px; }
.conversation-invite .btn { flex: none; }
.check-list { display: grid; gap: 0; }
.check-row { display: flex; align-items: flex-start; gap: 10px; min-height: 42px; padding: 10px 0; margin: 0; border-top: 1px solid var(--app-line); cursor: pointer; }
.check-row:first-child { border-top: 0; }
.check-row input { flex: none; margin-top: 2px; }
.check-row span { color: #c7ccd5; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 2px; }
.time-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.test-results { margin-top: 34px; }
.test-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 18px; align-items: center; padding: 15px 18px; }
.test-row + .test-row { border-top: 1px solid var(--app-line); }
.test-row > div { display: grid; }
.test-row > div span { color: var(--app-muted); font-size: 12px; }
.test-row > strong { font-variant-numeric: tabular-nums; }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 36px; align-items: start; }
.settings-index { position: sticky; top: 92px; display: grid; gap: 4px; }
.settings-index a { padding: 8px 10px; border-radius: 0; color: var(--app-muted); font-size: 12px; font-weight: 700; letter-spacing: .055em; text-decoration: none; text-transform: uppercase; }
.settings-index a:hover { color: var(--app-ink); background: #181a20; }
.settings-content { display: grid; gap: 28px; }
.settings-section h2 { margin: 0 0 4px; font-size: 18px; font-weight: 900; letter-spacing: .02em; text-transform: uppercase; }
.settings-section > p { margin: 0 0 11px; color: var(--app-muted); }
.settings-list { overflow: hidden; border: 2px solid var(--app-line); border-radius: 0; background: var(--app-surface); }
.settings-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 18px; }
.settings-row + .settings-row { border-top: 1px solid var(--app-line); }
.settings-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-inline: auto; border: 2px solid #000; border-radius: 0; color: #121212; background: var(--bauhaus-yellow); font-size: 12px; font-weight: 900; }
.settings-icon svg, .settings-brand svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.settings-brand { display: grid; place-items: center; width: 76px; min-height: 42px; }
.strava-brand img { display: block; width: 76px; height: auto; }
.coros-device { width: 42px; height: 42px; margin-inline: auto; border: 2px solid #000; color: #fff; background: var(--bauhaus-blue); box-shadow: 3px 3px 0 #000; }
.settings-copy { min-width: 0; overflow-wrap: anywhere; }
.settings-copy h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 4px; font-size: 15px; }
.settings-copy h3 .badge { flex-shrink: 0; }
.settings-copy p { margin: 0; color: var(--app-muted); font-size: 13px; }
.settings-action { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.inline-status { grid-column: 2 / -1; margin: 3px 0 0; color: var(--app-muted); font-size: 12px; }
.inline-status:empty { display: none; }
.device-list { margin: 10px 0 14px; padding: 0; list-style: none; }
.device-list li { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-top: 1px solid var(--app-line); }
.device-list li .small { flex-shrink: 0; white-space: nowrap; }
.secret-link { grid-column: 2 / -1; margin-top: 10px; }
.code { overflow-wrap: anywhere; padding: 10px 12px; border: 2px solid var(--app-line); border-radius: 0; background: #0b0b0b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* Chat */
body[data-page="chat"] .page-wrapper, body[data-page="chat"] .page-body, body[data-page="chat"] .app-container { min-height: 0; }
body[data-page="chat"] .app-container { height: calc(100vh - 64px); height: calc(100dvh - 64px); padding-top: 18px; padding-bottom: 18px; }
.chat-container { max-width: 920px; }
.chat { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.chat-shell { overflow: hidden; border: 2px solid var(--app-line); border-radius: 0; background: var(--app-surface); }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 70px; padding: 14px 18px; border-bottom: 1px solid var(--app-line); }
.chat-head h1, .chat-head h2 { margin: 0; color: var(--app-ink); font-size: 22px; font-weight: 900; letter-spacing: .02em; text-transform: uppercase; }
.chat-head p { margin-top: 2px !important; font-size: 13px; }
.messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; padding: 24px; scrollbar-gutter: stable; }
.msg { max-width: min(82%, 620px); padding: 10px 13px; border-radius: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.msg.user { align-self: flex-end; border: 2px solid #000; color: #fff; background: var(--bauhaus-blue); box-shadow: var(--hard-shadow-sm); }
.msg.assistant { align-self: flex-start; padding: 2px 0 2px 14px; border-left: 4px solid var(--bauhaus-yellow); border-radius: 0; color: #e4e4e4; background: transparent; }
.msg.assistant a { color: var(--tblr-primary); }
.msg.system { align-self: center; max-width: 100%; color: var(--app-muted); background: transparent; font-size: 12px; text-align: center; }
.msg.tool { display: none; }
.chat-empty { display: grid; place-items: center; margin: auto; max-width: 540px; color: var(--app-muted); text-align: center; }
.chat-empty p { margin: 12px 0; }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; padding: 10px; border: 2px solid #000; border-radius: 50%; color: #121212; background: var(--bauhaus-yellow); }
.quick-prompts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin-top: 8px; }
.prompt-chip { min-height: 43px; padding: 9px 12px; border: 2px solid var(--app-line); border-radius: 0; color: #e1e1e1; background: #0b0b0b; font-weight: 700; text-align: left; cursor: pointer; transition: transform 160ms ease-out, border-color 160ms ease-out; }
.prompt-chip:hover { border-color: #495a91; background: #151a28; }
.chat-activity { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 4px 24px; color: var(--app-muted); font-size: 12px; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: #8993a5; animation: typing 1.15s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .14s; }
.typing-dots i:nth-child(3) { animation-delay: .28s; }
@keyframes typing { 0%, 65%, 100% { opacity: .3; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-2px); } }
.confirm { margin: 8px 18px; padding: 13px; border: 2px solid var(--bauhaus-blue); border-radius: 0; background: #121a31; }
.confirm .opts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chatform { display: flex; align-items: flex-end; gap: 8px; padding: 13px 18px 16px; border-top: 1px solid var(--app-line); background: var(--app-surface); }
.chatform textarea { flex: 1; resize: none; max-height: 150px; line-height: 1.45; }
.composer-hint { margin: -11px 20px 10px; color: var(--app-muted); font-size: 10px; }
.chat-drawer { width: min(500px, 100%); max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0 0 0 auto; padding: 0; border: 0; border-left: 1px solid var(--app-line); color: var(--app-ink); background: var(--app-surface); box-shadow: -24px 0 60px rgb(0 0 0 / 35%); }
.chat-drawer[open] { display: block; }
.chat-drawer::backdrop { background: rgb(0 0 0 / 56%); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.chat-drawer-inner { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.chat-drawer .chat-head { padding-top: max(14px, env(safe-area-inset-top)); }
body:has(.chat-drawer[open]) { overflow: hidden; }

/* Sign in and recovery */
.auth-page { background: var(--app-bg); }
.auth-body { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; margin: 0; padding: 24px; }
.auth-body .app-container { width: 100%; max-width: 420px; padding: 0; }
.auth-card { position: relative; padding: 30px; border: 3px solid #000; border-radius: 0; background: var(--bauhaus-yellow); box-shadow: var(--hard-shadow); color: #121212; }
.auth-logo { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 25px; font-size: 18px; font-weight: 750; }
.auth-card h1 { margin: 0 0 8px; color: #121212; font-size: 34px; font-weight: 900; letter-spacing: -.045em; text-transform: uppercase; }
.auth-card > p { color: #343434; }
.auth-card .form-label, .auth-card .small { color: #343434 !important; }
.auth-card a { color: var(--bauhaus-blue); }
.auth-card .btn { width: 100%; margin-top: 10px; }
.auth-card .field { margin-top: 18px; text-align: left; }
.auth-footer { margin-top: 18px; text-align: center; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 767.98px) {
  .app-container { padding: 20px 14px calc(88px + env(safe-area-inset-bottom)); }
  .app-navbar { position: fixed; inset: auto 0 0; top: auto; min-height: 68px; border-top: 2px solid var(--app-line); border-bottom: 0; background: rgb(11 11 11 / 97%); }
  .app-navbar > .container-xl { min-height: 68px; padding: 0 6px max(2px, env(safe-area-inset-bottom)); }
  .app-brand { display: none; }
  .app-nav { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; gap: 2px; }
  .app-nav .nav-link { flex-direction: column; justify-content: center; gap: 2px; min-height: 58px; padding: 5px 2px; border-radius: 0; font-size: 10px; }
  .app-nav .nav-link.active { background: transparent; }
  .nav-link-icon { width: 20px; height: 20px; }
  .page-wrapper .page-header { margin-bottom: 24px; }
  .page-title { font-size: 29px; }
  .today-grid, .history-layout, .settings-layout { grid-template-columns: 1fr; gap: 18px; }
  .plan-panel { padding: 25px 21px; border-radius: 0; }
  .plan-art { right: -24%; bottom: -13%; width: 78%; opacity: .16; }
  .plan-panel h1 { font-size: 42px; }
  .plan-duration { display: block; margin: 8px 0 0; font-size: 16px; }
  .next-panel { grid-template-columns: 1fr; padding: 18px; }
  .next-actions { justify-content: flex-start; }
  .source-row { grid-template-columns: auto minmax(0, 1fr); }
  .source-meta { grid-column: 2; }
  .schedule-panel { padding: 18px; }
  .phase-strip { align-items: flex-start; flex-direction: column; margin-bottom: 23px; }
  .limit-list { justify-content: flex-start; }
  .history-head { flex-direction: column; align-items: flex-start; }
  .period-header { align-items: flex-start; }
  .period-nav { flex-direction: column; }
  .period-nav a { min-height: 34px; }
  .stat-item { padding: 15px 10px; }
  .stat-item strong { font-size: 19px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid .small { grid-column: auto; }
  .settings-index { display: none; }
  .settings-row { grid-template-columns: 62px minmax(0, 1fr); padding: 16px; }
  .settings-row-integration .strava-brand, .settings-row-integration .strava-brand img { width: 62px; }
  .device-list li { flex-direction: column; gap: 4px; }
  .settings-action, .inline-status, .secret-link { grid-column: 2; justify-content: flex-start; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .form-grid.score-grid, .form-grid.three.score-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  .score-grid .form-label { min-height: 32px; font-size: 11px; line-height: 1.25; }
  .form-section { padding: 18px; }
  .conversation-invite { align-items: flex-start; flex-direction: column; }
  .test-row { grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; }
  .test-row .badge { grid-column: 2; }
  .form-actions { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 5; margin: 0 -14px -18px; padding: 12px 14px; border-top: 1px solid var(--app-line); background: rgb(12 13 15 / 94%); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
  .form-actions .btn-primary { flex: 1; }
  body[data-page="chat"] .app-container { height: calc(100vh - 68px - env(safe-area-inset-bottom)); height: calc(100dvh - 68px - env(safe-area-inset-bottom)); padding: 8px 8px 4px; }
  .chat-shell { border-radius: 0; }
  .chat-head { min-height: 60px; padding: 10px 13px; }
  .chat-head h1 { font-size: 18px; }
  .messages { padding: 17px 13px; }
  .msg { max-width: 90%; }
  .quick-prompts { grid-template-columns: 1fr; }
  .chatform { padding: 9px 10px 10px; }
  .composer-hint { display: none; }
  .chat-drawer { width: 100%; border-left: 0; }
}

@media (max-width: 390px) {
  .history-head .btn { padding-inline: 9px; }
  .stat-item span { font-size: 11px; }
  .week-table td { padding-inline: 13px; }
}

@media (max-width: 359px) {
  .form-grid.score-grid, .form-grid.three.score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- tasks ---- */
.task-list { display: flex; flex-direction: column; gap: 6px; }
.task-row { display: flex; align-items: center; gap: 10px; }
.task-row form { display: flex; margin: 0; }
.task-check { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line, #2a2a2f); background: transparent; cursor: pointer; color: inherit; font-size: 13px; line-height: 1; padding: 0; }
.task-check:hover { border-color: var(--accent, #e3b341); }
.task-check, .task-remove { position: relative; }
.task-check::after, .task-remove::after { content: ''; position: absolute; width: 44px; height: 44px; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.task-check.checked { background: var(--accent, #e3b341); border-color: var(--accent, #e3b341); color: #111; }
.task-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.task-row.task-done .task-text { text-decoration: line-through; opacity: 0.55; }
.task-due { font-style: normal; font-size: 12px; opacity: 0.7; }
.task-due.overdue { color: #ff6b6b; opacity: 1; }
.task-remove { border: 0; background: transparent; color: inherit; opacity: 0.4; cursor: pointer; font-size: 16px; padding: 0 2px; }
.task-remove:hover { opacity: 1; }
.task-empty { margin: 2px 0; }
.task-add { display: flex; gap: 8px; margin-top: 10px; }
.task-add .form-control { flex: 1; min-width: 0; }

/* Saved data: one readable view shared by chat and forms. */
.records-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--app-line); margin-bottom: 24px; }
.records-tabs a { flex: 1; max-width: 220px; padding: 14px 16px; text-align: center; color: var(--app-ink); text-decoration: none; }
.records-tabs a[aria-current="page"] { background: var(--bauhaus-yellow); color: #111; font-weight: 700; }
.records-filter, .record-shortcuts { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.records-filter .field { min-width: 160px; }
.records-grow { flex: 1; min-width: 0; }
.record-shortcuts { align-items: center; }
.record-shortcuts [aria-current="page"] { border-color: var(--bauhaus-yellow); color: var(--bauhaus-yellow); }
.records-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.record-panel { background: var(--app-surface); border: 1px solid var(--app-line); padding: 20px; }
.record-panel h3 { margin-top: 0; }
.record-values { margin: 12px 0 0; }
.record-value { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr); gap: 16px; padding: 13px 0; border-top: 1px solid var(--app-line); }
.record-value dt { font-weight: 500; }
.record-value dd { margin: 0; overflow-wrap: anywhere; }
.record-status { display: inline-block; padding: 2px 7px; margin: 3px 0; border: 1px solid var(--app-line); font-size: 12px; color: var(--app-muted); }
.record-meta { display: block; margin-top: 5px; color: var(--app-muted); font-size: 12px; }
.record-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.record-observation { padding: 16px 0; border-top: 1px solid var(--app-line); }
.record-note, .record-task { margin-bottom: 14px; }
.record-note-head, .record-task { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.record-note-head { flex-wrap: wrap; margin-bottom: 12px; }
/* The daily loop: three anchors, saved facts, and one next action. */
.day-anchors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 2px solid var(--app-line); background: var(--app-surface); }
.day-anchor { display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 17px 14px; color: var(--app-ink); text-decoration: none; }
.day-anchor + .day-anchor { border-left: 1px solid var(--app-line); }
.day-anchor:hover { color: var(--app-ink); background: var(--app-soft); }
.day-anchor-number { color: var(--app-muted); font-size: 11px; font-weight: 700; letter-spacing: .1em; }
.day-anchor-label { font-size: 12px; color: var(--app-muted); }
.day-anchor strong { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.day-anchor.is-saved .day-anchor-number { color: var(--bauhaus-yellow); }
.day-anchor .small { font-size: 12px; line-height: 1.45; }
.next-panel.day-closed { color: var(--app-ink); background: var(--app-surface); border-color: var(--app-line); box-shadow: none; }
.next-panel.day-closed h2 { color: var(--app-ink); }
.next-panel.day-closed h1 { margin: 2px 0 5px; color: var(--app-ink); font-size: 24px; font-weight: 900; letter-spacing: -.025em; }
.next-panel.day-closed p { color: var(--app-muted); }
.next-panel.day-closed .section-label { color: var(--bauhaus-yellow); }
.arc-focus, .review-next, .memory-catchup { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px; border: 1px solid var(--app-line); background: var(--app-surface); }
.arc-focus h2 { font-size: 19px; line-height: 1.3; margin: 0 0 8px; }
.arc-focus .section-label { color: var(--bauhaus-yellow); }
.arc-focus p, .review-next p, .memory-catchup p { margin-bottom: 0; }
.review-next .small, .memory-catchup .small { margin-top: 8px; }
.arc-focus > a, .review-next > a { flex-shrink: 0; }
.saved-memory { border: 1px solid var(--app-line); background: var(--app-surface); }
.saved-memory summary { cursor: pointer; padding: 15px 18px; font-weight: 500; }
.saved-memory-body { padding: 0 18px 18px; }
.saved-memory dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.saved-memory dt { color: var(--app-muted); font-size: 12px; }
.saved-memory dd { margin: 3px 0 0; font-size: 15px; }
.schedule-item { grid-template-columns: minmax(78px, .7fr) minmax(0, 1fr); }
.schedule-item .schedule-time { font-weight: 700; font-size: 12px; color: var(--app-ink); font-variant-numeric: tabular-nums; }
.protected-slot span:last-child { color: var(--bauhaus-yellow); }
@media (max-width: 767.98px) {
  .day-anchor { padding: 14px 10px; gap: 6px; }
  .day-anchor .small { display: none; }
  .day-anchor strong { font-size: 13px; }
  .arc-focus, .review-next, .memory-catchup { align-items: flex-start; flex-direction: column; padding: 18px; }
}
@media (pointer: coarse) {
  .btn-sm { min-height: 44px; }
  .task-row { min-height: 44px; }
  .form-control, .form-select { font-size: 16px; }
}
@media (max-width: 767.98px) {
  .records-grid { grid-template-columns: 1fr; }
  .record-panel { padding: 16px; }
  .record-value { grid-template-columns: 1fr; gap: 6px; }
  .records-filter .field { flex: 1 1 100%; min-width: 0; }
  .records-tabs a { padding: 12px 9px; }
  .record-task { flex-wrap: wrap; }
}

/* Check-in continuity: saved state, explicit corrections and stale-form notice. */
.checkin-state { border: 1px solid var(--app-line); border-left: 4px solid var(--bauhaus-yellow); background: var(--app-surface); padding: 20px; margin-bottom: 24px; }
.checkin-state h2 { font-size: 19px; margin: 0 0 10px; }
.checkin-state p { margin: 0 0 12px; line-height: 1.55; }
.checkin-state p:last-child { margin-bottom: 0; }
.checkin-state-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.checkin-stale { border-left-color: #e5a43c; }
.checkin-stale:focus { outline: 2px solid var(--bauhaus-yellow); outline-offset: 3px; }
.stop-line-summary { margin-bottom: 20px; line-height: 1.55; }
.stop-line-readings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.stop-line-readings dt { color: var(--app-muted); font-size: 12px; font-weight: 500; }
.stop-line-readings dd { margin: 3px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.checkin-reflection { margin-top: 32px; }
.checkin-reflection summary { cursor: pointer; }
.checkin-reflection summary span { color: var(--app-muted); font-size: 12px; margin-left: 8px; }
.checkin-reflection p { margin: 16px 0; }
@media (max-width: 479.98px) {
  .checkin-state { padding: 16px; }
  .checkin-state-actions { flex-direction: column; }
  .stop-line-readings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
