:root {
  --brand-red: #cf0a2c;
  --brand-red-dark: #a90824;
  --brand-red-soft: #fde8ec;
  --brand-black: #000;
  --brand-white: #fff;
  --brand-metal-grey: #777575;
  --app-bg: #f6f7f9;
  --surface: #fff;
  --surface-muted: #f1f2f4;
  --surface-soft: #fff8f7;
  --sidebar-bg: #090a0c;
  --sidebar-surface: #141518;
  --border-subtle: #e2e4e8;
  --border-strong: #c9cdd3;
  --text-primary: #17191c;
  --text-secondary: #4e535a;
  --text-muted: #737982;
  --text-inverse: #fff;
  --success: #15803d;
  --success-soft: #e8f5ee;
  --warning: #b7791f;
  --warning-soft: #fff4db;
  --danger: #b91c1c;
  --danger-soft: #fdecec;
  --info: #0f5e8c;
  --info-soft: #e8f3fa;
  --ai-violet: #5b4dff;
  --ai-violet-soft: #efeeff;
  --trace-blue: #2563eb;
  --trace-blue-soft: #eaf1ff;
  --font-ui: "Inter", "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 84px;
  --header-height: 72px;
  --right-panel-width: 360px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-panel: 0 12px 32px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text-primary);
  background: var(--app-bg);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
}

body.theme-dark {
  color-scheme: dark;
  --app-bg: #101216;
  --surface: #17191d;
  --surface-muted: #22252b;
  --surface-soft: #1c1f25;
  --border-subtle: #30343c;
  --border-strong: #474c56;
  --text-primary: #f4f6f8;
  --text-secondary: #c1c7d0;
  --text-muted: #8e96a3;
  --brand-red-soft: #3a1219;
  --success-soft: #10281b;
  --warning-soft: #2f2410;
  --danger-soft: #351316;
  --info-soft: #102536;
  --ai-violet-soft: #252146;
  --trace-blue-soft: #12233f;
  --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.28);
  --shadow-panel: 0 16px 44px rgba(0, 0, 0, 0.38);
}

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

button {
  cursor: pointer;
}

.material-symbols-outlined {
  font-size: 20px;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  line-height: 1;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

body.auth-locked {
  overflow: auto;
}

body.auth-locked .app-shell,
body.auth-locked .drawer-backdrop,
body.auth-locked .detail-drawer,
body.auth-locked .settings-backdrop,
body.auth-locked .settings-panel {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 480px);
  gap: 32px;
  align-items: center;
  padding: clamp(24px, 5vw, 64px);
  background:
    radial-gradient(circle at 12% 16%, rgba(207, 10, 44, 0.18), transparent 32%),
    radial-gradient(circle at 86% 10%, rgba(37, 99, 235, 0.11), transparent 30%),
    linear-gradient(135deg, var(--app-bg), var(--surface));
}

body:not(.auth-locked) .login-screen {
  display: none;
}

.login-brand-panel {
  display: grid;
  gap: 28px;
  max-width: 760px;
}

.login-logo-card {
  display: inline-grid;
  place-items: center;
  width: 230px;
  min-height: 76px;
  padding: 12px 0;
}

.login-logo-card img {
  display: block;
  max-width: 100%;
  max-height: 74px;
  object-fit: contain;
}

body.theme-dark .login-logo-card img {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35)) brightness(1.08);
}

.login-brand-panel h1 {
  max-width: 720px;
  margin-bottom: 12px;
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1.03;
  letter-spacing: 0;
}

.login-brand-panel p {
  max-width: 620px;
  font-size: 17px;
}

.login-signal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 150px));
  gap: 12px;
}

.login-signal-grid div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow-card);
}

.login-signal-grid span,
.login-signal-grid strong {
  display: block;
}

.login-signal-grid span {
  margin-bottom: 4px;
  color: var(--brand-red);
  font-size: 24px;
  font-weight: 900;
}

.login-signal-grid strong {
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
}

.login-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  box-shadow: var(--shadow-panel);
}

.login-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.login-card-header h2 {
  margin-bottom: 0;
  font-size: 30px;
}

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

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-form .field {
  height: 46px;
  font-size: 15px;
}

.login-submit {
  width: 100%;
  min-height: 46px;
}

.login-error {
  display: none;
  margin: -4px 0 0;
  padding: 10px 12px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(185, 28, 28, 0.2);
  border-radius: 10px;
  font-weight: 800;
}

.login-error.show {
  display: block;
}

.login-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  background: var(--border-subtle);
}

.azure-signin {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 900;
}

.azure-signin:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: var(--trace-blue-soft);
}

