:root {
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --color-canvas: #f5f7f6;
  --color-surface: #ffffff;
  --color-surface-subtle: #f0f4f2;
  --color-surface-hover: #eaf2ef;
  --color-border: #d8e0dd;
  --color-border-strong: #adb9b5;
  --color-text: #172421;
  --color-text-muted: #5c6d68;
  --color-text-subtle: #7c8985;
  --color-accent: #087d76;
  --color-accent-hover: #066860;
  --color-accent-soft: #e1f1ee;
  --color-success: #18724f;
  --color-success-soft: #e4f3eb;
  --color-warning: #8a6100;
  --color-warning-soft: #fff3cf;
  --color-danger: #ae3e35;
  --color-danger-soft: #fbe9e6;
  --color-info: #2d6478;
  --color-info-soft: #e5f1f5;
  --color-sidebar: #172421;
  --color-sidebar-text: #dce6e3;
  --color-sidebar-muted: #9fb0ab;
  --shadow-popover: 0 12px 34px rgba(23, 36, 33, 0.16);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --sidebar-width: 236px;
  --control-height: 38px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--color-canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--color-text);
  background: var(--color-canvas);
  font: 14px/1.5 var(--font-sans);
  text-rendering: optimizeLegibility;
}

a {
  color: var(--color-accent-hover);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--color-accent);
}

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

button,
a,
input,
select,
textarea,
summary,
[tabindex]:not([tabindex="-1"]) {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
  outline: 3px solid rgba(8, 125, 118, 0.28);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: var(--space-3);
  left: var(--space-3);
  padding: var(--space-2) var(--space-3);
  color: var(--color-surface);
  background: var(--color-accent-hover);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  color: var(--color-sidebar-text);
  background: var(--color-sidebar);
  border-right: 1px solid #273834;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 68px;
  padding: var(--space-4);
  color: #ffffff;
  text-decoration: none;
}

.sidebar-brand:hover {
  color: #ffffff;
}

.brand-mark {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #ffffff;
  background: var(--color-accent);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
}

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

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

.environment-label {
  display: inline-flex;
  align-items: center;
  margin-top: 2px;
  color: var(--color-sidebar-muted);
  font-size: 11px;
  line-height: 1.2;
  text-transform: capitalize;
}

.workspace-selector {
  display: grid;
  gap: var(--space-2);
  padding: 0 var(--space-3) var(--space-3);
  border-bottom: 1px solid #2c3e39;
}

.workspace-selector-label,
.workspace-selector-status {
  color: var(--color-sidebar-muted);
  font-size: 11px;
}

.workspace-selector-name {
  overflow: hidden;
  color: #ffffff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-selector form {
  display: grid;
  gap: var(--space-2);
  margin: 0;
}

.workspace-selector select,
.workspace-selector button {
  width: 100%;
  min-width: 0;
}

.workspace-selector select {
  color: var(--color-sidebar-text);
  background: #21322e;
  border-color: #456158;
}

.workspace-selector button {
  min-height: 32px;
  padding: 6px 9px;
  color: #ffffff;
  background: #29413b;
  border-color: #456158;
}

.workspace-selector button:hover {
  color: #ffffff;
  background: #36534b;
  border-color: #57776d;
}

.workspace-manage-link {
  color: var(--color-sidebar-text);
  font-size: 11px;
}

.workspace-manage-link:hover {
  color: #ffffff;
}

.sidebar-nav {
  display: grid;
  gap: 2px;
  padding: var(--space-3) var(--space-3) var(--space-4);
}

.sidebar-nav a,
.sidebar-footer-link {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 9px var(--space-3);
  color: var(--color-sidebar-text);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 520;
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-footer-link:hover {
  color: #ffffff;
  background: #233631;
}

.sidebar-nav a[aria-current="page"],
.sidebar-footer-link[aria-current="page"] {
  color: #ffffff;
  background: #29413b;
  border-color: #38554e;
}

.nav-badge,
.notification-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 6px;
  color: #ffffff;
  background: var(--color-danger);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
}

.sidebar-footer {
  display: grid;
  gap: 2px;
  margin-top: auto;
  padding: var(--space-3);
  border-top: 1px solid #2c3e39;
}

.user-menu {
  position: relative;
  margin-top: var(--space-2);
}

.user-menu summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  color: var(--color-sidebar-text);
  border-radius: var(--radius-md);
  cursor: pointer;
  list-style: none;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu summary:hover,
