:root {
  --bg: #f7f8f8;
  --surface: #ffffff;
  --surface-2: #eef2f1;
  --line: #d9dfdd;
  --text: #17201d;
  --muted: #66736f;
  --teal: #0f766e;
  --teal-dark: #0a514c;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 12px 28px rgba(15, 23, 20, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  min-height: 36px;
  padding: 0 12px;
}

button:hover {
  border-color: #aebbb7;
}

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

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

.primary:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.full {
  width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #101817;
  color: #eef6f4;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #21a298;
  color: #fff;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.section-head h3,
.detail-title h3,
.detail-title p,
.empty-state h3,
.empty-state p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.1;
}

.brand p {
  color: #9db0ab;
  font-size: 12px;
  margin-top: 3px;
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.project-nav-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px;
  color: #dbe7e4;
  cursor: pointer;
}

.project-nav-item:hover,
.project-nav-item.selected {
  background: #1a2624;
  border-color: #2c403c;
}

.project-nav-item strong,
.row-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-nav-item span {
  color: #9db0ab;
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
}

.topbar h2 {
  font-size: 26px;
  line-height: 1.15;
}

.topbar p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.toolbar {
  display: flex;
  gap: 8px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 16px;
}

.table-panel,
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.table-panel {
  overflow: hidden;
}

.detail-panel {
  padding: 16px;
}

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

.section-head h3 {
  font-size: 15px;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
}

.project-table {
  display: grid;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 110px 130px 80px minmax(180px, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.project-row:hover,
.project-row.selected {
  background: #f0f7f5;
}

.row-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.row-title span,
.cell-muted {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.status-active {
  background: #dff5ef;
  color: var(--teal-dark);
}

.status-blocked {
  background: #fff0d9;
  color: var(--amber);
}

.status-done {
  background: #e7eefc;
  color: #2754a8;
}

.blocker-count {
  color: var(--red);
  font-weight: 750;
}

.detail-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-title h3 {
  font-size: 20px;
}

.detail-title p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.detail-title .thread-line {
  color: #42514d;
}

.edit-form {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: #42514d;
  font-size: 12px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

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

.empty-state {
  display: grid;
  align-content: center;
  min-height: 360px;
  gap: 8px;
  color: var(--muted);
}

.empty-state h3 {
  color: var(--text);
  font-size: 18px;
}

.handoff-box {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.codex-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.codex-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.codex-panel .section-head,
.handoff-box .section-head {
  padding: 10px 12px;
}

pre {
  margin: 0;
  padding: 12px;
  background: #101817;
  color: #edf6f4;
  overflow: auto;
  max-height: 300px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.hidden {
  display: none;
}

.public-page {
  background: #f3f5f4;
}

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

.public-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--line);
}

.public-head h1,
.public-head p,
.public-kicker,
.public-row h2,
.public-row p {
  margin: 0;
}

.public-kicker {
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.public-head h1 {
  font-size: 34px;
  line-height: 1.1;
  margin-top: 4px;
}

.public-head p {
  color: var(--muted);
  margin-top: 8px;
}

.login-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  padding: 0 12px;
  text-decoration: none;
}

.public-list {
  display: grid;
  gap: 10px;
  padding-top: 18px;
}

.public-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) auto minmax(220px, 1fr) 120px;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 16px;
  box-shadow: 0 8px 18px rgba(15, 23, 20, 0.05);
}

.public-row h2 {
  font-size: 16px;
}

.public-row p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.public-muted {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .project-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

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

@media (max-width: 640px) {
  .workspace {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar button {
    flex: 1;
  }
}
