/* BabyCat component language — see docs/design_system.md.
   Presentation only: catalog cells, editor overlays and document styles are
   intentionally excluded. This sheet is last so new pages can share one finish. */
:root {
  --ui-space-1:4px; --ui-space-2:8px; --ui-space-3:12px;
  --ui-space-4:16px; --ui-space-6:24px; --ui-space-8:32px;
  --ui-radius-control:8px; --ui-radius-panel:12px; --ui-radius-dialog:16px;
  --ui-line:color-mix(in srgb,var(--theme-border,#879da9) 68%,var(--theme-surface,#fff));
  --ui-control-line:var(--theme-border,#879da9);
  --ui-shadow:0 8px 28px #0002;
  --ui-motion:130ms ease;
}
/* Controls keep their existing density. Do not resize spreadsheet cell editors,
   syntax overlays, formatting swatches, resize handles or row/column headings. */
:is(button,input,select,textarea):not(:where(.data-table *, .workbook-grid *, .file-diff-table *, .rule-syntax-editor *, .rule-search-editor *, .email-code-stack *, .function-code *, .resize-handle, .rule-drag, .help-info)) {
  border-radius:var(--ui-radius-control);
}
button:not(:where(.data-table *, .workbook-grid *, .file-diff-table *, .help-info, .rule-drag)) {
  transition:background-color var(--ui-motion),border-color var(--ui-motion),box-shadow var(--ui-motion);
}
button:not(:where(.data-table *, .workbook-grid *, .file-diff-table *, .help-info, .rule-drag)):hover { box-shadow:none; }
button:not(:where(.data-table *, .workbook-grid *, .file-diff-table *, .help-info, .rule-drag)):active:not(:disabled) { box-shadow:inset 0 0 0 1px var(--theme-accent); }
:is(button,a,summary,input,select,textarea):not(:where(.data-table *, .workbook-grid *, .file-diff-table *)):focus-visible {
  outline:2px solid var(--theme-accent,#087765); outline-offset:2px;
}
/* Tiny help controls retain their circular shape and information-mode toggle. */
.help-info { font-family:ui-serif,Georgia,serif; box-shadow:none!important; }
:where(.actions,.form-row,.template-toolbar,.function-toolbar,.email-studio-tools,.analytics-actions,.supplier-image-tools) { gap:var(--ui-space-2); }
:where(.actions,.template-toolbar,.function-toolbar,.email-studio-tools) { row-gap:var(--ui-space-2); }
:where(.header-icon,.theme-button,.rename-pencil) { border-radius:var(--ui-radius-control); }
.topbar { gap:var(--ui-space-4); }
.topbar h1 { font-weight:650; letter-spacing:-.025em; }
.topbar .actions { align-items:center; }
.topbar :where(.header-icon,.theme-button) { vertical-align:middle; }
/* Navigation pills are deliberately distinct from action buttons. */
.tabs { align-items:center; row-gap:6px; }
.tabs :is(button[data-tab],.workbench-menu>summary) { border-radius:999px; }
.tabs>.workbench-menu>summary { gap:0; }
.tabs .workbench-menu>div { border:1px solid var(--ui-control-line); border-radius:var(--ui-radius-panel); padding:6px; box-shadow:var(--ui-shadow); }
.tabs .workbench-menu>div button { border-radius:6px; padding:9px 10px; }
.sidebar .catalog-item { border-radius:6px; }
.sidebar :is(.catalog-item,.supplier-home-link) { transition:background-color var(--ui-motion),color var(--ui-motion); }
.sidebar .section-label { letter-spacing:.08em; }
.sidebar footer { line-height:1.5; }
/* Surfaces use the same quiet boundary; existing page widths and grids stay put. */
:is(.section,.stage-hero,.upload-card,.mapping-card,.destination-summary,.mapping-template-panel,.reference-card,.saved-authorizations,.source-card,.webhook-section,.webhook-card,.profile-delivery-fields,.delivery-card,.version-card,.template-library,.template-editor,.function-list,.function-studio,.email-live,.email-attachments,.analytics-card,.analytics-filters,.analytics-metric,.workbook-library-card,.supplier-image-card) {
  border-radius:var(--ui-radius-panel); border-color:var(--ui-line);
}
[data-theme-level] :is(.section,.stage-hero,.upload-card,.mapping-card,.destination-summary,.mapping-template-panel,.reference-card,.saved-authorizations,.source-card,.webhook-section,.webhook-card,.profile-delivery-fields,.delivery-card,.version-card,.template-library,.template-editor,.function-list,.function-studio,.email-live,.email-attachments,.analytics-card,.analytics-filters,.analytics-metric,.workbook-library-card,.supplier-image-card) { border-color:var(--ui-line); }
:where(.section,.reference-card,.source-card,.template-library,.template-editor,.analytics-card)>:is(h3,header h3) { font-weight:650; line-height:1.4; }
:where(.section,.reference-card,.source-card,.connection-step) p { line-height:1.6; }
:is(.organization-card,.hierarchy-card,.reference-library-card,.setup-method) { border-radius:var(--ui-radius-panel); box-shadow:none; }
:is(.organization-card,.hierarchy-card,.reference-library-card,.setup-method):hover { transform:none; box-shadow:none; }
.hierarchy-card { border-color:var(--ui-line); }
.hierarchy-card:hover { border-color:var(--theme-accent); }
.hierarchy-card h3 { font-size:20px; letter-spacing:-.02em; }
.hierarchy-heading { margin-bottom:var(--ui-space-6); }
.hierarchy-heading .metrics { font-variant-numeric:tabular-nums; }
.entity-marker { letter-spacing:.07em; gap:6px; }
/* Import page: upload surface and chips must follow brightness, too. */
[data-theme-level] .drop-zone { background:var(--theme-input); color:var(--theme-input-ink); border-color:var(--ui-control-line); border-radius:var(--ui-radius-panel); }
[data-theme-level] .drop-zone :is(strong,p,small) { color:inherit; }
.destination-summary>.eyebrow { display:block; margin-bottom:8px; }
[data-theme-level] .schema-chips :is(code,span) { background:var(--theme-input); color:var(--theme-input-ink); border:1px solid var(--ui-line); border-radius:5px; }
/* Connection choices are a family, including the explicit Create lookup card. */
.setup-methods { align-items:stretch; }
.setup-method-item { align-self:stretch; }
.setup-method { padding:18px; gap:12px; min-height:136px; }
.setup-method>span:nth-child(2) { flex:1; min-width:0; }
.setup-method strong { font-size:14px; font-weight:650; line-height:1.4; }
.setup-method small { font-size:12px; line-height:1.55; margin-top:6px; }
.setup-method-icon { width:36px; height:36px; border-radius:10px; background:var(--theme-surface); border-color:var(--ui-line); }
.setup-method-icon svg { display:block; }
.setup-method>.setup-method-arrow { display:inline-flex; flex:none; color:var(--muted); }
.setup-page-header { align-items:center; gap:16px; }
.reference-page .setup-page-header { margin-bottom:16px; }
.reference-filters { gap:12px; }
.reference-filters :is(input,select) { height:36px; padding:7px 10px; }
.reference-library-card { border-color:var(--ui-line); }
.reference-library-card.active { border-color:var(--theme-accent); }
/* Rule cards retain editor geometry and syntax. Quiet chrome replaces heavy frames. */
[data-theme-level] .rule-card { border-width:1px; border-color:var(--ui-control-line); border-radius:var(--ui-radius-panel); box-shadow:none; }
.rule-card-options { border-color:var(--ui-line); }
.rule-card-options>summary { font-size:12px; line-height:1.5; }
.rule-board-toolbar { row-gap:8px; }
.compact-rule-controls { gap:6px; }
.rule-page-navigation :is(input,select,button) { border-radius:6px; }
/* Forms and preview editors share edge treatment without touching code metrics. */
:is(.email-code-stack,.function-code,.email-preview-canvas) { border-radius:var(--ui-radius-control); }
.email-studio-tools { align-items:flex-end; }
.email-studio-tools .help-inline { align-self:flex-end; }
.email-live header { min-height:28px; }
.email-live h3 { font-size:14px; font-weight:650; }
.email-preview-controls { align-items:flex-end; }
:where(.workbook-titlebar,.workbook-format-toolbar,.workbook-footer) { gap:8px; }
.workbook-titlebar { align-items:center; }
:is(.template-list-card,.function-item,.template-rule,.email-behavior-card) { border-radius:var(--ui-radius-control); }
/* Dialog shells only — supplier table/cell rules remain in supplier_portal.css. */
dialog:not(.supplier-correction-dialog) { border-radius:var(--ui-radius-dialog); border-color:var(--ui-control-line); box-shadow:var(--ui-shadow); }
dialog::backdrop { background:#07131b99; }
:where(.connection-wizard-header,.template-dialog>header,.help-dialog>header,.cell-history>header) { align-items:flex-start; gap:16px; }
.connection-wizard-header h2 { font-size:21px; line-height:1.3; }
.connection-wizard-actions { gap:8px; align-items:center; }
.connection-steps { gap:8px; }
.connection-step>label { margin-block:12px; }
.connection-step>label:first-of-type { margin-top:8px; }
.setup-field-grid { gap:12px; }
.setup-callout { border-radius:var(--ui-radius-control); }
/* Consistent numerical rhythm for summaries and history, never catalog cells. */
:where(.metrics,.analytics-metric,.version-number,.badge,.correction-message-row) { font-variant-numeric:tabular-nums; }
:where(.empty,.page-load-error) { border-radius:var(--ui-radius-panel); }
.filter-icon { display:inline-block; flex:none; vertical-align:middle; }
#notification { border:1px solid var(--ui-line); border-radius:var(--ui-radius-control); box-shadow:var(--ui-shadow); }
@media(max-width:760px) {
  .setup-method { min-height:112px; padding:16px; }
  .setup-page-header { align-items:flex-start; flex-wrap:wrap; }
  .reference-filters { gap:10px; }
  .email-studio-tools { align-items:center; }
}
@media(prefers-reduced-motion:reduce) {
  button,.organization-card,.hierarchy-card,.reference-library-card,.setup-method,.sidebar .catalog-item { transition:none!important; transform:none!important; }
}
@media(forced-colors:active) {
  :root { --ui-line:CanvasText; --ui-control-line:ButtonText; }
  :is(button,a,summary,input,select,textarea):not(:where(.data-table *, .workbook-grid *, .file-diff-table *)):focus-visible { outline-color:Highlight; }
}
/* Opt-in primitives for future ordinary screens and the living reference. */
.ui-panel { padding:16px; border:1px solid var(--ui-line); border-radius:var(--ui-radius-panel); background:var(--theme-panel); color:var(--theme-panel-ink); min-width:0; }
.ui-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.ui-field { display:grid; gap:6px; min-width:0; font-size:12px; }
.ui-field :is(input,select,textarea) { width:100%; min-width:0; }
.ui-icon-button { display:inline-flex; width:32px; height:32px; align-items:center; justify-content:center; padding:6px; flex:none; }
.ui-status { display:inline-flex; align-items:center; gap:6px; border:1px solid var(--ui-line); border-radius:999px; padding:3px 8px; font-size:12px; }
.ui-status[data-tone=warning] { background:var(--theme-warning); color:var(--theme-warning-ink); }
.ui-status[data-tone=reject] { background:var(--theme-error); color:var(--theme-error-ink); }
.ui-status[data-tone=success] { background:var(--theme-success); color:var(--theme-success-ink); }
/* These layout rules belong only to the developer-facing living reference. */
.component-reference { max-width:1200px; margin:0 auto; padding:32px 24px 64px; }
.component-reference>header { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:32px; }
.component-reference h1 { margin:8px 0; }
.component-reference h2 { font-size:17px; margin-bottom:12px; }
.component-reference p { color:var(--theme-surface-muted); line-height:1.6; }
.component-reference-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.component-reference-grid>section { display:grid; align-content:start; gap:16px; }
.component-reference-grid .ui-panel { padding:20px; }
.component-reference-grid .setup-methods { margin:0; grid-template-columns:1fr 1fr; }
.component-reference .ui-toolbar { gap:8px; }
.component-reference code { color:var(--theme-accent); font-size:12px; }
.component-swatches { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.component-swatches span { padding:16px 8px; border:1px solid var(--ui-line); border-radius:8px; font-size:12px; text-align:center; }
@media(max-width:760px) { .component-reference-grid { grid-template-columns:1fr; } .component-reference>header { flex-wrap:wrap; } }
/* Review found a light-theme supplier link inheriting dark-only text, and a
   legacy mobile !important header rule squeezing breadcrumbs behind actions. */
[data-theme-level] .sidebar .supplier-group .supplier-home-link { color:var(--theme-panel-ink); }
@media(max-width:700px) {
  .shell:not(.sidebar-collapsed)>.sidebar { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-content:start; align-items:center; padding:10px 14px; gap:8px; }
  .shell:not(.sidebar-collapsed) .sidebar-brand { grid-column:1; margin:0; }
  .shell:not(.sidebar-collapsed) .sidebar-brand .brand { font-size:17px; flex-wrap:nowrap; }
  .shell:not(.sidebar-collapsed) .sidebar-brand .babycat-logo { width:30px; height:30px; }
  .shell:not(.sidebar-collapsed) .sidebar .organization-switch { grid-column:2; margin:0!important; padding:7px!important; min-height:36px; }
  .shell:not(.sidebar-collapsed) .sidebar .current-organization { margin:0!important; }
  .shell:not(.sidebar-collapsed) .sidebar .current-organization small { padding-left:0; }
  .shell:not(.sidebar-collapsed) .sidebar .sidebar-search { margin:0!important; }
  .shell:not(.sidebar-collapsed) .sidebar .sidebar-search input { width:100%; }
  .shell:not(.sidebar-collapsed) .sidebar .sidebar-section-heading { display:none; }
  .shell:not(.sidebar-collapsed) .sidebar .catalogs { grid-column:1/-1; display:block; max-height:110px; }
  .shell:not(.sidebar-collapsed) .sidebar .sidebar-create { grid-column:1/-1; margin:0; }
  .topbar { flex-direction:column!important; align-items:stretch!important; gap:10px; }
  .topbar>div:first-child { min-width:0; width:100%; }
  .topbar h1 { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
  .topbar .workspace-breadcrumbs { width:100%; min-width:0; flex-wrap:nowrap; white-space:nowrap; overflow-x:auto; padding-bottom:4px; }
  .topbar .workspace-breadcrumbs>* { flex-shrink:0; }
  .topbar .workspace-breadcrumbs :is(button,[aria-current]) { max-width:220px; }
  .topbar .actions { width:100%!important; justify-content:flex-start; flex-wrap:wrap; gap:6px; }
  .topbar .page-search { flex:1; min-width:120px; max-width:none; }
  .topbar .help-toolbar { margin-left:auto; }
}
/* Final page-specific alignment found in the inventory, not new workflows. */
.function-list>button { margin-block:4px; }
#previewOwnPortal { margin-block:12px; }
#runDetail:empty { display:none; }
.reference-detail { border-radius:var(--ui-radius-panel); border-color:var(--ui-line); }
.connection-step :is(label,input,select,textarea) { font-size:13px; font-weight:400; }
.connection-step label { font-size:12px; font-weight:500; }
.connection-step h3 { font-size:17px; line-height:1.4; }
.tools-page .diff-scroll table:not(.file-diff-table) { width:100%; border-collapse:collapse; font-size:12px; }
.tools-page .diff-scroll table:not(.file-diff-table) :is(th,td) { padding:10px 12px; text-align:left; border-bottom:1px solid var(--ui-line); vertical-align:top; }
.tools-page .diff-scroll table:not(.file-diff-table) th { font-weight:600; color:var(--muted); }
.tools-page .section>.actions { margin-block:12px; }
.matching-settings label+label { margin-top:12px; }
.supplier-intake-card form>label+label { margin-top:12px; }
#intakeUploadForm>label+label { margin-top:12px; }
#renameSupplier,#supplierExportPolicy { display:grid; gap:12px; justify-items:start; margin-top:12px; }
#renameSupplier>label,#supplierExportPolicy>label { width:100%; }
/* Email behavior shares the dialog spacing used by the other setup tools. */
.email-behavior-dialog>header { display:flex; align-items:center; flex-wrap:wrap; gap:12px; padding:20px; }
.email-behavior-dialog>header h2 { flex:1; font-size:21px; }
.email-behavior-dialog>header [data-close] { order:3; }
.email-behavior-dialog>header .help-toolbar { order:2; margin:0; }
.email-behavior-dialog>:is(.email-behavior-tools,p,.email-behavior-cards,.email-severity-help) { margin-left:20px; margin-right:20px; }
.email-behavior-dialog .email-behavior-tools { align-items:flex-end; }
.email-behavior-dialog .email-behavior-cards { padding-top:12px; }
.ui-toolbar:has(>.ui-field) { align-items:flex-end; }
/* Separate administration shell uses the same components, not different rules. */
:where(.admin-card,.admin-metric,.admin-login) { border-color:var(--ui-line); }
[data-theme-level] .admin-tabs button[aria-selected=true] { background:var(--theme-active); color:var(--theme-active-ink); border-color:var(--ui-control-line); }
.admin-tabs { gap:8px; }
.admin-actions { gap:8px; }
.email-behavior-dialog>header>.help-toolbar { width:auto; flex-basis:auto; }
.admin-users table { min-width:680px; }
/* Quiet is a real variant; the legacy theme-wide button rule must not turn it
   back into a bordered secondary button. Catalog-cell controls are excluded. */
[data-theme-level] button.quiet:not(:where(.data-table *, .workbook-grid *, .file-diff-table *)) { border-color:transparent; background:transparent; }
[data-theme-level] button.quiet:not(:where(.data-table *, .workbook-grid *, .file-diff-table *)):hover { background:var(--theme-hover); color:var(--theme-hover-ink); }
.auth>button.quiet { margin:8px 8px 0 0; }
.auth #tryDemoAccount { display:block; }
#authForm .feedback:empty { margin:0; }
/* Loading follows the destination: rules are stacked, portal sections are wide. */
.page-loading-rules { display:grid; gap:12px; }
.page-loading-rule { padding:16px; min-height:240px; border:1px solid var(--ui-line); border-radius:12px; background:var(--theme-panel); }
.page-loading-rule>i:first-child { width:30%; margin-bottom:16px; }
.page-loading-rule>div { display:grid; grid-template-columns:1fr 1.3fr; gap:16px; }
.page-loading-rule>div>i { height:60px; }
.page-loading-rule>i:last-child { width:20%; margin-top:16px; }
.page-loading-portal { display:grid; gap:20px; }
.page-loading-panel { padding:24px; border:1px solid var(--ui-line); border-radius:12px; background:var(--theme-panel); }
.page-loading-panel>i:first-child { width:35%; margin-bottom:16px; }
.page-loading-panel>i:nth-child(2) { width:65%; margin-bottom:20px; }
.page-loading-panel>i:nth-child(3) { min-height:110px; }
.page-loading-portal-row { display:grid; grid-template-columns:2fr 1fr 1fr; gap:20px; padding:16px 0; border-bottom:1px solid var(--ui-line); }
.portal-opening { max-width:1200px; margin:auto; padding:24px; width:100%; }
.portal-opening>header { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:24px; }
.supplier-correction-dialog .correction-window-actions [data-correction-expand] { display:inline-flex; align-items:center; justify-content:center; line-height:1; }
.correction-window-actions [data-correction-expand] svg { display:block; width:18px; height:18px; flex:none; }
.intake-results { max-width:100%; overflow-x:auto; }
.intake-queue { width:100%; min-width:1040px; table-layout:fixed; }
.intake-queue th { white-space:nowrap; font-weight:600; }
.intake-queue :is(th,td) { padding:12px 14px; text-align:left; }
.intake-queue td:nth-child(-n+3) { overflow-wrap:anywhere; }
.intake-queue [data-queue-details] :is(select,button) { max-width:100%; }
.intake-queue .portal-open-file { padding:7px 8px; font-size:12px; white-space:nowrap; }
.intake-queue td { position:relative; vertical-align:top; }
.intake-queue [data-queue-details] { min-width:180px; max-width:360px; overflow-wrap:anywhere; }
.intake-queue [data-queue-rows] { font-variant-numeric:tabular-nums; text-align:left; }
/* One row, one wave: never restart the shimmer at a column boundary.
   The full-width layer clips its own background, keeping scroll bounds stable. */
.intake-queue tr[data-busy=true] { position:relative; isolation:isolate; }
.intake-queue tr[data-busy=true]::after { content:''; position:absolute; inset:0; z-index:0; pointer-events:none; background-image:linear-gradient(100deg,transparent 37%,color-mix(in srgb,var(--theme-accent) 7%,transparent) 43%,color-mix(in srgb,var(--theme-accent) 30%,transparent) 50%,color-mix(in srgb,var(--theme-accent) 7%,transparent) 57%,transparent 63%); background-size:200% 100%; background-repeat:no-repeat; animation:intake-row-sweep 2.8s linear infinite; }
.intake-queue tr[data-busy=true]>td { position:relative; z-index:1; background:transparent; }
@keyframes intake-row-sweep { from { background-position:125% 0; } to { background-position:-25% 0; } }
@media(max-width:700px) { .page-loading-rule>div { grid-template-columns:1fr; gap:10px; } .page-loading-rule>div>i { height:38px; } .portal-opening { padding:16px; } }
@media(prefers-reduced-motion:reduce) { .intake-queue tr[data-busy=true]::after { animation:none; background-position:50% 0; } }
.intake-queue th:nth-child(4) { text-align:left; }
.portal-opening>header .brand { margin-right:auto; }
/* Leave room for the existing fixed companion when revealing the queue. */
.intake-results { scroll-margin-bottom:88px; }

.supplier-correction-table>.page-loading,.supplier-correction-table>.review-load-error { padding:16px; }
.review-load-error p { margin-bottom:12px; }
