:root {
  color-scheme: dark;
  --bg: #030506;
  --surface: #090d12;
  --surface-strong: #0f1720;
  --text: #4da3ff;
  --muted: #8bc6ff;
  --line: #1d3f66;
  --red: #ff3b30;
  --green: #29e36d;
  --blue: #4da3ff;
  --blue-strong: #7fc2ff;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.46);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand img {
  flex: 0 0 auto;
}

.brand-kicker,
.section-kicker {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

h1,
h2,
p,
blockquote {
  margin: 0;
}

h1 {
  font-size: clamp(1.55rem, 4vw, 2.45rem);
  line-height: 1;
  font-weight: 900;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-menu[hidden] {
  display: none;
}

.user-menu span {
  max-width: 210px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button,
.icon-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 15px;
  font-weight: 800;
}

.button.primary {
  background: var(--red);
  color: #050607;
  border-color: var(--red);
}

.button.secondary,
.icon-button {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(41, 227, 109, 0.34);
  outline-offset: 2px;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 16px;
  margin-top: 24px;
  min-width: 0;
}

.task-form,
.quote-panel,
.lane,
.metric,
.filter-band,
.reminder-panel,
.ledger-section,
.auth-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel {
  display: grid;
  gap: 16px;
  width: min(520px, 100%);
  margin: 28px auto 0;
  padding: 18px;
}

.auth-panel[hidden] {
  display: none;
}

.auth-panel h2 {
  margin-top: 5px;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.05;
}

.auth-panel p {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.4;
}

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

.auth-form[hidden] {
  display: none;
}

.auth-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.task-form {
  display: grid;
  gap: 16px;
  padding: 16px;
}

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

.field label,
.timeframe-field legend {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #05080d;
  color: var(--text);
  padding: 0 12px;
}

textarea {
  min-height: 86px;
  padding: 11px 12px;
  line-height: 1.35;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(170px, 0.55fr) minmax(270px, 1fr);
  gap: 14px;
  align-items: end;
}

.timeframe-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.timeframe-field legend {
  margin-bottom: 7px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.segmented-control label {
  min-width: 0;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 850;
  text-align: center;
}

.segmented-control input:checked + span {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 12px rgba(77, 163, 255, 0.18);
}

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

.form-status {
  min-height: 20px;
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 700;
}

.quote-panel {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 18px;
}

blockquote {
  margin-top: 10px;
  font-size: clamp(1.25rem, 3.4vw, 2rem);
  font-weight: 900;
  line-height: 1.08;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr)) minmax(240px, 1.35fr);
  gap: 12px;
  margin-top: 16px;
}

.metric {
  display: grid;
  gap: 4px;
  min-height: 88px;
  align-content: center;
  padding: 14px;
}

.metric strong {
  font-size: clamp(1.25rem, 2.6vw, 1.9rem);
  line-height: 1.05;
}

.metric span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.filter-band {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 12px;
  min-width: 0;
  overflow: hidden;
}

.category-filters {
  display: flex;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.category-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #05080d;
  color: var(--text);
  padding: 0 11px;
  font-weight: 800;
}

.category-filter[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green);
  color: #050607;
}

.swatch {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--category-color);
}

.reminder-panel {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  padding: 14px;
  border-left: 5px solid var(--red);
}

.reminder-panel[hidden] {
  display: none;
}

.reminder-panel p {
  margin-top: 4px;
  color: var(--text);
  font-weight: 800;
}

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

.reminder-task-list {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.reminder-check-card {
  display: grid;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #05080d;
  padding: 12px;
}

.reminder-check-card h3,
.ledger-entry h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.25;
}

.status-choice-group {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.status-choice-group legend,
.reason-field label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.status-choice-group label {
  display: grid;
}

.status-choice-group input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.status-choice-group span {
  display: grid;
  min-height: 38px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #05080d;
  color: var(--text);
  padding: 0 10px;
  font-size: 0.86rem;
  font-weight: 850;
}

.status-choice-group input:checked + span {
  border-color: var(--green);
  background: var(--green);
  color: #050607;
}

.reason-field {
  display: grid;
  gap: 7px;
}

.reason-field[hidden] {
  display: none;
}

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

.reminder-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
  min-width: 0;
}

.lane {
  min-height: 390px;
  padding: 14px;
}

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

.lane h2 {
  margin-top: 2px;
  font-size: 1.25rem;
  line-height: 1.1;
}

.lane-limit {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 5px 8px;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

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

.task-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #05080d;
  padding: 12px;
}

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

.task-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.task-title {
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.25;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

.category-pill span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-meta {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.35;
}

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

.task-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #05080d;
  color: var(--text);
  padding: 0 10px;
  font-size: 0.84rem;
  font-weight: 850;
}

.empty-state {
  display: grid;
  min-height: 130px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
  font-weight: 800;
}

.ledger-section {
  margin-top: 16px;
  padding: 14px;
}

.ledger-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.ledger-entry {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #05080d;
  padding: 12px;
}

.ledger-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ledger-entry time {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 0 8px;
  color: #050607;
  font-size: 0.76rem;
  font-weight: 900;
}

.status-completed {
  background: var(--green);
}

.status-working {
  background: var(--blue);
}

.status-procrastinating {
  background: var(--red);
}

.ledger-reason {
  border-left: 3px solid var(--red);
  color: var(--muted);
  padding-left: 9px;
  font-size: 0.9rem;
  line-height: 1.4;
}

@media (max-width: 920px) {
  .control-grid,
  .board-grid {
    grid-template-columns: 1fr;
  }

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

  .metric.wide {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 20px, 620px);
    padding-top: 12px;
  }

  .topbar,
  .form-actions,
  .reminder-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: stretch;
    width: 100%;
  }

  .user-menu,
  .auth-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions .button,
  .form-actions .button,
  .reminder-buttons .button,
  .auth-actions .button {
    width: 100%;
  }

  .reminder-buttons {
    flex-direction: column;
  }

  .form-row,
  .summary-grid,
  .filter-band {
    grid-template-columns: 1fr;
  }

  .metric.wide {
    grid-column: auto;
  }

  .segmented-control {
    grid-template-columns: 1fr;
  }

  .lane {
    min-height: 260px;
  }
}
