:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-soft: #f0f2ee;
  --ink: #1d2522;
  --muted: #66736e;
  --line: #dfe4de;
  --accent: #2f7d6d;
  --accent-strong: #1f5f53;
  --blue: #3d6f9f;
  --amber: #b7791f;
  --red: #b84a4a;
  --shadow: 0 18px 50px rgba(31, 44, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.auth-view {
  min-height: 92vh;
  display: grid;
  place-items: center;
}

.auth-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.muted {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 125, 109, 0.14);
}

.primary,
.ghost,
.danger,
.chip,
.status-action,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 750;
}

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

.primary:hover {
  background: var(--accent-strong);
}

.ghost {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.danger {
  background: #fff1f1;
  color: var(--red);
}

.auth-switch {
  width: 100%;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 14px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 8px 0 24px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

.metric strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.task-form,
.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 150px 150px 180px auto;
  gap: 12px;
  align-items: end;
}

.filters {
  grid-template-columns: minmax(280px, auto) minmax(220px, 1fr) 180px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 4px;
}

.chip {
  min-width: 82px;
  background: transparent;
  color: var(--muted);
}

.chip.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(31, 44, 40, 0.08);
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  align-items: start;
}

.column {
  min-width: 0;
}

.column[data-status="backlog"] .column-header {
  color: #59665f;
}

.column[data-status="archived"] .column-header {
  color: #7a6a58;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.task-card {
  display: grid;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 8px 20px rgba(31, 44, 40, 0.04);
}

.task-card.overdue {
  border-color: rgba(184, 74, 74, 0.45);
}

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

.task-title {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.3;
}

.task-description {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.note-button {
  min-height: 34px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 8px 10px;
  text-align: left;
}

.note-button:hover,
.note-button:focus-visible {
  border-color: var(--line);
  background: var(--surface-soft);
}

.note-button.empty {
  color: #89948f;
  font-weight: 650;
}

.inline-note-editor {
  display: grid;
  gap: 8px;
}

.inline-note-editor textarea {
  min-height: 112px;
}

.inline-note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.meta,
.tags,
.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.badge.priority-high {
  background: #fff7e8;
  color: var(--amber);
}

.badge.priority-urgent,
.badge.overdue {
  background: #fff1f1;
  color: var(--red);
}

.badge.priority-low {
  background: #eef5fb;
  color: var(--blue);
}

.tag {
  background: #edf6f3;
  color: var(--accent-strong);
}

.status-action {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.status-action:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.quick-save,
.quick-backlog {
  color: var(--accent-strong);
}

.quick-archive {
  color: #7a5f38;
}

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

dialog {
  width: min(720px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(21, 30, 27, 0.35);
}

.dialog-card {
  display: grid;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.dialog-card header,
.dialog-card footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.icon-button {
  width: 40px;
  padding: 0;
  margin-left: auto;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.spacer {
  flex: 1;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .summary,
  .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .main-input,
  .segmented {
    grid-column: 1 / -1;
  }
}

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

  h1 {
    font-size: 36px;
  }

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

  .summary,
  .board,
  .task-form,
  .filters,
  .dialog-grid {
    grid-template-columns: 1fr;
  }

  .segmented {
    grid-auto-flow: row;
  }

  .chip {
    width: 100%;
  }
}
