:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --surface-raised: #fbfcfd;
  --text: #18202b;
  --muted: #66717f;
  --line: #dce3ec;
  --line-strong: #c6d0dc;
  --blue: #1f5fbf;
  --blue-soft: #edf4ff;
  --blue-line: #b9cff4;
  --linear-accent: #5e6ad2;
  --linear-accent-soft: rgba(94, 106, 210, 0.16);
  --red: #b84224;
  --amber: #a46116;
  --green: #0d766c;
  --green-soft: #edf8f5;
  --navy: #111827;
  --ink: #0b1220;
  --ink-soft: #172033;
  --linear-bg: #08090d;
  --linear-panel: #11131a;
  --linear-panel-2: #171a23;
  --radius-sm: 6px;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 14px 34px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 24px 70px rgba(17, 24, 39, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(235, 241, 246, 0.88), rgba(248, 250, 252, 0) 360px),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

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

button {
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

input,
select,
textarea {
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 95, 191, 0.13);
}

.app-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.app-header h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--navy);
  font-size: 19px;
  font-weight: 760;
  letter-spacing: 0;
}

.app-header h1::before {
  content: "";
  width: 12px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--ink), var(--green));
  box-shadow: 0 8px 18px rgba(11, 18, 32, 0.18);
}

.app-header p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-header button,
.remediation-save,
.secondary-action,
#saveIntakeButton,
#loginButton {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 680;
}

.app-header button:hover,
.app-header button.active,
.remediation-save:hover,
.secondary-action:hover,
#saveIntakeButton:hover,
#loginButton:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: #f8fbff;
  box-shadow: var(--shadow-sm);
}

.app-header .mode-button.active {
  border-color: var(--ink-soft);
  background: var(--ink-soft);
  color: #fff;
  box-shadow: 0 12px 28px rgba(11, 18, 32, 0.16);
}

.user-badge {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--surface-raised);
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.42);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-lg);
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-heading h2 {
  margin: 0;
  font-size: 21px;
}

.modal-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.icon-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.modal-card label {
  display: block;
  margin-top: 12px;
}

.modal-card label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 6px;
}

.modal-card input,
.modal-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.modal-card input {
  height: 40px;
  padding: 0 11px;
}

.modal-card textarea {
  min-height: 96px;
  padding: 10px 11px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions span {
  margin-right: auto;
  color: var(--muted);
}

.modal-actions span.error {
  color: var(--red);
}

.modal-actions span.success {
  color: var(--green);
}

#profileSaveButton {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
}

.client-intake-page .app-header {
  height: auto;
  min-height: 72px;
  border-bottom-color: var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.client-intake-page .app-header h1 {
  color: var(--navy);
  font-size: 18px;
}

.client-intake-page .app-header p {
  color: #596579;
}

.client-intake-page .header-actions {
  gap: 10px;
}

.client-intake-page .mode-button.active {
  background: var(--linear-accent);
  border-color: var(--linear-accent);
  color: #fff;
  box-shadow: 0 12px 28px rgba(94, 106, 210, 0.28);
}

.client-intake-page .app-header button,
.client-intake-page .user-badge {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.client-intake-page .app-header button:hover {
  border-color: var(--linear-accent);
  background: rgba(94, 106, 210, 0.08);
  color: #303a9b;
}

.login-screen {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background:
    linear-gradient(135deg, rgba(31, 95, 191, 0.08), rgba(13, 118, 108, 0.055) 48%, rgba(255, 255, 255, 0) 76%),
    var(--bg);
}

.login-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow-lg);
}

.login-brand span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #184f9c;
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 14px;
}

.login-card h2 {
  margin: 0;
  color: var(--navy);
  font-size: 26px;
  letter-spacing: 0;
}

.login-card p {
  color: var(--muted);
  margin: 10px 0 22px;
  line-height: 1.6;
}

.login-card label {
  display: block;
  margin-top: 12px;
}

.login-card label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: var(--surface-raised);
}

.login-hints {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.login-card .form-actions {
  position: static;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 16px 0 0;
  border-top: 0;
  background: transparent;
}

.login-hints span {
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 12px;
}

#loginStatus {
  color: var(--red);
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: calc(100vh - 72px);
}

