:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #637083;
  --line: #dfe4ea;
  --line-strong: #c9d1dc;
  --accent: #126f66;
  --accent-soft: #d9efeb;
  --danger: #bd3f35;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.1);
  --radius: 8px;
  --time-col: 64px;
  --hour-height: 76px;
  --day-hours: 16;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  position: relative;
  max-width: 1480px;
  margin: 0 auto;
  padding: 14px 22px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr);
  gap: 18px;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  user-select: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.18);
}

.brand h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: 0;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f6f7f9;
}

.auth-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 28px;
  align-items: center;
}

.auth-loading {
  grid-template-columns: 1fr;
}

.auth-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  grid-column: 1;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.auth-brand h1 {
  margin: 0;
  font-size: 22px;
}

.auth-copy h2 {
  max-width: 560px;
  margin: 0;
  color: var(--ink);
  font-size: 42px;
  line-height: 1.02;
  letter-spacing: 0;
}

.auth-copy {
  grid-column: 1;
}

.auth-copy p {
  max-width: 560px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.auth-card {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(23, 32, 51, 0.1);
}

.auth-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 8px;
  background: #eef2f6;
}

.auth-mode-toggle button {
  min-height: 36px;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
  cursor: pointer;
}

.auth-mode-toggle button.active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(23, 32, 51, 0.08);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-error {
  padding: 9px 10px;
  border: 1px solid #f0c6c2;
  border-radius: 8px;
  color: #8a332b;
  background: #fff2f1;
  font-size: 13px;
  font-weight: 750;
}

