:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-strong: #f0f2f5;
  --input-bg: #ffffff;
  --topbar-bg: rgba(255, 255, 255, 0.94);
  --sidebar-bg: #111827;
  --sidebar-text: #f9fafb;
  --sidebar-muted: #cbd5e1;
  --sidebar-hover: rgba(255, 255, 255, 0.1);
  --sidebar-panel: rgba(255, 255, 255, 0.08);
  --sidebar-line: rgba(255, 255, 255, 0.12);
  --text: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --red: #aa182c;
  --red-dark: #7f1221;
  --green: #0f7a3f;
  --gold: #d8a90f;
  --blue: #1f5f99;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --shadow: 0 18px 40px rgba(23, 32, 42, 0.08);
  --workspace-text-size: 12.5px;
  --workspace-line-height: 1.35;
  font-family: "Segoe UI", Arial, sans-serif;
}

.workspace[data-scheme="comfort"] {
  --bg: #f7faf6;
  --surface: #ffffff;
  --surface-strong: #edf5ec;
  --input-bg: #ffffff;
  --topbar-bg: rgba(255, 255, 255, 0.96);
  --sidebar-bg: #10251d;
  --sidebar-hover: rgba(166, 217, 178, 0.16);
  --text: #14231b;
  --muted: #52675a;
  --line: #cbd9cd;
  --red: #9b1c31;
  --green: #176d3a;
  --blue: #275f7f;
}

.workspace[data-scheme="highContrast"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #111111;
  --surface-strong: #1d1d1d;
  --input-bg: #000000;
  --topbar-bg: rgba(0, 0, 0, 0.98);
  --sidebar-bg: #000000;
  --sidebar-text: #ffffff;
  --sidebar-muted: #ffffff;
  --sidebar-hover: #2f2f2f;
  --sidebar-panel: #111111;
  --sidebar-line: #ffffff;
  --text: #ffffff;
  --muted: #f1f5f9;
  --line: #ffffff;
  --red: #ff334f;
  --green: #25d366;
  --gold: #ffd83d;
  --blue: #61dafb;
  --shadow: none;
}

.workspace[data-scheme="warm"] {
  --bg: #fbf7ef;
  --surface: #fffdf8;
  --surface-strong: #f4ead8;
  --input-bg: #fffdf8;
  --topbar-bg: rgba(255, 253, 248, 0.96);
  --sidebar-bg: #33251b;
  --sidebar-hover: rgba(232, 184, 91, 0.16);
  --text: #241b15;
  --muted: #6f6253;
  --line: #ded0ba;
  --red: #9a2432;
  --green: #3f6f3f;
  --blue: #4e6f8f;
}

.workspace[data-scheme="cool"] {
  --bg: #f2f7fb;
  --surface: #ffffff;
  --surface-strong: #e7f0f7;
  --input-bg: #ffffff;
  --topbar-bg: rgba(255, 255, 255, 0.96);
  --sidebar-bg: #0f2430;
  --sidebar-hover: rgba(109, 188, 218, 0.16);
  --text: #13232c;
  --muted: #536874;
  --line: #c7d9e4;
  --red: #9e2333;
  --green: #14714e;
  --blue: #1d6f9f;
}

