:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #575279;
  background: #faf4ed;
  font-synthesis: none;
  text-rendering: geometricPrecision;
  --base: #faf4ed;
  --surface: #fffaf5;
  --overlay: #f2e9e1;
  --muted: #9893a5;
  --text: #575279;
  --accent: #d7827e;
  --accent-soft: rgba(215, 130, 126, 0.12);
  --border: rgba(87, 82, 121, 0.12);
  --border-strong: rgba(87, 82, 121, 0.2);
  --foam: #56949f;
  --pine: #286983;
  --gold: #ea9d34;
  --love: #b4637a;
  --iris: #907aa9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--base);
}

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

button {
  cursor: pointer;
}

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

.login-box {
  width: min(360px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 18px 45px rgba(87, 82, 121, 0.08);
}

.login-box h1,
.page-header h1 {
  font-size: 18px;
  margin: 0 0 3px;
  font-weight: 560;
}

.login-box p,
.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.login-box form,
.modal form {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: rgba(255, 250, 245, 0.78);
  border-radius: 7px;
  padding: 8px 10px;
  outline: none;
}

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

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

.shell {
  display: flex;
  min-height: 100vh;
  background: var(--base);
}

.sidebar {
  width: 236px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(242, 233, 225, 0.42);
  padding: 14px 10px;
}

.workspace {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  font-size: 13px;
}

.workspace strong {
  display: block;
  font-weight: 560;
}

.workspace small {
  color: var(--muted);
  font-size: 11px;
}

.workspace-mark {
  height: 26px;
  width: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--surface);
  background: var(--accent);
  font-weight: 600;
}

.project-list {
  margin-top: 18px;
  flex: 1;
  overflow: auto;
}

.nav-group {
  margin: 18px 10px 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.project-button {
  width: 100%;
  display: block;
  border: 0;
  text-align: left;
  background: transparent;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 2px;
}

.project-button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.project-button small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 8px 3px;
  display: grid;
  gap: 8px;
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 48px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 8px 20px;
  gap: 12px;
  font-size: 12px;
}

.crumb {
  flex: 1;
  min-width: 0;
}

.project-select {
  display: none;
}

.board-page {
  display: flex;
  min-height: 0;
  flex: 1;
}

.board-area {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.page-header {
  min-height: 74px;
  flex-shrink: 0;
  padding: 15px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

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

.primary-button,
.quiet-button,
.danger-button {
  min-height: 32px;
  border-radius: 7px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  background: transparent;
  font-size: 13px;
}

.primary-button {
  border-color: var(--accent);
  color: #fffaf5;
  background: var(--accent);
}

.primary-button:hover {
  border-color: #c36f6c;
  background: #c97874;
}

.quiet-button:hover {
  background: var(--overlay);
}

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

.primary-button:disabled,
.danger-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.board {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow-x: auto;
}

.column {
  min-width: 228px;
  width: 20%;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: background 130ms ease;
}

.column.drop-target {
  background: rgba(215, 130, 126, 0.055);
}

.column > header {
  height: 45px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  font-size: 12px;
  font-weight: 550;
}

.column > header small {
  min-width: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 6px;
  line-height: 1;
  border-radius: 10px;
  background: var(--overlay);
  color: var(--muted);
}

.task-list {
  flex: 1;
  overflow: auto;
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.task-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: rgba(255, 250, 245, 0.9);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.task-card:hover,
.task-card.selected {
  border-color: rgba(215, 130, 126, 0.45);
  box-shadow: 0 8px 20px rgba(87, 82, 121, 0.06);
}

.task-card.dragging {
  opacity: 0.35;
}

.task-card strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
}

.task-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.drawer {
  width: 360px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.drawer header {
  min-height: 52px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.drawer-body {
  padding: 14px;
  display: grid;
  gap: 12px;
  overflow: auto;
}

.drawer-body h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 560;
}

.drawer-body p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.activity {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: grid;
  gap: 7px;
}

.activity-row {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.settings-page {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.settings-body {
  flex: 1;
  overflow: auto;
  padding: 18px 22px 28px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.settings-panel {
  display: grid;
  gap: 12px;
  max-width: 840px;
}

.settings-panel h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 560;
}

.settings-form {
  display: grid;
  gap: 10px;
  max-width: 520px;
}

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

.project-admin-row {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(120px, 180px) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.project-admin-row textarea {
  min-height: 42px;
}

.project-admin-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(87, 82, 121, 0.18);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 20;
}

.modal {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(87, 82, 121, 0.16);
}

.modal h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 560;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--surface);
  border: 0;
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
}

.empty {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 18px 8px;
}

@media (max-width: 820px) {
  .shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    position: sticky;
    top: 0;
    background: var(--base);
    z-index: 5;
  }

  .project-select {
    display: block;
    width: min(240px, 48vw);
  }

  .page-header {
    align-items: flex-start;
    padding: 12px;
  }

  .settings-body {
    padding: 14px 12px 22px;
  }

  .project-admin-row {
    grid-template-columns: 1fr;
  }

  .project-admin-actions {
    justify-content: flex-start;
  }

  .board-page {
    display: block;
  }

  .board {
    min-height: calc(100vh - 137px);
    scroll-snap-type: x mandatory;
  }

  .column {
    min-width: 82vw;
    scroll-snap-align: start;
  }

  .drawer {
    position: fixed;
    inset: 0;
    width: auto;
    z-index: 15;
  }
}