.auth-message {
  padding: 9px 10px;
  border: 1px solid rgba(18, 111, 102, 0.18);
  border-radius: 8px;
  color: #126f66;
  background: #dff3ed;
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.auth-card-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.auth-card-heading h3,
.auth-card-heading p {
  margin: 0;
}

.auth-card-heading h3 {
  font-size: 18px;
}

.auth-card-heading p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-link-button {
  margin-top: 10px;
  padding: 0;
  border: 0;
  color: #126f66;
  background: transparent;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.claim-existing {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px solid #d6dde6;
  border-radius: 8px;
  color: #455369;
  background: #f7f8fa;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.claim-existing input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.auth-submit {
  width: 100%;
}

.settings-button {
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid #d9e0e8;
  border-radius: 999px;
  color: #4a5667;
  background: #ffffff;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.share-button {
  min-height: 34px;
  padding: 0 11px;
  color: #172033;
}

.share-button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.week-nav,
.toolbar-actions,
.tabs,
.event-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.week-nav {
  justify-content: center;
}

.toolbar-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.tabs {
  justify-content: center;
  flex-wrap: wrap;
}

.icon-button,
.primary-button,
.secondary-button,
.ghost-button,
.tab-button {
  min-height: 36px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.icon-button {
  width: 36px;
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  background: #edf1f5;
}

.icon-button svg,
.button-icon,
.tab-icon svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.primary-button,
.secondary-button,
.ghost-button,
.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  white-space: nowrap;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
}

.secondary-button {
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: #ffffff;
}

.secondary-button.active {
  color: #0f4f49;
  border-color: #9fcfc7;
  background: var(--accent-soft);
}

.ghost-button {
  color: var(--muted);
  background: transparent;
}

.tab-button {
  position: relative;
  min-width: 78px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
}

.tab-icon {
  display: none;
}

.tab-label {
  width: 100%;
  text-align: center;
}

.tab-button.active {
  color: var(--ink);
  background: #e9eef3;
}

.icon-button:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.date-pill {
  min-width: 230px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #f1f4f7;
  text-align: center;
  font-weight: 700;
}

.date-pill.day-date-pill {
  min-width: 176px;
}

.main-layout {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px 22px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.privacy-footer {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 0 22px 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.auth-footer-wrap {
  grid-column: 1 / -1;
}

.auth-privacy-footer {
  width: 100%;
  padding: 0;
}

.footer-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-links a,
.creator-credit a {
  color: #52615a;
  font-weight: 850;
  text-decoration: none;
}

.footer-links a:hover,
.creator-credit a:hover {
  color: var(--accent);
}

.creator-credit {
  color: #52615a;
  font-weight: 800;
  text-align: right;
}

.privacy-footer details {
  border-top: 1px solid var(--line);
  padding-top: 11px;
}

.privacy-footer summary {
  width: fit-content;
  cursor: pointer;
  color: #52615a;
  font-weight: 850;
}

.privacy-copy {
  display: grid;
  gap: 8px;
  max-width: 760px;
  margin-top: 10px;
}

.privacy-copy h4,
.privacy-copy p {
  margin: 0;
}

.privacy-copy h4 {
  padding-top: 4px;
  color: var(--ink);
  font-size: 13px;
}

.workspace {
  min-width: 0;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  position: relative;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 8px 0 0 8px;
  background: var(--metric-accent, #9aa6b5);
}

.metric-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-status {
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--metric-accent, #667386);
  background: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.metric-value {
  margin-top: 4px;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.05;
}

.metric-good {
  --metric-accent: #1f7a5b;
  border-color: #9dccbb;
  background: #edf8f3;
}

.metric-warn {
  --metric-accent: #946a17;
  border-color: #d7bd70;
  background: #fbf5df;
}

.metric-bad {
  --metric-accent: #b13f36;
  border-color: #dda09a;
  background: #fff0ee;
}

.metric-neutral {
  --metric-accent: #667386;
  border-color: var(--line);
  background: var(--panel);
}

.metric-core.metric-good {
  --metric-accent: #16815c;
  border-color: #8ac7a7;
  background: #e9f7f0;
}

.daily-panel,
.calendar-panel,
.scores-panel,
.recap-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.calendar-panel {
  overflow: hidden;
}

.schedule-tools {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.schedule-tools span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.daily-panel {
  padding: 14px;
}

.daily-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.daily-header-compact {
  justify-content: center;
  gap: 12px;
}

.daily-header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0;
}

.daily-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  min-width: min(480px, 100%);
}

.daily-header-compact .daily-stats {
  width: min(720px, 100%);
  min-width: 0;
}

.daily-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.daily-stat {
  min-width: 0;
  min-height: 76px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.daily-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.daily-stat b {
  display: block;
  margin-top: 9px;
  font-size: 29px;
  line-height: 1;
}

.daily-day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 12px;
}

.daily-day-button {
  min-width: 0;
  min-height: 42px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
  cursor: pointer;
}

.daily-day-button span,
.daily-day-button b {
  display: block;
  line-height: 1;
}

.daily-day-button span {
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.daily-day-button b {
  margin-top: 5px;
  color: var(--ink);
  font-size: 15px;
}

.daily-day-button.today {
  background: var(--accent-soft);
}

.daily-day-button.selected {
  border-color: rgba(18, 111, 102, 0.56);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.daily-event-grid {
  width: min(760px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.daily-event-grid .event-card {
  min-height: 72px;
}

.daily-event-grid .sleep-context-card {
  min-height: 88px;
}

.calendar-x-scroll {
  overflow-x: auto;
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(180px, 1fr));
  min-width: 1260px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  padding-right: 15px;
}

.timezone-cell,
.day-head {
  min-height: 46px;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
}

.timezone-cell {
  display: grid;
  align-items: end;
  color: var(--muted);
  font-size: 12px;
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: inherit;
  text-align: left;
  background: #fbfcfd;
  cursor: pointer;
}

.day-head:last-child {
  border-right: 0;
}

.day-head.today {
  background: var(--accent-soft);
}

.day-head.selected {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.day-head.day-past {
  color: #8792a1;
  background: #eef1f4;
}

.day-head.day-today {
  background: var(--accent-soft);
}

.day-date-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.day-name {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.day-number {
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
}

.today .day-number {
  min-width: 28px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
}

.day-score {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eef2f6;
}

.day-status-stack {
  display: grid;
  justify-items: end;
  gap: 3px;
  line-height: 1;
}

.day-core {
  color: #6c7685;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  white-space: nowrap;
}

.day-core.met {
  color: #16815c;
}

.day-head.today .day-score {
  background: rgba(255, 255, 255, 0.74);
}

.calendar-scroll {
  height: calc(100vh - 254px);
  min-height: 560px;
  min-width: 1260px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.calendar-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(180px, 1fr));
  min-width: 1260px;
  min-height: 100%;
}

.time-column {
  grid-column: 1;
  background: #fbfcfd;
  border-right: 1px solid var(--line);
}

.time-slot {
  height: var(--hour-height);
  padding: 0 9px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  text-align: right;
  transform: translateY(-8px);
}

.day-column {
  min-height: 100%;
  padding: 10px;
  border-right: 1px solid var(--line);
  background:
    #ffffff;
}

.day-column.selected {
  background: #fbfdfc;
}

.day-column.day-past {
  background: #f1f3f5;
}

.day-column.day-today {
  background: #fbfdfc;
}

.day-column:last-child {
  border-right: 0;
}

.now-line {
  position: absolute;
  left: var(--time-col);
  right: 0;
  height: 2px;
  background: #d6453d;
  z-index: 6;
  pointer-events: none;
}

.now-line::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d6453d;
}

.event-card {
  position: relative;
  min-height: 0;
  padding: 8px 8px 8px 10px;
  overflow: visible;
  border: 1px solid var(--event-border);
  border-left: 0;
  border-radius: 8px;
  color: #334155;
  background: var(--event-bg);
  box-shadow: 0 4px 10px rgba(23, 32, 51, 0.04);
  z-index: 1;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    opacity 0.16s ease;
}

.reorder-mode .event-card {
  will-change: transform;
}

.event-card.core-event {
  color: #102033;
  border-color: var(--event-border);
  box-shadow: 0 10px 20px rgba(23, 32, 51, 0.12);
}

.event-card.editing {
  z-index: 4;
  box-shadow: 0 18px 34px rgba(23, 32, 51, 0.22);
}

.event-card.optional {
  border-style: dashed;
}

.event-card.empty-event {
  color: #7a8595;
  border-color: #dce2ea;
  background: #fbfcfd !important;
  box-shadow: none;
  opacity: 0.82;
}

.event-card.empty-event .event-color-bar {
  background: #c8d0da;
  opacity: 0.55;
}

.event-card.empty-event .event-title {
  color: #758194;
  font-style: italic;
}

.sleep-visual-block {
  position: relative;
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid #dce2ea;
  border-radius: 8px;
  color: #7a8595;
  background: #f3f5f7;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  box-shadow: none;
  opacity: 0.72;
}

.sleep-visual-mark {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #c8d0da;
  opacity: 0.72;
}

.event-card.event-past {
  border-color: #d5dbe3;
  color: #667386;
  background: #eceff3 !important;
  box-shadow: none;
}

.event-card.event-past .event-color-bar {
  background: #aab3bf;
}

.event-card.event-current {
  border-color: rgba(18, 111, 102, 0.72);
  box-shadow:
    0 0 0 2px rgba(18, 111, 102, 0.18),
    0 12px 22px rgba(23, 32, 51, 0.12);
}

.event-card.event-current:not(.core-event) {
  background: #f1f5f6;
}

.event-card.completed {
  opacity: 0.72;
}

.event-card.completed .event-title {
  text-decoration: line-through;
}

.event-card.event-dragging {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.97;
  transform: translate3d(var(--drag-x, 0), var(--drag-y, 0), 0) scale(1.018);
  transition: none;
  box-shadow:
    0 20px 36px rgba(23, 32, 51, 0.24),
    0 0 0 1px rgba(18, 111, 102, 0.22);
}

.event-drop-placeholder {
  min-height: 42px;
  border: 1px dashed rgba(18, 111, 102, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(18, 111, 102, 0.13), rgba(18, 111, 102, 0.04));
  box-shadow: inset 4px 0 0 rgba(18, 111, 102, 0.42);
  animation: placeholder-in 0.12s ease-out;
}

@keyframes placeholder-in {
  from {
    opacity: 0;
    transform: scaleY(0.84);
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

.is-event-dragging {
  cursor: grabbing;
  user-select: none;
}

.event-color-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: var(--event-color);
}

.event-card:not(.core-event) .event-color-bar {
  opacity: 0.55;
}

.event-top {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
}

.event-top-log {
  grid-template-columns: minmax(0, 1fr);
}

.event-check {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--event-color);
}

.event-drag-handle {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  margin-top: 1px;
  color: #8792a1;
  font-size: 14px;
  line-height: 1;
  cursor: grab;
}

.event-reorder-actions {
  display: none;
  opacity: 0.78;
}

.reorder-mode .event-reorder-actions {
  display: flex;
}

.event-card:hover .event-reorder-actions,
.event-reorder-actions:focus-within {
  opacity: 1;
}

.event-reorder-actions button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(99, 112, 131, 0.24);
  border-radius: 8px;
  color: #526074;
  background: rgba(255, 255, 255, 0.78);
  font-size: 17px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
}

.event-reorder-actions .event-drag-grip {
  color: #126f66;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 3px 8px rgba(23, 32, 51, 0.08);
}

.is-event-dragging .event-reorder-actions .event-drag-grip {
  cursor: grabbing;
}

.event-reorder-actions button:hover {
  color: #172033;
  border-color: rgba(82, 97, 111, 0.45);
  background: #ffffff;
}

.event-title {
  min-width: 0;
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-card.core-event .event-title {
  font-weight: 850;
}

.event-time {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.event-time span {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  white-space: nowrap;
}

.event-time .checked-at {
  color: #42526a;
  background: rgba(255, 255, 255, 0.82);
}

.event-card.core-event .event-time span {
  color: #293a52;
  background: rgba(255, 255, 255, 0.72);
}

.event-summary {
  width: 100%;
  margin-top: 6px;
  padding: 4px 6px;
  border-radius: 6px;
  color: #334155;
  background: rgba(255, 255, 255, 0.68);
  text-align: left;
  font-size: 11px;
  line-height: 1.25;
  cursor: pointer;
}

.event-completion {
  width: 100%;
  margin-top: 5px;
  padding: 3px 6px;
  border-radius: 6px;
  color: #526074;
  background: rgba(255, 255, 255, 0.58);
  text-align: left;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
}

.event-log-note {
  width: 100%;
  min-height: 38px;
  margin-top: 7px;
  padding: 6px 7px;
  resize: vertical;
  border: 1px solid rgba(23, 32, 51, 0.13);
  border-radius: 6px;
  color: #182235;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.3;
}

.event-card.event-past .event-log-note {
  border-color: #d5dbe3;
  color: #667386;
  background: rgba(255, 255, 255, 0.58);
}

.sleep-context-card {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 8px 8px 8px 10px;
  border: 1px solid #d6dde6;
  border-left: 4px solid #9aa6b5;
  border-radius: 8px;
  color: #334155;
  background: #f4f6f8;
  box-shadow: 0 4px 10px rgba(23, 32, 51, 0.04);
}

.sleep-context-card.sleep-context-past {
  border-color: #d5dbe3;
  border-left-color: #aab3bf;
  color: #667386;
  background: #eceff3;
  box-shadow: none;
}

.sleep-context-heading {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.sleep-context-input {
  width: 100%;
  min-height: 42px;
  padding: 6px 7px;
  resize: vertical;
  border: 1px solid #d7dee7;
  border-radius: 7px;
  color: var(--ink);
  background: #ffffff;
  font-size: 12px;
  line-height: 1.35;
}

.sleep-context-card.sleep-context-past .sleep-context-input {
  border-color: #d5dbe3;
  color: #667386;
  background: rgba(255, 255, 255, 0.62);
}

.event-note {
  width: 100%;
  min-height: 28px;
  max-height: 62px;
  margin-top: 7px;
  padding: 5px 7px;
  resize: none;
  border: 1px solid rgba(23, 32, 51, 0.13);
  border-radius: 6px;
  color: #182235;
  background: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  line-height: 1.25;
}

.event-note-hint {
  margin-top: 4px;
  color: #526074;
  font-size: 11px;
  line-height: 1.25;
}

.note-popover {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  width: min(420px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.note-popover-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.note-popover-header h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.note-popover-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.note-popover-header .completion-meta {
  color: #16815c;
  font-weight: 850;
}

.note-popover .event-note {
  min-height: 112px;
  max-height: 180px;
}

.note-popover-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}

.note-popover-footer span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.event-note:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(18, 111, 102, 0.24);
  outline-offset: 1px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 5px;
}

.field label,
.field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 37px;
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
}

.field textarea {
  min-height: 72px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.segment-events {
  display: grid;
  gap: 7px;
}

.day-review {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #d6dde6;
  border-radius: 8px;
  color: #5d6878;
  background: #f7f8fa;
  font-size: 12px;
  font-weight: 800;
}

.day-review input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #52616f;
}

.day-review.reviewed {
  color: #2f4a3f;
  border-color: #b8d2c4;
  background: #edf7f1;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: flex-end;
  padding: 72px 18px 18px;
  background: rgba(23, 32, 51, 0.18);
}

.settings-panel {
  width: min(360px, 100%);
  align-self: flex-start;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-header h2 {
  margin: 0;
  font-size: 20px;
}

.settings-header .icon-button {
  width: 32px;
  min-height: 32px;
  font-size: 20px;
  line-height: 1;
}

.settings-note {
  padding: 10px;
  border-radius: 8px;
  color: #5d6878;
  background: #f4f6f8;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.settings-help {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.settings-help h3,
.settings-help p {
  margin: 0;
}

.settings-help h3 {
  font-size: 13px;
  font-weight: 900;
}

.settings-help p {
  color: #5f6b7c;
  font-size: 12px;
  line-height: 1.4;
}

.settings-export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settings-export-actions .secondary-button {
  justify-content: center;
  text-decoration: none;
}

.settings-signout {
  justify-self: start;
}

.scores-panel,
.builder-panel,
.habits-panel,
.priority-panel,
.feedback-panel,
.recap-panel {
  padding: 18px;
}

.feedback-panel {
  max-width: 780px;
  margin: 0 auto;
}

.feedback-form {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.feedback-message-field textarea {
  min-height: 190px;
  resize: vertical;
}

.field em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  font-weight: 650;
}

.feedback-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.feedback-status {
  padding: 10px 12px;
  border-radius: 8px;
  color: #126f66;
  background: #e8f6f1;
  font-size: 13px;
  font-weight: 800;
}

.feedback-status-error {
  color: var(--danger);
  background: #fff0ee;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.panel-heading p {
  margin: 5px 0 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.builder-add {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 130px 120px 150px auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.builder-window {
  display: grid;
  grid-template-columns: 130px 130px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.routine-safety {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.builder-window-note {
  min-height: 37px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  color: #5f6b7c;
  background: #eef2f6;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.onboarding-panel form {
  display: grid;
  gap: 12px;
}

.onboarding-window {
  margin-bottom: 0;
}

.onboarding-list {
  display: grid;
  gap: 8px;
}

.onboarding-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 120px auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.onboarding-core {
  min-height: 37px;
}

.onboarding-actions {
  display: flex;
  justify-content: flex-end;
}

.builder-list {
  display: grid;
  gap: 8px;
}

.builder-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid #d6dde6;
  border-radius: 8px;
  background: #f7f8fa;
  box-shadow: 0 4px 10px rgba(23, 32, 51, 0.04);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    opacity 0.16s ease;
}

.builder-drag-handle {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #c7d0dc;
  border-radius: 8px;
  color: #126f66;
  background: #ffffff;
  font-size: 18px;
  font-weight: 850;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 3px 8px rgba(23, 32, 51, 0.08);
}

.builder-drag-handle:hover,
.builder-drag-handle:focus-visible {
  border-color: rgba(18, 111, 102, 0.45);
  outline: none;
  box-shadow:
    0 0 0 3px rgba(18, 111, 102, 0.12),
    0 3px 8px rgba(23, 32, 51, 0.08);
}

.builder-item.builder-dragging {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.97;
  transform: translate3d(var(--drag-x, 0), var(--drag-y, 0), 0) scale(1.012);
  transition: none;
  box-shadow:
    0 20px 36px rgba(23, 32, 51, 0.22),
    0 0 0 1px rgba(18, 111, 102, 0.22);
}

.builder-drop-placeholder {
  min-height: 58px;
  border: 1px dashed rgba(18, 111, 102, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(18, 111, 102, 0.13), rgba(18, 111, 102, 0.04));
  box-shadow: inset 4px 0 0 rgba(18, 111, 102, 0.42);
  animation: placeholder-in 0.12s ease-out;
}

.is-builder-dragging {
  cursor: grabbing;
  user-select: none;
}

.builder-item.core {
  border-color: #98c2e7;
  background: #edf6ff;
}

.builder-item.empty-template {
  border-style: dashed;
  background: #fbfcfd;
}

.builder-item-main {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.builder-fields {
  display: grid;
  grid-template-columns: 120px 120px 160px;
  gap: 9px;
}

.builder-item-side {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 8px;
  align-items: center;
}

.builder-core-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 37px;
  padding: 0 10px;
  border: 1px solid #c7d0dc;
  border-radius: 8px;
  color: #334155;
  background: #ffffff;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.builder-core-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.builder-points {
  min-width: 82px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #334155;
  background: #ffffff;
  text-align: center;
}

.builder-points b,
.builder-points span {
  display: block;
  line-height: 1.1;
}

.builder-points b {
  font-size: 17px;
  font-weight: 850;
}

.builder-points b::after {
  content: " pts";
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.builder-duration b::after {
  content: "";
}

.builder-points span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.builder-remove {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  color: #8a332b;
  background: #fff2f1;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.priority-list {
  display: grid;
  gap: 8px;
}

.habit-list {
  display: grid;
  gap: 8px;
}

.habit-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr);
  gap: 14px;
  align-items: center;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid #d6dde6;
  border-radius: 8px;
  color: #334155;
  background: #f7f8fa;
  box-shadow: 0 4px 10px rgba(23, 32, 51, 0.04);
}

.habit-item.core {
  border-color: #98c2e7;
  background: #edf6ff;
}

.habit-main {
  min-width: 0;
}

.habit-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.habit-main h3 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 850;
}

.habit-core-badge {
  flex: 0 0 auto;
  min-height: 19px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #126f66;
  background: #d8efe8;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.habit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.habit-meta span {
  min-height: 18px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #5d6878;
  background: #ffffff;
  font-size: 11px;
  font-weight: 750;
}

.habit-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.habit-stats div {
  min-width: 0;
  padding: 8px;
  border-radius: 8px;
  background: #ffffff;
}

.habit-stats span,
.habit-stats em {
  display: block;
  color: #667386;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.habit-stats b {
  display: block;
  margin-top: 3px;
  color: #27364a;
  font-size: 16px;
  line-height: 1.1;
}

.habit-stats div.habit-stat-good {
  color: #126f66;
  background: #dff3ed;
  box-shadow: inset 0 0 0 1px rgba(18, 111, 102, 0.16);
}

.habit-stats div.habit-stat-good b,
.habit-stats div.habit-stat-good span,
.habit-stats div.habit-stat-good em {
  color: #126f66;
}

.habit-performance-heading {
  align-items: center;
}

.habit-performance-heading .score-period-badge {
  margin-top: 0;
}

.habit-performance-item {
  grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
}

.habit-performance-section .habit-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.habit-performance-bar {
  height: 6px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #d8dee7;
}

.habit-performance-bar span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: #126f66;
}

.priority-item {
  display: grid;
  grid-template-columns: 34px 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid #d6dde6;
  border-radius: 8px;
  color: #334155;
  background: #f7f8fa;
  box-shadow: 0 4px 10px rgba(23, 32, 51, 0.04);
}

.priority-item.core {
  border-color: #98c2e7;
  background: #edf6ff;
}

.priority-item.dragging {
  opacity: 0.55;
}

.priority-item.drag-over {
  border-color: #52616f;
  box-shadow: 0 0 0 2px rgba(82, 97, 111, 0.18);
}

.priority-rank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #ffffff;
  background: #52616f;
  font-size: 12px;
  font-weight: 850;
}

.priority-handle {
  color: #7b8796;
  font-size: 16px;
  cursor: grab;
}

.priority-body {
  min-width: 0;
}

.priority-body h3 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 850;
}

.priority-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.priority-meta span {
  min-height: 18px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #5d6878;
  background: #ffffff;
  font-size: 11px;
  font-weight: 750;
}

.priority-actions {
  display: flex;
  gap: 4px;
}

.priority-actions button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #c7d0dc;
  border-radius: 7px;
  color: #334155;
  background: #ffffff;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.priority-actions button:disabled {
  opacity: 0.35;
  cursor: default;
}

.score-history {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.score-section + .score-section {
  margin-top: 26px;
}

.score-section-heading {
  margin-bottom: 12px;
}

.week-score-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.week-score-card.current {
  border-color: rgba(18, 111, 102, 0.55);
  background: #e8f6f1;
  box-shadow: inset 0 0 0 1px rgba(18, 111, 102, 0.12);
}

.week-score-card.past {
  border-color: #e0e5ec;
  background: #f7f9fb;
}

.week-score-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.week-score-title {
  min-width: 0;
}

.week-score-top h3 {
  margin: 0;
  font-size: 15px;
}

.score-period-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-top: 7px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #687487;
  background: #edf1f5;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.week-score-card.current .score-period-badge {
  color: #126f66;
  background: #cfece5;
}

.week-score-percent {
  font-size: 28px;
  font-weight: 850;
}

.progress-track {
  position: relative;
  height: 8px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #d8dee7;
}

.progress-fill {
  height: 100%;
  width: var(--progress);
  border-radius: inherit;
  background: var(--accent);
}

.goal-track {
  overflow: visible;
}

.goal-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  border-radius: 999px;
  background: #172033;
  opacity: 0.55;
  z-index: 2;
}

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

.score-card-stat {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(201, 209, 220, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.score-card-stat b,
.score-card-stat span {
  display: block;
  line-height: 1.1;
}

.score-card-stat b {
  font-size: 15px;
  font-weight: 850;
}

.score-card-stat span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.vacation-balance-section .score-period-badge {
  margin-top: 0;
}

.vacation-card {
  padding: 16px;
  border: 1px solid rgba(18, 111, 102, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(18, 111, 102, 0.1), rgba(255, 255, 255, 0) 42%),
    #fbfcfd;
}

.vacation-card.vacation-over {
  border-color: rgba(180, 59, 48, 0.36);
  background:
    linear-gradient(135deg, rgba(180, 59, 48, 0.1), rgba(255, 255, 255, 0) 42%),
    #fbfcfd;
}

.vacation-card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.vacation-kicker {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.vacation-card strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.vacation-pill {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid rgba(18, 111, 102, 0.22);
  border-radius: 999px;
  color: #126f66;
  background: rgba(207, 236, 229, 0.7);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.vacation-over .vacation-pill {
  border-color: rgba(180, 59, 48, 0.22);
  color: #9b2e25;
  background: rgba(255, 226, 222, 0.72);
}

.vacation-track {
  height: 8px;
  margin: 14px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #d8dee7;
}

.vacation-track span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: #126f66;
}

.vacation-over .vacation-track span {
  background: #b43b30;
}

.vacation-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.vacation-stats div {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(201, 209, 220, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.vacation-stats b,
.vacation-stats span {
  display: block;
  line-height: 1.1;
}

.vacation-stats b {
  font-size: 15px;
  font-weight: 850;
}

.vacation-stats span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.vacation-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.recap-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.recap-hero h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}

.recap-range {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.recap-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.recap-metric {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--recap-accent, #667386);
  border-radius: 8px;
  background: #fbfcfd;
}

.recap-metric span,
.recap-metric em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.15;
  text-transform: uppercase;
  font-style: normal;
}

.recap-metric b {
  display: block;
  margin: 6px 0 5px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.recap-good {
  --recap-accent: #1f7a5b;
}

.recap-warn {
  --recap-accent: #946a17;
}

.recap-bad {
  --recap-accent: #b13f36;
}

.recap-neutral {
  --recap-accent: #667386;
}

.recap-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 14px;
  align-items: start;
}

.recap-workbench-simple {
  grid-template-columns: 1fr;
}

.recap-main,
.recap-side {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.recap-section {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.recap-section-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.recap-section-title h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.recap-section-title span,
.recap-source,
.recap-auto-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--muted);
  background: #edf1f5;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.recap-source-stack {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.recap-source.warning {
  color: #8a332b;
  background: #fdecea;
}

.recap-readout {
  display: grid;
  gap: 8px;
}

.recap-readout p,
.recap-summary-text,
.recap-log-list p,
.recap-warning,
.recap-list {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.recap-summary-text {
  color: #334155;
}

.recap-paragraph-stack {
  display: grid;
  gap: 10px;
}

.recap-paragraph-card {
  padding: 13px;
  border: 1px solid #e0e5ec;
  border-radius: 8px;
  background: #ffffff;
}

.recap-paragraph-card span,
.recap-log-type,
.recap-log-status {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  color: #526074;
  background: #eef2f6;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.recap-paragraph-card p {
  margin-top: 8px;
}

.recap-log-timeline {
  display: grid;
  gap: 10px;
}

.recap-log-card {
  padding: 13px;
  border: 1px solid #e0e5ec;
  border-radius: 8px;
  background: #ffffff;
}

.recap-log-card.current {
  border-color: #9ab6d8;
  background: #f7fbff;
}

.recap-log-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.recap-log-top h4 {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
}

.recap-log-card p {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.5;
}

.recap-context-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.recap-context-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #526074;
  background: #f0f3f6;
  font-size: 11px;
  font-weight: 800;
}

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

.recap-list-block h4 {
  margin: 0 0 7px;
  font-size: 13px;
  text-transform: uppercase;
  color: #455369;
}

.recap-list {
  padding-left: 18px;
}

.recap-list li + li {
  margin-top: 6px;
}

.recap-day-list,
.recap-log-list,
.recap-location-group {
  display: grid;
  gap: 8px;
}

.recap-day-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.8fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e0e5ec;
  border-radius: 8px;
  background: #ffffff;
}

.recap-day-row b,
.recap-log-list b {
  color: var(--ink);
}

.recap-day-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.recap-day-signals {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.recap-day-signals span,
.recap-pill-list b,
.recap-pill-list i {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #526074;
  background: #eef2f6;
  font-size: 11px;
  font-weight: 800;
  font-style: normal;
}

.recap-location-group > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.recap-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recap-pill-list em {
  margin-left: 4px;
  font-style: normal;
  color: var(--accent);
}

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

.recap-month-grid div {
  padding: 10px;
  border-radius: 8px;
  background: #ffffff;
}

.recap-month-grid b,
.recap-month-grid span {
  display: block;
}

.recap-month-grid b {
  font-size: 18px;
  line-height: 1;
}

.recap-month-grid span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.empty-state {
  padding: 34px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #fbfcfd;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: #172033;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

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

@media (max-width: 1120px) {
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-brand-row,
  .auth-brand,
  .auth-copy,
  .auth-card {
    grid-column: auto;
    grid-row: auto;
  }

  .topbar-inner {
    grid-template-columns: 1fr;
  }

  .brand,
  .week-nav,
  .toolbar-actions {
    justify-content: center;
  }

  .toolbar-actions {
    width: 100%;
  }

  .settings-button {
    position: absolute;
    top: 14px;
    right: 22px;
    z-index: 2;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

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

  .daily-header {
    display: grid;
  }

  .daily-header-actions {
    justify-content: stretch;
  }

  .daily-header-actions .secondary-button {
    flex: 1;
  }

  .recap-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .recap-workbench {
    grid-template-columns: 1fr;
  }

  .builder-add,
  .builder-window,
  .routine-safety,
  .builder-item,
  .builder-item-side,
  .onboarding-row {
    grid-template-columns: 1fr;
  }

  .builder-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .builder-item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .builder-item-side {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .toolbar-actions {
    justify-content: center;
  }

  .tabs {
    flex: 1 1 100%;
    justify-content: center;
  }

  .settings-button {
    flex: 0 0 auto;
    justify-content: center;
  }
}

@media (max-width: 720px) {
  :root {
    --time-col: 54px;
  }

  .topbar-inner,
  .main-layout,
  .privacy-footer {
    padding-left: 12px;
    padding-right: 12px;
  }

  .footer-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .creator-credit {
    text-align: left;
  }

  .brand {
    justify-content: flex-start;
  }

  .brand h1 {
    font-size: 17px;
  }

  .auth-shell {
    padding: 14px;
  }

  .auth-copy h2 {
    font-size: 30px;
  }

  .auth-copy p {
    font-size: 14px;
  }

  .week-nav {
    justify-content: stretch;
  }

  .date-pill {
    min-width: 0;
    flex: 1;
    font-size: 13px;
  }

  .toolbar-actions {
    justify-content: center;
    overflow-x: visible;
    padding-bottom: 0;
  }

  .tabs {
    flex: 1 1 100%;
    justify-content: center;
  }

  .settings-button {
    right: 12px;
    flex: 0 0 auto;
  }

  .score-strip,
  .daily-day-strip,
  .habit-item,
  .builder-fields,
  .recap-metrics,
  .recap-report-grid,
  .recap-day-row,
  .recap-month-grid {
    grid-template-columns: 1fr;
  }

  .recap-hero {
    display: grid;
  }

  .recap-day-signals {
    justify-content: flex-start;
  }

  .daily-event-grid {
    grid-template-columns: 1fr;
  }

  .schedule-tools {
    justify-content: stretch;
    align-items: stretch;
    flex-direction: column;
  }

  .schedule-tools .secondary-button {
    width: 100%;
  }

  .daily-panel {
    padding: 10px;
  }

  .daily-header {
    margin-bottom: 10px;
  }

  .daily-header-compact {
    display: block;
  }

  .daily-header-compact .daily-stats {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .daily-header-compact .daily-header-actions {
    margin-top: 8px;
  }

  .daily-stat {
    min-height: 64px;
    padding: 10px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .daily-stat span {
    font-size: 11px;
  }

  .daily-stat b {
    margin-top: 6px;
    font-size: 20px;
  }

  .habit-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calendar-scroll {
    height: 66vh;
    min-height: 520px;
  }

  .panel-heading {
    display: grid;
  }

}