.workspace[data-scheme="dark"] {
  color-scheme: dark;
  --bg: #0e1117;
  --surface: #161b22;
  --surface-strong: #21262d;
  --input-bg: #0d1117;
  --topbar-bg: rgba(22, 27, 34, 0.96);
  --sidebar-bg: #070b12;
  --sidebar-text: #f8fafc;
  --sidebar-muted: #cbd5e1;
  --sidebar-hover: rgba(148, 163, 184, 0.18);
  --sidebar-panel: rgba(148, 163, 184, 0.12);
  --sidebar-line: rgba(226, 232, 240, 0.16);
  --text: #f8fafc;
  --muted: #b6c2cf;
  --line: #30363d;
  --red: #d64055;
  --green: #37a66b;
  --blue: #58a6ff;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-width: 320px;
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

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

.workspace {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  transition: grid-template-columns 180ms ease;
}

.workspace.menu-collapsed {
  grid-template-columns: 78px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.menu-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: var(--sidebar-panel);
  color: var(--sidebar-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.brand {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sidebar-line);
  min-width: 0;
}

.brand img {
  width: 42px;
  height: 42px;
}

.brand-title {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.18;
  padding-right: 34px;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--sidebar-muted);
  margin-top: 3px;
}

.menu-collapsed .sidebar {
  padding-inline: 12px;
  align-items: center;
}

.menu-collapsed .brand {
  grid-template-columns: 1fr;
  justify-items: center;
  padding-top: 32px;
}

.menu-collapsed .brand-copy,
.menu-collapsed .nav-label {
  display: none;
}

.menu-collapsed .nav,
.menu-collapsed .nav-button {
  width: 100%;
}

.nav {
  display: grid;
  gap: 3px;
  align-content: start;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-muted) transparent;
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-button {
  color: var(--sidebar-muted);
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12.5px;
  line-height: 1.15;
}

.nav-button:hover,
.nav-button.active {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.nav-icon {
  width: 28px;
  min-width: 28px;
  text-align: center;
  font-size: 11px;
}

.nav-submenu {
  display: grid;
  gap: 2px;
  margin-left: 31px;
  padding-left: 8px;
  border-left: 1px solid var(--sidebar-line);
}

.nav-subitem {
  border: 0;
  background: transparent;
  color: var(--sidebar-muted);
  text-align: left;
  min-height: 22px;
  border-radius: 7px;
  padding: 4px 7px;
  font-size: 11px;
  line-height: 1.2;
}

.nav-subitem:hover,
.nav-subitem.active {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.menu-collapsed .nav-button {
  justify-content: center;
  padding-inline: 8px;
}

.menu-collapsed .nav-submenu {
  display: none;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(260px, 420px) minmax(520px, auto);
  gap: 12px;
  padding: 14px 18px;
  align-items: center;
}

.page-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.page-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.top-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
}

.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--input-bg);
  color: var(--text);
  min-height: 42px;
}

.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 8px;
  overflow: hidden;
  display: none;
  max-height: 330px;
  overflow-y: auto;
}

.suggestions.open {
  display: block;
}

.suggestion {
  width: 100%;
  border: 0;
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid #eef1f5;
  text-align: left;
  padding: 10px 12px;
}

.suggestion:hover {
  background: var(--surface-strong);
}

.suggestion small {
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.select,
.command-input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  padding: 8px 9px;
}

.command-input {
  width: 178px;
}

.button {
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}

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

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

.button.gold {
  border-color: #b8910d;
  background: #fff7d6;
  color: #5f4700;
}

.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--muted);
}

.communication-client-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
}

.communication-client-actions.compact {
  padding: 0 0 12px;
  margin-bottom: 12px;
}

.communication-client-actions .button {
  text-decoration: none;
}

.client-action {
  justify-content: center;
  min-width: 104px;
  max-width: 100%;
  white-space: normal;
}

.whatsapp-action {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 9%, var(--input-bg));
  color: var(--green);
}

.sms-action {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 11%, var(--input-bg));
  color: color-mix(in srgb, var(--gold) 70%, var(--text));
}

.message-preview-block {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
}

.message-preview-block pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: var(--font-body);
  line-height: 1.45;
}

.workflow-proof-details {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--green) 42%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--green) 7%, var(--surface));
  font-size: var(--font-body);
  line-height: 1.4;
}

.workflow-proof-details strong {
  color: var(--green);
}

.content {
  padding: 18px;
  display: grid;
  gap: 16px;
  background: var(--bg);
  scroll-margin-top: 92px;
}

