/* Component measurements come from the Security Analysis reader. Layouts may
   differ by task; typography, controls and spacing do not differ by route. */
:root {
  --type-body: 13px;
  --type-control: 12px;
  --type-label: 11px;
  --type-tag: 10px;
  --type-section: 18px;
  --type-subsection: 16px;
  --space-inline: 9px;
  --space-field: 16px;
  --space-section: 20px;
  --space-panel: 27px;
  --space-panel-compact: 19px;
  --control-height: 42px;
}
.app-main, .assistant-panel, .login-standalone, .product-page {
  font-family: var(--font-sans);
  font-size: var(--type-body);
  line-height: 1.7;
}
.app-main > :is(div, section), .app-main > .page-shell {
  width: 100%; max-width: 1640px; margin-inline: auto;
}
/* Explicit roles keep narrative/markdown headings and numeric evidence intact. */
.app-main :is(.op-workspace, .overview, .cs-page-stack, .admin-workspace,
  .investigation-workspace, .dg-guide, .sa-workspace) { font-size: var(--type-body); }
.app-main :is(.op-workspace, .overview, .cs-page-stack, .investigation-workspace) { gap: var(--space-section); }
.app-main :is(.op-traffic-grid, .op-source-grid, .op-geography-grid, .op-coverage-layout,
  .op-triage-grid, .op-efficiency-overview, .admin-index-layout, .inv-decision-brief,
  .cs-evidence-grid, .cs-summary-grid) { gap: var(--space-section); }
.app-main :is(h1, h2, h3, h4, h5, h6),
.assistant-panel h2, .product-page :is(h1, h2, h3), .login-standalone h2 {
  font-family: var(--font-sans);
  color: var(--text-strong);
}
.app-main h2:where(:not(.sa-markdown *)), .product-page h2 {
  font-size: var(--type-section) !important; font-weight: 500 !important; line-height: 1.4 !important;
}
.app-main h3:where(:not(.sa-markdown *)), .product-page h3 {
  font-size: var(--type-subsection) !important; font-weight: 500 !important; line-height: 1.4 !important;
}
.ui-copy {
  font-family: var(--font-sans);
  font-size: var(--type-body) !important;
  font-weight: 400;
  line-height: 1.85 !important;
  margin-top: 0;
  margin-bottom: var(--space-field);
}
.ui-copy.ui-help, .sa-report-heading > .ui-copy, .sa-reader-rail .ui-copy,
.sa-event-list .ui-copy {
  font-size: var(--type-label) !important; line-height: 1.7 !important;
}
.app-main .sa-metrics .ui-copy,
.app-main .sa-note.ui-copy { font-size: var(--type-tag) !important; line-height: 1.6 !important; }
.app-main .ui-copy:last-child, .assistant-panel .ui-copy:last-child { margin-bottom: 0; }
.app-main :is(.overview-header h1, .cs-hero__title, .page-title, .dg-header h1,
  .intelligence-hero h2, .sa-report-heading h2), .login-standalone .page-title, .product-page h1 {
  font-size: clamp(19px, 2.1vw, 29px) !important;
  font-weight: 500 !important;
  line-height: 1.4;
  letter-spacing: -.035em;
  margin: 9px 0;
}
.app-main :is(.op-section-head h2, .card-header h2, .card-header h3, .card-header h4,
  .section-heading h2, .section-heading h3, .section-heading h4,
  .cs-section-card__header h3, .admin-section__title, .ai-efficiency-card__header h3,
  .intelligence-attention h2, .overview-card h2, .overview-assistant h2,
  .panel-card > h2, .dg-chapter > header h2, .sa-section-heading h2),
.assistant-panel h2 {
  font-size: var(--type-section) !important;
  font-weight: 500 !important;
  line-height: 1.4;
  letter-spacing: -.025em;
  margin: 0;
}
.app-main :is(.op-rank-panel h3, .inv-recorded-reason h3, .intelligence-decisions h3,
  .sa-evidence .sa-section-heading h2) {
  font-size: var(--type-subsection) !important; font-weight: 500; line-height: 1.4;
}
.app-main .sa-event-list h3 { font-size: var(--type-control) !important; }
.app-main :is(.section-label, .overview-eyebrow, .ai-efficiency-eyebrow, .cs-hero__eyebrow,
  .op-label, .inv-label, .dg-eyebrow, .sa-eyebrow), .assistant-panel .overview-eyebrow {
  font-size: var(--type-tag) !important; font-weight: 650; line-height: 1.5;
  letter-spacing: .13em; text-transform: uppercase;
}
.app-main :is(.op-section-head p, .admin-section__intro, .cs-hero__subtitle,
  .overview-header p, .intelligence-freshness, .dg-header p, .workspace-meta,
  .op-context, .op-empty-note, .sa-toolbar-note), .assistant-panel-scope {
  font-size: var(--type-label); line-height: 1.7; color: var(--text-muted);
}
.app-main :is(.form-text, .cs-filter-field > span, .cs-filter-field > small) {
  font-size: var(--type-label) !important; line-height: 1.7;
}
.app-main .workspace-sections { padding: 7px; gap: 3px; }
.app-main .workspace-sections a {
  padding: 13px 10px; font-size: var(--type-label); font-weight: 400; line-height: 1.5;
  border-left: 2px solid transparent; border-radius: 4px;
}
.app-main .workspace-sections a[aria-current] {
  background: var(--surface-accent); border-left-color: var(--ui-accent); color: var(--text-strong);
}
/* All action buttons share the reference reader's 11px / 15px padding.
   !important defeats Bootstrap sizing utilities and older route overrides. */
