:root {
  color-scheme: light;
  --ink: #0b3558;
  --accent: #006bff;
  --accent-hover: #0059d6;
  --muted: #476788;
  --line: #d4e0ed;
  --line-strong: #b9cadd;
  --subtle: #f0f3f8;
  --canvas: #f8f9fb;
  --surface: #ffffff;
  --danger: #b42318;
  --warning: #8a5a00;
  --radius-control: 8px;
  --shadow-sm: 0 1px 2px rgb(11 53 88 / 4%), 0 8px 24px rgb(11 53 88 / 5%);
  --shadow-drawer: 0 24px 64px rgb(11 53 88 / 14%);
  --motion-fast: 160ms;
  --motion-panel: 240ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  font-family: Inter, "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; line-height: 1.55; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, input, select, textarea, summary { outline: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { box-shadow: 0 0 0 3px rgb(0 107 255 / 18%); }
button { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); line-height: 1.2; }
h1 { font-size: 32px; font-weight: 680; }
h2 { font-size: 20px; font-weight: 680; }
h3 { font-size: 15px; font-weight: 680; }
h1[tabindex]:focus, h2[tabindex]:focus { outline: none; }
[hidden] { display: none !important; }
.status-message[hidden] { display: none; }

.app-header { position: sticky; z-index: 40; top: 0; height: 64px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(18px); }
.app-header__inner { display: flex; align-items: center; min-height: 64px; padding: 0 20px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 232px; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 4px); align-items: end; gap: 3px; width: 30px; height: 30px; padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.brand-mark i { display: block; border-radius: 1px; background: var(--accent); }
.brand-mark i:nth-child(1) { height: 7px; opacity: .5; }
.brand-mark i:nth-child(2) { height: 13px; opacity: .72; }
.brand-mark i:nth-child(3) { height: 17px; }
.product-name, .diagnostic-name { margin: 0; }
.product-name { color: var(--ink); font-size: 13px; font-weight: 720; }
.diagnostic-name { color: var(--muted); font-size: 10px; }
.header-status { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--muted); font-size: 11px; }
.header-status button { padding: 2px 5px; border: 0; background: transparent; color: var(--accent); font: inherit; cursor: pointer; }
.header-status[data-state="loading"] .status-dot { animation: status-pulse 1s ease-in-out infinite; }
.header-status[data-state="connected"] .status-dot { background: var(--accent); }
.header-status[data-state="error"] .status-dot { background: #b94a54; box-shadow: 0 0 0 3px rgb(185 74 84 / 10%); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgb(0 107 255 / 10%); }
.header-tools { display: none; align-items: center; gap: 8px; margin-left: auto; }
.workspace-active .header-status { display: flex; }
.workspace-active .header-tools { display: flex; margin-left: 12px; }
.project-switcher { display: grid; min-width: 220px; padding: 6px 32px 6px 11px; border: 0; border-left: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.project-switcher span { color: var(--muted); font-size: 9px; }
.project-switcher strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.icon-tool, .avatar-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast); }
.icon-tool { border-radius: 7px; color: var(--muted); font-size: 18px; }
.avatar-button { border-radius: 50%; background: var(--ink); color: white; font-size: 11px; font-weight: 750; }
.icon-tool:hover, .avatar-button:hover { border-color: var(--line-strong); transform: translateY(-1px); }