.content :where(p, span, strong, small, div, td, th, li, label, input, select, textarea, button, code) {
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.content :where(h2, h3, h4, .panel-title, .metric-value, .metric-label, .metric-change, .metric-sub, .timeline-text, .chip, .button) {
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.content .chip,
.content .chip *,
.content .mini-action,
.content .mini-action *,
.content .mini-list span,
.content .mini-list span *,
.content .panel-header .chip,
.content .record-topline .chip {
  font-size: var(--workspace-text-size) !important;
  line-height: var(--workspace-line-height) !important;
}

[data-section] {
  scroll-margin-top: 92px;
}

.section-focus {
  outline: 3px solid color-mix(in srgb, var(--gold) 74%, transparent);
  outline-offset: 3px;
  transition: outline-color 200ms ease;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.metric-summary {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.grid.two {
  grid-template-columns: minmax(0, 1.7fr) minmax(340px, 0.8fr);
}

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

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

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

.panel-header {
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.panel-header > * {
  min-width: 0;
}

.panel-title {
  margin: 0;
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.panel-body {
  padding: 15px;
}

.selected-record {
  border-color: var(--accent);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  padding: 15px;
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
  min-width: 0;
  overflow: hidden;
}

.detail-grid span,
.detail-grid strong {
  display: block;
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
}

.detail-grid strong {
  margin-top: 5px;
  font-weight: 750;
}

.panel-body,
.record-card,
.statement-list,
.automation-item,
.manual-item,
.shortcut-item,
.integration-card,
.integration-action-record,
.expected-output {
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.selected-record .detail-grid,
.selected-record .detail-grid div,
.selected-record .detail-grid span,
.selected-record .detail-grid strong,
.selected-record .panel-body,
.selected-record .panel-body p {
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.panel-header .muted,
.panel-body .muted,
.record-card .muted,
.statement-list span,
.statement-list strong,
.automation-item strong,
.manual-item strong,
.shortcut-item strong {
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.panel-body p,
.record-card p,
.expected-output,
.muted {
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
}

.metric {
  padding: 15px;
}

.metric-value {
  font-size: var(--workspace-text-size);
  font-weight: 800;
  line-height: var(--workspace-line-height);
}

.metric-label {
  color: var(--muted);
  font-size: var(--workspace-text-size);
  margin-top: 6px;
}

.integration-action-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 10px;
}

.integration-action-record {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--soft);
  min-width: 0;
  overflow: hidden;
}

.integration-action-record .expected-output {
  margin: 10px 0 0;
}

.integration-action-group {
  align-content: start;
}

.metric-change {
  margin-top: 10px;
  font-size: var(--workspace-text-size);
  color: var(--green);
}

.metric.mini {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.metric-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  min-width: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 660px;
  table-layout: auto;
}

.record-table {
  min-width: 960px;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
  vertical-align: top;
}

th {
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

td {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  max-width: 360px;
  min-width: 96px;
}

.record-table td,
.record-table td *,
.record-table th,
.record-table th * {
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
  word-break: normal;
  hyphens: none;
}

.record-table th:nth-child(3),
.record-table td:nth-child(3) {
  min-width: 260px;
  overflow-wrap: break-word;
}

.record-table th:nth-child(5),
.record-table td:nth-child(5) {
  min-width: 140px;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  white-space: normal;
}

.record-table th:nth-child(6),
.record-table td:nth-child(6) {
  min-width: 210px;
  overflow-wrap: break-word;
}

.grid.two > .panel {
  min-width: 0;
  max-width: 100%;
}

.grid.two .table-wrap {
  overflow-x: visible;
  overflow-y: visible;
}

.grid.two .table-wrap table {
  min-width: 0;
  table-layout: fixed;
}

.grid.two .table-wrap th,
.grid.two .table-wrap td {
  min-width: 0;
  max-width: none;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.grid.two .table-wrap th {
  hyphens: none;
}

.panel[data-section="payroll-runs"] .table-wrap,
.panel[data-section="employee-register"] .table-wrap {
  overflow-x: visible;
  overflow-y: visible;
}

.panel[data-section="payroll-runs"] table.record-table,
.panel[data-section="employee-register"] table.record-table {
  min-width: 0;
  table-layout: fixed;
}

.panel[data-section="payroll-runs"] .record-table th,
.panel[data-section="payroll-runs"] .record-table td,
.panel[data-section="employee-register"] .record-table th,
.panel[data-section="employee-register"] .record-table td {
  min-width: 0;
  max-width: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

.panel[data-section="payroll-runs"] .record-table th:nth-child(3),
.panel[data-section="payroll-runs"] .record-table td:nth-child(3),
.panel[data-section="payroll-runs"] .record-table th:nth-child(5),
.panel[data-section="payroll-runs"] .record-table td:nth-child(5),
.panel[data-section="payroll-runs"] .record-table th:nth-child(6),
.panel[data-section="payroll-runs"] .record-table td:nth-child(6),
.panel[data-section="employee-register"] .record-table th:nth-child(3),
.panel[data-section="employee-register"] .record-table td:nth-child(3),
.panel[data-section="employee-register"] .record-table th:nth-child(5),
.panel[data-section="employee-register"] .record-table td:nth-child(5),
.panel[data-section="employee-register"] .record-table th:nth-child(6),
.panel[data-section="employee-register"] .record-table td:nth-child(6) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.panel[data-section="payroll-runs"] .record-table .chip,
.panel[data-section="employee-register"] .record-table .chip {
  white-space: normal;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: var(--workspace-text-size);
  font-weight: 650;
  border: 1px solid transparent;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  text-align: center;
  overflow-wrap: break-word;
  word-break: normal;
}

.panel-header .chip,
.record-topline .chip {
  flex-shrink: 1;
}

td:last-child,
th:last-child {
  width: 104px;
}

td:last-child .chip {
  max-width: 92px;
  white-space: normal;
  line-height: 1.15;
}

td:last-child .button {
  width: 72px;
  min-height: 34px;
  padding: 6px 8px;
  justify-content: center;
}

.chip.critical {
  color: #fff;
  background: var(--danger);
}

.chip.high {
  color: #fff;
  background: var(--red);
}

.chip.medium {
  color: #5f4700;
  background: #fff3bd;
  border-color: #f4d35e;
}

.chip.low {
  color: #064e3b;
  background: #dff7ea;
  border-color: #b8e5c8;
}

.chip.neutral {
  color: #344054;
  background: #f2f4f7;
  border-color: #e4e7ec;
}

.record-topline .chip.neutral {
  justify-content: flex-end;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  text-align: right;
  max-width: min(42%, 240px);
}

.record-topline .chip.neutral::before {
  content: "Ref ";
  font-weight: 500;
  color: var(--muted);
}

.chip.ok {
  color: #fff;
  background: var(--green);
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 3px;
  background: var(--red);
}

.timeline-text {
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.muted {
  color: var(--muted);
}

.automation-list,
.manual-list,
.shortcut-list,
.integration-grid {
  display: grid;
  gap: 10px;
}

.automation-item,
.manual-item,
.shortcut-item,
.integration-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--surface);
}

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

.integration-card {
  display: grid;
  gap: 9px;
}

.integration-card p {
  margin: 0;
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.compact-list {
  margin: 0;
  padding-left: 18px;
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.integration-card code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.integration-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.integration-meta {
  display: grid;
  gap: 4px;
  font-size: var(--workspace-text-size);
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 12px;
  padding: 15px;
}

.record-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
  min-width: 0;
  max-width: 100%;
}

.record-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mini-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 7px;
  align-items: start;
}

.inline-workflow-result {
  inline-size: 100%;
  display: grid;
  gap: 9px;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--green) 42%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--green) 7%, var(--surface));
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
  min-width: 0;
  overflow-wrap: break-word;
}

.inline-workflow-result p {
  margin: 0;
}

.inline-workflow-record {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inline-workflow-record span {
  color: var(--muted);
}

.inline-workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr));
  gap: 8px;
}

.inline-workflow-grid div {
  display: grid;
  gap: 2px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  min-width: 0;
}

.inline-workflow-grid span {
  color: var(--muted);
  overflow-wrap: break-word;
}

.inline-workflow-proof {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--green) 32%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--green) 5%, var(--surface));
}

.inline-workflow-proof ul {
  margin: 0;
  padding-left: 18px;
}

.inline-workflow-proof li {
  margin: 2px 0;
}

.mini-list span,
.mini-action {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
}

.mini-action {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  min-height: 38px;
  max-inline-size: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.mini-action:hover,
.mini-action:focus-visible {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, var(--surface-strong));
  outline: 2px solid color-mix(in srgb, var(--green) 35%, transparent);
  outline-offset: 2px;
}

.workflow-action-panel {
  border-color: var(--green);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 16%, transparent), var(--shadow);
}

