:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --sidebar: #17252b;
  --sidebar-strong: #0f1a1f;
  --surface: #ffffff;
  --surface-soft: #eef3f4;
  --surface-warm: #fff7ea;
  --line: #d9e1e4;
  --line-strong: #c3cfd4;
  --text: #1d2b31;
  --muted: #65747b;
  --accent: #166b79;
  --accent-strong: #0f5560;
  --blue: #305a9a;
  --amber: #94641c;
  --danger: #a33b3b;
  --shadow: 0 12px 32px rgba(22, 38, 45, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

button,
input {
  font: inherit;
}

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

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

.sidebar {
  background: var(--sidebar);
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #d7f1f0;
  color: #11343b;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  line-height: 1.2;
}

.brand small {
  color: rgba(255, 255, 255, 0.68);
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-section {
  color: rgba(255, 255, 255, 0.48);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 14px 10px 4px;
  text-transform: uppercase;
}

.nav a {
  min-height: 38px;
  color: rgba(255, 255, 255, 0.84);
  padding: 8px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav a:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.nav a.active {
  box-shadow: inset 3px 0 0 #d7f1f0;
}

.nav-icon {
  width: 28px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.78);
  display: grid;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  place-items: center;
}

.content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar h1,
.login-panel h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.user-meta {
  display: grid;
  gap: 2px;
  text-align: right;
}

.user-meta span {
  color: var(--text);
  font-weight: 700;
}

.user-meta small {
  color: var(--muted);
}

.user-box button,
.login-form button,
.button-link,
.ghost-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
}

.user-box button:hover,
.login-form button:hover,
.button-link:hover,
.ghost-button:hover {
  background: var(--accent-strong);
  color: #fff;
}

.ghost-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 700;
}

.ghost-button:hover {
  background: var(--surface-soft);
  color: var(--accent-strong);
}

.ghost-button-static {
  cursor: default;
}

.workbench-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 20px;
  margin-bottom: 18px;
  padding: 22px;
}

.workbench-copy {
  display: grid;
  align-content: center;
  gap: 12px;
}

.workbench-copy p {
  max-width: 900px;
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}

.status-pill,
.panel-tag {
  width: fit-content;
  background: #e8f3f4;
  border: 1px solid #cde3e7;
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
}

.action-panel {
  background: var(--surface-warm);
  border: 1px solid #ead9b9;
  border-radius: 8px;
  display: grid;
  gap: 9px;
  padding: 16px;
}

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

.action-panel strong {
  color: var(--text);
  font-size: 20px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 114px;
  padding: 18px;
}

.metric span,
.muted {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 26px;
  line-height: 1.15;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  margin-bottom: 18px;
  padding: 20px;
}