.azure-mark {
  width: 18px;
  height: 18px;
  display: inline-block;
  background:
    linear-gradient(90deg, #f25022 0 46%, transparent 46% 54%, #7fba00 54% 100%) top / 100% 46% no-repeat,
    linear-gradient(90deg, #00a4ef 0 46%, transparent 46% 54%, #ffb900 54% 100%) bottom / 100% 46% no-repeat;
}

.login-theme-row {
  display: grid;
  gap: 10px;
}

.login-theme-row>span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.segmented-control.compact {
  margin-top: 0;
}

.login-hint {
  padding: 12px;
  color: var(--text-secondary);
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--surface-muted);
}

.login-hint strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

body.theme-dark .login-signal-grid div {
  background: rgba(23, 25, 29, 0.78);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 16px;
  color: var(--text-inverse);
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  transition: width 180ms ease, transform 180ms ease, padding 180ms ease;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 6px 24px;
}

.brand-copy {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-red);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-name {
  overflow: hidden;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle,
.user-role {
  overflow: hidden;
  color: var(--brand-metal-grey);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding-right: 2px;
}

.sidebar-collapse-button {
  width: 32px;
  height: 32px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #b5b5b7;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  transition: background 160ms ease, color 160ms ease, transform 120ms ease;
}

.sidebar-collapse-button:hover {
  color: #fff;
  background: var(--sidebar-surface);
  transform: translateY(-1px);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 10px 12px;
  color: #b5b5b7;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-link span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-link:hover {
  color: #fff;
  background: var(--sidebar-surface);
}

.nav-link.active {
  color: #fff;
  background: var(--brand-red);
  transform: scale(0.985);
}

.sidebar-footer {
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-chip {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px 6px;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  transition: background 160ms ease, transform 120ms ease;
}

.user-chip:hover {
  background: var(--sidebar-surface);
  transform: translateY(-1px);
}

.avatar {
  width: 34px;
  height: 34px;
  display: block;
  border-radius: 999px;
  background: #2a2c31;
  object-fit: cover;
  object-position: center;
}

.user-name {
  color: #fff;
  font-weight: 700;
}

.workspace {
  min-width: 0;
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: margin-left 180ms ease;
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
  padding-inline: 12px;
}

body.sidebar-collapsed .workspace {
  margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .brand {
  justify-content: center;
  padding-inline: 0;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .user-chip>div:not(.avatar),
body.sidebar-collapsed .nav-link span:last-child {
  width: 0;
  opacity: 0;
  pointer-events: none;
}

body.sidebar-collapsed .sidebar-collapse-button {
  position: absolute;
  top: 18px;
  right: -15px;
  background: var(--sidebar-bg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}

body.sidebar-collapsed .sidebar-nav {
  align-items: center;
  padding-right: 0;
}

body.sidebar-collapsed .nav-link {
  width: 48px;
  justify-content: center;
  padding-inline: 0;
}

body.sidebar-collapsed .sidebar-footer {
  display: flex;
  justify-content: center;
}

body.sidebar-collapsed .user-chip {
  justify-content: center;
  padding-inline: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
  width: 100%
}

.topbar-logo {
  width: 174px;
  height: 52px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: visible;
  background: transparent;
  border: 0;
}

.topbar-logo-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 55px;
  object-fit: cover;
  object-position: center;
}

body.theme-dark .topbar-logo-image {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35)) brightness(1.08);
}

.product-context {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  font-weight: 700;
}

.context-divider {
  width: 1px;
  height: 22px;
  background: var(--border-subtle);
}

.context-state {
  color: var(--brand-red);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: min(340px, 30vw);
}

.search-box .material-symbols-outlined {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 19px;
}

.search-box input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 40px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: #fafafa;
  color: var(--text-primary);
  outline: none;
}

.search-box input:focus,
.field:focus,
select:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(207, 10, 44, 0.12);
}

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

.menu-button {
  display: none;
}

.page {
  min-height: calc(100vh - var(--header-height));
  padding: 24px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--right-panel-width);
  gap: 24px;
  align-items: start;
}

.page-grid.wide-panel {
  grid-template-columns: 280px minmax(0, 1fr) var(--right-panel-width);
}

.page-grid.two-column {
  grid-template-columns: 300px minmax(0, 1fr);
}

.screen-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 22px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.35;
}

p {
  color: var(--text-secondary);
}

.header-actions,
.toolbar,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  color: var(--text-primary);
  background: #fff;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--brand-red);
  color: #fff;
}

.button-primary:hover {
  background: var(--brand-red-dark);
}

.button-secondary {
  border-color: var(--border-subtle);
  background: #fff;
}

.button-secondary:hover {
  background: var(--surface-muted);
}

.button-ai {
  border-color: rgba(91, 77, 255, 0.25);
  color: var(--ai-violet);
  background: var(--ai-violet-soft);
}

.button-success {
  background: var(--success);
  color: #fff;
}

.button-danger {
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.25);
  background: var(--danger-soft);
}

.button-ghost {
  color: var(--text-secondary);
  background: transparent;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text-secondary);
  background: transparent;
  transition: background 160ms ease, transform 120ms ease;
}

.icon-button:hover {
  color: var(--text-primary);
  background: var(--surface-muted);
}

.card,
.panel {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.card {
  padding: 18px;
}

.panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: #fff;
}

.panel-header.ai {
  background: var(--ai-violet-soft);
  border-bottom-color: rgba(91, 77, 255, 0.18);
}

.panel-body {
  padding: 18px;
}

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

.kpi-card {
  position: relative;
  min-height: 128px;
  padding: 16px;
  overflow: hidden;
}