.layout.client-intake-layout {
  display: block;
  background:
    linear-gradient(180deg, #f1f4f8 0, #eef3f7 360px, var(--bg) 100%);
}

.client-intake-layout .project-panel {
  display: none;
}

.client-intake-layout .detail-panel {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 24px 60px;
}

.project-panel {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  min-width: 0;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title h2 {
  margin: 0;
  font-size: 15px;
}

.panel-title span {
  color: var(--muted);
}

.project-list {
  overflow: auto;
  max-height: calc(100vh - 124px);
}

.project-item {
  width: 100%;
  display: block;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.project-item:hover,
.project-item.active {
  background: var(--surface-raised);
  box-shadow: inset 3px 0 0 var(--blue);
}

.project-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

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

.workflow-side-link em {
  display: inline-flex;
  margin-top: 8px;
  min-height: 24px;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 760;
}

.project-stats {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
}

.detail-panel {
  min-width: 0;
  padding: 24px;
}

.empty-state {
  padding: 64px 0;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  color: var(--text);
}

.hidden {
  display: none !important;
}

.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.detail-heading h2 {
  margin: 0;
  font-size: 22px;
}

.detail-heading p,
.generated-at {
  color: var(--muted);
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.client-intake-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: stretch;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 20px;
  padding: 38px 36px;
  border: 1px solid rgba(214, 221, 232, 0.92);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(94, 106, 210, 0.08), rgba(18, 184, 134, 0.045) 42%, rgba(255, 255, 255, 0) 74%),
    linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 24px 70px rgba(17, 24, 39, 0.10);
  overflow: hidden;
}

.client-intake-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--linear-accent), #12b886, transparent);
  opacity: 0.82;
}

.intake-hero-copy {
  min-width: 0;
  animation: intakeFadeUp 0.5s ease both;
}

.intake-hero-copy > span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(94, 106, 210, 0.38);
  border-radius: 999px;
  background: rgba(94, 106, 210, 0.14);
  color: #3943a8;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

.client-intake-hero h2 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(34px, 4.1vw, 44px);
  line-height: 1.14;
  letter-spacing: 0;
  color: var(--navy);
  font-weight: 820;
}

.client-intake-hero p {
  max-width: 720px;
  margin: 14px 0 0;
  color: #566273;
  line-height: 1.7;
  font-size: 16px;
}

.intake-trust-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  max-width: 830px;
  margin-top: 26px;
}

.intake-trust-strip div {
  min-height: 72px;
  padding: 12px 13px;
  border: 1px solid rgba(214, 221, 232, 0.86);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

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

.intake-trust-strip strong {
  color: var(--navy);
  font-size: 14px;
}

.intake-trust-strip span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.intake-hero-panel {
  align-self: stretch;
  display: grid;
  align-content: space-between;
  gap: 14px;
  min-height: 216px;
  padding: 20px;
  border: 1px solid rgba(214, 221, 232, 0.92);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(244, 246, 252, 0.88)),
    #ffffff;
  box-shadow: 0 18px 45px rgba(17, 24, 39, 0.10);
  animation: intakeFadeUp 0.58s ease 0.06s both;
}

.intake-hero-panel-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.intake-hero-panel-top strong {
  color: var(--navy);
  line-height: 1.35;
}

.intake-hero-panel-top span {
  color: var(--linear-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.intake-hero-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.intake-hero-panel li {
  position: relative;
  min-height: 22px;
  padding-left: 17px;
  color: #4d5867;
  line-height: 1.45;
}

.intake-hero-panel li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--linear-accent);
  box-shadow: 0 0 0 3px rgba(94, 106, 210, 0.12);
}

.intake-hero-panel .heading-actions {
  justify-content: stretch;
}

.intake-hero-panel .heading-actions button {
  flex: 1 1 auto;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

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

.metric strong {
  display: block;
  font-size: 26px;
  margin-top: 6px;
}

.metric.critical strong,
.metric.high strong {
  color: var(--red);
}

.metric.medium strong {
  color: var(--amber);
}

.metric.open strong {
  color: var(--green);
}

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-weight: 680;
}

.tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.tab-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 0;
  min-height: 360px;
  box-shadow: var(--shadow-sm);
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 260px);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

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

th {
  position: sticky;
  top: 0;
  background: #f4f7fa;
  font-weight: 700;
  z-index: 1;
}

.severity {
  font-weight: 700;
  text-transform: uppercase;
}

.severity.critical,
.severity.high {
  color: var(--red);
}

.severity.medium {
  color: var(--amber);
}

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

.status-select,
.owner-input,
.date-input,
.intake-grid input,
.intake-grid select,
.intake-question textarea {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: var(--surface-raised);
  color: var(--text);
}

.intake-grid input::placeholder,
.intake-question textarea::placeholder {
  color: #98a2b3;
}

.intake-workspace {
  min-width: 0;
}

.client-intake-layout .intake-workspace {
  max-width: 100%;
}

.intake-workbench {
  display: grid;
  grid-template-columns: minmax(178px, 220px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  animation: intakeFadeUp 0.55s ease 0.1s both;
}

.intake-files-panel {
  border-top: 1px solid var(--line);
  padding: 18px 18px 20px;
  background: #fff;
}

.intake-files-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.intake-files-heading h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.intake-files-heading p {
  margin: 0;
  color: var(--muted);
}

.intake-upload-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(120px, 0.6fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.intake-upload-row input[type="file"] {
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--surface-soft);
}

#intakeFileStatus {
  color: var(--muted);
}