.product-shell { min-height: calc(100vh - 64px); }
.workspace-sidebar { position: fixed; z-index: 30; top: 64px; bottom: 0; left: 0; display: none; width: 232px; padding: 22px 14px 16px; border-right: 1px solid var(--line); background: var(--surface); }
.workspace-active .workspace-sidebar { display: flex; flex-direction: column; animation: sidebar-in var(--motion-panel) var(--ease-out) both; }
.sidebar-heading { display: grid; gap: 3px; padding: 0 10px 18px; border-bottom: 1px solid var(--line); }
.sidebar-overline { color: #7891ab; font-size: 9px; font-weight: 760; }
.sidebar-heading strong { font-size: 14px; }
.sidebar-nav { display: grid; gap: 4px; margin-top: 16px; }
.sidebar-item { position: relative; display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; transition: color var(--motion-fast), background var(--motion-fast); }
.sidebar-item[hidden] { display: none; }
.sidebar-item::before { position: absolute; top: 8px; bottom: 8px; left: -14px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; content: ""; }
.sidebar-item:hover { background: var(--subtle); color: var(--ink); }
.sidebar-item.is-active { background: #edf5ff; color: var(--accent); font-weight: 650; }
.sidebar-item.is-active::before { background: var(--accent); }
.sidebar-icon { display: grid; place-items: center; width: 20px; height: 20px; color: currentColor; font-size: 13px; }
.sidebar-role-switcher { display: grid; gap: 5px; margin-top: auto; padding: 14px 8px; border-top: 1px solid var(--line); }
.sidebar-role-switcher span { margin-bottom: 3px; color: #7891ab; font-size: 9px; font-weight: 700; }
.sidebar-role-switcher button { min-height: 31px; padding: 5px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.sidebar-role-switcher button:hover { background: var(--subtle); color: var(--ink); }
.sidebar-footer { display: flex; align-items: center; gap: 9px; padding: 12px 8px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }

.app-main { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 22px 0 72px; }
.workspace-active .app-main { width: auto; max-width: 1500px; margin-left: 232px; padding: 24px 36px 80px; }
.global-boundary { display: flex; gap: 8px; margin-bottom: 16px; color: var(--muted); font-size: 11px; }
.workspace-active .global-boundary { padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; background: rgb(255 255 255 / 70%); }
.status-message { position: fixed; z-index: 80; top: 76px; right: 24px; max-width: 420px; margin: 0; padding: 11px 14px; border: 1px solid #9dbfee; border-radius: 7px; background: #eef6ff; color: var(--ink); box-shadow: var(--shadow-sm); animation: toast-in var(--motion-panel) var(--ease-out); }
.view.is-entering { animation: view-enter 220ms var(--ease-out) both; }

.workspace-page-heading, .page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 14px 0 24px; }
.workspace-page-heading h1, .page-heading h1 { margin: 3px 0 7px; }
.workspace-page-heading p, .page-heading p { margin-bottom: 0; color: var(--muted); }
.workspace-eyebrow, .dialog-kicker, .panel-label, .row-kicker { margin: 0; color: var(--accent); font-size: 10px; font-weight: 760; text-transform: uppercase; }
.heading-actions, .action-row, .button-group, .output-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.primary-button, .secondary-button, .text-button, .icon-button { min-height: 38px; padding: 8px 13px; border: 1px solid transparent; border-radius: var(--radius-control); cursor: pointer; transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast); }
.primary-button { border-color: var(--accent); background: var(--accent); color: white; box-shadow: 0 7px 16px rgb(0 107 255 / 15%); }
.primary-button:hover { border-color: var(--accent-hover); background: var(--accent-hover); transform: translateY(-1px); }
.secondary-button { border-color: var(--line); background: var(--surface); color: var(--ink); }
.secondary-button:hover { border-color: #a8bed6; background: var(--subtle); }
.text-button { padding-inline: 4px; border: 0; background: transparent; color: var(--accent); }
.icon-button { width: 38px; padding: 0; border-color: var(--line); background: var(--surface); color: var(--muted); font-size: 20px; }

.workspace-overview { display: grid; grid-template-columns: minmax(0, 1.8fr) repeat(3, minmax(120px, .58fr)); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); }
.overview-primary, .overview-metric { min-width: 0; padding: 20px; }
.overview-primary { border-right: 1px solid var(--line); }
.overview-primary__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.overview-primary h2 { margin: 8px 0 6px; font-size: 19px; }
.overview-primary p { margin-bottom: 0; color: var(--muted); }
.overview-metric + .overview-metric { border-left: 1px solid var(--line); }
.overview-metric span { display: block; color: var(--muted); font-size: 11px; }
.overview-metric strong { display: block; margin-top: 7px; color: var(--ink); font-size: 26px; font-weight: 680; }
.stage-progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 18px; }
.stage-progress span { height: 4px; border-radius: 2px; background: var(--line); }
.stage-progress span.is-done, .stage-progress span.is-active { background: var(--accent); }
.stage-progress span.is-active { opacity: .55; }

.work-queue { margin-top: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.queue-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 19px 20px 15px; border-bottom: 1px solid var(--line); }
.queue-header h2 { margin: 0 0 4px; }
.queue-header p { margin: 0; color: var(--muted); font-size: 12px; }
.queue-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.queue-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.queue-toolbar input[type="search"] { width: min(260px, 100%); }
.queue-toolbar input[type="search"], .queue-toolbar select { min-height: 36px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }
.mine-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); cursor: pointer; }
.filter-spacer { flex: 1; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; background: #fbfcfe; }
.filter-chip { min-height: 28px; padding: 4px 8px; border: 1px solid #b8d3f7; border-radius: 6px; background: #eef6ff; color: #175b9e; font-size: 11px; }
.queue-table-wrap { overflow-x: auto; }
.queue-table { width: 100%; min-width: 980px; border-collapse: collapse; table-layout: fixed; }
.queue-table th { height: 42px; padding: 9px 10px; border-bottom: 1px solid var(--line); background: #fbfcfe; color: var(--muted); font-size: 10px; font-weight: 700; text-align: left; }
.queue-table td { height: 62px; padding: 10px; border-bottom: 1px solid #e7edf4; color: var(--muted); font-size: 12px; vertical-align: middle; }
.queue-table tbody tr { transition: background var(--motion-fast); }
.queue-table tbody tr:hover { background: #f6f9fd; }
.queue-table tbody tr.is-selected { background: #edf5ff; }
.queue-table th:first-child, .queue-table td:first-child { width: 42px; text-align: center; }
.queue-table th:nth-child(2), .queue-table td:nth-child(2) { width: 210px; }
.queue-table th:nth-child(6), .queue-table td:nth-child(6) { width: 190px; }
.queue-title-button { width: 100%; padding: 0; border: 0; background: transparent; color: var(--ink); font-weight: 650; text-align: left; cursor: pointer; }
.queue-title-button:hover { color: var(--accent); }
.queue-subtext { display: block; margin-top: 2px; color: #7891ab; font-size: 10px; }
.status-label { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; }
.status-label::before { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); content: ""; }
.status-label--blocked::before { background: var(--warning); }
.evidence-meter { display: grid; grid-template-columns: minmax(54px, 1fr) auto; align-items: center; gap: 7px; }
.evidence-meter i { display: block; height: 4px; overflow: hidden; border-radius: 2px; background: var(--line); }
.evidence-meter i::after { display: block; width: var(--evidence); height: 100%; background: var(--accent); content: ""; }
.row-action { min-height: 30px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--accent); cursor: pointer; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; color: var(--muted); font-size: 11px; }
.pagination-controls { display: flex; gap: 5px; }
.pagination button { min-width: 32px; min-height: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; }
.pagination button[aria-current="page"] { border-color: var(--accent); background: var(--accent); color: white; }
.queue-state { display: grid; place-items: center; min-height: 260px; padding: 40px; text-align: center; }
.queue-state h3 { margin-bottom: 7px; font-size: 17px; }
.queue-state p { max-width: 440px; margin-bottom: 16px; color: var(--muted); }
.queue-loading .skeleton-row { width: min(820px, 90%); height: 14px; margin: 10px; border-radius: 4px; background: linear-gradient(90deg, var(--subtle), #e5ebf3, var(--subtle)); background-size: 200% 100%; animation: skeleton 1.2s linear infinite; }
.queue-error { color: var(--danger); }
.queue-empty { color: var(--muted); }

.drawer-scrim { position: fixed; z-index: 60; inset: 64px 0 0; border: 0; background: rgb(11 53 88 / 18%); cursor: default; animation: fade-in var(--motion-panel) ease both; }
.detail-drawer { position: fixed; z-index: 70; top: 64px; right: 0; bottom: 0; width: min(620px, calc(100vw - 260px)); overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-drawer); transform: translateX(102%); transition: transform var(--motion-panel) var(--ease-out); }
.detail-drawer.is-open { transform: translateX(0); }
.drawer-header { position: sticky; z-index: 2; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(16px); }
.drawer-header h2 { margin: 5px 0 0; font-size: 21px; }
.drawer-body { padding: 22px; }
.drawer-section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.drawer-section:first-child { padding-top: 0; }
.drawer-section h3 { margin-bottom: 10px; }
.drawer-section p { color: var(--muted); }
.drawer-facts, .drawer-evidence, .owner-list, .employee-materials { margin: 0; padding: 0; list-style: none; }
.drawer-facts li, .drawer-evidence li { padding: 11px 0; border-bottom: 1px solid #e8eef5; }
.drawer-evidence strong { display: block; margin-bottom: 3px; color: var(--ink); }
.drawer-action-panel { padding: 18px; border: 1px solid #b9d5fb; border-radius: 8px; background: #f3f8ff; }
.drawer-action-panel textarea { width: 100%; min-height: 130px; padding: 11px; border: 1px solid var(--line); border-radius: 7px; background: white; resize: vertical; }
.permission-notice { padding: 12px; border-left: 3px solid var(--line-strong); background: var(--subtle); color: var(--muted); }
.activity-timeline { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.activity-event { display: grid; grid-template-columns: 8px 1fr; gap: 10px; }
.activity-event__marker { width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; background: var(--accent); }
.activity-event__meta { display: flex; justify-content: space-between; color: #7891ab; font-size: 10px; }
.activity-event__body p { margin: 3px 0 0; }
.bulk-action-bar { position: fixed; z-index: 75; bottom: 20px; left: calc(50% + 116px); display: flex; align-items: center; gap: 8px; padding: 9px 10px 9px 14px; border: 1px solid #9cbfed; border-radius: 8px; background: var(--ink); color: white; box-shadow: 0 18px 50px rgb(11 53 88 / 22%); transform: translateX(-50%); animation: bulk-in var(--motion-panel) var(--ease-out); }
.bulk-action-bar span { margin-right: 5px; font-size: 12px; }
.bulk-action-bar button { min-height: 32px; padding: 5px 9px; border: 1px solid rgb(255 255 255 / 22%); border-radius: 6px; background: rgb(255 255 255 / 10%); color: white; cursor: pointer; }
.bulk-action-bar button:hover { background: rgb(255 255 255 / 18%); }
.success-feedback, .error-feedback { position: fixed; z-index: 90; top: 76px; right: 24px; max-width: 380px; padding: 11px 14px; border: 1px solid #9cbfed; border-radius: 7px; background: #eef6ff; color: var(--ink); box-shadow: var(--shadow-sm); animation: toast-in var(--motion-panel) var(--ease-out); }
.error-feedback { border-color: #efb6b2; background: #fff4f3; color: var(--danger); }

.invitation-view { max-width: 1180px; margin: 18px auto 0; }
.invitation-shell { display: grid; grid-template-columns: minmax(0, .92fr) minmax(520px, 1.08fr); min-height: 620px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); }
.invitation-story { display: flex; flex-direction: column; justify-content: center; padding: 58px 52px; border-right: 1px solid var(--line); background: #edf5ff; }
.invitation-overline { margin-bottom: 20px; color: var(--accent); font-size: 11px; font-weight: 750; }
.invitation-story h1 { margin-bottom: 20px; font-size: 44px; line-height: 1.12; }
.invitation-lead { max-width: 590px; color: var(--muted); line-height: 1.8; }
.invitation-journey { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 34px; border-top: 1px solid #bfd2e8; }
.invitation-journey div { display: grid; gap: 3px; padding: 15px 12px 0 0; }
.invitation-journey span { color: var(--accent); font-size: 10px; font-weight: 750; }
.invitation-journey strong { font-size: 13px; }
.invitation-journey em { color: var(--muted); font-size: 10px; font-style: normal; }
.invitation-entry { display: flex; flex-direction: column; justify-content: center; padding: 50px; }
.entry-heading { margin-bottom: 20px; }
.entry-index { display: block; margin-bottom: 16px; color: #7891ab; font-size: 9px; font-weight: 760; }
.entry-heading h2 { margin-bottom: 8px; font-size: 26px; }
.entry-heading p { color: var(--muted); }
.invitation-form { display: grid; gap: 9px; }
.invitation-form label, .role-selector legend { color: var(--muted); font-size: 11px; font-weight: 650; }
.invitation-form input { min-height: 46px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfe; }
.role-selector { margin: 10px 0 0; padding: 0; border: 0; }
.role-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 7px; }
.role-option { display: grid; gap: 3px; min-height: 82px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--muted); text-align: left; cursor: pointer; }
.role-option:hover, .role-option.is-selected { border-color: #86b9fa; background: #f1f7ff; color: var(--ink); }
.role-option-icon { color: var(--accent); }
.role-option small { color: #7891ab; }
.entry-button { justify-content: space-between; margin-top: 10px; }
.invitation-boundary { margin: 18px 0 0; color: var(--muted); font-size: 10px; }

.formal-entry-view { max-width: 1120px; margin: 24px auto 0; }
.formal-entry-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, .82fr); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); }
.formal-entry-story { padding: 58px; background: #edf5ff; }
.formal-entry-story h1 { max-width: 530px; margin: 14px 0 20px; font-size: 42px; }
.formal-entry-story > p { max-width: 600px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.formal-entry-steps { display: grid; gap: 10px; margin: 34px 0 0; padding: 0; list-style: none; counter-reset: steps; }
.formal-entry-steps li { display: flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 650; }
.formal-entry-steps li::before { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid #9fc0e8; border-radius: 50%; color: var(--accent); content: counter(steps); counter-increment: steps; font-size: 11px; }
.formal-entry-form, .formal-panel { display: grid; align-content: start; gap: 14px; padding: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); }
.formal-entry-form { border: 0; border-radius: 0; box-shadow: none; }
.formal-entry-form h2, .formal-panel h2 { margin: 4px 0 0; }
.formal-entry-form p, .formal-panel p { margin-bottom: 0; color: var(--muted); }
.formal-entry-form label, .formal-panel label, .formal-invitation-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.formal-entry-form input, .formal-panel input, .formal-panel textarea, .formal-invitation-form input, .formal-invitation-form select { width: 100%; min-height: 42px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfe; color: var(--ink); }
.formal-panel textarea { min-height: 120px; resize: vertical; }
.bootstrap-field { margin-top: 3px; }
.form-help { font-size: 11px; line-height: 1.6; }
.formal-page-heading { margin: 12px 0 24px; }
.formal-page-heading h1 { margin: 5px 0 8px; }
.formal-page-heading p:not(.panel-label) { margin: 0; color: var(--muted); }
.formal-builder-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 18px; }
.formal-invitation-panel { grid-template-columns: minmax(220px, .65fr) minmax(0, 1fr); align-items: end; margin-top: 18px; }
.formal-invitation-form { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(160px, .7fr) auto; gap: 10px; align-items: end; }
.formal-project-list { display: grid; gap: 10px; min-height: 120px; }
.formal-project-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.formal-project-row:last-child { border-bottom: 0; }
.formal-project-row strong, .formal-project-row span { display: block; }
.formal-project-row span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.formal-invitation-link { display: grid; gap: 5px; min-width: 0; padding: 12px; border: 1px solid #b8d3f7; border-radius: 7px; background: #f3f8ff; color: var(--ink); font-size: 12px; }
.formal-invitation-link code { overflow-wrap: anywhere; color: #175b9e; }
body.formal-active .app-header, body.formal-active .workspace-sidebar, body.formal-active .global-boundary { display: none !important; }
body.formal-active .app-main { width: min(1180px, calc(100% - 48px)); max-width: none; margin: 0 auto; padding-top: 28px; }

@media (max-width: 760px) { .formal-entry-shell, .formal-builder-grid, .formal-invitation-panel { grid-template-columns: 1fr; } .formal-entry-story { padding: 34px 26px; } .formal-entry-story h1 { font-size: 32px; } .formal-entry-form, .formal-panel { padding: 24px; } .formal-invitation-form { grid-template-columns: 1fr; } body.formal-active .app-main { width: calc(100% - 32px); padding-top: 16px; } }

.project-intro, .project-row, .panel, .output-panel, .activity-panel, .risk-details, .proposal-details, .employee-layout, .verifier-question-panel, .owner-review-panel { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); }
.project-list { display: grid; gap: 12px; }
.project-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.project-row__main { display: flex; align-items: flex-start; gap: 36px; }
.project-meta { display: flex; gap: 24px; margin: 0; }
.project-meta dt { color: var(--muted); font-size: 10px; }
.project-meta dd { margin: 3px 0 0; color: var(--ink); }
.demo-flow { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.demo-flow__steps, .owner-actions, .outcome-grid, .evidence-pair, .owner-grid, .proposal-grid, .risk-grid, .output-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.demo-flow-step, .owner-action, .verifier-outcome { min-height: 86px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: white; text-align: left; cursor: pointer; }
.demo-flow-step.is-active, .owner-action.is-selected, .verifier-outcome.is-selected { border-color: #8ebcf8; background: #f0f6ff; }
.employee-layout { display: grid; grid-template-columns: 1.5fr .7fr; gap: 22px; }
.employee-draft { width: 100%; min-height: 210px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; }
.evidence-card, .owner-card, .proposal-grid article, .risk-grid article, .output-grid article { padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfe; }
.warning-chip, .success-chip, .simulation-note, .state-chip { display: inline-flex; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--subtle); color: var(--muted); font-size: 10px; }
.warning-chip { color: var(--warning); }
.success-chip { color: var(--accent); }
.employee-boundary, .verifier-boundary, .owner-boundary, .workbench-guide, .blocking-message { padding: 12px; border-left: 3px solid #9db5cf; background: var(--subtle); color: var(--muted); }
.confirmation-card--blocked, .confirmation-card--resolved { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); }
.confirmation-card--resolved { border-left: 3px solid var(--accent); }
.fact-list { display: grid; gap: 9px; }
.fact { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.evidence-tag { color: var(--muted); font-size: 10px; }
.stage-rail { margin: 0; padding: 0; list-style: none; }
.stage { display: grid; grid-template-columns: 10px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stage__dot { width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; background: var(--line-strong); }
.stage--active .stage__dot, .stage--done .stage__dot { background: var(--accent); }
.workbench-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 18px; }
.workbench-main { display: grid; min-width: 0; gap: 14px; }
.workbench-wide { grid-column: 1 / -1; }
dialog { max-width: 720px; padding: 0; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-drawer); }
dialog::backdrop { background: rgb(11 53 88 / 24%); }
.wizard-dialog { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; }
.wizard-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 18px 0; padding: 0; list-style: none; }
.wizard-steps li { padding: 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 10px; }
.wizard-steps li.is-active { border-color: var(--accent); color: var(--accent); }

@keyframes view-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sidebar-in { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes bulk-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes skeleton { to { background-position: -200% 0; } }
@keyframes status-pulse { 50% { opacity: .35; } }

@media (max-width: 1080px) {
  .workspace-sidebar { width: 196px; }
  .workspace-active .app-main { margin-left: 196px; padding-inline: 22px; }
  .workspace-overview { grid-template-columns: 1.5fr repeat(3, .55fr); }
  .bulk-action-bar { left: calc(50% + 98px); }
  .invitation-shell { grid-template-columns: 1fr; }
  .invitation-story { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 760px) {
  .app-header__inner { padding-inline: 13px; }
  .diagnostic-name, .project-switcher span, .icon-tool { display: none; }
  .brand-lockup { min-width: 0; }
  .project-switcher { min-width: 0; max-width: 150px; padding-right: 6px; }
  .workspace-active .workspace-sidebar { position: sticky; top: 64px; display: block; width: 100%; height: 52px; padding: 6px 10px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-heading, .sidebar-role-switcher, .sidebar-footer { display: none; }
  .sidebar-nav { display: flex; min-width: max-content; margin: 0; gap: 4px; }
  .sidebar-item { min-height: 38px; padding: 7px 9px; white-space: nowrap; }
  .sidebar-item::before, .sidebar-icon { display: none; }
  .workspace-active .app-main { width: min(100% - 24px, 680px); margin: 0 auto; padding: 14px 0 74px; }
  .global-boundary { display: block; }
  .workspace-page-heading, .page-heading { display: grid; margin-top: 8px; }
  .workspace-page-heading h1, .page-heading h1 { font-size: 27px; }
  .heading-actions { width: 100%; }
  .heading-actions button { flex: 1; }
  .workspace-overview { grid-template-columns: repeat(3, 1fr); }
  .overview-primary { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); }
  .overview-metric { padding: 15px 12px; }
  .overview-metric strong { font-size: 22px; }
  .queue-toolbar { align-items: stretch; }
  .queue-toolbar input[type="search"] { width: 100%; }
  .queue-toolbar select { flex: 1; min-width: 110px; }
  .filter-spacer { display: none; }
  .queue-table { min-width: 0; table-layout: auto; }
  .queue-table th:nth-child(n+4):not(:last-child), .queue-table td:nth-child(n+4):not(:last-child) { display: none; }
  .queue-table th:nth-child(2), .queue-table td:nth-child(2) { width: auto; }
  .queue-table th:last-child, .queue-table td:last-child { width: 92px; }
  .detail-drawer { inset: 0; width: 100%; max-width: none; }
  .drawer-scrim { inset: 0; }
  .drawer-header { top: 0; }
  .bulk-action-bar { right: 10px; bottom: 10px; left: 10px; flex-wrap: wrap; justify-content: center; transform: none; }
  .bulk-action-bar span { width: 100%; text-align: center; }
  .invitation-view { margin-top: 0; }
  .invitation-shell { min-height: 0; }
  .invitation-story, .invitation-entry { padding: 34px 22px; }
  .invitation-story h1 { font-size: 34px; }
  .invitation-journey { grid-template-columns: 1fr; }
  .role-options { grid-template-columns: 1fr; }
  .project-row, .project-row__main { display: grid; }
  .project-meta, .demo-flow__steps, .owner-actions, .outcome-grid, .evidence-pair, .owner-grid, .proposal-grid, .risk-grid, .output-grid, .employee-layout, .workbench-layout { grid-template-columns: 1fr; }
  .workbench-wide { grid-column: auto; }
  .wizard-steps { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