.audience-selection-panel {
  border-color: color-mix(in srgb, var(--green) 44%, var(--line));
}

.audience-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.selected-audience-summary {
  border: 1px solid color-mix(in srgb, var(--green) 42%, var(--line));
  background: color-mix(in srgb, var(--green) 8%, var(--surface));
  border-radius: 8px;
  padding: 10px;
  margin: 0 0 12px;
  display: grid;
  gap: 7px;
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.selected-audience-summary.empty {
  border-color: var(--line);
  background: var(--surface-strong);
}

.selected-audience-summary > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.selected-audience-summary span {
  border: 1px solid color-mix(in srgb, var(--green) 45%, var(--line));
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--surface);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.audience-row-selected {
  background: color-mix(in srgb, var(--green) 7%, var(--surface));
}

.audience-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-inline-size: 100%;
  font-weight: 700;
  color: var(--text);
}

.audience-check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.audience-table-wrap {
  max-height: min(520px, 55vh);
  overflow-x: auto;
  overflow-y: auto;
}

.audience-table {
  min-width: 1120px;
}

.audience-table th:first-child,
.audience-table td:first-child {
  min-width: 132px;
}

.audience-table th:nth-child(5),
.audience-table td:nth-child(5) {
  min-width: 260px;
  overflow-wrap: break-word;
}