#intakeFileStatus.error {
  color: #b91c1c;
}

#intakeFileStatus.success {
  color: #047857;
}

.intake-file-list {
  display: grid;
  gap: 8px;
}

.intake-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

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

.intake-file-row span {
  color: var(--muted);
  font-size: 13px;
}

.intake-side-panel {
  position: sticky;
  top: 88px;
}

.permissions-workspace {
  min-width: 0;
}

.permission-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.permission-section h3 {
  margin: 0;
  padding: 14px 16px;
  font-size: 16px;
  background: linear-gradient(90deg, #ffffff, var(--surface-soft));
  border-bottom: 1px solid var(--line);
}

.audit-toolbar {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(150px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr) auto auto;
  gap: 10px;
  padding: 14px 16px 0;
}

.audit-toolbar input,
.audit-toolbar select {
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  background: var(--surface-raised);
  color: var(--text);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  padding: 14px 16px;
}

.signup-request-list {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
}

.signup-request-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.signup-request-card strong,
.signup-request-card span,
.signup-request-card em {
  display: block;
}

.signup-request-card span,
.signup-request-card em,
.signup-request-card p {
  color: var(--muted);
}

.signup-request-card p {
  margin: 8px 0 0;
}

.permission-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.permission-card.locked {
  background: var(--surface-soft);
}

.permission-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.permission-card-head strong,
.permission-card-head span {
  overflow-wrap: anywhere;
}

.permission-card-head span,
.permission-card p,
.scope-line,
.permission-help span {
  color: var(--muted);
}

.permission-card p {
  min-height: 38px;
  margin: 8px 0 10px;
}

.docs-workspace {
  display: grid;
  gap: 18px;
}

.docs-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(94, 106, 210, 0.12), rgba(18, 184, 134, 0.06) 46%, rgba(255, 255, 255, 0) 78%),
    linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: var(--shadow-md);
}

.docs-hero > div {
  max-width: 760px;
  padding: 30px;
}

.docs-hero span,
.doc-card span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(13, 118, 108, 0.22);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 760;
}

.docs-hero h3 {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--navy);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.16;
  letter-spacing: 0;
}

.docs-hero p {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

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

.workflow-workspace {
  display: grid;
  gap: 18px;
}

.workflow-hero,
.workflow-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.workflow-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.65fr);
  gap: 24px;
  align-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(31, 95, 191, 0.08), rgba(13, 118, 108, 0.055) 48%, rgba(255, 255, 255, 0) 78%),
    var(--surface);
}

.workflow-hero > div:first-child > span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--blue-line);
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 760;
}

.workflow-hero h3 {
  margin: 12px 0 0;
  color: var(--navy);
  font-size: clamp(28px, 3.4vw, 42px);
  line-height: 1.16;
}