.kpi-card::after {
  content: "";
  position: absolute;
  inset: auto -16px -42px auto;
  width: 96px;
  height: 96px;
  border-radius: 999px;
  background: var(--brand-red-soft);
  opacity: 0.9;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  color: var(--brand-red);
  background: var(--brand-red-soft);
  border-radius: 10px;
}

.kpi-label {
  color: var(--text-secondary);
  font-weight: 700;
}

.kpi-value {
  color: var(--text-primary);
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

.kpi-caption {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.badge,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.chip {
  color: var(--trace-blue);
  border: 1px solid rgba(37, 99, 235, 0.25);
  background: var(--trace-blue-soft);
}

.badge.generated,
.badge.ai {
  color: var(--ai-violet);
  background: var(--ai-violet-soft);
}

.badge.approved,
.badge.covered,
.badge.passed,
.badge.complete {
  color: var(--success);
  background: var(--success-soft);
}

.badge.needs-review,
.badge.partial,
.badge.warning,
.badge.draft {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge.rejected,
.badge.gap,
.badge.blocked,
.badge.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.badge.grey {
  color: var(--text-secondary);
  background: var(--surface-muted);
}

.data-table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--text-secondary);
  background: #fafafa;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-table tbody tr {
  transition: background 140ms ease;
}

.data-table tbody tr:hover {
  background: #fafafa;
}

.data-table tbody tr[data-detail] {
  cursor: pointer;
}

.mono {
  font-family: var(--font-mono);
  font-weight: 600;
}

.score {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 96px;
}

.score-track {
  width: 44px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6e8ec;
}

.score-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--success);
}

.score-fill.warn {
  background: #d99020;
}

.score-fill.danger {
  background: var(--danger);
}

.insight-card {
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: #fff;
}

.insight-card.warning {
  border-color: rgba(185, 28, 28, 0.2);
  background: var(--danger-soft);
}

.insight-card.ai {
  border-color: rgba(91, 77, 255, 0.2);
  background: rgba(239, 238, 255, 0.55);
}

.insight-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 800;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 14px;
}

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

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

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

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 28px;
  text-align: center;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: #fff;
}

.drop-zone .material-symbols-outlined {
  font-size: 42px;
  color: var(--brand-red);
}

