:root {
  --bg: #f6f1e8;
  --surface: #fffdf8;
  --surface-alt: #f0e7d8;
  --ink: #15130f;
  --muted: #6d665c;
  --line: #e2d7c2;
  --line-strong: #c7b896;
  --teal: #0a6b5f;
  --teal-soft: #e4f2ed;
  --blue: #274b6d;
  --blue-soft: #e8eef3;
  --green: #286245;
  --green-soft: #e4f1e7;
  --amber: #b86a16;
  --amber-soft: #fff0d1;
  --gold: #f0b429;
  --red: #a33a2d;
  --red-soft: #f8e3df;
  --violet: #5e4b75;
  --violet-soft: #eee8f4;
  --header-bg: #070707;
  --header-line: #26231e;
  --header-muted: #c9c0ad;
  --shadow: 0 16px 44px rgba(49, 42, 31, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.35;
}

body {
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sprite {
  display: none;
}

.app-shell {
  background: linear-gradient(180deg, var(--bg) 0%, #fbf8f1 44%, #f4f4ee 100%);
  min-height: 100vh;
  padding: 0 20px 20px;
}

.app-header {
  align-items: center;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-line);
  color: #fffdf8;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 0 -20px 18px;
  min-height: 72px;
  padding: 14px max(20px, calc((100vw - 1680px) / 2 + 20px));
  z-index: 12;
}

.brand-lockup {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 13px;
  min-height: 42px;
  min-width: 0;
  padding: 0;
}

.brand-logo {
  display: block;
  height: 33px;
  width: 99px;
}

.brand-divider {
  background: rgba(255, 253, 248, 0.24);
  display: block;
  height: 28px;
  width: 1px;
}

.brand-copy {
  color: var(--header-muted);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.top-nav {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: center;
  min-width: 0;
}

.top-nav-item {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--header-muted);
  display: inline-flex;
  font-size: 13px;
  font-weight: 750;
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.top-nav-item:hover,
.top-nav-item.active {
  background: rgba(255, 253, 248, 0.1);
  border-color: rgba(255, 253, 248, 0.16);
  color: #fffdf8;
}

.app-header .icon-button,
.app-header .ghost-button {
  background: rgba(255, 253, 248, 0.08);
  border-color: rgba(255, 253, 248, 0.16);
  color: #fffdf8;
}

.app-header .icon-button:hover,
.app-header .ghost-button:hover {
  background: rgba(255, 253, 248, 0.13);
  border-color: rgba(255, 253, 248, 0.26);
}

.app-header .tool-action {
  display: none;
}

.app-shell.mapper-mode .app-header .tool-action {
  display: inline-flex;
}

.is-hidden {
  display: none !important;
}

.portal-board {
  display: grid;
  gap: 16px;
  grid-template-columns: 320px minmax(0, 1fr);
  margin: 0 auto 16px;
  max-width: 1680px;
}

.portal-account,
.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.portal-account {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 42px minmax(0, 1fr);
  padding: 14px;
}

.account-icon {
  align-items: center;
  background: var(--ink);
  border-radius: 8px;
  color: #fffdf8;
  display: flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.account-copy {
  min-width: 0;
}

.account-label {
  color: var(--teal);
  display: block;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.account-copy strong,
.account-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 15px;
  margin-top: 2px;
}

.account-copy small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.account-actions {
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
}

.account-actions > button {
  flex: 1 1 0;
}

.portal-intro {
  align-items: center;
  background: linear-gradient(135deg, var(--ink) 0%, #1f1a13 54%, #3a2a12 100%);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: #fffdf8;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-width: 0;
  padding: 22px;
}

.portal-intro .eyebrow {
  color: var(--gold);
}

.portal-intro h1 {
  font-size: 30px;
}

.portal-intro p {
  color: var(--header-muted);
  margin: 6px 0 0;
}

.portal-intro-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.portal-intro .primary-button {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
}

.portal-intro .primary-button:hover {
  background: #d99b1d;
}

.portal-intro .ghost-button {
  background: rgba(255, 253, 248, 0.08);
  border-color: rgba(255, 253, 248, 0.18);
  color: #fffdf8;
}

.product-home {
  margin: 0 auto 16px;
  max-width: 1680px;
}

.product-library {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

.product-library .portal-section {
  background: rgba(255, 253, 248, 0.68);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.portal-products {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-width: 0;
}

.portal-section {
  min-width: 0;
}

.portal-section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.portal-section-heading span {
  font-size: 13px;
  font-weight: 850;
}

.portal-section-heading small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

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

.product-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 196px;
  padding: 14px;
}

.product-media {
  align-items: center;
  background: linear-gradient(135deg, #15130f, #3a2a12);
  border-radius: 8px;
  display: flex;
  height: 104px;
  justify-content: center;
  margin-bottom: 2px;
  overflow: hidden;
}

.product-media img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.product-card.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(10, 107, 95, 0.12), var(--shadow);
}

.product-card.available {
  background: linear-gradient(180deg, var(--surface) 0%, #fff6e5 100%);
}

.product-card.available .primary-button {
  background: var(--amber);
  border-color: var(--amber);
  color: #fffdf8;
}

.product-card.available .primary-button:hover {
  background: #96520f;
}

.product-topline,
.product-footer {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

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

.product-type,
.product-access {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 850;
  min-height: 22px;
  padding: 0 8px;
}

.product-type {
  background: var(--teal-soft);
  color: var(--teal);
}

.product-access {
  background: var(--surface-alt);
  color: var(--muted);
}

.product-card h3 {
  font-size: 14px;
  margin-bottom: 0;
}

.product-card p {
  color: var(--muted);
  flex: 1 1 auto;
  font-size: 12px;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.product-price {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.product-price s {
  color: var(--muted);
  font-weight: 500;
  margin-right: 4px;
}

.compact-button {
  min-height: 34px;
  padding: 0 10px;
}

.portal-empty {
  align-items: center;
  background: rgba(255, 253, 248, 0.64);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  min-height: 180px;
  padding: 16px;
}

.product-detail {
  min-width: 0;
}

.product-detail-shell {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 330px;
}

.product-detail-main,
.product-detail-side,
.resource-card,
.product-side-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.product-detail-main {
  overflow: hidden;
}

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

.product-detail-media {
  align-items: center;
  background: linear-gradient(135deg, #15130f, #3a2a12);
  border-radius: 8px;
  display: flex;
  flex: 0 0 108px;
  height: 108px;
  justify-content: center;
  overflow: hidden;
}

.product-detail-media img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.product-detail-heading h2 {
  font-size: 24px;
  margin-top: 8px;
}

.product-detail-heading p {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 0;
  max-width: 760px;
}

.product-detail-status {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: right;
}

.product-detail-status strong {
  font-size: 18px;
}

.product-detail-status s {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  margin-right: 5px;
}

.product-copy-grid {
  background: #fff8eb;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px;
}

.product-copy-block {
  min-width: 0;
}

.product-copy-block span {
  color: var(--teal);
  display: block;
  font-size: 11px;
  font-weight: 850;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.product-copy-block h3 {
  font-size: 16px;
  margin-bottom: 7px;
}

.product-copy-block p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.resource-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  padding: 18px;
}

.resource-card {
  box-shadow: none;
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  min-height: 156px;
  overflow: hidden;
}

.resource-card.locked {
  opacity: 0.82;
}

.resource-preview {
  align-items: center;
  background: linear-gradient(135deg, var(--ink), #3a2a12);
  color: #fffdf8;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  min-height: 156px;
  padding: 14px;
  text-align: center;
}

.resource-preview svg {
  height: 30px;
  width: 30px;
}

.resource-preview span {
  color: var(--header-muted);
  font-size: 13px;
  font-weight: 850;
}

.image-preview {
  background: #080808;
  min-height: 156px;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.image-preview img {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.image-preview span {
  background: rgba(7, 7, 7, 0.72);
  border: 1px solid rgba(255, 253, 248, 0.2);
  border-radius: 999px;
  bottom: 12px;
  color: #fffdf8;
  left: 12px;
  min-height: 24px;
  padding: 3px 9px;
  position: absolute;
}

.resource-preview.google-doc {
  background: linear-gradient(135deg, var(--blue), #0f2f4b);
}

.resource-preview.google-sheet {
  background: linear-gradient(135deg, #1f6f43, #0d3f28);
}

.resource-preview.docx {
  background: linear-gradient(135deg, #274b6d, #0f2f4b);
}

.resource-preview.chatgpt-gpt {
  background: linear-gradient(135deg, #0a6b5f, #111f1c);
}

.resource-preview.download {
  background: linear-gradient(135deg, var(--teal), #073d37);
}

.resource-preview.youtube-video,
.resource-preview.youtube-playlist {
  background: linear-gradient(135deg, #15130f, #702b18);
}

.resource-preview.application {
  background: linear-gradient(135deg, var(--green), #143b2a);
}

.video-embed {
  aspect-ratio: 16 / 9;
  min-height: 0;
  padding: 0;
}

.video-embed iframe {
  border: 0;
  display: block;
  height: 100%;
  width: 100%;
}

.resource-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
}

.resource-content h3 {
  font-size: 15px;
  margin-bottom: 0;
}

.resource-content p {
  color: var(--muted);
  flex: 1 1 auto;
  font-size: 13px;
  margin: 0;
}

.product-detail-side {
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.product-side-section {
  box-shadow: var(--shadow);
  padding: 14px;
}

.product-side-section h3 {
  font-size: 13px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.product-list {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  padding-left: 18px;
}

.product-list li {
  margin: 7px 0;
}

.product-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.full-action {
  width: 100%;
}

.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 2px;
  text-transform: uppercase;
}

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

h1 {
  font-size: 28px;
  line-height: 1.1;
  margin-bottom: 0;
}

h2 {
  font-size: 15px;
  margin-bottom: 0;
}

h3 {
  font-size: 14px;
  margin-bottom: 8px;
}

.header-actions,
.action-row,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-actions {
  align-items: center;
  flex-wrap: nowrap;
}

.view-header .inline-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.primary-button,
.ghost-button,
.square-button,
.tab {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.icon-button,
.ghost-button,
.tab {
  background: var(--surface);
  color: var(--ink);
}

.icon-button:hover,
.ghost-button:hover,
.square-button:hover,
.tab:hover {
  border-color: var(--line-strong);
}

.primary-button {
  background: var(--teal);
  border-color: var(--teal);
  color: #fffdf8;
  font-weight: 750;
}

.primary-button:hover {
  background: #084f47;
}

.square-button {
  aspect-ratio: 1;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  width: 36px;
}

svg {
  display: block;
  flex: 0 0 auto;
  height: 18px;
  width: 18px;
}

svg path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.workspace {
  display: grid;
  gap: 16px;
  grid-template-columns: 320px minmax(0, 1fr) 360px;
  margin: 0 auto;
  max-width: 1680px;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

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

.panel-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 48px;
  padding: 12px 14px;
}

.import-panel,
.list-panel,
.diagnosis-panel,
.brief-panel {
  overflow: hidden;
}

.drop-zone {
  align-items: center;
  background: linear-gradient(180deg, var(--surface), #faf1e3);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 14px;
  min-height: 88px;
  padding: 14px;
  text-align: center;
}

.drop-zone.dragging {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal);
}

.drop-zone input {
  display: none;
}

textarea,
.search-input,
.field input,
.field textarea,
.field select,
.step-input {
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
}

textarea:focus,
.search-input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus,
.step-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(10, 107, 95, 0.14);
}

#pasteInput {
  display: block;
  margin: 0 14px 12px;
  min-height: 134px;
  padding: 10px;
  resize: vertical;
  width: calc(100% - 28px);
}

.action-row {
  padding: 0 14px 14px;
}

.action-row > button {
  flex: 1 1 120px;
}

.status-pill {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 750;
  min-height: 26px;
  padding: 0 10px;
}

.status-pill.good {
  background: var(--green-soft);
  border-color: #a7cfb0;
  color: var(--green);
}

.status-pill.warn {
  background: var(--amber-soft);
  border-color: #dfbf7f;
  color: var(--amber);
}

.status-pill.bad {
  background: var(--red-soft);
  border-color: #e2aaa4;
  color: var(--red);
}

.search-input {
  display: block;
  height: 38px;
  margin: 14px;
  padding: 0 10px;
  width: calc(100% - 28px);
}

.workflow-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 475px);
  min-height: 260px;
  overflow: auto;
  padding: 0 10px 12px;
}

.workflow-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: inherit;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.workflow-item:hover {
  background: #f8efe1;
}

.workflow-item.active {
  background: var(--teal-soft);
  border-color: #8fc5ba;
}

.workflow-name {
  display: block;
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-meta {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.severity-dot {
  border-radius: 50%;
  height: 10px;
  margin-top: 4px;
  width: 10px;
}

.severity-dot.good {
  background: var(--green);
}

.severity-dot.warn {
  background: var(--amber);
}

.severity-dot.bad {
  background: var(--red);
}

.canvas-area {
  min-width: 0;
}

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

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-height: 78px;
  padding: 12px 14px;
}

.metric-label {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 750;
}

.metric-value {
  display: block;
  font-size: 24px;
  font-weight: 850;
  line-height: 1.2;
  margin-top: 4px;
}

.tabs {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  padding: 6px;
}

.tab {
  border-color: transparent;
  flex: 0 1 auto;
  min-width: 118px;
}

.tab.active {
  background: var(--ink);
  color: #fffdf8;
}

.main-view {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-height: calc(100vh - 200px);
  overflow: hidden;
}

.view-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 64px;
  padding: 14px 18px;
}

.view-title {
  min-width: 0;
}

.view-title h2 {
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-title p {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.view-body {
  padding: 18px;
}

.empty-state {
  align-items: center;
  color: var(--muted);
  display: flex;
  min-height: 360px;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.flow-stage {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 12px 4px 20px;
}

.flow-node {
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  flex: 0 0 172px;
  grid-template-rows: auto minmax(54px, auto) auto;
  min-height: 136px;
  padding: 12px;
  position: relative;
  text-align: left;
  user-select: text;
}

.flow-node::after {
  background: var(--line-strong);
  content: "";
  height: 2px;
  position: absolute;
  right: -13px;
  top: 50%;
  width: 13px;
}

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

.flow-node.ai {
  background: var(--green-soft);
  border-color: #a7cfb0;
}

.flow-node.automation {
  background: var(--blue-soft);
  border-color: #bccbd8;
}

.flow-node.human {
  background: var(--amber-soft);
  border-color: #dfbf7f;
}

.flow-node.risk {
  background: var(--red-soft);
  border-color: #e2aaa4;
}

.flow-node.system {
  background: var(--violet-soft);
  border-color: #c8b9d5;
}

.node-type {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.node-label {
  align-self: center;
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

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

.map-lower {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  margin-top: 10px;
}

.summary-band,
.step-detail,
.score-panel {
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

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

.summary-item {
  min-width: 0;
}

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

.summary-item strong {
  display: block;
  font-size: 18px;
  margin-top: 2px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.legend span {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  gap: 7px;
  min-height: 26px;
  padding: 0 10px;
}

.legend i {
  border-radius: 50%;
  display: block;
  height: 9px;
  width: 9px;
}

.legend .ai i {
  background: var(--green);
}

.legend .automation i {
  background: var(--blue);
}

.legend .human i {
  background: var(--amber);
}

.legend .risk i {
  background: var(--red);
}

.legend .system i {
  background: var(--violet);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field textarea,
.field select,
.step-input {
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

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

.steps-editor {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.step-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 34px minmax(0, 1fr) 36px;
  margin-bottom: 8px;
}

.step-index {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 850;
  height: 34px;
  justify-content: center;
}

.priority-table {
  border-collapse: collapse;
  width: 100%;
}

.priority-table th,
.priority-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
}

.priority-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.priority-table tr:hover td {
  background: #fff7ea;
}

.score-meter {
  background: var(--surface-alt);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  width: min(140px, 100%);
}

.score-meter span {
  background: var(--teal);
  display: block;
  height: 100%;
}

.issue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

.issue {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px;
}

.issue.critical {
  border-left-color: var(--red);
}

.issue.warning {
  border-left-color: var(--amber);
}

.issue.info {
  border-left-color: var(--blue);
}

.issue.success {
  border-left-color: var(--green);
}

.issue-title {
  display: block;
  font-size: 13px;
  font-weight: 850;
}

.issue-detail {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 0;
}

.question-list {
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

.ai-panel {
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.ai-panel h3 {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 0;
}

.ai-summary {
  background: var(--teal-soft);
  border: 1px solid #8fc5ba;
  border-radius: 8px;
  color: #174b43;
  font-size: 13px;
  padding: 10px;
}

.ai-block {
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.ai-block strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.ai-block ul,
.ai-block ol {
  margin: 0;
  padding-left: 18px;
}

.ai-block li {
  color: var(--muted);
  font-size: 12px;
  margin: 3px 0;
}

.ai-error {
  background: var(--red-soft);
  border: 1px solid #e2aaa4;
  border-radius: 8px;
  color: var(--red);
  font-size: 13px;
  padding: 10px;
}

.spinner {
  animation: spin 900ms linear infinite;
  border: 2px solid var(--line);
  border-radius: 50%;
  border-top-color: var(--teal);
  display: inline-block;
  height: 16px;
  width: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.question-list h3 {
  margin-bottom: 2px;
}

.question {
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.question label {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.question-control {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.question input {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 36px;
  padding: 0 9px;
  width: 100%;
}

.selection-button {
  min-height: 36px;
  padding: 0 10px;
}

.field-evidence {
  align-items: flex-start;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: 6px;
  line-height: 1.35;
  margin-top: 6px;
  min-width: 0;
}

.field-evidence span {
  background: var(--green-soft);
  border: 1px solid #a7cfb0;
  border-radius: 999px;
  color: var(--green);
  flex: 0 0 auto;
  font-weight: 850;
  padding: 1px 7px;
}

.field-evidence q {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#briefPreview {
  background: #fffaf2;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
  max-height: 300px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.full-width {
  margin: 14px;
  width: calc(100% - 28px);
}

.toast {
  background: var(--ink);
  border-radius: 8px;
  bottom: 18px;
  color: #fffdf8;
  left: 50%;
  max-width: min(460px, calc(100vw - 28px));
  opacity: 0;
  padding: 12px 14px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.small-note {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 0;
}

.compact-text {
  color: var(--muted);
  font-size: 13px;
}

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

.tag {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 750;
  min-height: 24px;
  padding: 0 8px;
}

.tag.green {
  background: var(--green-soft);
  color: var(--green);
}

.tag.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.red {
  background: var(--red-soft);
  color: var(--red);
}

@media (max-width: 1280px) {
  .portal-board,
  .workspace {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .portal-products {
    grid-template-columns: 1fr;
  }

  .product-library {
    grid-template-columns: 1fr;
  }

  .product-detail-shell {
    grid-template-columns: 1fr;
  }

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

  .inspector {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    display: grid;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 0 12px 12px;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
    margin: 0 -12px 14px;
    padding: 14px 12px;
  }

  .top-nav {
    justify-content: flex-start;
    order: 3;
    overflow-x: auto;
    width: 100%;
  }

  .workspace,
  .portal-board,
  .inspector {
    grid-template-columns: 1fr;
  }

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

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

  .product-copy-grid {
    grid-template-columns: 1fr;
  }

  .product-detail-heading {
    flex-direction: column;
  }

  .product-detail-media {
    flex-basis: auto;
    width: 100%;
  }

  .product-detail-status {
    align-items: flex-start;
    text-align: left;
  }

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

  .form-grid,
  .map-lower {
    grid-template-columns: 1fr;
  }

  .workflow-list {
    max-height: 360px;
  }
}

@media (max-width: 560px) {
  .header-actions,
  .tabs {
    width: 100%;
  }

  .header-actions > button,
  .tab {
    flex: 1 1 0;
    min-width: 0;
  }

  .brand-lockup {
    width: 100%;
  }

  .brand-copy {
    white-space: normal;
  }

  .portal-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-intro-actions,
  .portal-intro-actions > button {
    width: 100%;
  }

  .metric-strip,
  .summary-grid,
  .product-row {
    grid-template-columns: 1fr;
  }

  .product-topline,
  .product-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-card-actions,
  .product-card-actions > button {
    width: 100%;
  }

  .product-detail-heading h2 {
    font-size: 21px;
  }

  .question-control {
    grid-template-columns: 1fr;
  }

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

  .flow-node {
    flex-basis: 154px;
  }
}