.workflow-hero p {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.workflow-hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.workflow-hero-metrics div {
  min-height: 84px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
}

.workflow-hero-metrics strong,
.workflow-hero-metrics span {
  display: block;
}

.workflow-hero-metrics strong {
  color: var(--navy);
  font-size: 24px;
  line-height: 1.2;
}

.workflow-hero-metrics span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.workflow-section {
  padding: 22px;
}

.workflow-section-head {
  margin-bottom: 16px;
}

.workflow-section-head h3 {
  margin: 0;
  color: var(--navy);
  font-size: 18px;
}

.workflow-section-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.workflow-stage-list {
  display: grid;
  gap: 12px;
  position: relative;
}

.workflow-stage {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
}

.workflow-stage-marker {
  width: 18px;
  height: 18px;
  margin-top: 18px;
  border: 4px solid var(--surface);
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: 0 0 0 1px #cbd5e1;
}

.workflow-stage.done .workflow-stage-marker {
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(13, 118, 108, 0.35);
}

.workflow-stage.ready .workflow-stage-marker {
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(31, 95, 191, 0.12);
}

.workflow-stage.needs_review .workflow-stage-marker,
.workflow-stage.blocked .workflow-stage-marker {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(164, 97, 22, 0.13);
}

.workflow-stage-body {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.workflow-stage-heading,
.workflow-stage-columns,
.workflow-grid {
  display: grid;
  gap: 14px;
}

.workflow-stage-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.workflow-stage-heading strong,
.workflow-stage-heading span,
.workflow-stage-heading em {
  display: block;
}

.workflow-stage-heading strong {
  color: var(--navy);
  font-size: 16px;
}

.workflow-stage-heading span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.workflow-stage-heading em {
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-style: normal;
  font-weight: 760;
}

.workflow-progress {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef5;
}

.workflow-progress i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.workflow-stage-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.workflow-stage-columns p {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  line-height: 1.6;
}

.workflow-stage-columns b {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.workflow-stage-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.workflow-stage-workspace {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(31, 95, 191, 0.045), rgba(255, 255, 255, 0));
}

.workflow-workspace-head {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.workflow-workspace-head strong {
  color: var(--navy);
  font-size: 14px;
}

.workflow-workspace-head span,
.workflow-work-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.workflow-work-items {
  display: grid;
  gap: 8px;
}

.workflow-work-items article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.workflow-work-items strong,
.workflow-work-items span {
  display: block;
}

.workflow-work-items strong {
  color: var(--text);
  font-size: 13px;
}

.workflow-work-items span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.workflow-work-items em {
  max-width: 180px;
  color: var(--blue);
  font-size: 12px;
  font-style: normal;
  font-weight: 760;
  text-align: right;
}

.workflow-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.workflow-checklist span {
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 720;
}

.workflow-checklist .done {
  border-color: rgba(13, 118, 108, 0.28);
  color: var(--green);
  background: rgba(13, 118, 108, 0.08);
}

.workflow-checklist .pending {
  border-color: rgba(164, 97, 22, 0.25);
  color: var(--amber);
  background: rgba(164, 97, 22, 0.08);
}

.workflow-workspace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.workflow-inline-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(31, 95, 191, 0.18);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.workflow-inline-form > strong {
  color: var(--navy);
  font-size: 14px;
}

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

.workflow-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.workflow-form-grid .wide {
  grid-column: 1 / -1;
}

.workflow-form-grid input,
.workflow-form-grid select,
.workflow-form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.workflow-form-grid input,
.workflow-form-grid select {
  min-height: 38px;
  padding: 0 10px;
}

.workflow-form-grid textarea {
  min-height: 78px;
  padding: 10px;
  resize: vertical;
}

.workflow-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.workflow-form-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
}

.workflow-secondary-link {
  min-height: 32px;
  text-decoration: none;
}

.workflow-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  text-decoration: none;
}

.workflow-action-disabled {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.workflow-action-disabled b {
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f7fb;
  color: var(--muted);
  font-size: 12px;
}

.workflow-action-disabled small {
  color: var(--muted);
}

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

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

.workflow-info-card,
.workflow-empty {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.workflow-info-card strong,
.workflow-info-card span {
  display: block;
}

.workflow-info-card strong {
  color: var(--navy);
}

.workflow-info-card span {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.6;
}

.doc-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-height: 238px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.doc-card h3 {
  margin: 14px 0 0;
  color: var(--navy);
  font-size: 18px;
  line-height: 1.35;
}

.doc-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.doc-card .secondary-action {
  width: max-content;
  text-decoration: none;
}

.docs-side-link {
  color: inherit;
  text-decoration: none;
}

.permission-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.permission-tags span {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 7px;
  background: var(--surface-soft);
  font-size: 12px;
}

.scope-line {
  margin-top: 10px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.account-create-form,
.account-editor {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 16px;
}

.account-editor {
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  margin-top: 12px;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
  align-items: start;
}

.account-create-form label,
.account-editor label {
  display: block;
}

.account-create-form label span,
.account-editor label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.account-create-form input,
.account-create-form select,
.account-editor input:not([type="checkbox"]),
.account-editor select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  background: var(--surface-raised);
}

.account-create-form button {
  height: 34px;
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #fff;
  padding: 0 12px;
  cursor: pointer;
}

.account-create-form em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.account-state,
.account-locked {
  width: fit-content;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  padding: 3px 8px;
}

.account-state.disabled {
  background: #fee2e2;
  color: var(--red);
}

.account-locked {
  background: var(--blue-soft);
  color: #475467;
}

.scope-editor {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.scope-editor label {
  display: block;
}

.scope-editor label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.scope-editor input:not([type="checkbox"]) {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 8px;
}

.scope-editor input:focus,
.account-create-form input:focus,
.account-create-form select:focus,
.account-editor input:focus,
.account-editor select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 95, 191, 0.12);
}

.scope-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.scope-check span {
  margin: 0 !important;
}

.scope-save {
  width: fit-content;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  padding: 0 10px;
}

.scope-save:hover {
  border-color: var(--blue);
  color: var(--blue);
}

@media (max-width: 900px) {
  .account-create-form,
  .account-editor,
  .signup-request-card {
    grid-template-columns: 1fr;
  }
}

.scope-options {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
}

.scope-option-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.scope-option-group p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
  color: var(--muted);
}

.scope-option-group code {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  background: var(--surface-soft);
  color: var(--text);
}

.audit-log-list {
  display: grid;
  padding: 14px 16px;
}

.audit-log-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(90px, 0.7fr) minmax(120px, 1fr) minmax(140px, 1.3fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.audit-log-row span {
  color: var(--muted);
}

.permission-help {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.permission-help strong,
.permission-help span {
  display: block;
}

.permission-help span {
  margin-top: 6px;
  line-height: 1.5;
}

.intake-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(8, 9, 13, 0.14);
}

.intake-form::before {
  content: "";
  display: block;
  height: 5px;
  background: linear-gradient(90deg, var(--linear-accent), var(--green));
}

.intake-progress-shell {
  display: grid;
  gap: 18px;
  padding: 18px;
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #ffffff, var(--surface-raised));
  box-shadow: 0 18px 48px rgba(8, 9, 13, 0.10);
}

.intake-progress-shell > div:first-child {
  min-width: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.intake-progress-shell span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
  font-weight: 700;
}

.intake-progress-shell strong {
  display: block;
  font-size: 18px;
  line-height: 1.35;
}

.intake-stepper {
  display: grid;
  grid-template-columns: repeat(4, 34px);
  justify-content: start;
  gap: 8px;
}

.step-dot {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.step-dot:hover {
  transform: translateY(-1px);
  border-color: var(--blue-line);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.08);
}

.step-dot span {
  margin: 0;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
}

.step-dot.active {
  border-color: var(--linear-accent);
  background: var(--linear-accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(94, 106, 210, 0.28);
}

.step-dot.done {
  border-color: #a9d7cd;
  background: var(--green-soft);
  color: var(--green);
}

.intake-step-panel {
  min-height: 420px;
}

.intake-section-intro {
  padding: 28px 30px 16px;
  background:
    linear-gradient(90deg, #ffffff, var(--surface-raised));
}

.intake-section-intro h3 {
  margin: 0;
  font-size: 22px;
  color: var(--navy);
}

.intake-section-intro p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.project-type-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 30px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.project-type-selector > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.project-type-selector label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.project-type-selector label:has(input:checked) {
  border-color: var(--linear-accent);
  background: rgba(94, 106, 210, 0.10);
  color: #303a9b;
  box-shadow: 0 0 0 1px rgba(94, 106, 210, 0.08);
}

.project-type-selector strong {
  font-size: 13px;
}

.comparison-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(8, 9, 13, 0.10);
}

.saved-intake-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  animation: intakeFadeUp 0.5s ease 0.04s both;
}

.saved-intake-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  background:
    linear-gradient(90deg, #ffffff, var(--surface-raised));
  border-bottom: 1px solid var(--line);
}

.saved-intake-panel.collapsed .saved-intake-heading {
  border-bottom: 0;
}

.saved-intake-heading h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.saved-intake-heading span {
  color: var(--muted);
}

.saved-intake-heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.text-action {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--linear-accent);
  font-weight: 700;
  cursor: pointer;
}

.text-action:hover {
  text-decoration: underline;
}

.saved-intake-list {
  display: grid;
  gap: 10px;
  padding: 14px 18px;
  background: var(--surface-raised);
}

.saved-intake-panel.collapsed .saved-intake-list {
  display: none;
}

.saved-intake-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.035);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.saved-intake-card:hover,
.saved-intake-card.active {
  transform: translateY(-1px);
  border-color: var(--linear-accent);
  background: #fbfdff;
  box-shadow: 0 10px 24px rgba(94, 106, 210, 0.10);
}

