:root {
  color-scheme: dark;
  --bg: hsl(220, 55%, 13%);
  --surface: #15151d;
  --surface-soft: #1d1d28;
  --ink: #f4f3f8;
  --muted: #9a96ab;
  --line: #2a2a37;
  --accent: #a472f6;
  --accent-strong: #b98ffc;
  --accent-soft: rgba(164, 114, 246, 0.16);
  /* Set by the scroll train per zone; drives the page background tint. */
  --train-color: var(--accent);
  --warn: #e0a23c;
  --low: #f0716e;
  --mid: #e0a23c;
  --high: #3fbf8f;
  --danger-line: rgba(240, 113, 110, 0.42);
  --danger-soft: rgba(240, 113, 110, 0.12);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

body {
  background:
    radial-gradient(1200px 620px at 50% -220px, rgba(124, 77, 255, 0.28), transparent 70%),
    radial-gradient(900px 500px at 85% 0, rgba(64, 105, 200, 0.16), transparent 65%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

* {
  box-sizing: border-box;
}

/* Hide the browser scrollbar — page still scrolls via wheel/keyboard/touch. */
html {
  scrollbar-width: none; /* Firefox */
}

html::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none; /* Chromium / WebKit */
}

body {
  margin: 0;
  min-width: 320px;
  /* Tint the common background toward the train's current zone colour;
     transition matches the train's own 600ms colour fade. */
  background-color: color-mix(in srgb, var(--train-color) 14%, var(--bg));
  transition: background-color 600ms ease;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.train-rail {
  --train-color: #a472f6;
  position: fixed;
  top: 0;
  left: 0;
  width: 64px;
  height: 100vh;
  pointer-events: none;
  z-index: 5;
}

.train-rail svg {
  width: 100%;
  height: 100%;
}

.train-rail-base {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 2;
  stroke-dasharray: 2 7;
  stroke-linecap: round;
}

.train-rail-progress {
  fill: none;
  stroke: var(--train-color);
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0.55;
  transition: stroke 600ms ease;
}

.train-car {
  fill: var(--train-color);
  transition: fill 600ms ease;
}

.train-engine {
  filter: drop-shadow(0 0 6px var(--train-color));
}

@media (max-width: 760px) {
  .train-rail {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .train-engine {
    filter: none;
  }

  .train-rail-progress,
  .train-car {
    transition: none;
  }
}

.app-shell {
  width: min(100%, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

/* Dusk-image hero: backs the header + calendar; its bottom edge is the
   divider between the top region and the dark v6 area below. */
.hero {
  position: relative;
  margin-bottom: 22px;
  padding: 0 100px 50px;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
  background: #141a3a url("assets/bg-train-dusk.png") center top / cover no-repeat;
  box-shadow: var(--shadow);
}

.hero::before {
  /* darken the dusk scene so foreground text and cards stay readable */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(11, 11, 16, 0.28) 0%,
    rgba(11, 11, 16, 0.1) 38%,
    rgba(11, 11, 16, 0.72) 100%
  );
  z-index: 0;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero .calendar-panel {
  margin-bottom: 0;
}

.topbar {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 34px 16px 28px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--zone, var(--accent));
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar .eyebrow {
  color: rgba(233, 224, 255, 0.9);
}

.topbar h1 {
  color: #f6f4ff;
  text-shadow: 0 2px 18px rgba(124, 77, 255, 0.45);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 12px;
  font-size: 0.98rem;
}

.date-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  padding: 10px 14px;
  color: rgba(246, 244, 255, 0.92);
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
  /* Scales the side gutter down on narrow windows / phones instead of
     keeping a fixed 100px that crushes the content. */
  padding: 0 clamp(14px, 6vw, 100px);
}

.task-panel,
.dashboard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.task-panel {
  padding: 18px;
}

.dashboard {
  position: sticky;
  top: 18px;
  padding: 18px;
}

.calendar-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

/* Each section is colour-zoned to match the train as it travels past it. */
.calendar-panel {
  --zone: #a472f6;
}

.task-panel {
  --zone: #5b8def;
}

.dashboard {
  --zone: #2fb6a8;
}

.calendar-panel,
.task-panel,
.dashboard {
  border-top: 2px solid var(--zone);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--zone) 14%, transparent), transparent 180px),
    rgba(255, 255, 255, 0.025);
}

.calendar-panel .section-heading h2,
.task-panel .section-heading h2,
.dashboard .section-heading h2 {
  color: var(--zone);
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-nav strong {
  min-width: 150px;
  text-align: center;
  text-transform: capitalize;
  font-size: 1.05rem;
  white-space: nowrap;
}

.calendar-nav .ghost-button {
  min-width: 40px;
  padding: 0 10px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.calendar-weekdays span {
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.calendar-grid {
  display: grid;
  /* minmax(0,…) lets the 7 day-columns shrink below the chip text so a
     narrow window keeps all 7 visible (chips ellipsis) instead of
     overflowing and clipping to ~2 columns. */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-cell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  min-height: 96px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.calendar-cell:hover {
  border-color: var(--accent);
}

.calendar-cell.is-outside {
  background: var(--surface-soft);
}

.calendar-cell.is-outside .calendar-day-number {
  color: var(--muted);
}

.calendar-cell.is-today .calendar-day-number {
  background: var(--accent);
  color: #fff;
}

.calendar-cell.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft) inset;
}

.calendar-day-number {
  align-self: flex-start;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
}

.calendar-chips {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.calendar-chip {
  padding: 2px 6px;
  border-radius: 5px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-chip.is-complete {
  opacity: 0.62;
  text-decoration: line-through;
}

.calendar-more {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.view-toggle {
  display: inline-flex;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.view-toggle-btn {
  background: var(--surface);
  color: var(--muted);
  min-height: 34px;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 800;
}

.view-toggle-btn + .view-toggle-btn {
  border-left: 1px solid var(--line);
}

.view-toggle-btn.is-active {
  background: var(--accent);
  color: #fff;
}

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

.cw-head,
.cw-body {
  display: grid;
  grid-template-columns: 52px repeat(7, minmax(74px, 1fr));
  min-width: 620px;
}

.cw-head {
  margin-bottom: 4px;
}

.cw-dayhead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  background: var(--surface);
  border-radius: 8px;
  color: var(--ink);
}

.cw-dayhead .cw-dow {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.cw-dayhead strong {
  font-size: 1.05rem;
}

.cw-dayhead.is-today {
  background: var(--accent-soft);
  color: var(--accent);
}

.cw-dayhead.is-selected {
  box-shadow: 0 0 0 2px var(--accent) inset;
}

.cw-body {
  position: relative;
}

.cw-times {
  display: flex;
  flex-direction: column;
}

.cw-times span {
  display: block;
  padding-right: 6px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-align: right;
  transform: translateY(-6px);
}

.cw-col {
  position: relative;
  border-left: 1px solid var(--line);
  background-image: linear-gradient(var(--line) 1px, transparent 1px);
}

.cw-col:last-child {
  border-right: 1px solid var(--line);
}

.cw-block {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  padding: 3px 5px;
  border-radius: 5px;
  color: #fff;
  text-align: left;
  line-height: 1.15;
  cursor: grab;
  touch-action: none;
  transition: box-shadow 120ms ease;
}

.cw-block.is-complete {
  opacity: 0.6;
}

.cw-block.is-dragging {
  cursor: grabbing;
  opacity: 0.9;
  z-index: 6;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}

.cw-block-name {
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cw-block.is-complete .cw-block-name {
  text-decoration: line-through;
}

.cw-block-time {
  font-size: 0.64rem;
  font-weight: 600;
  opacity: 0.92;
}

.cw-now {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--low);
  z-index: 2;
}

.cw-now::before {
  content: "";
  position: absolute;
  left: -3px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--low);
}

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

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.ghost-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  min-height: 40px;
  padding: 0 12px;
  font-weight: 800;
}

.ghost-button:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.sync-status {
  align-self: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
}

.sync-status[data-state="ok"] {
  color: #4ade80;
}

.sync-status[data-state="error"] {
  color: #f87171;
}

.sync-status[hidden] {
  display: none;
}

.primary-ghost {
  border-color: rgba(164, 114, 246, 0.4);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.task-composer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
  margin-bottom: 14px;
}

.edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(164, 114, 246, 0.4);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 850;
}

.edit-banner[hidden] {
  display: none;
}

.edit-banner strong {
  font-weight: 950;
}

.recurring-manager {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.recurring-manager h3 {
  margin-bottom: 10px;
}

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

.recurring-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 11px;
  font-size: 0.82rem;
  font-weight: 800;
}

.recurring-item span {
  color: var(--muted);
}

.recurring-item strong {
  color: var(--ink);
}

.recurring-item button {
  flex: 0 0 auto;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--danger-line);
  background: var(--danger-soft);
  color: var(--low);
  padding: 0 11px;
  font-weight: 900;
}

.task-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 0;
}

.task-form label:first-child {
  grid-column: span 2;
}

.task-form .task-note-field {
  grid-column: 1 / -1;
}

/* Native date/time pickers need room or their indicator overlaps the
   value; trim the right padding and stop the field from shrinking. */
.task-form input[type="date"],
.task-form input[type="time"] {
  min-width: 0;
  padding-right: 6px;
}

.task-form button {
  min-width: 112px;
}

.category-manager,
.category-delete {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 138px;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
  margin-bottom: 12px;
}

.category-delete {
  background: var(--danger-soft);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

textarea {
  min-height: 60px;
  padding: 10px 12px;
  resize: vertical;
  font: inherit;
  line-height: 1.4;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding-right: 34px;
}

.task-form button,
.category-manager button,
.category-delete button,
.primary-action {
  min-height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 0 14px;
  font-weight: 900;
}

.task-form button:hover,
.category-manager button:hover,
.category-delete button:hover,
.primary-action:hover {
  background: var(--accent-strong);
}

.category-delete button,
.category-delete button.primary-action {
  border: 1px solid var(--danger-line);
  background: var(--danger-soft);
  color: var(--low);
}

.category-delete button:hover,
.category-delete button.primary-action:hover {
  background: rgba(240, 113, 110, 0.2);
}

.active-focus {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  min-height: 42px;
  padding: 0 12px;
  margin-bottom: 14px;
  font-weight: 800;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.active-focus.is-running .dot {
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(164, 114, 246, 0.22);
}

.active-focus.is-blocked {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--low);
}

.task-day-picker {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
  margin-bottom: 14px;
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.task-card.is-complete {
  background: var(--surface-soft);
}

.check-button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: transparent;
  font-weight: 900;
}

.check-button.is-checked {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

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

.task-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.task-title {
  overflow-wrap: anywhere;
  font-size: 1.04rem;
  font-weight: 900;
}

.status-badge {
  flex: 0 0 auto;
  align-self: start;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 5px 9px;
  font-size: 0.75rem;
  font-weight: 900;
}

.task-inline-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.task-inline-edit .ie-name {
  flex: 1 1 180px;
  min-width: 0;
}

.task-inline-edit .ie-min {
  flex: 0 0 86px;
  width: 86px;
}

.task-inline-edit input {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 8px 10px;
  font-weight: 700;
}

.task-inline-edit input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.ie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-basis: 100%;
}

.ie-actions button {
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 800;
}

.ie-actions button.primary-action {
  background: var(--accent);
  color: #fff;
}

.ie-actions .ie-detail {
  margin-left: auto;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
}

.timer-readout {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.time {
  font-variant-numeric: tabular-nums;
  font-size: 1.8rem;
  font-weight: 950;
  line-height: 1;
  color: var(--accent);
  transition: color 180ms ease;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.timer-readout.is-warning .time {
  color: var(--warn);
}

.timer-readout.is-warning .progress div {
  background: var(--warn);
}

.timer-readout.is-danger .time {
  color: var(--low);
}

.timer-readout.is-danger .progress div {
  background: var(--low);
}

.timer-readout.is-done .time {
  color: var(--high);
}

.timer-readout.is-done .progress div {
  background: var(--high);
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.task-note {
  margin-bottom: 12px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-actions button,
.rating-options button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 11px;
  font-weight: 900;
}

.task-actions button:hover,
.rating-options button:hover {
  border-color: var(--accent);
}

.danger-action {
  border-color: var(--danger-line) !important;
  color: var(--low) !important;
}

.finish-early-action {
  border-color: rgba(224, 162, 60, 0.42) !important;
  background: rgba(224, 162, 60, 0.12) !important;
  color: var(--warn) !important;
}

.finish-early-action:hover {
  border-color: rgba(224, 162, 60, 0.7) !important;
  background: rgba(224, 162, 60, 0.22) !important;
}

.task-card:has(.status-badge) .danger-action:hover {
  border-color: var(--low);
  background: var(--danger-soft);
}

.rating-box {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.rating-box span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.rating-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rating-options button.is-selected {
  color: white;
  border-color: transparent;
}

.rating-options button[data-rating="low"].is-selected {
  background: var(--low);
}

.rating-options button[data-rating="medium"].is-selected {
  background: var(--mid);
}

.rating-options button[data-rating="high"].is-selected {
  background: var(--high);
}

.score-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  margin-bottom: 12px;
}

.dashboard-filter {
  margin-bottom: 12px;
}

.day-clock-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  margin-bottom: 12px;
}

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

.clock-heading h3 {
  margin-bottom: 3px;
}

.clock-heading span,
.clock-task span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.clock-heading strong {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent);
  padding: 7px 10px;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}

.day-clock {
  display: grid;
  place-items: center;
}

.day-clock svg {
  width: min(100%, 340px);
  height: auto;
}

.clock-face {
  fill: var(--surface-soft);
  stroke: var(--line);
  stroke-width: 2;
}

.hour-marks line {
  stroke: var(--muted);
  stroke-linecap: round;
}

.hour-marks text {
  fill: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
}

.task-arc {
  fill: none;
  stroke-linecap: round;
  opacity: 0.9;
}

.task-arc.idle {
  opacity: 0.42;
}

.task-arc.running {
  filter: drop-shadow(0 0 5px rgba(164, 114, 246, 0.55));
}

.task-arc.paused {
  opacity: 0.65;
}

.now-hand {
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
}

.now-pin {
  fill: var(--ink);
}

.clock-center-time {
  fill: var(--ink);
  font-size: 1.22rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.clock-center-label {
  fill: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
}

.clock-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.clock-task {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.clock-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--task-color);
  margin-top: 5px;
}

.clock-task strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clock-task.running strong {
  color: var(--accent);
}

.score-card span,
.metric span,
.month-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.score-card strong {
  display: block;
  margin: 6px 0 10px;
  font-size: 1.35rem;
}

.meter {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.meter div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 200ms ease;
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
}

.chart-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.task-efficiency {
  display: grid;
  gap: 8px;
}

.category-breakdown {
  display: grid;
  gap: 10px;
}

.category-row {
  display: grid;
  gap: 7px;
}

.category-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.category-row-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-row-head span {
  flex: 0 0 auto;
}

.category-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.category-track div {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.eff-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.eff-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eff-pill {
  border-radius: 999px;
  padding: 5px 8px;
  text-align: center;
  color: white;
  font-size: 0.75rem;
}

.eff-pill.low {
  background: var(--low);
}

.eff-pill.medium {
  background: var(--mid);
}

.eff-pill.high {
  background: var(--high);
}

.muted-note,
.empty-state {
  color: var(--muted);
  font-weight: 750;
}

.empty-state {
  display: none;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  padding: 18px;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state span {
  margin-top: 5px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 150px;
}

.bar-item {
  display: grid;
  gap: 6px;
  align-items: end;
  min-width: 0;
}

.bar-track {
  display: flex;
  align-items: end;
  height: 104px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  min-height: 4px;
  background: var(--accent);
  border-radius: 8px 8px 0 0;
}

.bar-label,
.bar-value {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.month-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.month-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 1.15rem;
}

.history-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.history-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
  margin-bottom: 10px;
}

.history-summary strong,
.history-summary span {
  display: block;
}

.history-summary strong {
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.history-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.history-task {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--task-color);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px;
}

.history-task.running {
  background: var(--accent-soft);
}

.history-date {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 950;
}

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

.history-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.history-title-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-title-row span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 850;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .dashboard {
    position: static;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions {
    justify-content: start;
  }

  .calendar-nav {
    flex-wrap: wrap;
  }

  .calendar-nav strong {
    min-width: 0;
    flex: 1;
  }

  .calendar-panel {
    padding: 12px;
  }

  .calendar-grid,
  .calendar-weekdays {
    gap: 3px;
  }

  .calendar-weekdays span {
    font-size: 0.6rem;
  }

  .calendar-cell {
    min-height: 54px;
    padding: 3px;
  }

  .calendar-cell .calendar-day-number {
    font-size: 0.78rem;
  }

  .calendar-chip {
    font-size: 0.62rem;
    padding: 1px 4px;
  }

  .task-form {
    grid-template-columns: 1fr;
  }

  .task-form label:first-child {
    grid-column: auto;
  }

  .category-manager,
  .category-delete {
    grid-template-columns: 1fr;
  }

  .task-card {
    grid-template-columns: 1fr;
  }

  .check-button {
    width: 100%;
  }

  .timer-readout {
    grid-template-columns: 1fr;
  }

  .metrics-grid,
  .month-summary,
  .history-controls {
    grid-template-columns: 1fr;
  }
}