.ui-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-inline);
  box-sizing: border-box;
  min-height: var(--control-height) !important;
  padding: 11px 15px !important;
  font-family: var(--font-sans) !important;
  font-size: var(--type-control) !important;
  font-weight: 600 !important;
  line-height: 18px !important;
  letter-spacing: normal !important;
  border-radius: var(--radius-control) !important;
  border-width: 1px;
  border-style: solid;
  white-space: normal;
  text-align: center;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
}
.ui-button[hidden] { display: none !important; }
.ui-button:is(:disabled, [aria-disabled="true"]) { cursor: not-allowed; opacity: .6; }
.ui-button:is(.btn-outline-primary, .btn-outline-secondary, .btn-secondary,
  .dg-button, .sa-button:not(.sa-button--primary)) {
  color: var(--text-strong); background: var(--control-surface); border-color: var(--border-strong);
}
.ui-button:is(.btn-outline-primary, .btn-outline-secondary, .btn-secondary):hover {
  color: var(--text-strong); background: var(--surface-highlight); border-color: var(--ui-accent);
}
.ui-button:focus-visible, .ui-field:focus-visible {
  outline: 2px solid var(--ui-accent) !important; outline-offset: 4px; box-shadow: none;
}
/* Field labels and controls are identical for scopes, search and settings. */
.ui-field {
  box-sizing: border-box;
  min-height: var(--control-height) !important;
  padding: 10px 12px !important;
  font-family: var(--font-sans) !important;
  font-size: var(--type-control) !important;
  font-weight: 400;
  line-height: 20px !important;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control) !important;
  background-color: var(--control-surface);
  color: var(--text-strong);
  max-width: 100%;
}
select.ui-field { padding-right: 32px !important; }
textarea.ui-field { min-height: 120px !important; resize: vertical; }
.app-main :is(.op-filter, .cs-filter-grid, .workspace-inline-form, .adm-search-line,
  .adm-list-filter, .overview-filters, .inv-request-tools) { gap: var(--space-field); }
.app-main :is(.op-filter, .ai-filter-card, .adm-tools) { padding: var(--space-panel-compact) !important; }
.app-main :is(label:not(.form-check-label), .cs-filter-field > label), .assistant-panel label,
.login-standalone .form-label {
  font-family: var(--font-sans); font-size: var(--type-label) !important;
  font-weight: 400 !important; line-height: 1.5; margin-bottom: 7px;
}
.app-main :is(.cs-filter-field, .op-scope-bar > div) { min-width: 0; }
.app-main :is(.workspace-inline-form, .overview-filters) { align-items: end; }
.app-main :is(.overview-filters label, .workspace-inline-form label) { margin-bottom: 10px; }
.app-main :is(.op-section-nav, .sa-cadences) {
  display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%;
  gap: 4px; padding: 4px; background: var(--surface-tertiary);
  border: 1px solid var(--ui-border); border-radius: var(--radius-panel);
}
.app-main :is(.op-section-nav, .sa-cadences) a {
  padding: 9px 23px; font-size: var(--type-control); font-weight: 600; line-height: 18px;
  border: 0; border-radius: var(--radius-control); color: var(--text-muted);
  margin: 0; box-shadow: none; text-decoration: none;
}
.app-main :is(.op-section-nav, .sa-cadences) a[aria-current] {
  background: var(--surface-primary); color: var(--text-strong); box-shadow: var(--shadow-soft);
}
/* Tags retain semantic colors but never invent a different shape or text size. */
.app-main :is(.badge, .cs-badge, .analysis-chip, .confidence-pill, .cs-chip,
  .investigation-signal-pill, .sa-pills > span, .sa-state, .dg-meta > span),
