:root {
  color-scheme: light;
  --paper: #f8f7f3;
  --surface: #ffffff;
  --ink: #1d1d1b;
  --muted: #696964;
  --line: #dedbd2;
  --line-strong: #bdb7aa;
  --accent: #d64f2a;
  --accent-dark: #9f351b;
  --blue: #1e6b8f;
  --green: #527a47;
  --shadow: 0 10px 28px rgba(29, 29, 27, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: var(--surface);
  min-height: 38px;
  padding: 0 12px;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--ink);
}

button.icon {
  width: 38px;
  padding: 0;
}

button.danger {
  border-color: var(--accent-dark);
  background: var(--accent);
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login h1 {
  margin: 0 0 8px;
  font-size: 42px;
  line-height: 1;
  font-weight: 800;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  --space-color: #ff5a00;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 0;
  border-bottom: 7px solid var(--space-color);
  background: #ffffff;
  min-height: 146px;
  padding: 36px 38px 36px 56px;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.menu {
  position: relative;
}

.space-cluster {
  position: relative;
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
}

.menu summary {
  display: flex;
  align-items: center;
  min-height: 38px;
  list-style: none;
  cursor: pointer;
  border-radius: 4px;
  color: var(--ink);
}

.menu summary::-webkit-details-marker {
  display: none;
}

.space-menu summary {
  max-width: min(58vw, 720px);
  overflow-wrap: anywhere;
  font-size: clamp(34px, 3vw, 48px);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
}

.space-menu summary::after {
  display: none;
}

.color-picker {
  position: relative;
  width: 62px;
  height: 62px;
  display: block;
  flex: 0 0 auto;
}

.color-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.color-picker span {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 50%;
}

.header-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 30px;
  flex: 0 0 auto;
}

.circle-action {
  width: 62px;
  min-width: 62px;
  height: 62px;
  min-height: 62px;
  border: 0;
  border-radius: 50%;
  background: #cfcfcf;
  padding: 0;
}

.circle-action:not(:disabled):hover {
  background: #bdbdbd;
}

.circle-action.inactive {
  cursor: default;
  opacity: 1;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 30;
}

.menu-panel-right {
  right: 0;
  left: auto;
}

.settings-panel {
  top: calc(100% + 8px);
}

.menu-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px 4px;
  text-transform: uppercase;
}

.menu-item {
  width: 100%;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.menu-item:hover,
.menu-item.active {
  background: var(--paper);
  color: var(--space-color);
}

.workspace {
  min-height: 0;
}

.sidebar-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.board {
  min-width: 0;
  padding: 0;
  overflow: auto;
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.board-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.columns {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 0;
  align-items: stretch;
  min-height: calc(100vh - 153px);
}

.column {
  background: transparent;
  border: 0;
  border-left: 2px solid #8f8f8f;
  border-radius: 0;
  min-height: inherit;
  overflow: visible;
}

.column:first-child {
  border-left: 0;
}

.column-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 112px;
  padding: 58px 64px 18px 64px;
  border-bottom: 0;
}

.column-name {
  width: fit-content;
  min-height: 40px;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-size: clamp(28px, 2.2vw, 38px);
  font-weight: 800;
  line-height: 1;
  text-align: left;
  text-transform: none;
}

.column-name:hover {
  color: var(--space-color);
}

.add-card {
  min-height: 36px;
  width: 36px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
}

.add-card:hover {
  color: var(--space-color);
}

.column-create {
  display: grid;
  align-content: start;
  justify-content: end;
  padding: 58px 36px 0;
}

.column-add {
  width: 36px;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-size: 30px;
  line-height: 1;
}

.column-add:hover {
  color: var(--space-color);
}

.cards {
  min-height: 170px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 4px 64px 32px;
}

.card {
  display: grid;
  gap: 10px;
  text-align: left;
  width: 100%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 12px;
  box-shadow: 0 4px 10px rgba(29, 29, 27, 0.05);
}

.card[draggable="true"] {
  cursor: grab;
}

.card-title {
  font-size: 15px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px 7px;
  background: #fbfaf7;
}

.p1 {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.p2 {
  border-color: #d9902f;
  color: #925c16;
}

.p3 {
  border-color: var(--blue);
  color: var(--blue);
}

.p4,
.p5 {
  border-color: var(--green);
  color: var(--green);
}

.empty {
  display: none;
  color: var(--muted);
  border: 0;
  border-radius: 6px;
  padding: 16px 0;
  text-align: left;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 40;
  background: rgba(29, 29, 27, 0.26);
  padding: 18px;
}

.modal {
  width: min(720px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-head,
.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.check-row,
.user-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.user-row {
  grid-template-columns: 1fr auto auto auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.notice,
.error {
  border-radius: 4px;
  padding: 10px;
  font-size: 14px;
}

.notice {
  background: #edf4ed;
  color: #355d2f;
}

.error {
  background: #fff1eb;
  color: var(--accent-dark);
}

@media (max-width: 820px) {
  .topbar {
    align-items: center;
    min-height: 104px;
    padding: 24px 18px;
  }

  .toolbar {
    justify-self: stretch;
  }

  .space-cluster {
    gap: 12px;
  }

  .space-menu summary {
    max-width: calc(100vw - 180px);
    font-size: 26px;
  }

  .color-picker {
    width: 42px;
    height: 42px;
  }

  .header-actions {
    gap: 12px;
  }

  .circle-action {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
  }

  .menu-panel {
    position: static;
    margin-top: 8px;
  }

  .settings-panel {
    position: absolute;
  }

  .field-grid,
  .user-row {
    grid-template-columns: 1fr;
  }

  .columns {
    grid-auto-flow: row;
    grid-auto-columns: initial;
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .column,
  .column:first-child {
    border-left: 0;
    border-top: 2px solid #8f8f8f;
  }

  .column-head,
  .cards {
    padding-left: 22px;
    padding-right: 22px;
  }

  .column-head {
    min-height: 72px;
    padding-top: 22px;
    padding-bottom: 10px;
  }

  .column-name {
    min-height: 32px;
    font-size: 24px;
  }

  .add-card,
  .column-add {
    width: 32px;
    min-height: 32px;
    font-size: 24px;
  }

  .cards {
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 78vw);
    align-content: initial;
    align-items: start;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    padding-bottom: 18px;
  }

  .card {
    scroll-snap-align: start;
  }
}
