:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #5d6978;
  --line: #dce2e8;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--accent-dark);
}

.page {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0 14px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav a {
  font-size: 15px;
}

.nav .muted {
  font-size: 15px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin: 16px 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.project-people p {
  margin: 8px 0 0;
}

.card-actions {
  margin: 14px 0 0;
}

.people-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.people-summary h2 {
  margin-top: 0;
}

.people-summary ul {
  margin: 0;
  padding-left: 18px;
}

.people-summary li {
  margin-bottom: 10px;
}

.muted {
  color: var(--muted);
}

.error {
  color: var(--danger);
  font-weight: 700;
}

label {
  display: block;
  font-weight: 700;
  margin: 12px 0 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

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

input[type="checkbox"] {
  width: auto;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button.secondary,
.button.secondary {
  background: #425466;
}

button.danger {
  background: var(--danger);
}

.form-actions,
.icon-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.project-doc-form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 16px;
}

.checkbox-group,
.checkbox-grid {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.checkbox-group {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.checkbox-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.checkbox-group label,
.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.badge {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  margin-right: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e7f5f2;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.badge.success {
  background: #d1fadf;
  color: #05603a;
}

.badge.warning {
  background: #fff4d6;
  color: #7a4d00;
}

.badge.neutral {
  background: #edf2f7;
  color: #425466;
}

.assignment-list {
  display: grid;
  gap: 12px;
}

.assignment-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.assignment-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.assignment-card-header h2 {
  margin: 0;
}

.assignment-mini-list {
  display: grid;
  gap: 8px;
}

.assignment-mini-item {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.assignment-mini-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.assignment-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.inline-status-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-status-form label {
  width: 100%;
  margin: 0;
}

.inline-status-form select {
  min-width: 160px;
}

.progress-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.compact-progress-list {
  display: grid;
  gap: 10px;
  min-width: 260px;
}

.progress-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.progress-complete {
  background: #d1fadf;
  color: #05603a;
}

.progress-open {
  background: #fff4d6;
  color: #7a4d00;
}

.progress-dot {
  width: 14px;
  height: 14px;
  border: 1px solid #a8b3bd;
  border-radius: 50%;
  background: #fff;
}

.progress-dot.done {
  border-color: #039855;
  background: #12b76a;
}

.compact-doc-progress {
  display: inline-flex;
  align-items: stretch;
  width: max-content;
  max-width: 430px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.compact-doc-progress .progress-status {
  min-height: 0;
  padding: 2px 5px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.compact-doc-step {
  display: grid;
  grid-template-rows: 82px 22px;
  justify-items: center;
  width: 38px;
  flex: 0 0 38px;
  color: var(--muted);
  border-left: 1px solid var(--line);
}

.compact-doc-context {
  display: grid;
  align-items: center;
  justify-items: center;
  width: 58px;
  flex: 0 0 58px;
  padding: 4px;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  border-right: 1px solid var(--line);
  background: #f8fafc;
}

.compact-doc-label {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  max-height: 82px;
  padding: 6px 2px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.1;
  text-align: left;
}

.compact-doc-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  align-self: center;
  border: 1px solid #a8b3bd;
  border-radius: 50%;
  background: #fff;
}

.compact-doc-dot.done {
  border-color: #039855;
  background: #12b76a;
}

.compact-project-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 560px;
}

.compact-project-meta {
  display: grid;
  gap: 2px;
  width: 210px;
  flex: 0 0 210px;
}

.compact-project-meta a,
.compact-project-meta .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-matrix {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 38px;
  align-items: stretch;
  width: max-content;
  max-width: 100%;
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.document-step {
  display: grid;
  grid-template-rows: 82px 34px;
  min-width: 38px;
  border-left: 1px solid var(--line);
}

.document-step:first-child {
  border-left: 0;
}

.document-step-label {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  max-height: 82px;
  padding: 6px 2px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.1;
  text-align: left;
}

.document-step-control {
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--line);
  padding: 6px;
}

.document-step-control input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.document-step-summary {
  min-width: 58px;
}

.document-step-summary .document-step-label {
  text-transform: uppercase;
  color: var(--text);
  font-weight: 600;
}

.document-step-summary .progress-status {
  min-height: 22px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.matrix-check {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #a8b3bd;
  border-radius: 50%;
  background: #fff;
}

.matrix-check.done {
  border-color: #039855;
  background: #12b76a;
}

.matrix-check.done::after {
  color: #fff;
  content: "\2713";
  font-size: 14px;
  font-weight: 700;
}

.info-list p {
  margin: 8px 0;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef3f7;
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