.panel-grid .panel {
  margin-bottom: 0;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.panel p {
  color: var(--muted);
  line-height: 1.55;
}

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

.panel-header h2 {
  margin: 0;
}

.panel-header a {
  font-weight: 700;
}

.list,
.status-list,
.checklist {
  display: grid;
  gap: 10px;
}

.list-row,
.status-list div,
.table-row,
.table-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.list-row.single {
  grid-template-columns: minmax(0, 1fr);
}

.list-row:last-child,
.status-list div:last-child,
.table-row:last-child {
  border-bottom: 0;
}

.list-row small,
.table-row span:last-child {
  color: var(--muted);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.checklist span {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.checklist span {
  display: block;
  line-height: 1.45;
}

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

.readiness-item,
.module-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 7px;
  padding: 14px;
}

.readiness-item span,
.module-card span,
.module-card small {
  color: var(--muted);
  font-size: 13px;
}

.readiness-item strong,
.module-card strong {
  color: var(--text);
}

.readiness-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.module-card:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(22, 107, 121, 0.09);
}

.process-lane {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.process-lane div {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 13px;
}

.process-lane strong {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 999px;
  color: #fff;
  display: grid;
  place-items: center;
}

.process-lane span {
  color: var(--text);
  line-height: 1.35;
}

.ordered-flow {
  counter-reset: flow;
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ordered-flow li {
  border-bottom: 1px solid var(--line);
  counter-increment: flow;
  line-height: 1.45;
  padding: 0 0 10px 38px;
  position: relative;
}

.ordered-flow li::before {
  content: counter(flow);
  width: 26px;
  height: 26px;
  background: #e8f3f4;
  border: 1px solid #cde3e7;
  border-radius: 999px;
  color: var(--accent-strong);
  display: grid;
  font-size: 13px;
  font-weight: 800;
  left: 0;
  place-items: center;
  position: absolute;
  top: -2px;
}

.ordered-flow li:last-child {
  border-bottom: 0;
}

.table {
  overflow-x: auto;
}

.table-head,
.table-row {
  grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) 130px minmax(140px, 1fr);
  min-width: 720px;
}

.table-mailboxes .table-head,
.table-mailboxes .table-row {
  grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) minmax(170px, 1fr) 110px;
}

.table-projects .table-head,
.table-projects .table-row {
  grid-template-columns: minmax(260px, 2fr) minmax(140px, 1fr) 90px 110px;
}

.table-people .table-head,
.table-people .table-row {
  grid-template-columns: minmax(240px, 2fr) minmax(170px, 1fr) minmax(130px, 1fr) minmax(140px, 1fr) 90px;
}

.table-head {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-row strong,
.table-row small {
  display: block;
}

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

.action-buttons form {
  margin: 0;
}

.project-action-row {
  align-items: start;
}

.form-panel form,
.form-field {
  display: grid;
  gap: 14px;
}

.form-field {
  color: var(--muted);
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
}

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

.form-field small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.4;
}

.form-field em,
.errorlist {
  color: var(--danger);
  font-style: normal;
  font-weight: 600;
  margin: 0;
  padding: 0;
}

.form-field ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.form-field li label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
}

.form-field input[type="checkbox"] {
  width: auto;
}

.preview-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 14px;
}

.preview-box span,
.detail-list span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.preview-box pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.detail-list div {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
}

.detail-list div:last-child {
  border-bottom: 0;
}

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

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

.login-brand {
  color: var(--text);
  margin-bottom: 24px;
}

.login-brand small {
  color: var(--muted);
}

.login-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.alert {
  color: var(--danger);
  background: #fff1f1;
  border: 1px solid #f0c2c2;
  border-radius: 8px;
  padding: 10px 12px;
}

.message-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.notice {
  background: #f0f7f8;
  border: 1px solid #cfe4e8;
  border-radius: 8px;
  color: var(--accent-strong);
  padding: 10px 12px;
}

.compact-panel {
  max-width: 620px;
}

.qr-box {
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 12px;
}

.qr-box img {
  width: min(100%, 260px);
  height: auto;
  background: #fff;
  border-radius: 8px;
  padding: 10px;
}

.manual-secret {
  margin-top: 12px;
}

.manual-secret summary {
  cursor: pointer;
  color: var(--accent);
}

.manual-secret code,
.recovery-grid code {
  display: block;
  overflow-wrap: anywhere;
}

.recovery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.recovery-grid code {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  padding: 10px 12px;
  text-align: center;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 1180px) {
  .metric-grid,
  .readiness-grid,
  .module-grid,
  .process-lane {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: static;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-section {
    grid-column: 1 / -1;
  }

  .workbench-hero,
  .panel-grid {
    grid-template-columns: 1fr;
  }

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

  .user-meta {
    text-align: left;
  }

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

  .actions-row {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .content,
  .sidebar {
    padding: 18px;
  }

  .nav,
  .metric-grid,
  .readiness-grid,
  .module-grid,
  .process-lane {
    grid-template-columns: 1fr;
  }

  .topbar h1,
  .login-panel h1 {
    font-size: 26px;
  }
}