.document-preview {
  min-height: 620px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.doc-page {
  min-height: 540px;
  padding: 24px;
  background: linear-gradient(#fff, #fff), repeating-linear-gradient(0deg, #fff, #fff 27px, #f5f5f5 28px);
  border: 1px solid #e6e6e6;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}



.highlight {
  background: #fff4bc;
  border-radius: 3px;
  box-shadow: 0 0 0 2px #fff4bc;
  color: var(--text-muted)
}

.outline-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.outline-item,
.selectable-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  text-align: left;
}

.outline-item:hover,
.selectable-card:hover {
  color: var(--text-primary);
  background: #fafafa;
}

.outline-item.active,
.selectable-card.active {
  color: var(--brand-red);
  background: var(--brand-red-soft);
  border-color: rgba(207, 10, 44, 0.18);
}

.section-preview {
  min-width: 0;
  min-height: 620px;
  padding: 30px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.section-preview h2 {
  border-bottom: 2px solid var(--brand-red);
  padding-bottom: 12px;
}

.document-builder-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 22px;
  padding: 22px;
  color: #fff;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.94), rgba(18, 20, 26, 0.96)),
    radial-gradient(circle at 82% 10%, rgba(91, 77, 255, 0.32), transparent 34%);
  box-shadow: var(--shadow-card);
}

.document-builder-hero p {
  max-width: 850px;
  color: rgba(255, 255, 255, 0.76);
}

.document-type-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
}

.document-type-card label {
  display: grid;
  gap: 8px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.document-type-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.document-type-metrics div {
  min-width: 0;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
}

.document-type-metrics span,
.document-type-metrics strong {
  display: block;
}

.document-type-metrics span {
  margin-bottom: 4px;
  font-size: 20px;
  font-weight: 900;
}

.document-type-metrics strong {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  text-transform: uppercase;
}

.document-editor-toolbar {
  position: sticky;
  top: calc(var(--header-height) + 10px);
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.document-editor-toolbar .button {
  min-height: 34px;
  padding: 6px 10px;
}

.toolbar-divider {
  width: 1px;
  height: 28px;
  background: var(--border-subtle);
}

.document-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.document-source-row {
  margin-bottom: 18px;
}

.document-editor-surface {
  min-height: 420px;
  padding: 18px;
  color: var(--text-primary);
  border: 1px solid transparent;
  border-radius: 12px;
  outline: none;
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, rgba(207, 10, 44, 0.28), rgba(91, 77, 255, 0.22)) border-box;
}

.document-editor-surface:focus {
  border-color: rgba(207, 10, 44, 0.5);
  box-shadow: 0 0 0 4px rgba(207, 10, 44, 0.12);
}

.document-editor-surface h2,
.document-editor-surface h3 {
  border: 0;
  padding-bottom: 0;
}

.document-editor-surface table {
  width: 100%;
}

.document-editor-surface pre {
  overflow: auto;
  padding: 14px;
  border-radius: 10px;
  background: var(--surface-muted);
}

.brd-workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.brd-document-column {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.section-preview .data-table {
  min-width: 100%;
}

.brd-readiness {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.brd-readiness summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  color: var(--text-primary);
  list-style: none;
  cursor: pointer;
}

.brd-readiness summary::-webkit-details-marker {
  display: none;
}

.brd-readiness summary span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.brd-readiness summary strong {
  color: var(--ai-violet);
  white-space: nowrap;
}

.brd-readiness-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 0 18px 14px;
}

.brd-readiness>.button {
  margin: 0 18px 18px;
}

.diagram-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
}

.diagram-canvas {
  min-height: 520px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.flow-node {
  position: relative;
  min-height: 86px;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: #fff;
  font-weight: 800;
}

.flow-node.decision {
  border-color: rgba(207, 10, 44, 0.32);
  background: var(--brand-red-soft);
}

.flow-node.success {
  border-color: rgba(21, 128, 61, 0.28);
  background: var(--success-soft);
}

.flow-node::after {
  content: "arrow_forward";
  position: absolute;
  right: -22px;
  color: var(--text-muted);
  font-family: "Material Symbols Outlined";
  font-size: 22px;
}

.flow-node:last-child::after {
  display: none;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.mermaid-shell {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(rgba(37, 99, 235, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.035) 1px, transparent 1px),
    #fff;
  background-size: 28px 28px;
}

.mermaid-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 800;
}

.mermaid-status span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mermaid-stage {
  --diagram-zoom: 1;
  --diagram-pan-x: 0px;
  --diagram-pan-y: 0px;
  min-height: 360px;
  display: block;
  padding: 28px;
  overflow: hidden;
}

.mermaid-stage .mermaid {
  width: 100%;
  margin: 0;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.mermaid-stage svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  transform: translate(var(--diagram-pan-x), var(--diagram-pan-y)) scale(var(--diagram-zoom));
  transform-origin: center center;
  transition: transform 120ms ease;
}

.mermaid-stage:has(svg) {
  cursor: grab;
}

.mermaid-stage.is-panning {
  cursor: grabbing;
  user-select: none;
}

.mermaid-stage.is-panning svg {
  transition: none;
}

.diagram-code-panel {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: #101216;
}

.diagram-code-panel .panel-header {
  color: #fff;
  background: #17191c;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.diagram-code-panel .panel-header h2 {
  margin: 0;
}

.diagram-code {
  width: 100%;
  min-height: 240px;
  max-height: 240px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  resize: vertical;
  border: 0;
  outline: none;
  color: #f4f6f8;
  background: #101216;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
}

.diagram-zoom-label {
  min-width: 52px;
  padding: 8px 10px;
  color: var(--text-secondary);
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  text-align: center;
  font-weight: 800;
}

.wireframe-canvas {
  min-height: 620px;
  padding: 24px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(rgba(37, 99, 235, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.045) 1px, transparent 1px),
    #fff;
  background-size: 24px 24px;
  box-shadow: var(--shadow-card);
}

.wireframe-page {
  max-width: 920px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
}

.wireframe-top {
  display: flex;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 2px solid #d6d9df;
}

.wireframe-body {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.wf-section {
  padding: 16px;
  border: 1px solid #d5d8de;
  border-radius: 8px;
}

.wf-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wf-field {
  height: 40px;
  border-radius: 6px;
  background: #f1f2f4;
  border: 1px solid #d8dbe1;
}

.wf-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 22px;
}

.wf-button {
  width: 118px;
  height: 36px;
  border-radius: 6px;
  background: #d9dce2;
}

.wf-button.primary {
  background: #9ea4af;
}

.chart-row {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
}

.donut {
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
  margin: 10px auto;
  border-radius: 999px;
  background: conic-gradient(var(--success) 0 48%, var(--warning) 48% 77%, var(--danger) 77% 100%);
}

.donut-core {
  width: 100px;
  height: 100px;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: #fff;
  font-size: 24px;
  font-weight: 800;
}

.bar-chart {
  display: flex;
  align-items: stretch;
  gap: 16px;
  height: 190px;
  padding-top: 12px;
}

.bar {
  flex: 1;
  min-width: 46px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 8px;
  height: 100%;
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.bar-fill {
  width: 100%;
  min-height: 8px;
  flex: 0 0 auto;
  border-radius: 8px 8px 3px 3px;
  border-style: solid;
  background: linear-gradient(180deg, var(--brand-red), var(--brand-red-soft));
}

.trace-visual-card {
  position: relative;
  margin-bottom: 18px;
  padding: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.trace-visual-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 0%, rgba(207, 10, 44, 0.08), transparent 28%),
    radial-gradient(circle at 88% 4%, rgba(37, 99, 235, 0.09), transparent 30%);
}

.trace-visual-header {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
  margin-bottom: 14px;
}

.trace-visual-header p {
  max-width: 840px;
}

.trace-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.trace-summary-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.trace-summary-grid span,
.trace-summary-grid strong {
  display: block;
}

.trace-summary-grid span {
  margin-bottom: 4px;
  color: var(--brand-red);
  font-size: 22px;
  font-weight: 900;
}

.trace-summary-grid strong {
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
}

.trace-legend {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.trace-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.trace-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.trace-legend .source {
  background: var(--brand-red);
}

.trace-legend .requirement {
  background: var(--trace-blue);
}

.trace-legend .criteria {
  background: var(--ai-violet);
}

.trace-legend .test {
  background: var(--success);
}

.trace-legend .diagram {
  background: var(--warning);
}

.trace-legend .document {
  background: var(--text-secondary);
}

.trace-legend .gap {
  background: var(--danger);
}

.trace-graph {
  position: relative;
  z-index: 1;
  min-height: 560px;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    #fff;
  background-size: 28px 28px;
}

.trace-sankey {
  display: block;
  min-width: 920px;
}

.trace-link {
  mix-blend-mode: multiply;
  transition: stroke-opacity 140ms ease, stroke-width 140ms ease;
}

.trace-link:hover {
  stroke-opacity: 0.58;
}

.trace-node rect {
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.14));
}

.trace-tooltip {
  position: absolute;
  z-index: 5;
  max-width: 280px;
  padding: 10px 12px;
  pointer-events: none;
  opacity: 0;
  color: #fff;
  border-radius: 10px;
  background: rgba(23, 25, 28, 0.94);
  box-shadow: var(--shadow-panel);
  transition: opacity 100ms ease;
}

.trace-tooltip strong,
.trace-tooltip span,
.trace-tooltip em {
  display: block;
}

.trace-tooltip span,
.trace-tooltip em {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-style: normal;
}

.trace-graph-fallback {
  display: none;
  position: relative;
  z-index: 1;
  margin-top: 10px;
  padding: 12px;
  color: var(--text-secondary);
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--surface-muted);
}