.saved-intake-card strong,
.saved-intake-card span {
  display: block;
  overflow-wrap: anywhere;
}

.saved-intake-card strong {
  color: var(--text);
  font-size: 14px;
}

.saved-intake-card span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.saved-intake-card em {
  color: var(--linear-accent);
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.comparison-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line);
}

.comparison-heading h3 {
  margin: 0;
  font-size: 16px;
}

.comparison-heading span {
  color: var(--muted);
}

.comparison-list {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
}

.comparison-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.comparison-card.site {
  border-left-color: var(--blue);
}

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

.comparison-card-head strong {
  font-size: 14px;
}

.comparison-card-head span {
  color: var(--amber);
  font-weight: 700;
}

.comparison-scope {
  color: var(--muted);
  margin-top: 6px;
}

.comparison-card h4 {
  margin: 12px 0 8px;
  font-size: 14px;
}

.comparison-answers {
  display: grid;
  gap: 8px;
}

.comparison-answers div {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 2fr);
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.comparison-answers span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.comparison-answers strong {
  overflow-wrap: anywhere;
}

.comparison-card p,
.comparison-empty {
  color: var(--muted);
  margin: 10px 0 0;
}

.intake-grid {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(180px, 1fr);
  gap: 16px;
  padding: 20px 30px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.industry-priority-grid {
  grid-template-columns: minmax(240px, 1fr);
  background: #ffffff;
  padding-top: 18px;
  padding-bottom: 18px;
}

.industry-priority-grid label {
  max-width: 520px;
}

.industry-priority-grid select {
  height: 42px;
  font-weight: 700;
}

.multi-factory-grid {
  border-top: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.intake-grid label,
.intake-question label {
  display: block;
}

.intake-grid span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.intake-section {
  padding: 0 30px 30px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.intake-question {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.intake-question:first-of-type {
  margin-top: 0;
}

.intake-question h4 {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.45;
}

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

.check-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 42px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.check-option:hover {
  border-color: var(--blue-line);
  background: #f8fbff;
}

.check-option:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 1px rgba(31, 95, 191, 0.06);
}

.check-option input {
  flex: 0 0 auto;
  margin-top: 2px;
}

.check-option span {
  overflow-wrap: anywhere;
}

.intake-question textarea {
  display: block;
  min-height: 72px;
  padding: 10px 11px;
  resize: vertical;
  margin-top: 12px;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.94);
  backdrop-filter: blur(12px);
  position: sticky;
  bottom: 0;
  z-index: 3;
}

#intakeSaveStatus {
  color: var(--green);
}

#saveIntakeButton {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  min-width: 132px;
  box-shadow: 0 10px 22px rgba(31, 95, 191, 0.2);
}