.user-menu[open] summary {
  background: #233631;
}

.user-avatar {
  display: inline-grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--color-text);
  background: #d6e6e1;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.user-identity {
  min-width: 0;
}

.user-identity strong,
.user-identity span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity strong {
  color: #ffffff;
  font-size: 12px;
}

.user-identity span {
  color: var(--color-sidebar-muted);
  font-size: 11px;
}

.user-menu-panel {
  display: grid;
  gap: 2px;
  margin-top: var(--space-1);
  padding: var(--space-2);
  background: #21322e;
  border: 1px solid #385049;
  border-radius: var(--radius-md);
}

.user-menu-panel a,
.user-menu-panel button {
  width: 100%;
  padding: var(--space-2);
  color: var(--color-sidebar-text);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  text-align: left;
  text-decoration: none;
}

.user-menu-panel a:hover,
.user-menu-panel button:hover {
  color: #ffffff;
  background: #2b413b;
}

.app-main {
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(10px);
}

.topbar-context {
  min-width: 0;
  color: var(--color-text-muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.notification-link {
  position: relative;
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 9px;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.notification-link:hover {
  color: var(--color-text);
  background: var(--color-surface-subtle);
}

.mobile-menu-button {
  display: none;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.menu-lines,
.menu-lines::before,
.menu-lines::after {
  display: block;
  width: 16px;
  height: 2px;
  margin: auto;
  content: "";
  background: currentColor;
}

.menu-lines {
  position: relative;
}

.menu-lines::before {
  position: absolute;
  top: -5px;
}

.menu-lines::after {
  position: absolute;
  top: 5px;
}

.content-wrap {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-6) 56px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.page-header-copy {
  min-width: 0;
}

.breadcrumb {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  margin-bottom: var(--space-1);
  color: var(--color-text-subtle);
  font-size: 12px;
}

.breadcrumb a {
  color: inherit;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 680;
  line-height: 1.25;
}

h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
}

h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.page-description,
.section-description {
  max-width: 760px;
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin: var(--space-8) 0 var(--space-3);
}

.section-heading:first-child {
  margin-top: 0;
}

.section-kicker {
  margin: 0 0 var(--space-1);
  color: var(--color-text-subtle);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.button,
button {
  display: inline-flex;
  min-height: var(--control-height);
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 8px 12px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 560;
  line-height: 1.2;
  text-decoration: none;
}

.button:hover,
button:hover {
  color: var(--color-text);
  background: var(--color-surface-subtle);
  border-color: #87958f;
}

.button.primary,
button.primary {
  color: #ffffff;
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.button.primary:hover,
button.primary:hover {
  color: #ffffff;
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.button.danger,
button.danger {
  color: var(--color-danger);
  background: var(--color-surface);
  border-color: #d9aaa4;
}

.button.subtle,
button.subtle {
  color: var(--color-text-muted);
  background: transparent;
  border-color: transparent;
}

button:disabled,
.button[aria-disabled="true"] {
  color: var(--color-text-subtle);
  background: var(--color-surface-subtle);
  border-color: var(--color-border);
  cursor: not-allowed;
  opacity: 0.72;
}

.toolbar,
.action-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: 0 0 var(--space-4);
}

.toolbar > form,
.action-bar > form {
  margin: 0;
}

.campaign-table-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.campaign-table-actions form {
  margin: 0;
}

.panel,
.detail {
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-wrap: anywhere;
}

.panel + .panel,
.detail + .detail {
  margin-top: var(--space-3);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
  gap: var(--space-6);
}

.attention-list,
.activity-list,
.progress-list,
.notification-list {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  list-style: none;
}

.attention-item,
.activity-item,
.progress-item,
.notification-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  min-height: 68px;
  padding: var(--space-3) var(--space-4);
  color: var(--color-text);
  background: var(--color-surface);
  text-decoration: none;
}

a.attention-item:hover,
a.progress-item:hover {
  color: var(--color-text);
  background: #fbfcfc;
}

.attention-item p,
.activity-item p,
.progress-item p,
.notification-item p {
  margin: 2px 0 0;
  color: var(--color-text-muted);
  font-size: 12px;
}

.attention-count {
  min-width: 38px;
  font-size: 24px;
  font-weight: 680;
  text-align: right;
}

.attention-item[data-tone="attention"] .attention-count {
  color: var(--color-warning);
}

.attention-item[data-tone="danger"] .attention-count {
  color: var(--color-danger);
}

.attention-item[data-tone="quiet"] .attention-count {
  color: var(--color-text-subtle);
}

.quick-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.metric {
  min-width: 0;
  padding: var(--space-4);
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.metric span {
  display: block;
  color: var(--color-text-muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: var(--space-1);
  font-size: 24px;
  font-weight: 680;
}

.tabs {
  display: flex;
  gap: var(--space-4);
  margin: 0 0 var(--space-4);
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
  scrollbar-width: thin;
}

.tabs a {
  position: relative;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 2px;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 560;
  text-decoration: none;
  white-space: nowrap;
}

.tabs a:hover {
  color: var(--color-text);
}

.tabs a[aria-current="page"] {
  color: var(--color-text);
}

.tabs a[aria-current="page"]::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  content: "";
  background: var(--color-accent);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 8px;
  color: var(--color-text-muted);
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.status-badge::before {
  width: 6px;
  height: 6px;
  content: "";
  background: currentColor;
  border-radius: 50%;
}

.status-badge.success {
  color: var(--color-success);
  background: var(--color-success-soft);
  border-color: #b9ddca;
}

.status-badge.warning {
  color: var(--color-warning);
  background: var(--color-warning-soft);
  border-color: #ead79d;
}

.status-badge.danger {
  color: var(--color-danger);
  background: var(--color-danger-soft);
  border-color: #efc4bf;
}

.status-badge.info {
  color: var(--color-info);
  background: var(--color-info-soft);
  border-color: #c4dce5;
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.filter-bar .field {
  margin: 0;
}

.filter-bar .search-field {
  flex: 1 1 240px;
}

.filter-chips {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: 0 0 var(--space-3);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  font-size: 12px;
}

.table-wrap {
  position: relative;
  width: 100%;
  max-height: 68vh;
  overflow: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  scrollbar-width: thin;
}

.mail-review-table {
  min-width: 1380px;
  table-layout: fixed;
}

.mail-review-table .mail-review-company {
  width: 190px;
}

.mail-review-table .mail-review-recipient,
.mail-review-table .mail-review-sender {
  width: 240px;
}

.mail-review-table .mail-review-message {
  width: 430px;
}

.mail-review-table .mail-review-state {
  width: 130px;
}

.mail-review-table .mail-review-time,
.mail-review-table .mail-review-result {
  width: 180px;
}

.mail-review-table th,
.mail-review-table td {
  overflow-wrap: anywhere;
  word-break: normal;
}

.message-preview {
  max-width: 100%;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.enterprise-table-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
}

.enterprise-table-tools input[type="search"] {
  width: min(260px, 100%);
}

.enterprise-table table {
  table-layout: fixed;
}

.deliverability-table .table-primary,
.deliverability-table .table-secondary {
  display: block;
}

.deliverability-table .table-secondary {
  margin-top: 4px;
}

.campaign-health-table th {
  width: 140px;
}

.campaign-health-table th:first-child {
  width: 260px;
}

.campaign-health-table th:nth-child(2) {
  width: 240px;
}

.table-columns-menu {
  position: relative;
}

.table-columns-menu > summary {
  list-style: none;
  cursor: pointer;
}

.table-columns-menu > summary::-webkit-details-marker {
  display: none;
}

.table-columns-options {
  position: absolute;
  z-index: 12;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  min-width: 220px;
  max-height: 320px;
  padding: var(--space-2);
  overflow: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
}

.table-columns-options label {
  padding: 7px 8px;
  white-space: nowrap;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-surface);
}

caption {
  padding: var(--space-3);
  color: var(--color-text-muted);
  text-align: left;
}

th,
td {
  padding: 11px 12px;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  z-index: 2;
  top: 0;
  color: var(--color-text-muted);
  background: #f0f3f2;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  user-select: none;
}

th[aria-sort="ascending"]::after {
  content: "  \2191";
}

th[aria-sort="descending"]::after {
  content: "  \2193";
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer:hover,
.column-resizer:active {
  background: var(--color-accent);
}

.table-compact th,
.table-compact td {
  padding-top: 6px;
  padding-bottom: 6px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td,
tbody tr:focus-within td {
  background: #f8fbfa;
}

.table-primary {
  color: var(--color-text);
  font-weight: 620;
}

.table-secondary {
  color: var(--color-text-muted);
  font-size: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.field {
  display: grid;
  gap: 5px;
  margin-bottom: var(--space-4);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.pool-override-group {
  border: 0;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  padding: var(--space-4) 0;
  min-width: 0;
}

.pool-override-group .field {
  min-width: 0;
}

.pool-override-group .field-help {
  overflow-wrap: anywhere;
}

#discovery-outcome.warning {
  border-left: 3px solid #a46b00;
  background: #fff6df;
  color: #614400;
}

label,
.field-label,
legend {
  color: var(--color-text);
  font-size: 12px;
  font-weight: 620;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--control-height);
  padding: 8px 10px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
}

select {
  width: auto;
  min-width: 150px;
  max-width: 100%;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

.copy-source-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.copy-source-field input[readonly],
.copy-source-field textarea[readonly] {
  background: var(--color-surface-subtle);
}

.copy-source-field textarea {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--color-accent);
}

input[type="number"] {
  max-width: 180px;
}

.field-help {
  color: var(--color-text-muted);
  font-size: 12px;
}

.field-error,
.errorlist {
  margin: 0;
  padding: 0;
  color: var(--color-danger);
  font-size: 12px;
  list-style: none;
}

.field:has(.field-error) input,
.field:has(.field-error) select,
.field:has(.field-error) textarea {
  border-color: var(--color-danger);
}

.form-panel {
  max-width: 760px;
}

.form-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-6);
}

fieldset {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

fieldset label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.toast-region {
  position: fixed;
  z-index: 100;
  top: var(--space-4);
  right: var(--space-4);
  display: grid;
  width: min(390px, calc(100vw - 32px));
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  padding: var(--space-3) var(--space-4);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  pointer-events: auto;
}

.toast.error {
  border-left-color: var(--color-danger);
}

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

.inline-message,
.notice,
.error {
  margin: 0 0 var(--space-4);
  padding: var(--space-3);
  color: var(--color-info);
  background: var(--color-info-soft);
  border-left: 3px solid var(--color-info);
  border-radius: var(--radius-sm);
}

.inline-message.error,
.error {
  color: var(--color-danger);
  background: var(--color-danger-soft);
  border-left-color: var(--color-danger);
}

.empty-state {
  display: grid;
  min-height: 160px;
  place-items: center;
  padding: var(--space-8);
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--color-text);
}

.loading-state {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text-muted);
}

.loading-indicator {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: bdp-spin 0.8s linear infinite;
}

details.disclosure,
details:not(.user-menu) {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

details.disclosure > summary,
details:not(.user-menu) > summary {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-weight: 620;
}

details.disclosure[open] > summary,
details:not(.user-menu)[open] > summary {
  border-bottom: 1px solid var(--color-border);
}

details.disclosure > :not(summary),
details:not(.user-menu) > :not(summary) {
  margin: var(--space-4);
}

.context-preview {
  max-width: 100%;
  max-height: 420px;
  overflow: auto;
  padding: var(--space-3);
  color: #28413a;
  background: #edf3f1;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.confirmation-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-popover);
}

.confirmation-dialog::backdrop {
  background: rgba(16, 27, 24, 0.48);
}

.dialog-content {
  padding: var(--space-6);
}

.dialog-content p {
  margin: var(--space-2) 0 var(--space-6);
  color: var(--color-text-muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.decision-bar {
  position: sticky;
  z-index: 8;
  bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: fit-content;
  max-width: calc(100vw - 48px);
  margin: var(--space-8) auto var(--space-3);
  padding: var(--space-2);
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  backdrop-filter: blur(10px);
}

.decision-bar form {
  margin: 0;
}

.decision-bar fieldset {
  display: flex;
  gap: var(--space-2);
  margin: 0 var(--space-2) 0 0;
  padding: 0;
  border: 0;
}

.decision-primary {
  display: flex;
  align-items: center;
}

.rejection-dialog {
  width: min(620px, calc(100vw - 32px));
  padding: 0;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-popover);
}

.rejection-dialog::backdrop {
  background: rgba(16, 27, 24, 0.58);
}

.rejection-dialog form {
  padding: var(--space-5);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.dialog-heading h2 {
  margin: 0;
  font-size: 20px;
}

.rejection-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.rejection-option {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  min-height: 70px;
  padding: var(--space-3);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  text-align: left;
}

.rejection-option:hover,
.rejection-option:focus-visible {
  background: #fff6f4;
  border-color: var(--color-danger);
}

.rejection-option span {
  color: var(--color-text-muted);
  font-size: 12px;
}

.artifact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.artifact-card,
.document-view,
.integration-state {
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.artifact-card h3,
.document-view h2 {
  margin-top: 0;
}

.artifact-card form {
  margin-top: var(--space-3);
}

.artifact-meta {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.artifact-meta span {
  padding: 5px 8px;
  color: var(--color-text-muted);
  background: #f0f3f2;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.document-view {
  max-width: 980px;
  margin-bottom: var(--space-5);
}

.document-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

.document-body {
  max-width: 76ch;
  line-height: 1.65;
}

.readable-fields > div {
  display: grid;
  grid-template-columns: minmax(140px, 0.35fr) minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.readable-fields dd {
  margin: 0;
}

.source-create-panel {
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.other-rejection textarea {
  width: 100%;
  margin: var(--space-2) 0 var(--space-4);
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.settings-section {
  max-width: 980px;
}

.settings-list {
  margin: 0;
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.45fr) minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

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

.settings-row dt {
  color: var(--color-text-muted);
}

.settings-row dd {
  margin: 0;
  font-weight: 560;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: var(--space-6);
  background: var(--color-canvas);
}

.login-panel {
  width: min(420px, 100%);
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.sidebar-overlay {
  display: none;
}

.campaign-summary p:last-child {
  margin-bottom: 0;
  color: var(--color-text-muted);
}

.prospect-pool-performance {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: var(--space-3);
  margin-bottom: var(--space-6);
}

.prospect-pool-performance .metric {
  padding: var(--space-3) var(--space-4);
}

.prospect-pool-performance .metric strong {
  font-size: 20px;
}

.prospect-pool-performance .metric small {
  display: block;
  margin-top: 2px;
  color: var(--color-text-subtle);
  font-size: 11px;
}

@media (max-width: 720px) {
  .prospect-pool-performance {
    grid-template-columns: 1fr;
  }
}

.run-monitor {
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.run-monitor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  padding: 20px var(--space-6);
  background: #f8fbfa;
  border-bottom: 1px solid var(--color-border);
}

.run-state-copy {
  min-width: 0;
}

.run-state-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  color: var(--color-success);
  font-size: 12px;
  text-transform: uppercase;
}

.run-live-indicator {
  width: 9px;
  height: 9px;
  background: var(--color-success);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(24, 114, 79, 0.12);
  animation: run-pulse 1.8s ease-in-out infinite;
}

.run-state-copy h3 {
  font-size: 19px;
}

.run-state-copy p {
  max-width: 820px;
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
}

.run-clock {
  flex: 0 0 auto;
  text-align: right;
}

.run-clock span,
.run-total-cost span {
  display: block;
  color: var(--color-text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.run-clock strong {
  display: block;
  margin-top: 2px;
  font-size: 20px;
}

.target-progress {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.target-progress-label {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-2);
}

.target-progress-label span {
  color: var(--color-text-muted);
}

.target-progress progress {
  display: block;
  width: 100%;
  height: 12px;
  overflow: hidden;
  accent-color: var(--color-accent);
  border: 0;
  border-radius: var(--radius-sm);
}

.target-progress progress::-webkit-progress-bar {
  background: var(--color-surface-subtle);
}

.target-progress progress::-webkit-progress-value {
  background: var(--color-accent);
}

.target-progress p {
  margin: var(--space-2) 0 0;
  color: var(--color-text-muted);
  font-size: 12px;
}

.pipeline-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(80px, 1fr));
  margin: 0;
  padding: var(--space-4) var(--space-6);
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
  list-style: none;
}

.pipeline-steps li {
  position: relative;
  display: flex;
  min-width: 80px;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-subtle);
  font-size: 12px;
}

.pipeline-steps li:not(:last-child)::after {
  position: absolute;
  z-index: 0;
  top: 50%;
  right: var(--space-2);
  left: 38px;
  height: 1px;
  content: "";
  background: var(--color-border);
}

.pipeline-steps span {
  z-index: 1;
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: 50%;
  font-size: 11px;
}

.pipeline-steps b {
  z-index: 1;
  padding-right: var(--space-2);
  background: var(--color-surface);
}

.pipeline-steps .is-complete,
.pipeline-steps .is-active {
  color: var(--color-text);
}

.pipeline-steps .is-complete span {
  color: #ffffff;
  background: var(--color-success);
  border-color: var(--color-success);
}

.pipeline-steps .is-active span {
  color: #ffffff;
  background: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-accent-soft);
}

.run-funnel {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
}

.run-funnel > div {
  min-width: 120px;
  padding: var(--space-4);
  border-right: 1px solid var(--color-border);
}

.run-funnel > div:last-child {
  border-right: 0;
}

.run-funnel span,
.run-funnel small {
  display: block;
  color: var(--color-text-muted);
  font-size: 11px;
}

.run-funnel strong {
  display: block;
  margin: 2px 0;
  font-size: 24px;
}

.run-funnel-emphasis {
  background: var(--color-success-soft);
}

.run-funnel-emphasis strong {
  color: var(--color-success);
}

.run-monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  border-bottom: 1px solid var(--color-border);
}

.run-current-work,
.run-costs {
  min-width: 0;
  padding: var(--space-4) var(--space-6);
}

.run-current-work {
  border-right: 1px solid var(--color-border);
}

.run-working-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-success);
  font-size: 11px;
  font-weight: 650;
}

.run-working-label i {
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
  animation: run-pulse 1.8s ease-in-out infinite;
}

.run-detail-list {
  margin: 0;
}

.run-detail-list > div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: var(--space-3);
  padding: 9px 0;
  border-top: 1px solid var(--color-border);
}

.run-detail-list dt {
  color: var(--color-text-muted);
}

.run-detail-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 560;
}

.run-detail-list.compact > div {
  grid-template-columns: 110px minmax(0, 1fr);
}

.run-total-cost {
  padding: var(--space-3) 0;
}

.run-total-cost strong {
  display: block;
  margin-top: 2px;
  color: var(--color-info);
  font-size: 28px;
}

.run-cost-note {
  margin: var(--space-3) 0 0;
  color: var(--color-text-muted);
  font-size: 11px;
}

.run-activity {
  padding: var(--space-4) var(--space-6);
}

.run-activity .panel-header > span {
  color: var(--color-text-subtle);
  font-size: 11px;
}

.run-activity-list {
  display: grid;
  gap: 0;
  max-height: 260px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.run-activity-list li {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: var(--space-2);
  padding: 8px 0;
  border-top: 1px solid var(--color-border);
}

.activity-dot {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  background: var(--color-border-strong);
  border-radius: 50%;
}

.run-activity-list .is-current .activity-dot {
  background: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.run-activity-list strong,
.run-activity-list small {
  display: block;
}

.run-activity-list small {
  margin-top: 1px;
  color: var(--color-text-muted);
}

.run-alerts {
  padding: var(--space-3) var(--space-6);
  color: var(--color-warning);
  background: var(--color-warning-soft);
  border-top: 1px solid #ecd791;
}

.territory-switch-notice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-6);
  color: var(--color-info);
  background: var(--color-info-soft);
  border-bottom: 1px solid var(--color-border);
}

.territory-switch-notice[hidden] {
  display: none;
}

.territory-switch-notice span {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.territory-switch-notice strong {
  min-width: 0;
  font-size: var(--font-size-sm);
}

.technical-details {
  margin-top: var(--space-3);
}

.market-exploration-history {
  margin-top: var(--space-6);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.market-exploration-history > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  list-style-position: inside;
}

.market-exploration-history > summary span:first-child strong,
.market-exploration-history > summary span:first-child small,
.exploration-run-header strong,
.exploration-run-header small,
.exploration-step-heading strong,
.exploration-step-heading small {
  display: block;
}

.market-exploration-history > summary small,
.exploration-history-summary,
.exploration-run-header small,
.exploration-step-heading small {
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.exploration-history-runs {
  border-top: 1px solid var(--color-border);
}

.exploration-run + .exploration-run {
  border-top: 1px solid var(--color-border-strong);
}

.exploration-run-header,
.exploration-step-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.exploration-run-header {
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface-subtle);
  border-bottom: 1px solid var(--color-border);
}

.exploration-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.exploration-step {
  position: relative;
  padding: var(--space-4) var(--space-5) var(--space-4) 44px;
}

.exploration-step + .exploration-step {
  border-top: 1px solid var(--color-border);
}

.exploration-step::before {
  position: absolute;
  top: 24px;
  left: 21px;
  width: 9px;
  height: 9px;
  content: "";
  background: var(--color-border-strong);
  border: 2px solid var(--color-surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--color-border-strong);
}

.exploration-step.is-active::before {
  background: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.exploration-step:not(:last-child)::after {
  position: absolute;
  top: 34px;
  bottom: -10px;
  left: 25px;
  width: 1px;
  content: "";
  background: var(--color-border);
}

.exploration-transition {
  margin: 0 0 var(--space-3);
  padding: 8px 10px;
  color: var(--color-info);
  background: var(--color-info-soft);
  border-left: 3px solid var(--color-info);
  font-size: var(--font-size-sm);
}

.exploration-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(90px, 1fr));
  margin-top: var(--space-3);
  overflow-x: auto;
  border: 1px solid var(--color-border);
}

.exploration-metrics > div {
  min-width: 90px;
  padding: 9px 10px;
  border-right: 1px solid var(--color-border);
}

.exploration-metrics > div:last-child {
  border-right: 0;
}

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

.exploration-metrics span {
  color: var(--color-text-muted);
  font-size: 11px;
}

.exploration-metrics strong {
  margin-top: 2px;
}

.exploration-rationale {
  margin: var(--space-3) 0 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.exploration-rationale span {
  color: var(--color-text);
  font-weight: 700;
}

.market-coverage {
  margin-top: var(--space-6);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.market-coverage > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  list-style-position: inside;
}

.market-coverage > summary span:first-child strong,
.market-coverage > summary span:first-child small {
  display: block;
}

.market-coverage > summary small,
.market-coverage-summary {
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.coverage-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.coverage-metrics > div {
  min-width: 0;
  padding: var(--space-4) var(--space-5);
  border-right: 1px solid var(--color-border);
}

.coverage-metrics > div:last-child {
  border-right: 0;
}

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

.coverage-metrics span {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.coverage-metrics strong {
  margin-top: 4px;
  font-size: var(--font-size-lg);
}

.market-coverage .table-wrap {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.market-coverage td strong,
.market-coverage td small {
  display: block;
}

.market-coverage td small {
  max-width: 360px;
  margin-top: 3px;
  color: var(--color-text-muted);
}

.coverage-evidence {
  max-width: 420px;
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.coverage-evidence > summary {
  cursor: pointer;
  color: var(--color-accent-strong);
  font-weight: 700;
}

.coverage-evidence p {
  margin: var(--space-2) 0 var(--space-1);
}

.coverage-evidence ul {
  margin: 0;
  padding-left: var(--space-5);
}

@keyframes run-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.38; }
}

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

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

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

  .exploration-metrics {
    grid-template-columns: repeat(3, minmax(110px, 1fr));
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    width: min(var(--sidebar-width), calc(100vw - 48px));
    transform: translateX(-105%);
    transition: transform 160ms ease;
  }

  body[data-nav-open="true"] .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgba(15, 25, 22, 0.45);
    border: 0;
    border-radius: 0;
    opacity: 0;
    transition: opacity 160ms ease, visibility 160ms ease;
  }

  body[data-nav-open="true"] .sidebar-overlay {
    visibility: visible;
    opacity: 1;
  }

  .mobile-menu-button {
    display: inline-grid;
    place-items: center;
  }

  .topbar {
    padding: 0 var(--space-4);
  }

  .content-wrap {
    padding: var(--space-6) var(--space-4) 48px;
  }

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

  .artifact-grid,
  .document-columns {
    grid-template-columns: 1fr;
  }

  .run-monitor-grid {
    grid-template-columns: 1fr;
  }

  .run-current-work {
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }
}

@media (max-width: 680px) {
  .topbar-context {
    display: none;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
    gap: var(--space-3);
  }

  .page-header-actions,
  .page-header-actions .button,
  .quick-actions .button {
    width: 100%;
  }

  .field-row,
  .settings-row {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-bar .field,
  .filter-bar input,
  .filter-bar select,
  .filter-bar button {
    width: 100%;
  }

  .filter-bar .search-field {
    flex: 0 0 auto;
  }

  .enterprise-table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .enterprise-table-tools input[type="search"],
  .enterprise-table-tools button,
  .enterprise-table-tools details {
    width: 100%;
  }

  .attention-item,
  .activity-item,
  .progress-item,
  .notification-item {
    gap: var(--space-2);
  }

  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .run-monitor-header,
  .target-progress-label {
    align-items: flex-start;
    flex-direction: column;
  }

  .run-clock {
    text-align: left;
  }

  .decision-bar {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
    border-radius: 0;
  }

  .rejection-options {
    grid-template-columns: 1fr;
  }

  .run-monitor-header,
  .target-progress,
  .territory-switch-notice,
  .pipeline-steps,
  .run-current-work,
  .run-costs,
  .run-activity {
    padding-right: var(--space-4);
    padding-left: var(--space-4);
  }

  .run-detail-list > div,
  .run-detail-list.compact > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .market-exploration-history > summary,
  .exploration-run-header,
  .exploration-step-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .exploration-metrics {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }
}

.authoring-format-notes {
  margin: var(--space-3) 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--color-info);
  background: var(--color-info-soft);
}

.authoring-format-notes p {
  margin: 0;
}

.mail-step-list {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.mail-step-editor {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.mail-step-editor > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-weight: 700;
  background: var(--color-surface-subtle);
}

.mail-step-editor[open] > summary {
  border-bottom: 1px solid var(--color-border);
}

.mail-step-editor > :not(summary) {
  margin-right: var(--space-4);
  margin-left: var(--space-4);
}

.mail-step-summary {
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 500;
}

.compact-fields {
  grid-template-columns: minmax(80px, 0.25fr) minmax(220px, 1fr) minmax(220px, 1fr);
  margin-top: var(--space-4);
}

.step-advanced-settings {
  margin-top: var(--space-4);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-border);
}

.step-advanced-settings > summary {
  cursor: pointer;
  color: var(--color-accent);
  font-weight: 700;
}

.mail-step-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.preview-selector {
  margin-bottom: var(--space-4);
}

.personal-email-preview {
  max-width: 860px;
}

.email-preview-header {
  margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-subtle);
}

.email-preview-header p {
  margin: var(--space-1) 0;
}

.email-preview-header span {
  display: inline-block;
  width: 64px;
  color: var(--color-text-muted);
}

.personal-email-body {
  min-height: 260px;
  margin: 0;
  padding: var(--space-4) 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font: 14px/1.65 var(--font-sans);
}

.personal-email-preview iframe {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--color-border);
  background: #ffffff;
}

.pool-picker-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(160px, 0.8fr) minmax(180px, 1fr) auto;
  align-items: end;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.pool-picker-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.pool-picker-actions strong {
  margin-left: auto;
  color: var(--color-text-muted);
}

.pool-picker-options {
  max-height: 420px;
  margin-bottom: var(--space-2);
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.pool-picker-options > div > div,
.pool-picker-options > ul > li {
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.pool-picker-options > div > div:last-child,
.pool-picker-options > ul > li:last-child {
  border-bottom: 0;
}

.pool-option-description {
  display: block;
  margin-top: var(--space-1);
  padding-left: 24px;
  color: var(--color-text-muted);
  font-size: 12px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .compact-fields {
    grid-template-columns: 1fr;
  }

  .mail-step-editor > summary,
  .mail-step-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .pool-picker-toolbar {
    grid-template-columns: 1fr;
  }

  .pool-picker-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .pool-picker-actions strong {
    margin-left: 0;
  }
}

.test-environment-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  border-bottom: 1px solid #8a6a15;
  background: #fff1bf;
  color: #4d3a05;
}

.test-environment-banner > div,
.test-environment-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.test-environment-actions form {
  margin: 0;
}

.test-environment-actions button {
  min-height: 34px;
  padding: 6px 10px;
  border-color: #8a6a15;
  background: #fff8dd;
}

.test-environment-panel {
  border-color: #d7b84b;
}

@media (max-width: 720px) {
  .test-environment-banner,
  .test-environment-banner > div {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.discovery-live-controls {
  position: sticky;
  top: 56px;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  background: var(--color-surface, #fff);
  border-bottom: 1px solid #d5e1e1;
}
.discovery-live-controls > span { margin-right: auto; }
.discovery-live-controls form { margin: 0; }
body:has(.discovery-live-controls) .toast-region { top: auto; bottom: 16px; }
.discovery-steering-dialog { width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.discovery-steering-dialog form { padding: 24px; margin: 0; }
.discovery-steering-dialog h2 { font-size: 20px; }
.discovery-steering-dialog label { display: block; margin: 16px 0 6px; font-weight: 600; }
.discovery-steering-dialog input { width: 100%; box-sizing: border-box; }
.discovery-steering-dialog .dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.discovery-steering-status { margin: 12px 0; overflow-wrap: anywhere; }
