.workspace, .dialog, .notification {
  --bg: var(--gs-deep);
  --rail: var(--gs-surface);
  --panel: var(--gs-base);
  --surface: var(--gs-raised);
  --line: var(--gs-border);
  --muted: var(--gs-muted);
  --positive: var(--gs-positive);
  --harm: var(--gs-negative);
  font-family: var(--gs-font);
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
button, input, textarea { font: inherit; }
.workspace a { color: inherit; text-decoration: none; }
:where(.workspace, .dialog) :where(button, .button) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 7px 12px; border: 1px solid var(--gs-action-border); border-radius: var(--gs-radius);
  background: var(--gs-action-bg); color: var(--text); font-size: 13px; font-weight: 650; cursor: pointer;
}
:where(.workspace, .dialog) :where(button, .button):hover { border-color: var(--gs-active-edge); }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); color: var(--gs-action-ink); border-color: var(--accent); }
.primary:hover { background: var(--gs-action-hover); }
.plain, .text-button { border-color: transparent; background: transparent; }
.text-button { color: var(--muted); }
[hidden] { display: none !important; }
.workspace { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 52px; padding: 8px 24px; border-bottom: 1px solid var(--line); background: var(--rail);
  color: var(--muted); font-size: 12px;
}
.preview-label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--amber); }
.preview-label span[aria-hidden] { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
main { max-width: 1370px; margin: 0 auto; padding: 24px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(24px, 3vw, 31px); line-height: 1.25; letter-spacing: -.025em; }
h2 { font-size: 17px; line-height: 1.35; }
h3 { font-size: 14px; }
p { line-height: 1.58; }
.muted { color: var(--muted); font-size: 13px; }
.page-head, .section-head, .dialog-head, .list-row, .next-step, .actions, .chips {
  display: flex; align-items: center; gap: 10px;
}
.page-head, .section-head, .dialog-head, .next-step { justify-content: space-between; }
.page-head { margin-bottom: 17px; flex-wrap: wrap; }
.page-head p { margin-top: 5px; }
.panel { border: 1px solid var(--line); border-radius: 11px; background: var(--panel); min-width: 0; }
.panel.pad { padding: 14px; }
.section-head { margin-bottom: 10px; flex-wrap: wrap; }
.next-step {
  flex-wrap: wrap; padding: 13px 14px; margin-bottom: 14px;
  background: var(--gs-selected-bg); border: 1px solid var(--gs-active-edge); border-radius: 10px;
}
.next-step p { margin-top: 2px; }
.chips { flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.ok { color: var(--positive); }
.watch { color: var(--amber); }
.bad { color: var(--harm); }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 13px; }
th { font-size: 11px; color: var(--muted); font-weight: 650; }
th, td { padding: 10px 12px; vertical-align: middle; }
thead th { border-bottom: 1px solid var(--line); background: var(--grid-head); }
thead th:first-child { border-top-left-radius: 10px; }
thead th:last-child { border-top-right-radius: 10px; }
td:last-child { text-align: right; }
td span.line { display: block; margin-top: 3px; }
.ea-name { font-weight: 750; color: var(--text); }
.ea-name:hover { color: var(--accent); text-decoration: underline; }
.compact-link { white-space: nowrap; }
.workspace .tabs, .segments { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.workspace .tabs { border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.workspace .tabs a { font-size: 13px; font-weight: 650; padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; }
.workspace .tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.segments { margin-bottom: 12px; }
.segments button[aria-pressed="true"] { color: var(--accent); border-color: var(--gs-active-edge); background: var(--gs-selected-bg); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stack { display: grid; align-content: start; gap: 12px; }
.key-list { display: grid; gap: 7px; margin: 11px 0 0; }
.key-list div { display: flex; gap: 8px; justify-content: space-between; }
.key-list dt { color: var(--muted); font-size: 13px; }
.key-list dd { margin: 0; text-align: right; font-size: 13px; }
.changes { display: grid; gap: 9px; padding-left: 19px; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.comparison td { border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.comparison th { text-align: right; }
.comparison :is(td, th):first-child { text-align: left; }
.comparison tr:last-child td { border-bottom: 0; }
.period-note { margin: 0 0 10px; }
.comparison-meta { display: flex; gap: 5px 14px; flex-wrap: wrap; margin: 7px 0 12px; }
.actions { justify-content: flex-end; flex-wrap: wrap; }
.note-panel { padding: 12px; background: var(--gs-warn-bg); border: 1px solid var(--gs-warn-edge); border-radius: 8px; }
.note-panel p { margin-top: 4px; }
.comparison + .note-panel, .demo-actions { margin-top: 12px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 11px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history p { margin-top: 3px; overflow-wrap: anywhere; }
.journey { display: grid; align-content: start; gap: 8px; list-style: none; padding: 0; margin: 0; }
.journey li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.journey-step { color: var(--accent); font-size: 12px; padding-top: 2px; }
.journey h2 { font-size: 15px; margin-bottom: 3px; }
.journey-state { display: inline-block; margin-top: 5px; }
.journey .button { align-self: center; }
.dialog {
  width: min(440px, calc(100vw - 26px)); padding: 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--text);
}
.dialog::backdrop { background: var(--gs-backdrop); }
.dialog-head { margin-bottom: 5px; }
.dialog .field { margin: 12px 0; }
.field { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
textarea {
  width: 100%; min-width: 0; resize: vertical; padding: 8px; border: 1px solid var(--gs-border-strong); border-radius: 7px;
  background: var(--bg); color: var(--text);
}
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
.detail-grid.with-chat { grid-template-columns: minmax(0, 1fr) clamp(270px, 28vw, 350px); }
.chat-message { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 8px; font-size: 13px; }
.chat-message p { margin-top: 3px; overflow-wrap: anywhere; }
.messages { max-height: 285px; overflow-y: auto; }
.chat-choices { display: flex; flex-wrap: wrap; gap: 5px 10px; border: 0; padding: 0; margin: 8px 0; font-size: 12px; }
.chat-choices legend { padding: 0 0 4px; color: var(--muted); }
.chat-choices label { display: inline-flex; align-items: center; gap: 4px; }
.chat-choices input { accent-color: var(--accent); margin: 0; }
.chat .actions { margin-top: 8px; }
.notification {
  position: fixed; z-index: 3; bottom: 14px; right: 14px; max-width: min(370px, calc(100vw - 28px));
  pointer-events: none;
  padding: 10px 12px; background: var(--gs-selected-bg); border: 1px solid var(--gs-active-edge); border-radius: 8px; font-size: 13px;
}
@media (max-width: 940px) {
  main { padding: 16px; }
  .detail-grid.with-chat { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .topbar { min-height: 37px; padding: 6px 10px; }
  main { padding: 13px 10px; }
  .two { grid-template-columns: minmax(0, 1fr); }
  .ea-table thead { display: none; }
  .ea-table, .ea-table tbody { display: block; }
  .ea-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px; padding: 10px; }
  .ea-table td { display: block; padding: 0; text-align: left; }
  .ea-table td[data-label]::before { display: block; content: attr(data-label); font-size: 10px; color: var(--muted); }
  .ea-table td:first-child { grid-column: span 2; }
  .comparison th, .comparison td { padding: 8px 4px; font-size: 11px; }
  .journey li { grid-template-columns: 23px minmax(0, 1fr); }
  .journey .button { grid-column: 2; justify-self: start; }
}

/* EA review reuses the workspace's panels, buttons and compact navigation. */
.ea-versions small { color: var(--muted); font-size: 11px; font-weight: 400; }
.ea-trail { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--muted); margin-bottom: 7px; font-size: 12px; }
.workspace .ea-trail a, .workspace .history a { color: var(--accent); }
.ea-trail a:hover, .history a:hover { text-decoration: underline; }
.ea-workflow .page-head { margin-bottom: 8px; }
.ea-workflow .chips { justify-content: flex-start; }
.ea-workflow :is(a, button).primary { color: var(--gs-deep); font-weight: 750; }
.ea-workflow .detail-grid { width: 100%; max-width: 1050px; }
.ea-workflow .tabs { gap: 5px; margin: 8px 0 11px; }
.ea-workflow .tabs a { white-space: nowrap; }
.ea-market { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.ea-market select {
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; min-height: 32px;
  padding: 3px 6px; font: inherit; font-weight: 650;
}
.ea-workflow .ea-sample-note { font-size: 11px; margin-top: 7px; }
.ea-versions { table-layout: fixed; }
.ea-versions th:first-child { width: 41%; }
.ea-versions :is(th, td) { overflow-wrap: anywhere; }
.ea-versions th[scope="row"] { border-bottom: 1px solid var(--line); }
.ea-versions tr:last-child th[scope="row"] { border-bottom: 0; }
.ea-versions small { display: block; margin-top: 3px; }
.ea-versions tbody td { font-size: 13px; }
.ea-metrics tbody td { font-weight: 700; }
.ea-workflow .journey-actions { margin-top: 10px; }
.ea-workflow .history time { display: block; margin-top: 3px; font-size: 11px; }
.ea-workflow .history a { display: inline-flex; align-items: center; min-height: 34px; }
@media (max-width: 670px) {
  .ea-workflow .panel.pad { padding: 10px; }
  .ea-workflow .tabs a { padding: 8px 9px; }
  .ea-versions tbody td { font-size: 12px; }
  .ea-versions small { font-size: 10px; }
  .ea-workflow :is(.journey-actions, .demo-actions) { justify-content: stretch; }
  .ea-workflow :is(.journey-actions, .demo-actions) > * { flex: 1 1 auto; }
}

/* EA catalog and creation preview use the existing workspace colors and controls. */
#main.ea-catalog-main { width: 100%; max-width: none; }
.workspace .ea-mock-nav[hidden] { display: none; }
.ea-review .workspace:has(#ea-sections:not([hidden])) .topbar {
  height: 44px;
  min-height: 44px;
  padding-block: 4px;
}
.workspace #ea-sections {
  background: var(--bg-base);
  gap: 4px;
  padding: 5px clamp(8px, 2vw, 20px);
}
.workspace #ea-sections a {
  justify-content: center;
  min-height: 34px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 650;
}
.workspace #ea-sections a[aria-current="page"] { box-shadow: inset 0 -2px var(--accent); }
.workspace #ea-sections a:focus-visible, .ea-overview-shortcuts a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.ea-overview-shortcuts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding-inline-end: 8px;
  border-inline-end: 1px solid var(--line);
}
.ea-calendar-back { margin: 0 0 9px; }
.ea-index { min-width: 0; }
.ea-index .page-head { justify-content: flex-start; align-items: center; gap: 6px 16px; margin-bottom: 10px; }
.ea-index .small-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  min-height: 34px;
  font-size: 12px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.ea-index .small-button:hover { border-color: var(--accent); }
.ea-index-tabs, .ea-index-filters { margin-bottom: 8px; }
.ea-index-tabs a { gap: 5px; }
.ea-index-tabs b { color: var(--muted); font-variant-numeric: tabular-nums; }
.ea-index-filters {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 5px 8px;
}
.ea-index-filters label {
  display: grid;
  gap: 3px;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
}
.ea-index-filters select {
  max-width: 100%;
  min-height: 35px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
}
.ea-index-panel h2 { margin: 0 0 8px; font-size: 16px; }
.ea-index-panel p { margin: 6px 0; }
.ea-index-list { margin: 0; padding: 0; list-style: none; }
.ea-index-row {
  display: grid;
  grid-template-columns: minmax(165px, 1.3fr) minmax(210px, 1fr) minmax(85px, 0.55fr) auto;
  align-items: center;
  gap: 6px 16px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.ea-index-row small, .ea-index-row dt { display: block; color: var(--muted); font-size: 11px; }
.ea-index-values { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; }
.ea-index-values dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.ea-index-trend { width: min(100%, 175px); height: 32px; color: var(--accent); }
.ea-index-row a { justify-self: start; }
.ea-monitor-row { grid-template-columns: minmax(165px, 1.3fr) minmax(85px, .65fr) minmax(110px, .65fr) auto; }
.ea-monitor-progress { min-width: 0; }
.ea-monitor-progress progress { width: min(100%, 170px); height: 8px; accent-color: var(--accent); }
@media (max-width: 670px) {
  .workspace #ea-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 5px 8px;
  }
  .workspace #ea-sections[hidden] { display: none; }
  .workspace #ea-sections a { min-height: 44px; padding-inline: 3px; }
  .portfolio .port-header-actions:has(.ea-overview-shortcuts) { flex: 0 1 auto; min-width: 0; }
  .ea-overview-shortcuts { max-width: 100%; padding-inline-end: 0; border-inline-end: 0; }
  .portfolio .ea-overview-shortcuts a, .ea-index .small-button, .ea-index-tabs a { min-height: 40px; }
  .ea-index-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ea-index-row > :first-child { grid-column: 1 / -1; }
  .ea-index-row a { grid-column: 1 / -1; }
  .ea-index-filters label:first-child { flex: 1 1 100%; }
  .ea-index-filters label:not(:first-child) { flex: 1 0 40%; min-width: 0; }
}