.assistant-panel .badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 8px !important; border-radius: 4px !important;
  font-family: var(--font-sans); font-size: var(--type-tag) !important;
  font-weight: 500 !important; line-height: 15px !important;
  letter-spacing: normal; text-transform: none;
  border-width: 1px; border-style: solid; border-color: var(--ui-border);
  white-space: normal; vertical-align: middle;
}
.app-main :is(.cs-chip, .analysis-chip, .dg-meta > span) { background: var(--surface-secondary); color: var(--text-main); }
/* Panel roles: primary reading surfaces use 27px, supporting surfaces 19px. */
.app-main :is(.card-body, .panel-card.p-4, .sa-narrative, .intelligence-hero,
  .inv-recorded-reason, .dg-chapter) { padding: var(--space-panel) !important; }
.app-main :is(.card-header, .op-section-head, .op-rank-panel > h3,
  .ai-efficiency-card__header, .op-feed-row, .op-ranked-list > li,
  .op-efficiency-overview > article, .op-analysis-stats > div,
  .intelligence-decisions > article, .inv-enforcement-context,
  .sa-evidence > .sa-panel, .admin-summary-tile) { padding: var(--space-panel-compact) !important; }
.app-main :is(.card-body > :last-child, .op-section-head p) { margin-bottom: 0; }
.app-main :is(.section-heading, .cs-section-card__header, .sa-section-heading) { margin-bottom: 19px; }
.app-main :is(.cs-filter-actions, .ai-page-header__actions, .intelligence-actions,
  .ai-decision-actions, .inv-brief-links, .assistant-panel-tools) { gap: var(--space-inline); }
.app-main :is(.table, .cs-data-table) { font-size: var(--type-label) !important; line-height: 1.6; }
.app-main :is(.table, .cs-data-table) :is(th, td) { padding: 10px 12px !important; }
.assistant-panel { padding: var(--space-panel-compact); }
.assistant-panel .assistant-message { padding: var(--space-panel-compact); font-size: var(--type-body); line-height: 1.85; }
.assistant-panel-tools { gap: var(--space-inline); margin-block: var(--space-field); }
.assistant-panel-composer { padding-top: var(--space-field); }
.app-main :is(.cs-kpi-card__value, .op-analysis-stats > div > strong, .overview-kpi strong,
  .op-added-value > strong, .op-efficiency-overview > article > strong, .sa-metrics strong) {
  font-size: clamp(23px, 2.4vw, 33px) !important; font-weight: 500 !important;
  line-height: 1.2 !important; letter-spacing: -.04em;
}
.app-main .overview-kpi strong.is-unavailable { font-size: var(--type-subsection) !important; }
.login-password-field .ui-field { padding-right: 72px !important; }
.product-page :is(p, li), .login-standalone :is(p, li) { font-size: var(--type-body); line-height: 1.7; }
.app-main .op-added-value { padding: var(--space-panel); }
@media (max-width: 760px) {
  :root { --space-panel: 20px; }
  .app-main :is(.op-section-nav, .sa-cadences) a { padding-inline: 16px; }
  .app-main :is(.overview-header h1, .cs-hero__title, .page-title, .dg-header h1,
    .intelligence-hero h2, .sa-report-heading h2), .login-standalone .page-title, .product-page h1 {
    font-size: 20px !important;
  }
}
@media (max-width: 575px) {
  :root { --control-height: 44px; }
  .ui-field { font-size: 16px !important; }
  .ui-button { min-height: 44px !important; }
  .app-main .overview-filters { width: 100%; }
  .app-main .overview-filters .ui-field { flex: 1; max-width: 100%; }
}

/* One scope toolbar for report cadence, traffic windows and coverage windows. */
.app-main .ui-scope-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-field);
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
}
.ui-scope-options { min-width: 0; max-width: 100%; }
.app-main .ui-scope-options .sa-cadences { margin: 0; }
.ui-scope-form {
  display: flex; flex-wrap: wrap; align-items: end;
  gap: var(--space-inline); margin: 0; min-width: 0;
}
.ui-scope-field { display: grid; gap: 7px; min-width: 180px; max-width: 100%; }
.app-main .ui-scope-field label { margin: 0; }
.ui-scope-field .ui-field { width: 100%; }
.ui-scope-form .sa-text-link { padding-block: 11px; font-size: var(--type-control); }
@media (max-width: 760px) {
  .ui-scope-options, .ui-scope-form { width: 100%; }
  .ui-scope-field { flex: 1; min-width: 0; }
  .app-main .ui-scope-options .sa-cadences { width: 100%; }
  .app-main .ui-scope-options .sa-cadences a { flex: 1 1 auto; text-align: center; }
}

.app-main .sa-workspace > .ui-scope-toolbar { margin-bottom: var(--space-section); }
