:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-soft: #f1f5f3;
  --ink: #202424;
  --muted: #65706c;
  --line: #d9dfdc;
  --accent: #1f7a6f;
  --accent-dark: #155c54;
  --danger: #ad2f39;
  --blocker: #c94145;
  --parallel: #2e72b8;
  --sequential: #7a6a3b;
  --shadow: 0 16px 40px rgba(37, 43, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  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 {
  cursor: pointer;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: rgba(246, 245, 241, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.board-shell {
  padding: 18px 24px 32px;
}

.add-objective {
  margin-bottom: 18px;
}

.crossing-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.crossing-card {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr);
  gap: 10px 12px;
  min-width: 260px;
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.crossing-card.blocker {
  border-color: rgba(201, 65, 69, 0.45);
}

.crossing-card p,
.crossing-card strong,
.crossing-card small {
  display: block;
}

.crossing-card p {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.crossing-card strong {
  font-size: 0.98rem;
}

.crossing-card small {
  grid-column: 2;
  color: var(--muted);
  line-height: 1.35;
}

.crossing-line {
  display: grid;
  align-content: center;
  gap: 3px;
  width: 24px;
}

.crossing-line span {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--dot-color);
}

.quick-form,
.add-subtask,
.card-form,
.stack {
  display: grid;
  gap: 10px;
}

.quick-form {
  grid-template-columns: minmax(220px, 1.1fr) minmax(220px, 2fr) minmax(150px, 0.5fr) auto;
  align-items: center;
  max-width: 1180px;
}

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

textarea {
  resize: vertical;
}

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

.board {
  display: grid;
  grid-auto-columns: minmax(300px, 360px);
  grid-auto-flow: column;
  gap: 16px;
  min-height: calc(100vh - 190px);
  overflow-x: auto;
  padding-bottom: 22px;
  scroll-snap-type: x proximity;
}

.objective-column {
  position: relative;
  display: grid;
  align-content: start;
  gap: 12px;
  padding-left: 26px;
  scroll-snap-align: start;
}

.objective-column::before {
  position: absolute;
  top: 0;
  bottom: 18px;
  left: 8px;
  width: 10px;
  border-radius: 999px;
  background: linear-gradient(to bottom, var(--flow-color), color-mix(in srgb, var(--flow-color) 18%, transparent));
  content: "";
}

.objective-card,
.subtask-card,
.add-subtask,
.empty-state,
.login-panel,
.error-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.objective-card {
  position: relative;
  padding: 14px;
  border-top: 5px solid var(--flow-color);
}

.objective-card::before {
  position: absolute;
  top: 24px;
  left: -25px;
  width: 25px;
  height: 10px;
  border-radius: 999px 0 0 999px;
  background: var(--flow-color);
  content: "";
}

.objective-column.done .objective-card {
  opacity: 0.78;
}

.subtask-list {
  display: grid;
  gap: 12px;
  padding-top: 18px;
}

.subtask-card {
  position: relative;
  padding: 14px;
  border-left: 5px solid var(--flow-color);
}

.subtask-card::before {
  position: absolute;
  top: 28px;
  left: -31px;
  width: 26px;
  height: 5px;
  border-radius: 999px 0 0 999px;
  background: var(--flow-color);
  content: "";
}

.subtask-card[data-crossing-key]:not([data-crossing-key=""]) {
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--flow-color) 32%, transparent),
    var(--shadow);
}

.subtask-card[data-crossing-key]:not([data-crossing-key=""])::after {
  position: absolute;
  top: 28px;
  right: -18px;
  width: 18px;
  border-top: 2px dashed color-mix(in srgb, var(--flow-color) 65%, transparent);
  content: "";
}

.subtask-card.dragging {
  opacity: 0.55;
  transform: rotate(0.5deg);
}

.subtask-list.drop-target {
  border-radius: 8px;
  outline: 2px dashed rgba(31, 122, 111, 0.4);
  outline-offset: 6px;
}

.drag-handle {
  width: 100%;
  min-height: 30px;
  margin-bottom: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.drag-handle:hover {
  border-color: rgba(31, 122, 111, 0.45);
  color: var(--accent-dark);
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.subtask-card.blocker {
  background:
    linear-gradient(to right, rgba(201, 65, 69, 0.08), transparent 44%),
    var(--surface);
}

.subtask-card.done {
  opacity: 0.72;
}

.title-input {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 6px 0 10px;
  font-size: 1.04rem;
  font-weight: 800;
}

.objective-card .title-input {
  font-size: 1.2rem;
}

.form-row,
.subtask-footer,
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-row.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.subtask-footer,
.card-actions {
  justify-content: space-between;
}

.card-actions {
  margin-top: 10px;
  justify-content: flex-end;
}

.primary-button,
.small-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button,
.small-button {
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
}

.primary-button:hover,
.small-button:hover {
  background: var(--accent-dark);
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
  padding: 0 14px;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--ink);
  font-size: 1rem;
}

.icon-button.danger {
  color: var(--danger);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(122, 106, 59, 0.14);
  color: var(--sequential);
  font-size: 0.78rem;
  font-weight: 900;
}

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

.pill.parallel {
  background: rgba(46, 114, 184, 0.12);
  color: var(--parallel);
}

.pill.blocker {
  background: rgba(201, 65, 69, 0.12);
  color: var(--blocker);
}

.pill.crossing {
  border: 1px dashed currentColor;
}

.add-subtask {
  padding: 12px;
  background: var(--surface-soft);
  box-shadow: none;
}

.empty-state {
  width: min(520px, calc(100vw - 48px));
  padding: 28px;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(460px, 100%);
}

.login-panel,
.error-shell {
  padding: 28px;
}

.notice.error {
  border: 1px solid rgba(173, 47, 57, 0.2);
  border-radius: 8px;
  background: rgba(173, 47, 57, 0.08);
  color: var(--danger);
  padding: 10px 12px;
}

.as-link {
  text-decoration: none;
}

.error-shell {
  width: min(560px, calc(100vw - 48px));
  margin: 12vh auto;
}

@media (max-width: 760px) {
  .topbar,
  .board-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

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

  .board {
    grid-auto-columns: minmax(286px, calc(100vw - 28px));
  }

}