.export-summary {
  position: sticky;
  top: 96px;
}

.package-card {
  position: relative;
  display: block;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
}

.package-card input {
  position: absolute;
  opacity: 0;
}

.package-card.selected {
  border-color: rgba(207, 10, 44, 0.45);
  background: var(--brand-red-soft);
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: var(--border-strong);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 160ms ease;
}

.switch[aria-checked="true"] {
  background: var(--trace-blue);
}

.switch[aria-checked="true"]::after {
  transform: translateX(20px);
}

.field,
select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: #fff;
  color: var(--text-primary);
  outline: none;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.criteria-control-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
  gap: 18px;
  align-items: end;
}

.criteria-control-bar label {
  min-width: 0;
  display: grid;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 800;
}

.criteria-control-bar .field {
  min-width: 0;
  width: 100%;
}

.criteria-format-toggle {
  margin-top: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.empty-state {
  display: none;
  padding: 28px;
  color: var(--text-secondary);
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: #fff;
}

.portfolio-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 24px;
  margin-bottom: 24px;
  padding: 28px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 18% 0%, rgba(0, 0, 0, 0.28), transparent 34%),
    linear-gradient(135deg, #090a0c 0%, #1b1d22 52%, #000000 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-panel);
}

.portfolio-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(90deg, transparent, #000 35%, transparent);
}

.portfolio-hero>* {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 760px;
}

.hero-copy .eyebrow,
.portfolio-hero p {
  color: rgba(255, 255, 255, 0.72);
}