#saveIntakeButton:hover {
  color: #fff;
  filter: brightness(0.96);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090b10;
  --surface: #11131a;
  --surface-soft: #171a22;
  --surface-raised: #141821;
  --text: #e6e9ef;
  --muted: #98a2b3;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.18);
  --blue: #7c86ff;
  --blue-soft: rgba(94, 106, 210, 0.18);
  --blue-line: rgba(124, 134, 255, 0.42);
  --green: #45d3bd;
  --green-soft: rgba(69, 211, 189, 0.14);
  --navy: #f5f7fb;
  --ink: #f5f7fb;
  --ink-soft: #d9defb;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 30px 90px rgba(0, 0, 0, 0.44);
}

html[data-theme="dark"] body {
  background:
    linear-gradient(180deg, rgba(18, 22, 32, 0.92), rgba(9, 11, 16, 0) 390px),
    var(--bg);
}

html[data-theme="dark"] .app-header {
  border-bottom-color: var(--line);
  background: rgba(9, 11, 16, 0.84);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .app-header h1,
html[data-theme="dark"] .detail-heading h2,
html[data-theme="dark"] .empty-state h2,
html[data-theme="dark"] .login-card h2,
html[data-theme="dark"] .modal-heading h2,
html[data-theme="dark"] .intake-section-intro h3,
html[data-theme="dark"] .permission-section h3,
html[data-theme="dark"] .workflow-section-head h3,
html[data-theme="dark"] .saved-intake-heading h3,
html[data-theme="dark"] .comparison-heading h3,
html[data-theme="dark"] .intake-progress-shell strong,
html[data-theme="dark"] .intake-question h4 {
  color: var(--navy);
}

html[data-theme="dark"] .app-header p,
html[data-theme="dark"] .client-intake-page .app-header p {
  color: var(--muted);
}

html[data-theme="dark"] .app-header button,
html[data-theme="dark"] .secondary-action,
html[data-theme="dark"] .remediation-save,
html[data-theme="dark"] #loginButton,
html[data-theme="dark"] #saveIntakeButton,
html[data-theme="dark"] .user-badge {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

html[data-theme="dark"] .app-header button:hover,
html[data-theme="dark"] .secondary-action:hover,
html[data-theme="dark"] .remediation-save:hover {
  border-color: var(--blue-line);
  background: rgba(124, 134, 255, 0.12);
  color: #ffffff;
}

html[data-theme="dark"] .app-header .mode-button.active,
html[data-theme="dark"] .client-intake-page .mode-button.active,
html[data-theme="dark"] #saveIntakeButton,
html[data-theme="dark"] #profileSaveButton,
html[data-theme="dark"] .account-create-form button {
  border-color: var(--linear-accent);
  background: var(--linear-accent);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(94, 106, 210, 0.28);
}

html[data-theme="dark"] .login-screen,
html[data-theme="dark"] .layout.client-intake-layout {
  background:
    linear-gradient(180deg, #0b0d13 0, #10141d 360px, var(--bg) 100%);
}

html[data-theme="dark"] .login-card,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .project-panel,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .tab-panel,
html[data-theme="dark"] .permission-section,
html[data-theme="dark"] .permission-card,
html[data-theme="dark"] .docs-hero,
html[data-theme="dark"] .doc-card,
html[data-theme="dark"] .workflow-hero,
html[data-theme="dark"] .workflow-section,
html[data-theme="dark"] .workflow-stage-body,
html[data-theme="dark"] .workflow-info-card,
html[data-theme="dark"] .workflow-empty,
html[data-theme="dark"] .signup-request-card,
html[data-theme="dark"] .scope-option-group,
html[data-theme="dark"] .comparison-panel,
html[data-theme="dark"] .comparison-card,
html[data-theme="dark"] .saved-intake-panel,
html[data-theme="dark"] .saved-intake-card,
html[data-theme="dark"] .intake-progress-shell,
html[data-theme="dark"] .intake-form,
html[data-theme="dark"] .intake-file-row {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

html[data-theme="dark"] .project-panel {
  background: rgba(17, 19, 26, 0.88);
}

html[data-theme="dark"] .project-item {
  border-bottom-color: var(--line);
  background: transparent;
}

html[data-theme="dark"] .project-item:hover,
html[data-theme="dark"] .project-item.active,
html[data-theme="dark"] .permission-card.locked,
html[data-theme="dark"] .login-hints,
html[data-theme="dark"] .permission-section h3,
html[data-theme="dark"] .saved-intake-heading,
html[data-theme="dark"] .saved-intake-list,
html[data-theme="dark"] .comparison-heading,
html[data-theme="dark"] .form-actions {
  background: var(--surface-soft);
}

html[data-theme="dark"] .workflow-side-link em {
  border-color: rgba(124, 134, 255, 0.28);
  background: rgba(124, 134, 255, 0.12);
  color: #c4c8ff;
}

html[data-theme="dark"] .workflow-action-disabled b {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
}

html[data-theme="dark"] .workflow-stage-workspace {
  border-color: var(--line);
  background: rgba(124, 134, 255, 0.055);
}

html[data-theme="dark"] .workflow-work-items article,
html[data-theme="dark"] .workflow-checklist span {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.045);
}

html[data-theme="dark"] .workflow-workspace-head strong,
html[data-theme="dark"] .workflow-work-items strong {
  color: #f8fafc;
}

html[data-theme="dark"] .workflow-work-items em {
  color: #c4c8ff;
}

html[data-theme="dark"] .client-intake-hero {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(135deg, rgba(94, 106, 210, 0.16), rgba(69, 211, 189, 0.06) 45%, rgba(255, 255, 255, 0) 76%),
    linear-gradient(180deg, #151821, #10131b);
  box-shadow: var(--shadow-lg);
}

html[data-theme="dark"] .client-intake-hero h2,
html[data-theme="dark"] .docs-hero h3,
html[data-theme="dark"] .doc-card h3,
html[data-theme="dark"] .workflow-hero h3,
html[data-theme="dark"] .workflow-hero-metrics strong,
html[data-theme="dark"] .workflow-stage-heading strong,
html[data-theme="dark"] .workflow-info-card strong,
html[data-theme="dark"] .intake-trust-strip strong,
html[data-theme="dark"] .intake-hero-panel-top strong,
html[data-theme="dark"] .saved-intake-card strong,
html[data-theme="dark"] .permission-card-head strong,
html[data-theme="dark"] .metric strong {
  color: #f8fafc;
}

html[data-theme="dark"] .client-intake-hero p,
html[data-theme="dark"] .docs-hero p,
html[data-theme="dark"] .doc-card p,
html[data-theme="dark"] .workflow-hero p,
html[data-theme="dark"] .workflow-section-head p,
html[data-theme="dark"] .workflow-hero-metrics span,
html[data-theme="dark"] .workflow-stage-heading span,
html[data-theme="dark"] .workflow-stage-columns p,
html[data-theme="dark"] .workflow-info-card span,
html[data-theme="dark"] .intake-trust-strip span,
html[data-theme="dark"] .intake-hero-panel li,
html[data-theme="dark"] .permission-card p,
html[data-theme="dark"] .scope-line,
html[data-theme="dark"] .generated-at {
  color: var(--muted);
}

html[data-theme="dark"] .intake-hero-copy > span {
  border-color: rgba(124, 134, 255, 0.42);
  background: rgba(94, 106, 210, 0.18);
  color: #d8dcff;
}

html[data-theme="dark"] .docs-hero {
  background:
    linear-gradient(135deg, rgba(94, 106, 210, 0.16), rgba(69, 211, 189, 0.06) 48%, rgba(255, 255, 255, 0) 78%),
    linear-gradient(180deg, #151821, #10131b);
}

html[data-theme="dark"] .docs-hero span,
html[data-theme="dark"] .doc-card span,
html[data-theme="dark"] .workflow-hero > div:first-child > span {
  border-color: rgba(69, 211, 189, 0.28);
  background: rgba(69, 211, 189, 0.12);
  color: #87eadb;
}

html[data-theme="dark"] .intake-trust-strip div,
html[data-theme="dark"] .intake-hero-panel {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .intake-section-intro,
html[data-theme="dark"] .project-type-selector,
html[data-theme="dark"] .intake-grid,
html[data-theme="dark"] .industry-priority-grid,
html[data-theme="dark"] .multi-factory-grid,
html[data-theme="dark"] .intake-section,
html[data-theme="dark"] .intake-files-panel {
  border-color: var(--line);
  background: var(--surface);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .status-select,
html[data-theme="dark"] .owner-input,
html[data-theme="dark"] .date-input,
html[data-theme="dark"] .account-create-form input,
html[data-theme="dark"] .account-create-form select,
html[data-theme="dark"] .account-editor input:not([type="checkbox"]),
html[data-theme="dark"] .account-editor select,
html[data-theme="dark"] .scope-editor input:not([type="checkbox"]) {
  border-color: var(--line);
  background: #0d1118;
  color: var(--text);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #6f7a89;
}

html[data-theme="dark"] .project-type-selector label,
html[data-theme="dark"] .check-option,
html[data-theme="dark"] .comparison-answers div,
html[data-theme="dark"] .workflow-hero-metrics div,
html[data-theme="dark"] .workflow-stage-columns p,
html[data-theme="dark"] .permission-tags span,
html[data-theme="dark"] .scope-option-group code {
  border-color: var(--line);
  background: var(--surface-soft);
}

html[data-theme="dark"] .project-type-selector label:has(input:checked),
html[data-theme="dark"] .check-option:has(input:checked),
html[data-theme="dark"] .saved-intake-card:hover,
html[data-theme="dark"] .saved-intake-card.active {
  border-color: var(--linear-accent);
  background: rgba(94, 106, 210, 0.16);
  color: #e6e9ff;
}

html[data-theme="dark"] .step-dot {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

html[data-theme="dark"] .step-dot.active {
  border-color: var(--linear-accent);
  background: var(--linear-accent);
  color: #ffffff;
}

html[data-theme="dark"] .step-dot.done {
  border-color: rgba(69, 211, 189, 0.38);
  background: rgba(69, 211, 189, 0.12);
  color: #8ee9da;
}

html[data-theme="dark"] th {
  background: #151a23;
}

html[data-theme="dark"] td,
html[data-theme="dark"] th {
  border-bottom-color: var(--line);
}

html[data-theme="dark"] .tab.active,
html[data-theme="dark"] .text-action,
html[data-theme="dark"] .saved-intake-card em,
html[data-theme="dark"] .intake-hero-panel-top span {
  color: #aeb6ff;
}

@keyframes intakeFadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .intake-hero-copy,
  .intake-hero-panel,
  .intake-workbench,
  .saved-intake-panel {
    animation: none;
  }

  .step-dot,
  .saved-intake-card,
  .check-option {
    transition: none;
  }
}

#intakePrevButton:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .intake-workbench {
    grid-template-columns: 1fr;
  }

  .intake-side-panel {
    position: static;
  }

  .intake-stepper {
    grid-template-columns: repeat(auto-fit, 34px);
  }
}

.report-preview {
  margin: 0;
  padding: 18px;
  white-space: pre-wrap;
  overflow: auto;
  max-height: calc(100vh - 260px);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  line-height: 1.5;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

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

  .project-list {
    max-height: 260px;
  }

  .detail-panel {
    padding: 16px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .detail-heading {
    display: block;
  }

  .heading-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .app-header {
    position: static;
    height: auto;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }

  .app-header > div:first-child {
    width: 100%;
  }

  .app-header h1 {
    font-size: 20px;
    line-height: 1.25;
  }

  .app-header p {
    line-height: 1.5;
  }

  .header-actions {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .header-actions > * {
    flex: 0 0 auto;
  }

  .client-intake-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 24px 22px;
  }

  .client-intake-hero h2 {
    font-size: 27px;
    line-height: 1.25;
  }

  .client-intake-hero p {
    line-height: 1.6;
  }

  .client-intake-hero::before {
    display: none;
  }

  .intake-trust-strip {
    grid-template-columns: 1fr 1fr;
  }

  .intake-hero-panel {
    min-height: 0;
  }

  .intake-hero-panel .heading-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .login-card .form-actions,
  .modal-actions {
    justify-content: stretch;
  }

  .login-card .form-actions button,
  .modal-actions button {
    flex: 1 1 auto;
  }

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

  .intake-upload-row,
  .intake-file-row {
    grid-template-columns: 1fr;
  }

  .comparison-answers div {
    grid-template-columns: 1fr;
  }

  .audit-toolbar {
    grid-template-columns: 1fr;
  }

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

  .workflow-hero,
  .workflow-grid,
  .workflow-stage-columns {
    grid-template-columns: 1fr;
  }

  .workflow-hero {
    padding: 22px;
  }

  .workflow-stage-heading {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .intake-trust-strip {
    grid-template-columns: 1fr;
  }

  .client-intake-layout .detail-panel {
    padding-left: 16px;
    padding-right: 16px;
  }

  .intake-section-intro,
  .project-type-selector,
  .intake-grid,
  .intake-section {
    padding-left: 18px;
    padding-right: 18px;
  }
}
