:root {
  color-scheme: light;
  --bg: #f4f5f0;
  --panel: #ffffff;
  --ink: #17201b;
  --muted: #66706b;
  --line: #d9ded7;
  --accent: #167c80;
  --accent-strong: #0d5659;
  --danger: #b23b3b;
  --ok: #2f7d46;
  --shadow: 0 16px 40px rgba(31, 42, 36, 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,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

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

button:active {
  transform: translateY(1px);
}

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

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

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

.hidden {
  display: none !important;
}

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

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

.auth-panel h1,
.brand-row h1 {
  margin: 0;
}

.auth-panel p {
  margin: 8px 0 20px;
  color: var(--muted);
  line-height: 1.5;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  background: #eef2ef;
  color: var(--ink);
}

.tab.active {
  background: var(--accent);
  color: white;
}

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

.message {
  margin-top: 12px;
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 74px minmax(460px, 1fr) 380px;
}

.rail,
.details {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: auto;
}

.rail {
  display: grid;
  grid-template-rows: repeat(4, min-content) 1fr min-content;
  gap: 8px;
  min-height: 100vh;
  padding: 12px 8px;
}

.rail-link,
.rail-project,
.rail-logout {
  width: 100%;
  min-height: 46px;
  padding: 8px 6px;
  display: grid;
  place-items: center;
  background: #eef2ef;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.rail-link.active,
.rail-project.active {
  background: var(--accent);
  color: white;
}

.rail-project {
  min-height: 68px;
  box-shadow: inset 0 4px 0 var(--ok);
}

.rail-user {
  align-self: end;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.rail-logout {
  min-height: 38px;
  background: var(--ink);
  color: white;
}

.details {
  padding: 18px;
  border-right: 0;
  border-left: 1px solid var(--line);
}

.topbar,
.task-input-actions,
.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#user-label,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  background: #eef2ef;
  color: var(--ink);
}

.compact-form {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.compact-form textarea {
  min-height: 72px;
}

.task-board,
.project-page,
.users-page {
  min-width: 0;
  padding: 22px;
  overflow: auto;
}

.project-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
}

.project-tab {
  background: #eef2ef;
  color: var(--ink);
}

.project-tab.active {
  background: var(--accent);
  color: white;
}

.project-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.project-tile {
  display: grid;
  gap: 8px;
  min-height: 124px;
  text-align: left;
  color: var(--ink);
  background: #dcf4e2;
  border: 1px solid #b7dfc2;
  align-content: start;
}

.project-tile.has-open {
  background: #fff0b8;
  border-color: #e5c84d;
}

.project-tile.current {
  box-shadow: inset 5px 0 0 var(--ok);
}

.project-tile strong {
  display: block;
  overflow-wrap: anywhere;
}

.project-tile span {
  color: var(--muted);
  font-size: 12px;
}

.project-docs {
  display: grid;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.project-docs h3 {
  margin: 0;
}

.project-docs pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: inherit;
}

.project-page,
.users-page {
  grid-column: 2 / -1;
}

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

.user-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px 120px 120px;
  gap: 10px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.user-row strong,
.user-row span {
  display: block;
}

.user-row span {
  color: var(--muted);
  font-size: 12px;
}

.topbar {
  margin-bottom: 16px;
}

.topbar h2 {
  margin: 2px 0 0;
  font-size: 28px;
}

.progress-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 10px;
}

.progress-strip div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.progress-strip strong,
.progress-strip span {
  display: block;
}

.progress-strip span {
  color: var(--muted);
  font-size: 12px;
}

.task-input {
  display: grid;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 18px;
}

.task-input-actions {
  align-items: stretch;
}

.task-input-actions input {
  flex: 1 1 auto;
}

.task-input-actions select {
  width: 150px;
}

#task-project-select {
  width: 190px;
}

.columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 12px;
  align-items: start;
}

.column {
  display: grid;
  gap: 8px;
}

.column h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.task-card {
  text-align: left;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.task-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(22, 124, 128, 0.14);
}

.task-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.task-card span {
  display: inline-block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  float: right;
  color: var(--accent-strong);
}

.empty-state {
  color: var(--muted);
  line-height: 1.5;
}

.title-input {
  font-size: 22px;
  font-weight: 700;
}

.details-form textarea {
  min-height: 110px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 27, 0.32);
}

.modal {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

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

.modal-head h3 {
  margin: 0;
  font-size: 17px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .details {
    grid-column: 2 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .task-board {
    grid-column: 2 / -1;
  }
}

@media (max-width: 760px) {
  .workspace {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .project-page,
  .users-page {
    grid-column: 2 / -1;
  }

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

  .rail {
    padding: 8px 6px;
  }

  .rail-link,
  .rail-project,
  .rail-logout {
    min-height: 42px;
    font-size: 10px;
  }

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

  .progress-strip,
  .columns {
    grid-template-columns: 1fr;
  }

  .task-input-actions select {
    width: 100%;
  }

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