.hero-copy h1 {
  margin: 8px 0 12px;
  font-size: clamp(34px, 5vw, 64px);
  letter-spacing: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.portfolio-hero .button-secondary {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.portfolio-hero .button-ai {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(91, 77, 255, 0.34);
}

.hero-panel {
  display: grid;
  gap: 14px;
  align-content: stretch;
}

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

.signal-grid div,
.command-strip {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.signal-grid span {
  display: block;
  margin-bottom: 4px;
  color: #fff;
  font-size: 30px;
  font-weight: 800;
}

.signal-grid strong {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.command-strip {
  display: grid;
  gap: 14px;
}

.command-strip strong {
  color: #fff;
}

.portfolio-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.portfolio-toolbar h2 {
  margin-bottom: 4px;
  font-size: 24px;
}

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

.project-card {
  position: relative;
  display: flex;
  min-height: 360px;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: rgba(207, 10, 44, 0.24);
  box-shadow: var(--shadow-panel);
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--brand-red);
}

.project-blue::before {
  background: var(--trace-blue);
}

.project-violet::before {
  background: var(--ai-violet);
}

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

.project-card-header h2 {
  margin: 6px 0 8px;
}

.project-body {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.readiness-ring {
  --value: 0;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: conic-gradient(var(--brand-red) calc(var(--value) * 1%), #e8eaee 0);
}

.readiness-ring span {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  color: var(--text-primary);
  background: #fff;
  border-radius: inherit;
  font-size: 22px;
  font-weight: 800;
}

.project-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.project-metrics div {
  padding: 12px 8px;
  text-align: center;
  background: #fafafa;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

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

.project-metrics strong {
  font-size: 20px;
}

.project-metrics span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.project-footer span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.portfolio-extras {
  margin-top: 18px;
}

.quick-action-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}

.quick-action-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.24);
}

.quick-action-card>.material-symbols-outlined {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--brand-red);
  background: var(--brand-red-soft);
  border-radius: 12px;
}

.profile-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.profile-identity {
  position: sticky;
  top: 96px;
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.profile-avatar {
  width: 112px;
  height: 112px;
  display: block;
  object-fit: cover;
  object-position: center;
  background: var(--brand-red-soft);
  border-radius: 28px;
  border: 3px solid var(--surface);
}

.profile-identity h1 {
  font-size: 28px;
}

.profile-status {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.profile-contact {
  width: 100%;
  display: grid;
  gap: 12px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  text-align: left;
}

.profile-contact div {
  display: grid;
  gap: 3px;
}

.profile-contact strong {
  overflow-wrap: anywhere;
}

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

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  display: none;
  background: rgba(9, 10, 12, 0.24);
}

.drawer-backdrop.open {
  display: block;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  width: min(440px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid var(--border-subtle);
  box-shadow: -16px 0 40px rgba(15, 23, 42, 0.18);
  transform: translateX(105%);
  transition: transform 180ms ease;
}

.detail-drawer.open {
  transform: translateX(0);
}

.drawer-header,
.drawer-footer {
  padding: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--text-inverse);
  background: var(--brand-red)
}

.drawer-header .eyebrow {
  color: var(--text-inverse)
}

.drawer-header h2 {
  margin: 4px 0 0;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.drawer-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 0;
  background: #fafafa;
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 49;
  display: none;
  background: rgba(9, 10, 12, 0.28);
}

.settings-backdrop.open {
  display: block;
}

.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(420px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid var(--border-subtle);
  box-shadow: -16px 0 42px rgba(15, 23, 42, 0.18);
  transform: translateX(105%);
  transition: transform 180ms ease;
}

.settings-panel.open {
  transform: translateX(0);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--brand-red);
  color: var(--text-inverse);
}

.settings-header .eyebrow {
  color: var(--text-inverse);
}

.settings-header h2 {
  margin: 4px 0 0;
}

.settings-body {
  display: grid;
  gap: 16px;
  overflow-y: auto;
  padding: 18px;
}

.settings-section {
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.settings-section h3 {
  margin-bottom: 6px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  padding: 4px;
  background: var(--surface-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.segmented-control button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 9px;
  font-weight: 800;
}

.segmented-control button.active {
  color: #fff;
  background: var(--brand-red);
  box-shadow: 0 8px 20px rgba(207, 10, 44, 0.22);
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
}

.settings-toggle strong,
.settings-toggle small {
  display: block;
}

.settings-toggle small {
  color: var(--text-muted);
  font-weight: 600;
}

body.theme-dark .settings-header {
  border-color: var(--border-subtle);
}

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

.detail-row {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

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

.eyebrow {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 280px;
  max-width: 360px;
  padding: 12px 14px;
  color: #fff;
  background: #202329;
  border-radius: 12px;
  box-shadow: var(--shadow-panel);
  font-weight: 700;
  animation: toast-in 180ms ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

.ai-admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.55fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
  padding: 24px;
  overflow: hidden;
  color: #fff;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.94), rgba(18, 20, 26, 0.96)),
    radial-gradient(circle at 82% 10%, rgba(91, 77, 255, 0.32), transparent 34%);
  box-shadow: var(--shadow-card);
}

.ai-admin-hero p {
  max-width: 880px;
  color: rgba(255, 255, 255, 0.78);
}

.ai-admin-hero .eyebrow,
.document-builder-hero .eyebrow {
  color: rgba(255, 255, 255, 0.72);
}

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

.ai-admin-metrics div {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
}

.ai-admin-metrics span {
  display: block;
  margin-bottom: 6px;
  font-size: 24px;
  font-weight: 900;
}

.ai-admin-metrics strong {
  font-size: 12px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.ai-admin-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.ai-global-settings-panel {
  margin-bottom: 22px;
}

.ai-catalog {
  position: sticky;
  top: calc(var(--header-height) + 18px);
  max-height: calc(100vh - var(--header-height) - 42px);
}

.ai-catalog .panel-body {
  max-height: calc(100vh - var(--header-height) - 110px);
  overflow: auto;
}

.ai-catalog-filters,
.ai-prompt-toolbar,
.ai-service-form,
.ai-global-toggle-grid,
.ai-prompt-support-grid {
  display: grid;
  gap: 10px;
}

.ai-global-settings-panel .panel-body {
  display: grid;
  gap: 14px;
}

.ai-catalog-filters {
  grid-template-columns: 1fr;
  margin-bottom: 14px;
}

.ai-stage-group {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.ai-stage-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.ai-stage-heading strong {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  color: var(--brand-red);
  border-radius: 999px;
  background: var(--brand-red-soft);
}

.ai-prompt-card {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: #fff;
  color: var(--text-primary);
  transition: border-color 160ms ease, background 160ms ease, transform 120ms ease;
}

.ai-prompt-card:hover {
  transform: translateY(-1px);
  border-color: rgba(207, 10, 44, 0.28);
  background: #fff9fa;
}

.ai-prompt-card.active {
  border-color: rgba(207, 10, 44, 0.5);
  background: var(--brand-red-soft);
  box-shadow: inset 4px 0 0 var(--brand-red);
}

.ai-prompt-card .mono {
  color: var(--brand-red);
  font-size: 11px;
}

.ai-prompt-card small {
  color: var(--text-secondary);
  line-height: 1.45;
}

.ai-prompt-meta,
.ai-context-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-editor-stack,
.ai-side-stack {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.ai-editor-panel .panel-body {
  display: grid;
  gap: 16px;
}

.ai-prompt-toolbar {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto auto;
  align-items: end;
}

.ai-prompt-toolbar label,
.ai-service-form label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.ai-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 14px;
}

.ai-code-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-muted);
}

.ai-code-card.prompt {
  grid-row: span 2;
}

.ai-code-card>span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.ai-code-card textarea {
  width: 100%;
  min-height: 220px;
  padding: 14px;
  resize: vertical;
  color: #e9eef7;
  border: 1px solid #242a35;
  border-radius: 10px;
  outline: none;
  background: #11151c;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
}

.ai-code-card.prompt textarea {
  min-height: 482px;
}

.ai-code-card textarea:focus {
  border-color: rgba(207, 10, 44, 0.75);
  box-shadow: 0 0 0 3px rgba(207, 10, 44, 0.16);
}

.ai-code-card textarea.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.18);
}

.ai-system-prompt {
  max-height: 240px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
}

.ai-service-form {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.ai-service-form label:nth-child(8) {
  grid-column: span 2;
}

.ai-global-toggle-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-prompt-support-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.ai-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  color: var(--text-secondary);
  font-weight: 800;
  border-top: 1px solid var(--border-subtle);
}

.ai-sim-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(91, 77, 255, 0.2);
  border-radius: 12px;
  background: rgba(239, 238, 255, 0.55);
}

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

.ai-validation-grid div {
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: #fff;
}

.ai-validation-grid span,
.ai-validation-grid strong {
  display: block;
}

.ai-validation-grid span {
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

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

.ai-run-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.ai-run-item:last-child {
  border-bottom: 0;
}

.ai-run-item span,
.ai-run-item small {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary);
}

.hide {
  display: none !important;
}

body.theme-dark .topbar,
body.theme-dark .card,
body.theme-dark .panel,
body.theme-dark .login-card,
body.theme-dark .azure-signin,
body.theme-dark .section-preview,
body.theme-dark .trace-visual-card,
body.theme-dark .document-editor-toolbar,
body.theme-dark .diagram-canvas,
body.theme-dark .document-preview,
body.theme-dark .drop-zone,
body.theme-dark .wireframe-canvas,
body.theme-dark .project-card,
body.theme-dark .ai-prompt-card,
body.theme-dark .quick-action-card,
body.theme-dark .brd-readiness,
body.theme-dark .detail-drawer,
body.theme-dark .donut-core,
body.theme-dark .settings-panel {
  background: var(--surface);
  border-color: var(--border-subtle);
}

body.theme-dark .panel-header,
body.theme-dark .drawer-footer,
body.theme-dark .wireframe-page,
body.theme-dark .wireframe-top,
body.theme-dark .wireframe-body,
body.theme-dark .project-metrics div,
body.theme-dark .trace-summary-grid div,
body.theme-dark .search-box input,
body.theme-dark .field,
body.theme-dark select,
body.theme-dark .button-secondary,
body.theme-dark .diagram-zoom-label,
body.theme-dark .mermaid-shell,
body.theme-dark .mermaid-status,
body.theme-dark .ai-code-card,
body.theme-dark .ai-validation-grid div,
body.theme-dark .document-editor-surface,
body.theme-dark .doc-page,
body.theme-dark .readiness-ring span,
body.theme-dark .empty-state {
  color: var(--text-primary);
  background: var(--surface-muted);
  border-color: var(--border-subtle);
}

body.theme-dark .package-card {
  background: var(--surface-muted);
  border-color: var(--border-subtle);
}

body.theme-dark .package-card.selected {
  background: var(--brand-red-soft);
  border-color: rgba(207, 10, 44, 0.45);
}

body.theme-dark .trace-graph {
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    var(--surface);
  background-size: 28px 28px;
}

body.theme-dark .trace-link {
  mix-blend-mode: screen;
}

body.theme-dark .data-table th,
body.theme-dark .data-table tbody tr:hover,
body.theme-dark .outline-item:hover,
body.theme-dark .selectable-card:hover,
body.theme-dark .ai-prompt-card:hover {
  background: #20232a;
}

body.theme-dark .data-table th,
body.theme-dark .data-table td,
body.theme-dark .drawer-header,
body.theme-dark .drawer-footer,
body.theme-dark .panel-header,
body.theme-dark .project-footer,
body.theme-dark .brd-readiness summary,
body.theme-dark .canvas-toolbar {
  border-color: var(--border-subtle);
}

body.theme-dark .insight-card {
  color: var(--text-primary);
  background: #1c1f25;
  border-color: var(--border-subtle);
}

body.theme-dark .insight-card.ai {
  background: rgba(91, 77, 255, 0.16);
}

body.theme-dark .ai-prompt-card.active {
  background: rgba(207, 10, 44, 0.16);
}

body.theme-dark .ai-sim-card {
  background: rgba(91, 77, 255, 0.16);
}

body.theme-dark .document-editor-surface {
  background: linear-gradient(var(--surface-muted), var(--surface-muted)) padding-box, linear-gradient(135deg, rgba(207, 10, 44, 0.36), rgba(91, 77, 255, 0.26)) border-box;
}

body.theme-dark .insight-card.warning {
  background: rgba(185, 28, 28, 0.16);
}

body.theme-dark .button-secondary:hover,
body.theme-dark .icon-button:hover {
  background: #2a2e36;
}

body.theme-dark .kpi-card::after {
  opacity: 0.42;
  background: var(--brand-metal-grey)
}

body.theme-dark .mermaid-stage {
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    var(--surface);
  background-size: 28px 28px;
}

body.theme-dark .wireframe-canvas {
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    var(--surface);
  background-size: 24px 24px;
}

body.compact-ui .data-table th,
body.compact-ui .data-table td {
  padding: 8px 10px;
}

body.compact-ui .card,
body.compact-ui .panel-body {
  padding: 14px;
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  scroll-behavior: auto !important;
  transition-duration: 0.01ms !important;
  animation-duration: 0.01ms !important;
}

@media (max-width: 1180px) {

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

  .page-grid,
  .page-grid.wide-panel,
  .brd-workspace,
  .document-builder-hero,
  .criteria-control-bar,
  .profile-layout,
  .diagram-layout,
  .ai-admin-hero,
  .ai-admin-layout,
  .ai-service-form,
  .ai-global-toggle-grid,
  .ai-prompt-support-grid,
  .trace-visual-header,
  .chart-row,
  .login-screen,
  .portfolio-hero {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    max-width: none;
  }

  .ai-catalog {
    position: static;
    max-height: none;
  }

  .ai-catalog .panel-body {
    max-height: none;
  }

  .ai-prompt-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

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

  .brd-readiness-grid {
    grid-template-columns: 1fr;
  }

  .export-summary {
    position: static;
  }

  .profile-identity {
    position: static;
  }
}

@media (max-width: 900px) {
  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-width);
    padding: 16px;
  }

  body.sidebar-collapsed .workspace,
  .workspace {
    margin-left: 0;
  }

  body.sidebar-collapsed .brand {
    justify-content: flex-start;
    padding: 8px 6px 24px;
  }

  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .user-chip>div:not(.avatar),
  body.sidebar-collapsed .nav-link span:last-child {
    width: auto;
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-collapsed .sidebar-collapse-button {
    position: static;
    box-shadow: none;
  }

  body.sidebar-collapsed .sidebar-nav {
    align-items: stretch;
  }

  body.sidebar-collapsed .nav-link {
    width: auto;
    justify-content: flex-start;
    padding: 10px 12px;
  }

  body.sidebar-collapsed .sidebar-footer {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-button {
    display: inline-grid;
  }

  .topbar {
    padding: 0 14px;
  }

  .topbar-logo {
    width: 136px;
    height: 44px;
  }

  .topbar-logo-image {
    max-height: 44px;
  }

  .product-context {
    display: none;
  }

  .search-box {
    width: min(46vw, 320px);
  }

  .topbar-actions .button-secondary {
    display: none;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 16px;
  }

  .topbar-actions .button-primary {
    display: none;
  }

  .search-box {
    width: 52vw;
  }

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

  .portfolio-hero {
    padding: 20px;
  }

  .portfolio-toolbar,
  .project-footer {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .project-body {
    grid-template-columns: 1fr;
  }

  .readiness-ring {
    justify-self: center;
  }

  .kpi-grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .profile-summary,
  .ai-admin-metrics,
  .trace-summary-grid,
  .login-signal-grid,
  .ai-prompt-toolbar,
  .ai-editor-grid,
  .ai-prompt-list,
  .wf-fields {
    grid-template-columns: 1fr;
  }

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

  .flow-node::after {
    content: "arrow_downward";
    right: auto;
    bottom: -24px;
  }

  .drawer-footer {
    grid-template-columns: 1fr;
  }
}

.login-brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.login-logo-card {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-card img {
  width: 220px;
  height: auto;
  object-fit: contain;
}

.login-brand-divider {
  width: 1px;
  height: 90px;
  background: rgba(255, 255, 255, 0.28);
}

.login-brand-copy h1 {
  margin: 0 0 0.4rem;
  font-size: 2rem;
  line-height: 1.1;
}

.login-brand-copy p {
  margin: 0;
  font-size: 1rem;
  opacity: 0.85;
}

.login-intro-copy {
  margin-top: 1.75rem;
  max-width: 560px;
}

.login-intro-copy p {
  margin: 0;
  line-height: 1.6;
}

.login-signal-grid div span {
  font-size: 1.15rem;
  font-weight: 700;
}

.login-signal-grid div strong {
  display: block;
  margin-top: 0.35rem;
}