.result-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.result-list div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.audience-channel-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--green) 42%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--green) 7%, var(--surface));
}

.audience-channel-actions {
  padding: 0;
  border-bottom: 0;
}

.audience-channel-action {
  min-width: 96px;
  font-weight: 700;
}

.workflow-outcome-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--green) 44%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--green) 7%, var(--surface));
}

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

.workflow-progress {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.workflow-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
}

.workflow-progress-track span {
  display: block;
  inline-size: var(--workflow-progress, 0%);
  block-size: 100%;
  border-radius: inherit;
  background: var(--green);
}

.workflow-step-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workflow-step {
  max-inline-size: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  overflow-wrap: anywhere;
}

.workflow-step.done {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  color: var(--green);
}

.workflow-step.current {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, var(--surface));
  font-weight: 700;
}

.workflow-step.pending {
  color: var(--muted);
}

.workflow-outcome-metrics div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.workflow-outcome-metrics strong,
.workflow-outcome-metrics span {
  display: block;
  overflow-wrap: anywhere;
}

.workflow-outcome-metrics strong {
  color: var(--green);
  font-size: 14px;
}

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

.workflow-outcome-grid > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.workflow-outcome-grid h3 {
  margin: 0 0 6px;
  font-size: var(--workspace-text-size);
}

.workflow-outcome-list {
  margin: 0;
  padding-left: 18px;
}

.workflow-outcome-list li {
  margin: 3px 0;
}

.workflow-endpoint {
  font-family: Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
}

.no-break {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.expected-output {
  border-top: 1px solid var(--line);
  padding-top: 9px;
  color: var(--text);
  line-height: var(--workspace-line-height);
}

.accounting-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.hidden-control {
  display: none;
}

.statement-list {
  display: grid;
  gap: 10px;
  padding: 15px;
}

.statement-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.statement-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.statement-list strong {
  white-space: normal;
  text-align: right;
}

.automation-item strong,
.manual-item strong,
.shortcut-item strong {
  display: block;
  margin-bottom: 4px;
}

.video-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(220px, 0.75fr);
  gap: 14px;
}

video {
  width: 100%;
  background: #101828;
  border-radius: 8px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.command-log {
  min-height: 110px;
  max-height: none;
  overflow: visible;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  border-radius: 8px;
  padding: 10px;
  font-size: var(--workspace-text-size);
  line-height: var(--workspace-line-height);
}

.command-log-list {
  display: grid;
  gap: 10px;
}

.command-log-entry .chip {
  white-space: normal;
  text-align: left;
}

.email-preview {
  white-space: pre-wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  line-height: var(--workspace-line-height);
  font-family: Verdana, Arial, sans-serif;
  font-size: var(--workspace-text-size);
}

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

.field {
  display: grid;
  gap: 5px;
}

.field label {
  font-size: var(--workspace-text-size);
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  min-height: 38px;
  width: 100%;
  background: var(--input-bg);
  color: var(--text);
}

.field textarea {
  min-height: 90px;
}

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

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
}

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .workspace,
  .workspace.menu-collapsed {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .main {
    height: auto;
    overflow: visible;
  }

  .menu-collapsed .sidebar {
    align-items: stretch;
  }

  .menu-collapsed .brand {
    grid-template-columns: 48px 1fr;
    justify-items: start;
    padding-top: 0;
  }

  .menu-collapsed .brand-copy,
  .menu-collapsed .nav-label {
    display: block;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    padding-right: 0;
  }

  .menu-collapsed .nav-button {
    justify-content: flex-start;
  }

  .topbar,
  .grid.two,
  .video-grid,
  .integration-grid,
  .detail-grid,
  .accounting-controls {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  .content,
  .topbar {
    padding: 12px;
  }

  .nav,
  .grid.metrics,
  .grid.three,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: stretch;
  }

  .button,
  .select,
  .command-input {
    width: 100%;
    justify-content: center;
  }
}
