/* Shared workspace and daily overview. */
.workspace { margin-inline: 0; width: 100%; }
.workspace-bar { background: var(--card); padding-inline: max(24px, calc((100% - 1496px) / 2)); }
.breadcrumb strong { color: var(--ink); font-weight: 600; }
.breadcrumb-home, .breadcrumb-menu > summary {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 7px;
  border: 0; border-radius: 6px; background: transparent; color: var(--sub); cursor: pointer;
}
.breadcrumb-home { padding-inline: 0 8px; color: var(--ink); font-size: 14px; font-weight: 600; }
.breadcrumb-home svg { color: var(--action); }
.breadcrumb-menu { position: relative; }
.breadcrumb-menu > summary { list-style: none; gap: 12px; padding-inline: 10px; border: 1px solid var(--line); background: var(--neutral-surface); }
.breadcrumb-menu > summary::-webkit-details-marker { display: none; }
.breadcrumb-home:hover, .breadcrumb-menu > summary:hover, .breadcrumb-menu[open] > summary { background: var(--hover-surface); color: var(--ink); }
#breadcrumb-routes {
  position: absolute; z-index: 15; top: calc(100% + 6px); left: 0; display: grid; gap: 2px;
  min-width: 188px; max-height: calc(100dvh - 72px); overflow: auto;
  padding: 6px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); box-shadow: var(--shadow-overlay);
}
#breadcrumb-routes > button {
  display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 4px 10px;
  border: 0; border-radius: 6px; background: transparent; color: var(--sub); text-align: left;
}
#breadcrumb-routes > button:hover, #breadcrumb-routes > button:focus-visible { background: var(--hover-surface); color: var(--ink); }
#breadcrumb-routes > button[aria-current="page"] { background: var(--soft); color: var(--action); }
.route-count { margin-left: auto; padding: 1px 6px; border-radius: 5px; background: var(--neutral-surface); color: var(--sub); font-variant-numeric: tabular-nums; }
.command-trigger { border: 1px solid var(--line); background: var(--bg); }
.command-trigger:hover { background: var(--soft); border-color: var(--selection-border); }
.page-heading h1 { font-size: clamp(28px, 2.6vw, 36px); line-height: 1.2; font-weight: 500; letter-spacing: -.02em; }
.page-heading p { margin-top: 8px; color: var(--sub); font-size: 14px; line-height: 1.55; }
.card-head h2, .surface-heading { font-weight: 500; }
.card-head h2 { font-size: 16px; }
.btn { font-weight: 500; }
.btn.primary:active { background: var(--action-hover); box-shadow: inset 0 0 0 2px #ffffff22; }
.segmented button.active { color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px var(--shadow-segment); }
.empty strong { font-weight: 600; }
::selection { background: var(--accent-surface); color: var(--ink); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .milestone-edit input:focus {
  outline-color: color-mix(in srgb, var(--action) 25%, transparent);
}
.dialog-head h2 { font-weight: 600; }
dialog:not(.schedule-detail) .dialog-head { background: var(--dialog-footer); }
dialog .dialog-foot { background: var(--dialog-footer); }
dialog.entity-drawer { width: clamp(440px, 50vw, 860px); max-width: 100vw; }
dialog.entity-drawer > form { height: 100%; }
.milestone-add-dialog::backdrop { background: rgb(0 0 0 / .38); }
@media (prefers-reduced-motion: no-preference) {
  dialog.entity-drawer::backdrop { animation-duration: 235ms; }
}
.goal-drawer .dialog-body { padding: 0; }
.goal-drawer .project-detail { display: block; max-height: none; overflow: visible; border: 0; border-radius: 0; }
.attention-drawer-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%;
  padding: 14px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--ink); text-align: left;
}
.attention-drawer-item:hover { background: var(--hover-surface); }
.attention-drawer-item > span { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.attention-drawer-item small { color: var(--sub); }
.attention-drawer-item > svg { flex-shrink: 0; color: var(--action); }

.new-plan-dialog { width: 480px; }
.mastery-plan-dialog { width: 640px; }
.mastery-plan-section + .mastery-plan-section {
  margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line);
}
.mastery-plan-section h3 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.mastery-plan-section .field { margin-bottom: 12px; }
.mastery-plan-section > .hint { margin: 0 0 10px; }
.mastery-days { min-width: 0; margin: 0 0 12px; padding: 0; border: 0; }
.mastery-days legend { margin-bottom: 8px; font-size: 13px; }
.mastery-days .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mastery-days .checkbox-field {
  min-height: 34px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--neutral-surface);
}
.mastery-days .checkbox-field:has(input:checked) { border-color: var(--selection-border); background: var(--soft); }
.mastery-days output { display: block; margin-top: 8px; color: var(--sub); font-size: 13px; font-variant-numeric: tabular-nums; }
.schedule-goal-link { margin-top: 12px; text-align: left; }
.schedule-goal-link span { min-width: 0; overflow-wrap: anywhere; }
.schedule-goal-link svg { flex-shrink: 0; }
@media (max-width: 420px) {
  .mastery-plan-section .form-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
.new-plan-dialog .dialog-body { padding: clamp(14px, 3vw, 20px); }
.new-plan-options { display: grid; gap: 8px; }
.new-plan-option {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
  text-align: left;
  transition: background-color 130ms ease, border-color 130ms ease;
}
.new-plan-option:hover, .new-plan-option:focus-visible {
  background: var(--soft);
  border-color: var(--selection-border);
}
.new-plan-option:focus-visible { outline-offset: 1px; }
.new-plan-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--action);
}
.new-plan-option .new-plan-icon { color: var(--sub); }
.new-plan-copy { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.new-plan-copy strong { font-size: 15px; font-weight: 600; line-height: 1.45; }
.new-plan-copy small { font-size: 13px; color: var(--sub); line-height: 1.5; }
.new-plan-arrow { display: grid; place-items: center; color: var(--action); }

.daily-heading {
  min-height: 60px;
  margin-bottom: 8px;
  padding: 0 0 12px;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.daily-heading h1 { margin: 0; font-size: 32px; line-height: 1.15; font-weight: 500; letter-spacing: -.02em; }
.day-navigation { order: 0; margin-inline-start: auto; gap: 8px; }
.day-control {
  display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); min-width: 0;
}
.day-control > .icon-btn { width: 38px; height: 36px; flex-shrink: 0; }
.day-control > .icon-btn:hover, .day-return:hover { background: var(--hover-surface); }
.day-control .day-picker {
  justify-content: center; min-width: 154px; min-height: 36px; padding: 4px 10px; gap: 8px;
  border-radius: 0; border-inline: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 500;
  white-space: nowrap;
}
.day-control .day-picker svg { transform: none; flex-shrink: 0; }
.day-return { min-height: 36px; padding-inline: 10px; white-space: nowrap; }
.daily-heading > .actions .btn { min-height: 36px; padding-inline: 12px; }
.daily-completion {
  display: flex; justify-content: flex-start; flex-wrap: wrap; align-items: center;
  gap: 4px 16px; min-height: 32px; padding: 0 0 8px; border: 0; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--ink); flex-shrink: 0;
}
.daily-completion > span { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.daily-completion > span:first-child { color: var(--ink); }
.daily-completion b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.daily-completion .daily-completion-done { color: var(--sub); }
.daily-completion-done svg, .daily-completion.is-complete > span:first-child { color: var(--green); }

body[data-page="today"] { --home-gutter: clamp(20px, 1.55vw, 28px); }
body[data-page="today"] #main > .page {
  max-width: none; height: 100%; min-height: 100%; padding-inline: var(--home-gutter);
}
body[data-page="today"] .workspace-bar { padding-inline: var(--home-gutter); }
.dashboard {
  --dashboard-gap: 16px;
  --history-space: 146px;
  --goal-space: 344px;
  --routine-space: 184px;
  --focus-space: 60px;
  display: grid;
  grid-template-columns: minmax(0, 1.23fr) minmax(0, 1fr);
  grid-template-rows: var(--history-space) minmax(var(--goal-space), 3fr) minmax(var(--routine-space), 2fr);
  grid-template-areas: "history history" "overview queue" "routine queue";
  gap: var(--dashboard-gap);
  flex: 1 0 0%;
  min-height: calc(var(--history-space) + var(--goal-space) + var(--routine-space) + 2 * var(--dashboard-gap));
}
.daily-queue {
  grid-area: queue; display: grid; grid-template-rows: minmax(0, .94fr) minmax(0, 1.06fr);
  gap: var(--dashboard-gap); min-width: 0; min-height: 0;
}
.daily-queue > .card { grid-area: auto; min-block-size: 0; }
.dashboard #today-todos { flex: 1 1 0; padding-inline-end: 4px; }
.dashboard :is(#today-todos, .home-goal-grid, .agenda-list, .home-habits .card-body) {
  min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable;
}
.daily-routine {
  grid-area: routine; display: grid; grid-template-rows: minmax(0, 1fr) var(--focus-space);
  min-width: 0; min-height: 0; background: #1e1e21;
}
.daily-routine > .home-habits {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  border: 0; border-radius: 0; background: transparent;
}
.home-habits .card-head { min-height: 42px; flex-shrink: 0; padding: 5px 18px; flex-wrap: wrap; }
.home-habits .card-head h2 { font-size: 16px; }
.home-habits-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; }
.home-habits .card-body {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 1; align-content: start; gap: 6px 10px; padding: 0 14px 6px 18px;
}
.home-habits .card-body:has(.home-habits-empty) { align-content: center; }
.home-habits .todo-item {
  min-width: 0; min-height: 36px; padding: 1px 6px; gap: 6px;
  border: 0; border-radius: var(--radius-control); background: var(--neutral-surface);
}
.home-habits .todo-item .grow { min-width: 0; }
.home-habits .todo-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-habits .todo-meta { display: none; }
.home-habits-empty { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 34px; color: var(--sub); font-size: 13px; }
.home-habits-empty svg { color: var(--muted); }
.daily-history.home-history {
  display: flex; flex-direction: column;
  padding: 0; border: 1px solid var(--line); background: #1e1e21; overflow: clip;
}
.home-history .card-head { padding: 14px 20px 8px; }
.home-history .card-head h2 { font-size: 17px; }
.home-history .card-body { display: grid; grid-template-columns: minmax(388px, .8fr) minmax(0, 1.2fr); flex: 1; align-items: center; gap: 24px; padding: 0 20px 16px; }
.history-metrics { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.15fr) minmax(0, .75fr); gap: 8px; margin: 0; }
.history-metrics > div { display: grid; gap: 2px; }
.history-metrics > div + div { border-left: 1px solid var(--line); padding-left: 8px; }
.history-metrics dt { color: var(--sub); font-size: 12px; line-height: 1.45; }
.history-metrics dd { margin: 0; font-size: 26px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.history-metrics dd small { margin-left: 4px; color: var(--sub); font-size: 12px; }
.history-metric-note {
  display: block; min-width: 0; margin-top: 3px; color: var(--sub);
  font: 400 11px/1.45 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-metrics > div:nth-child(2) .history-metric-note { white-space: normal; }
.history-chart { position: relative; min-width: 0; }
.history-weeks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 10px; margin-top: 4px; }
.history-week > span { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.history-week > div { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-top: 2px; }
.history-day {
  display: grid; place-items: center; min-width: 0; min-height: 30px;
  padding: 0; border: 0; border-radius: 4px; background: transparent;
}
.history-day i {
  width: min(100%, 24px); height: 13px; border-radius: 3px; background: var(--heat-empty);
  transition: background-color 180ms ease, transform 180ms ease;
}
.history-day.marked i { background: #79cbb1; }
.history-day:is(:hover, :focus-visible) i { transform: scaleY(1.28); }
.history-day[aria-current="date"] i { box-shadow: 0 0 0 1px var(--action); }
.history-chart .heat-key i { background: #79cbb1; }
.history-art { display: none; }
.history-day-records { display: grid; gap: 20px; }
.history-day-records h3 { font-size: 15px; margin-bottom: 8px; }
.history-day-records ul { padding: 0; list-style: none; }
.history-day-records li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.history-day-records li > svg { flex-shrink: 0; margin-top: 3px; color: var(--action); }
.history-day-records p { margin-top: 3px; color: var(--sub); overflow-wrap: anywhere; white-space: pre-wrap; }
@media (min-width: 1200px) {
  .history-weeks { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
}
@media (min-width: 701px) and (prefers-reduced-motion: no-preference) {
  .history-art {
    position: absolute; inset: auto 0 0; height: 26px; display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; pointer-events: none;
    animation: history-reveal 520ms ease-out both;
  }
  .history-chart:focus-within .history-art { visibility: hidden; }
  .history-art i {
    background: #fb877a; clip-path: polygon(0 0, 76% 0, 100% 100%, 0 100%);
  }
  .history-art i:nth-child(2) { background: #eab25c; clip-path: inset(0 round 14px 0 0 14px); }
  .history-art i:nth-child(3) { background: #a6c77a; clip-path: polygon(0 100%, 25% 0, 100% 0, 100% 100%); }
  .history-art i:nth-child(4) { background: #58baa7; clip-path: inset(0 round 0 14px 14px 0); }
  @keyframes history-reveal {
    0% { opacity: .94; transform: scaleY(1); }
    52% {
      opacity: .74;
      mask-image: repeating-conic-gradient(#000 0 25%, transparent 0 100%);
      mask-size: 7px 7px;
    }
    100% { opacity: 0; transform: scaleY(.64); }
  }
}
.dashboard .home-focus {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px;
  min-width: 0; min-height: 0; overflow: auto; padding: 6px 18px; border-top: 1px solid var(--line);
}
.home-focus-heading { display: flex; flex: 1; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; }
.home-focus-label { min-width: 0; }
.home-focus-heading h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.home-focus-heading h2 svg { color: var(--muted); }
.home-focus-heading .text-btn { flex-shrink: 0; }
.home-focus-task { margin: 1px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--sub); font-size: 12px; }
.home-focus[data-session="running"] .home-focus-heading h2 svg { color: var(--action); }
.home-focus-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; }
.home-focus .compact-timer { display: block; flex: 1 1 auto; }
.home-focus .compact-timer-body { justify-content: space-between; gap: 8px; }
.home-focus .timer-number { font-size: 23px; line-height: 30px; }
.home-focus .compact-timer .timer-actions > .btn { min-height: 32px; border-radius: var(--radius-control); }
.home-focus .compact-timer .timer-actions > .primary { background: var(--soft); }
.home-focus[data-session="running"] { background: var(--focus-surface); border-color: var(--selection-border); }
.home-focus[data-session="running"] .timer-number { color: var(--action); }
.home-focus-current {
  max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 2px 7px; border-radius: 5px; background: var(--soft); color: var(--action); font-size: 12px;
}
.home-focus-mode {
  display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--sub); font-size: 12px;
}
.home-focus-mode select {
  width: 84px; min-height: 29px; padding: 2px 7px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--neutral-surface); color: var(--ink); font: inherit;
}
.home-alerts { min-width: 0; margin: 0; overflow: hidden; }
.home-alerts .attention-summary { max-width: 100%; color: var(--terracotta); font-weight: 500; white-space: nowrap; }
.home-alerts .attention-summary small { min-width: 0; }
.home-alerts .attention-summary > :not(small) { flex-shrink: 0; }
.dashboard .home-schedule { border-radius: var(--radius-card); background: #1e1e21; }
.dashboard .today-card .card-head, .dashboard .home-schedule .card-head { block-size: 54px; min-height: 0; padding: 8px 20px; }
.dashboard .today-card .card-head h2 { font-size: 19px; font-weight: 600; }
.dashboard .home-schedule .card-head h2 { font-size: 17px; }
.today-card .card-body, .home-schedule .card-body { padding-inline: 20px; }
#today-todos > .empty, .home-goal-grid > .empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100%; padding-block: 10px;
}
#today-todos > .empty > svg, .home-goal-grid > .empty > svg { margin-bottom: 8px; }
.action-group + .action-group { margin-top: 8px; }
.action-group-label { color: var(--sub); font-weight: 500; padding: 8px 0 0; }
.action-group-label > span { color: var(--muted); }
.todo-item { min-height: 56px; padding: 6px 0; }
.todo-title { font-size: 15px; font-weight: 500; }
.todo-meta { margin-top: 2px; }
.todo-type-icon { width: 24px; height: 32px; color: var(--sub); }
.todo-action.btn.soft { color: var(--ink); font-weight: 500; }
.agenda-week { border-radius: 9px; background: var(--bg); }
.agenda-week .agenda-day { gap: 1px; padding-block: 2px; }
.agenda-week .agenda-day > span { line-height: 15px; }
.agenda-week .agenda-day > b { height: 23px; line-height: 23px; }
.agenda-day.is-today { color: var(--action); }
.agenda-day.is-today:not(.selected) > b { color: var(--action); }
.agenda-event { display: grid; grid-template-columns: 42px minmax(0, 1fr) 14px; align-items: center; gap: 8px; min-height: 39px; padding: 5px; }
.agenda-event-time { color: var(--sub); font-size: 12px; font-variant-numeric: tabular-nums; }
.agenda-event-main { display: flex; align-items: center; gap: 6px; }
.agenda-event strong { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.agenda-event-main small { color: var(--muted); font-size: 11px; flex: none; }
.agenda-event-main .agenda-event-status { color: var(--green); }
.agenda-event > svg { margin-top: 0; }
.agenda-list { margin-top: 8px; flex: 1 1 0; }
.agenda-list > .empty { display: flex; align-items: center; justify-content: center; min-height: 100%; gap: 8px; padding: 5px 4px; }
.agenda-list > .empty > svg { width: 16px; height: 16px; margin: 0; }
.agenda-list > .empty strong { margin: 0; color: var(--sub); font-weight: 400; }
.home-schedule .agenda-week { flex-shrink: 0; }
.agenda-footer { display: flex; align-items: center; flex: 0 0 24px; }
.agenda-day-count { min-width: 20px; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 15px; }
.agenda-day-count.has-events { border-radius: 4px; background: var(--soft); color: var(--action); }
.agenda-group + .agenda-group { margin-top: 6px; }
.dashboard .home-goals {
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
  border: 1px solid var(--line); background: var(--card);
}
.dashboard .home-goals .card-head { min-height: 44px; padding: 4px 20px; }
.dashboard .home-goals .card-head h2 { font-size: 16px; font-weight: 600; }
.dashboard .home-goals .card-head h2 > svg { display: block; flex: none; width: 17px; height: 17px; color: var(--action); }
.dashboard .home-goals .section-count { margin-inline-start: 2px; }
.dashboard .home-goals .card-body { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 0 12px; }
.home-goal-grid { display: grid; flex: 1; align-content: start; grid-auto-rows: max-content; min-width: 0; }
.home-goal-grid:has(> .empty) { align-content: stretch; grid-auto-rows: minmax(0, 1fr); }
.home-goal-footer {
  display: flex; flex: 0 0 32px; align-items: center; justify-content: space-between; gap: 10px;
  margin-inline: 6px; border-top: 1px solid var(--line);
}
.home-goal-footer > .text-btn { flex-shrink: 0; margin-inline-start: auto; }
.dashboard .home-goals .goal-mini {
  display: flex; min-width: 0; padding: 0; border: 0;
  border-radius: var(--radius-control); background: transparent; overflow: hidden;
}
.dashboard .home-goals .goal-mini + .goal-mini { border-top: 1px solid var(--line); border-radius: 0; }
.goal-mini-progress { display: grid; align-content: center; gap: 6px; }
.home-goal-pager { display: flex; align-items: center; gap: 3px; color: var(--sub); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.home-goal-pager .icon-btn { width: 27px; height: 28px; }
.goal-mini .goal-name {
  display: grid; grid-template-columns: minmax(0, 1fr) 84px minmax(100px, .6fr) 20px;
  align-items: center; gap: 8px 12px; width: 100%;
  padding: 7px 12px; border: 0; background: transparent; color: var(--ink); text-align: left; line-height: 1.35;
}
.goal-mini .goal-name:hover, .goal-mini .goal-name:focus-visible { background: var(--hover-surface); }
.goal-mini .goal-name:focus-visible { outline-offset: -3px; }
.goal-mini-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; }
.goal-mini-score { display: grid; justify-items: start; gap: 2px; color: var(--sub); font-size: 11px; font-variant-numeric: tabular-nums; }
.goal-mini-score b { font-size: 18px; font-weight: 500; line-height: 1; color: var(--ink); }
.goal-mini-score small { color: var(--sub); font-size: .58em; font-weight: 400; }
.goal-mini-open { display: grid; place-items: center; color: var(--action); }
.goal-mini:first-child .goal-name {
  grid-template-columns: minmax(0, 1fr) auto 38px;
  gap: 10px 20px; min-block-size: 134px; padding: 12px 12px 10px;
}
.goal-mini:first-child .goal-mini-title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  white-space: normal; overflow-wrap: anywhere; font-size: clamp(22px, 1.9vw, 32px); line-height: 1.22;
}
.goal-mini:first-child .goal-mini-score { justify-items: end; gap: 5px; }
.goal-mini:first-child .goal-mini-score b { font-size: clamp(28px, 2.7vw, 42px); }
.goal-mini:first-child .goal-mini-score small { font-size: .48em; }
.goal-mini:first-child .goal-mini-progress { grid-column: 1 / -1; grid-row: 2; gap: 9px; }
.goal-mini:first-child .goal-marks { height: 7px; }
.goal-mini:first-child .goal-mini-open {
  grid-column: 3; grid-row: 1; min-height: 38px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--neutral-surface);
}
.goal-marks { display: flex; gap: 4px; height: 5px; border-radius: 3px; }
.goal-marks:empty, .goal-marks:has(.wide) { background: var(--stage-track); }
.goal-marks > i { flex: 1; min-width: 0; border-radius: 2px; background: var(--stage-track); }
.goal-marks > i.done { background: var(--progress); }
.goal-marks > i.next { border: 1px solid var(--progress); background: transparent; }
.goal-marks > i.overdue { border: 0; background: var(--red); }
.goal-marks > i.next.overdue { box-shadow: 0 0 0 1px var(--red); }
@media (prefers-reduced-motion: no-preference) {
  .goal-marks > i { transition: background-color 200ms ease, box-shadow 200ms ease, width 200ms ease; }
}
.goal-stage-warning { display: inline-flex; align-items: center; gap: 4px; color: var(--red); }
.goal-marks > i.wide { flex: none; background: var(--progress); }
.goal-progress-meta b { color: var(--ink); font-weight: 600; }
.goal-mini-timing { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 4px 8px; color: var(--sub); font-size: 12px; }
.goal-mini-next { display: flex; gap: 8px; min-width: 0; margin-top: 4px; color: var(--sub); font-size: 13px; }
.goal-mini:first-child .goal-mini-next { margin-top: 10px; font-size: 14px; }
.goal-mini-next > span { flex-shrink: 0; color: var(--muted); }
.goal-mini-next > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.goal-mini.overdue .goal-mini-due { color: var(--red); }
.history-summary > span:first-child { color: var(--ink); font-weight: 600; }

/* Administrative pages share the reading rhythm of the workspaces. */
body[data-page="settings"] .settings-workspace { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.settings-workspace > .card .card-head, .settings-rules > .card .card-head { padding-block: 17px 12px; }
.settings-workspace .setting-row b, .settings-rules .setting-row b { font-weight: 600; }
.settings-workspace .setting-row p, .settings-rules .setting-row p { font-size: 13px; color: var(--sub); }
.settings-workspace .chip { color: var(--action); background: var(--soft); }
.settings-workspace #settings-form > .mt { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 15px; }
.settings-workspace #settings-form .setting-row:nth-last-child(2) { border-bottom: 0; }
.data-workspace { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; min-height: 0; }
.data-workspace > .card { min-height: 0; }
.data-workspace .card-head h2 > svg { display: inline; color: var(--action); width: 18px; height: 18px; }
.data-workspace .data-import-card { border-top: 2px solid var(--action); }
.data-workspace .data-import-card .card-head h2 { font-size: 19px; }
.data-workspace .data-backup-card { grid-row: span 2; }
.data-workspace .hint { font-size: 13px; line-height: 1.65; }
.data-workspace .data-restore { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.data-workspace .data-restore h3 { margin-bottom: 4px; font-weight: 600; }
.data-workspace .data-restore .actions { margin-top: 10px; }

@media (max-height: 820px) and (min-width: 1200px) {
  body[data-page="today"] #main > .page { padding-block: 14px 10px; }
  .daily-heading { min-height: 48px; padding-bottom: 8px; }
  .dashboard {
    --dashboard-gap: 12px; --history-space: 128px; --goal-space: 300px; --routine-space: 176px;
    --focus-space: 50px; column-gap: 16px;
  }
  .home-history .card-head { padding-block: 7px 4px; }
  .home-history .card-body { padding-bottom: 7px; }
  .dashboard .today-card .todo-item { min-height: 48px; }
  .dashboard .home-schedule .card-body { padding-bottom: 8px; }
  .goal-mini .goal-name { padding-block: 5px; }
  .goal-mini-next { margin-top: 2px; }
  .goal-mini:first-child .goal-name { min-block-size: 102px; gap: 5px 16px; padding-block: 7px; }
  .goal-mini:first-child .goal-mini-score b { font-size: 32px; }
  .goal-mini:first-child .goal-mini-progress { gap: 6px; }
  .goal-mini:first-child .goal-mini-next { margin-top: 5px; }
}
@media (max-width: 1199px) {
  .dashboard { --history-space: 210px; --routine-space: 224px; --focus-space: 86px; }
  .home-focus-heading { flex-basis: 100%; }
}
@media (max-width: 850px) {
  body[data-page="today"] #main > .page { height: auto; }
  .dashboard {
    flex: none; min-height: 0; grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--history-space) var(--goal-space) auto var(--routine-space);
    grid-template-areas: "history" "overview" "queue" "routine";
  }
  .daily-queue { grid-template-rows: 256px 300px; }
}
@media (max-width: 1000px) {
  .dashboard { --history-space: 245px; }
  .home-history .card-body { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}
@media (max-width: 520px) {
  .dashboard { --history-space: 420px; --routine-space: 336px; --focus-space: 106px; }
  .dashboard .home-focus { display: grid; align-content: center; gap: 4px; }
  .home-focus-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .home-focus .compact-timer-body { gap: 5px; }
  .home-focus .timer-number { font-size: 20px; }
  .home-focus-mode > span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .home-focus-mode select { width: 68px; }
  .home-focus .timer-actions > .primary svg { display: none; }
  .history-weeks { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
  .history-week > span { display: block; text-align: center; }
  .history-week > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .history-day { min-height: 24px; }
  .home-habits .card-body { grid-template-columns: minmax(0, 1fr); }
  .goal-mini .goal-name,
  .goal-mini:first-child .goal-name { grid-template-columns: minmax(0, 1fr) auto 28px; gap: 9px; padding-inline: 7px; }
  .goal-mini .goal-mini-progress { grid-column: 1 / -1; grid-row: 2; }
  .goal-mini .goal-mini-open { grid-column: 3; grid-row: 1; }
  .goal-mini:first-child .goal-mini-open { min-height: 28px; }
  .goal-mini:first-child .goal-mini-score b { font-size: 26px; }
}
@media (max-width: 900px) {
  body[data-page="settings"] .settings-workspace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  body[data-page="today"] { --home-gutter: 16px; }
  .workspace-bar { padding-inline: 16px; }
  .page-heading h1 { font-size: 29px; }
  .daily-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 0 0 12px; margin-bottom: 8px; }
  .daily-heading > .actions { grid-column: 2; grid-row: 1; }
  .daily-heading h1 { font-size: 27px; }
  .day-navigation { grid-column: 1 / -1; grid-row: 2; margin: 0; gap: 6px; flex-wrap: nowrap; }
  .day-control { flex: 1; }
  .day-control .day-picker { flex: 1; min-width: 0; padding-inline: 6px; }
  .dashboard .home-focus { padding-inline: 12px; }
  dialog.entity-drawer { width: 100vw; border-radius: 0; }
  .home-habits .card-head { display: grid; grid-template-rows: auto 27px; block-size: 58px; gap: 2px; padding: 6px 12px; }
  .home-habits .card-body { padding-inline: 12px; }
  .dashboard .home-goals .card-head { padding-inline: 12px; }
  .dashboard .home-goals .card-head h2 { font-size: 17px; }
  .home-history .card-head { padding-inline: 14px; }
  .home-history .card-body { padding-inline: 14px; }
  .dashboard .today-card .card-head, .dashboard .home-schedule .card-head { block-size: 62px; padding: 6px 12px; }
  .today-card .card-body, .home-schedule .card-body { padding-inline: 12px; }
  .dashboard .today-card .card-head h2 { font-size: 17px; }
  .todo-item { min-height: 64px; }
  .todo-type-icon { width: 26px; height: 28px; }
  .data-workspace { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .data-workspace .data-backup-card { grid-row: auto; }
}
