/* ==========================================================================
   design-review.css
   Implements the August 2026 designer review (Valeriia & Kostiantyn).

   Sources:
     Figma  "SP"          — 160 pinned comments
     Notion "SP — Veridian" — 25 issues + "Global Mini Design System"

   Load order matters: this file sits AFTER theme-luxe.css (so it can restate
   tokens luxe overrides) and BEFORE theme-dark.css (so dark mode still wins).
   Every block is tagged with the review item it answers, so each change can be
   validated against the source.
   ========================================================================== */

/* ==========================================================================
   1. TOKENS — Notion "Global Mini Design System Recommendations"
   ========================================================================== */

:root {
  /* --- Typography: the 4-level hierarchy Notion asked for ---------------- */
  --fs-page-title: 30px;   /* 28–32 / 700 */
  --fw-page-title: 700;
  --fs-section: 21px;      /* 20–24 / 700 */
  --fw-section: 700;
  --fs-item: 16px;         /* 16–18 / 600  — card + table item titles       */
  --fw-item: 600;
  --fs-body: 14px;         /* 14–16 / 400–500                               */
  --fw-body: 450;
  --lh-body: 1.5;

  /* --- Text colour: replaces the pale low-contrast greys ----------------- */
  --text: #172033;
  --text-primary: #172033;
  --text-secondary: #4b5563;
  --text-sec: #4b5563;
  --text-muted: #6b7280;
  --text-disabled: #9ca3af;   /* disabled CONTROLS only — 2.5:1, not for text */
  --text-tertiary: #6b7280;   /* legacy alias some modules use — muted tier */
  --text-dim: #6b7280;

  /* --- Backgrounds: kill the washed-out lavender ------------------------- */
  --bg-page: #f7f8fa;
  --bg-secondary: #f7f8fa;
  --bg: #ffffff;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --border-light: #eef0f3;

  /* --- Primary: ONE blue, but Activate's indigo, not a framework default.
         #3566e0 keeps the luxe hue family and clears AA under white ink. --- */
  --accent: #3566e0;
  --accent-light: #6ba1f7;
  --accent-soft: rgba(65, 128, 242, 0.09);
  --bg-hover: rgba(65, 128, 242, 0.05);

  /* Dark navy is now reserved for the selected sidebar state ONLY.          */
  --nav-active: #17215c;
  --bg-sidebar-active: #17215c;
  --text-sidebar-active: #ffffff;
  --bg-sidebar: #fbfbfd;
  --bg-sidebar-hover: rgba(23, 33, 92, 0.06);

  /* --- Accent (orange) is now creation-only ------------------------------ */
  --create: #f55819;
  --create-hover: #e04d12;
  --edit-ink: #374151;   /* neutral outline for Edit                        */
  --danger: #c1153a;     /* destructive only                                */

  /* --- Button sizing ----------------------------------------------------- */
  --btn-h-sm: 34px;      /* 32–36 — table row actions                       */
  --btn-h: 40px;         /* regular                                          */
  --btn-h-modal: 44px;   /* modal primary                                    */

  /* --- Modal widths ------------------------------------------------------ */
  --modal-sm: 560px;
  --modal-md: 720px;
  --modal-lg: 900px;

  /* --- Spacing scale (comments about "too close" / "too packed") --------- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* --- Elevation: the luxe layered ramp IS the brand's depth — one system,
         applied consistently (the review's complaint was inconsistency). --- */
  --shadow-sm: 0 1px 2px rgba(23, 26, 63, 0.05);
  --shadow: 0 1px 2px rgba(23, 26, 63, 0.04), 0 6px 20px -8px rgba(37, 51, 120, 0.10);
  --shadow-md: 0 2px 6px rgba(23, 26, 63, 0.05), 0 12px 28px -10px rgba(37, 51, 120, 0.14);
  --shadow-lg: 0 4px 12px rgba(23, 26, 63, 0.06), 0 24px 48px -16px rgba(37, 51, 120, 0.20);

  /* --- Geometry: the luxe radius language; the PILL is the button shape ---- */
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 18px;
  --btn-radius: 999px;

  /* --- The signature: Veridian's ember gradient, creation actions only ---- */
  --create-grad: linear-gradient(135deg, #ff6b2e, #f04e0e);
  --create-glow: 0 4px 14px -4px rgba(245, 88, 25, 0.45);
  --accent-glow: 0 4px 14px -4px rgba(53, 102, 224, 0.40);
}

/* Dark-mode counterparts for the tokens this file introduces (theme-dark.css
   does not know about them). Kept minimal — theme-dark still owns the rest. */
html[data-theme="dark"] {
  --text-tertiary: #8b93a7;
  /* --text-primary is introduced by THIS file and theme-dark.css knows nothing
     about it, so without these it would keep painting the light-mode
     near-black and any element inheriting body colour would vanish. */
  --text-primary: #e6e9f2;
  --text-secondary: #a8adbd;
  --text-muted: #8b93a7;
  --text-sec: #a8adbd;
  --text-disabled: #6b7280;
  --text-dim: #8b93a7;
  --edit-ink: #cbd5e1;
  --nav-active: #dbe6ff;
  --create: #f97316;
  --create-hover: #ea6a09;
  --border-light: #232a3a;
  --accent-soft: rgba(83, 152, 246, 0.16);
}

/* ==========================================================================
   2. TYPOGRAPHY  — Notion "Typography"
   "Avoid oversized bold text inside dense tables."
   ========================================================================== */

body {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
}

.header-title {
  font-size: 20px;
  font-weight: var(--fw-section);
  letter-spacing: -0.2px;
}

#content-area h1 { font-size: var(--fs-page-title); font-weight: var(--fw-page-title); letter-spacing: -0.3px; }
#content-area h2 { font-size: var(--fs-section);    font-weight: var(--fw-section);    letter-spacing: -0.2px; }
#content-area h3 { font-size: var(--fs-item);       font-weight: var(--fw-item); }
#content-area h4,
#content-area h5 { font-size: var(--fs-body);       font-weight: var(--fw-item); }

/* Dense tables never take display weights. Figma #80 "Inconsistent fonts,
   too big to the form", #128 "font consistency", #73 "Font size inconsistent" */
#content-area table td,
#content-area table th {
  font-size: 13px;
  line-height: 1.45;
}
#content-area table th {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
#content-area table td b,
#content-area table td strong { font-weight: 600; font-size: inherit; }

/* ==========================================================================
   3. SIDEBAR  — Notion #1, #2, #3
   ========================================================================== */

/* #1 "Sidebar logo and active nav state are visually heavier than the main
       workspace… Reduce logo footprint." */
.sidebar-header { padding: 12px 18px 10px; }
.sidebar-logo { width: 78%; max-width: 150px; }
/* The hover shimmer on the logo pulled the eye to chrome, not content. */
.sidebar-logo:hover { transform: none; filter: none; animation: none; }

/* #2 "Reduce the visual prominence of collapsed group labels: smaller text,
       lighter weight, less letter spacing, softer color." */
.nav-section-label {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  padding: 8px 12px 4px;
}
.nav-section-label:hover { color: var(--text-secondary); }
.nav-section-arrow { opacity: 0.45; }

/* #3 "Keep the selected state obvious, but reduce shadow, slightly reduce
       radius, and consider a calmer active background or left accent bar plus
       subtle fill." — left accent bar + subtle fill, no drop shadow. */
.nav-item {
  border-radius: 7px;
  padding: 6px 10px;
  border-left: 3px solid transparent;
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--nav-active);
  border-left-color: var(--accent);
  box-shadow: none;
  font-weight: 600;
}
html[data-theme="dark"] .nav-item.active { color: #dbe6ff; }
.nav-item.active .icon { color: var(--accent); opacity: 1; }
.nav-item.active .badge { background: var(--accent); color: #fff; }
.nav-item:hover { background: var(--bg-sidebar-hover); }

/* ==========================================================================
   4. HEADER  — Notion #4
   "Page title appears in the top app bar and again in the content area…
    the description line often truncates."
   The global header stays the single source of the title; the subtitle is
   allowed to wrap to a second line instead of being cut off mid-sentence.
   ========================================================================== */
.header-breadcrumb,
#header-subtitle {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  max-width: 68ch;
  line-height: 1.35;
  color: var(--text-secondary);
}

/* ==========================================================================
   5. BUTTONS  — Notion #7, #19 · Figma #82 #124 #143 #145 #148 #41 #42
   "Standardize button sizes… avoid mixed pill sizes in one row."
   "Reserve orange for primary creation actions only. Use neutral/blue for
    edit, red for destructive."
   ========================================================================== */

.btn-primary,
.btn-secondary,
.btn-create,
.btn-edit,
.btn-danger {
  min-height: var(--btn-h-sm);
  padding: 0 15px;
  border-radius: var(--btn-radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  /* Figma #87 #99 #105 #106 #110 #136 #137 #140 #146 #147: ALL-CAPS button
     labels were one of the competing capitalisation styles. Sentence case. */
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background var(--transition), border-color var(--transition),
              transform var(--transition), box-shadow var(--transition);
  /* Figma #143/#148 asked for CONSISTENT shadows: filled buttons carry one
     soft glow, outline buttons carry none. */
  box-shadow: none;
}
.btn-primary { box-shadow: var(--accent-glow); }
.btn-create,
.btn-primary.create { box-shadow: var(--create-glow); }
.btn-primary:hover,
.btn-create:hover { transform: translateY(-1px); }

/* Primary = the standardised blue, not orange. */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
.btn-primary:hover { background: #2b58cc; border-color: #2b58cc; }

/* Orange survives only where the action creates something. Opt in with
   .btn-create, or automatically for "+ New …" primaries. */
.btn-create,
.btn-primary.create,
.btn-primary[data-action="create"] {
  background: var(--create-grad);
  color: #fff;
  border: none;
}
.btn-create:hover,
.btn-primary.create:hover { background: var(--create-hover); border-color: var(--create-hover); }

/* Edit is neutral outline — it appears on every row and must not read primary. */
.btn-edit,
.btn-secondary {
  background: var(--bg-card);
  color: var(--edit-ink);
  border: 1px solid var(--border);
}
.btn-edit:hover,
.btn-secondary:hover { background: var(--bg-page); border-color: #d3d8e0; }

/* Destructive is the only red. */
.btn-danger {
  background: var(--bg-card);
  color: var(--danger);
  border: 1px solid rgba(193, 21, 58, 0.35);
}
.btn-danger:hover { background: rgba(193, 21, 58, 0.06); border-color: var(--danger); }

/* Size tiers. */
.btn-lg  { min-height: var(--btn-h); padding: 0 18px; font-size: 14px; }
.modal .btn-primary,
.modal .btn-create,
[class*="modal"] .btn-primary,
[class*="modal"] .btn-create { min-height: var(--btn-h-modal); padding: 0 20px; font-size: 14px; }

/* One row = one button height. Figma #41/#42 "Incosistent behaviour of
   Buttons when there are 23 lines and one". */
.btn-row,
.toolbar-actions,
.table-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.btn-row > button,
.toolbar-actions > button,
.table-actions > button { min-height: var(--btn-h-sm); }

/* ==========================================================================
   6. TABS / SEGMENTED CONTROL  — Notion #5 · Figma #102 #104 #138
   "Again another tab highlight variant. We need to generalazie and fix one way"
   One variant everywhere: text tab, blue ink + 2px underline when active.
   ========================================================================== */
.tabs,
.tab-bar,
.segmented,
[role="tablist"] {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
}
.tab,
.tab-btn,
.segmented > button,
[role="tab"] {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  min-height: 38px;
  padding: 0 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  box-shadow: none;
}
.tab:hover,
.tab-btn:hover,
[role="tab"]:hover { color: var(--text-primary); }
.tab.active,
.tab-btn.active,
.segmented > button.active,
[role="tab"][aria-selected="true"] {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
  background: transparent;
}

/* The app had grown a separate tab variant per screen — pill-in-a-track,
   filled pill, colour fill, drop-shadowed pill, text-only. Figma #102 / #104 /
   #138: "Again another tab highlight variant. We need to generalazie and fix
   one way", and Notion #5. All 25 variants fold into the single
   variant defined above: text tab, blue ink, 2px underline when active. */
.ac-tabs, .adopt-tabs, .agents-tabs, .apis-tabs, .apix-tabs, .apix-sidebar-tabs,
.cfg-tabs, .cfg-subtabs, .cicd-tabs, .cicd-screen-tabs, .dap-tabs, .design-flow-tabs,
.ds-tabs, .dt-tabs, .env-tabs, .ev-modal-tabs, .pupd-tabs, .rn-tabs, .sim-gui-tabs,
.simr-tabs, .te-tabs, .tests-tabs, .training-tabs, .tw-tabs, .vsn-tabs,
.wmc-network-tabs {
  display: flex !important;
  align-items: center;
  gap: 2px !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: var(--sp-4) !important;
  box-shadow: none !important;
}
.ac-tab, .adopt-tab, .agents-tab, .apis-tab, .apix-tab, .apix-sidebar-tab, .cfg-tab,
.cicd-tab, .cicd-screen-tab, .dap-tab-btn, .design-flow-tab, .ds-tab, .dt-tab,
.env-tab, .ev-tab, .jn-tab, .pupd-tab, .rn-tab, .simr-tab, .te-tab, .tests-tab,
.training-tab, .tw-tab, .vsn-tab, .wmc-network-tab {
  background: transparent !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  min-height: 38px;
  padding: 0 14px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--text-secondary) !important;
}
.ac-tab:hover, .adopt-tab:hover, .agents-tab:hover, .apis-tab:hover, .apix-tab:hover,
.apix-sidebar-tab:hover, .cfg-tab:hover, .cicd-tab:hover, .cicd-screen-tab:hover,
.dap-tab-btn:hover, .design-flow-tab:hover, .ds-tab:hover, .dt-tab:hover,
.env-tab:hover, .ev-tab:hover, .jn-tab:hover, .pupd-tab:hover, .rn-tab:hover,
.simr-tab:hover, .te-tab:hover, .tests-tab:hover, .training-tab:hover, .tw-tab:hover,
.vsn-tab:hover, .wmc-network-tab:hover {
  color: var(--text-primary) !important;
  background: transparent !important;
}
.ac-tab.active, .adopt-tab.active, .agents-tab.active, .apis-tab.active,
.apix-tab.active, .apix-sidebar-tab.active, .cfg-tab.active, .cicd-tab.active,
.cicd-screen-tab.active, .dap-tab-btn.active, .design-flow-tab.active, .ds-tab.active,
.dt-tab.active, .env-tab.active, .ev-tab.active, .jn-tab.active, .pupd-tab.active,
.rn-tab.active, .simr-tab.active, .te-tab.active, .tests-tab.active,
.training-tab.active, .tw-tab.active, .vsn-tab.active, .wmc-network-tab.active {
  color: var(--accent) !important;
  font-weight: 600 !important;
  background: transparent !important;
  border-bottom-color: var(--accent) !important;
  box-shadow: none !important;
}

/* ==========================================================================
   7. TABLES  — Notion #6 · Figma #8 #63 #114 #116
   "Tables need stronger scanability: sticky header, clearer row hover,
    consistent column alignment."
   ========================================================================== */
#content-area table { border-collapse: separate; border-spacing: 0; width: 100%; }

/* Figma #8 "View breaks, table headings should be non-transparent" */
#content-area thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 10px 12px;
}
#content-area tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); }
#content-area tbody tr { transition: background 0.12s ease; }
#content-area tbody tr:hover { background: var(--accent-soft); }

/* Numeric columns right-align. Opt in with .num, or via a data attribute. */
#content-area td.num,
#content-area th.num,
#content-area td[data-type="number"],
#content-area th[data-type="number"] { text-align: right; font-variant-numeric: tabular-nums; }

/* Row actions grouped, right-aligned, one size. */
#content-area td.actions,
#content-area th.actions { text-align: right; white-space: nowrap; }
#content-area td.actions > * + * { margin-left: var(--sp-2); }

/* Figma #114 "Do we need this much space taken for the table which does not
   have data? May be we could shrink a table to minimum size to state that it's
   there but empty" — an empty table collapses to a single compact row. */
.table-empty,
.empty-state {
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-page);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 0;
}

/* Grid-based "tables" (the agent inventory is a CSS grid, not a <table>) get
   the same hover and selected affordance. Notion #6. */
.as-row:hover { background: var(--accent-soft); }
.as-row:focus-within,
.as-row[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }

/* ==========================================================================
   8. CARDS  — Figma #93 #117 #64 #90 #91 #92
   "We need unified card structure all across the web app to avoid exhaustion"
   ========================================================================== */
.card,
.panel,
.kpi-card,
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.card + .card,
.panel + .panel { margin-top: var(--sp-3); }
.card h3,
.card h4,
.panel h3 { font-size: var(--fs-item); font-weight: var(--fw-item); margin: 0 0 var(--sp-2); }

/* Figma #34 "The hover effect on these exact boxes gives a feeling that those
   are buttons, it would be more obvious if we had hower on the whole frame" —
   only cards that are genuinely clickable get an affordance, and it covers the
   whole card. */
.card[onclick],
.card[role="button"],
.card.clickable,
a.card { cursor: pointer; }
.card[onclick]:hover,
.card[role="button"]:hover,
.card.clickable:hover,
a.card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
/* …and non-interactive cards explicitly do not pretend. Figma #76 */
.card:not([onclick]):not([role="button"]):not(.clickable):hover { box-shadow: var(--shadow-sm); }

/* ==========================================================================
   9. MODALS  — Notion #10 #14 #21 · Figma #77
   "Use max-widths: small 560px, medium 720px, large 900px. Keep footer actions
    fixed at bottom for long forms."
   ========================================================================== */
.modal,
.modal-panel,
.modal-content,
.dialog {
  max-width: var(--modal-md);
  width: calc(100vw - 48px);
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  /* Figma #77 "Too much shadow, shadow collapses with border, there should be
     less shadow, and border - further" */
  box-shadow: var(--shadow-lg);
}
.modal.modal-sm, .modal-panel.modal-sm, .dialog.modal-sm { max-width: var(--modal-sm); }
.modal.modal-lg, .modal-panel.modal-lg, .dialog.modal-lg { max-width: var(--modal-lg); }

.modal-header, .modal-head {
  flex: 0 0 auto;
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-4);
}
/* #14 "Keep Create Agent visible without forcing users to scroll to confirm." */
.modal-footer, .modal-foot, .modal-actions {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
}

/* ==========================================================================
   10. FORMS  — Notion #11 #13 #18
   "Labels, helper text, placeholder text, and validation copy should follow
    one pattern. Placeholder should not carry critical instructions."
   ========================================================================== */
.field { margin-bottom: var(--sp-4); }
.field > label,
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--sp-1);
  letter-spacing: 0;
}
.field-help,
.form-help {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--sp-1);
  line-height: 1.45;
}
.field-optional {
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 6px;
}
#content-area input::placeholder,
#content-area textarea::placeholder { color: var(--text-disabled); }

/* Form controls declare their own ink — a bare control otherwise takes
   `color: buttontext` (black) from the UA stylesheet and disappears in dark. */
#content-area input,
#content-area select,
#content-area textarea {
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
}
#content-area input:focus,
#content-area select:focus,
#content-area textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ==========================================================================
   11. STATUS BADGES  — Notion #8
   "Define semantic badge tokens: success, warning, danger, neutral, info.
    Ensure text contrast passes AA."
   ========================================================================== */
.badge-success, .badge-warning, .badge-danger, .badge-neutral, .badge-info {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: none;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-neutral { background: #f1f2f4; color: #374151; }
.badge-info    { background: #dbeafe; color: #1e40af; }

/* ==========================================================================
   12. ACCESSIBILITY  — Notion #8 #23 · Figma #19 #24 #33 #50 #81 #160
   "Icon-only buttons need labels/tooltips and keyboard focus states."
   ========================================================================== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
button, [role="button"], a { -webkit-tap-highlight-color: transparent; }

/* #23 "Viewer controls… may fail touch targets. Use 40px min height." */
.icon-btn,
.hdr-icon,
button.icon-only,
.viewer-controls button {
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Muted helper text was the most common contrast failure. */
.muted, .text-muted, small { color: var(--text-muted); }

/* ==========================================================================
   13. LEGACY NORMALIZATION  — Guidelines §0.3 / §5.1
   The app builds most UI from inline style strings in ~120 JS modules, and
   inline styles outrank stylesheets. These attribute-substring selectors +
   !important force the recurring legacy patterns to spec app-wide, so every
   screen honours the system even before its module is hand-converted.
   Hand-converted modules (§9 reference screens) don't match these selectors
   and are unaffected. Remove each block as its pattern dies out of the JS.
   ========================================================================== */

/* 13.1  Pill buttons → control radius (§5.1 retired pill buttons).
         Badges/chips are spans, so scoping to button/a leaves them alone.
         Covers every writing of the pattern: 999px/99px/100px/50px/20px+,
         with or without a space, inline OR class-based. The blanket rule
         wins over stylesheets; the [style*] variants win over inline. */
#content-area button,
#content-area a.btn,
#content-area a[class*="-btn"] {
  border-radius: var(--btn-radius);
}
/* Modules converted during the flat pass wrote radius-sm inline — re-pill. */
#content-area button[style*="border-radius:var(--radius-sm"],
#content-area button[style*="border-radius: var(--radius-sm"] {
  border-radius: var(--btn-radius) !important;
}

/* 13.2  Orange-gradient CTAs (49×) → flat --create. The gradient pattern was
         used almost exclusively for "+ New …" creation actions. */
#content-area button[style*="linear-gradient(135deg,#ff6b2e"],
#content-area a[style*="linear-gradient(135deg,#ff6b2e"] {
  box-shadow: var(--create-glow) !important;
}
/* Every other gradient button → the standardised blue. */
#content-area button[style*="linear-gradient(135deg,#253378"],
#content-area button[style*="linear-gradient(135deg,#2fae86"],
#content-area button[style*="linear-gradient(90deg"],
#content-area button[style*="linear-gradient(135deg,#474ecb"],
#content-area button[style*="linear-gradient(135deg,#5398f6"] {
  background: var(--accent) !important;
  box-shadow: none !important;
}

/* 13.3  ALL-CAPS buttons → sentence case (uppercase stays legal for the
         11px micro-cap labels, which are never <button>s). */
#content-area button[style*="text-transform:uppercase"],
#content-area button[style*="text-transform: uppercase"] {
  text-transform: none !important;
  letter-spacing: 0 !important;
}

/* 13.4  One shadow system: outline/neutral buttons carry none; filled
         primary/create buttons carry their single glow (set elsewhere). */
#content-area button[style*="background:var(--bg-card"],
#content-area button[style*="background: var(--bg-card"],
#content-area button[style*="border:1px solid var(--border"] { box-shadow: none !important; }

/* 13.4b Buttons are sentence case (§5.1) — inline OR class-delivered.
         Legal uppercase micro-caps are never <button>s. */
#content-area button {
  text-transform: none;
  letter-spacing: 0;
}

/* 13.5  Legacy small-button geometry: anything styled as a compact inline
         button gets at least the 30px row-action height. */
#content-area button[style*="padding:5px"],
#content-area button[style*="padding:6px"],
#content-area button[style*="padding:7px"] {
  min-height: 30px;
}

/* 13.6  Inline near-black / stale-navy ink on interactive text → tokens.
         (#253378 was both brand navy AND body text before the review.) */
#content-area button[style*="color:#253378"] { color: var(--edit-ink) !important; }

/* 13.7  (retired) Hover lifts restored as brand motion — luxe owns them. */

/* 13.8  Modal shells (33 modules ship their own overlay+dialog divs).
         Normalise the shell to §5.8: 14px radius, 1px border sitting clear of
         one --shadow-lg. Width tiers and sticky footers arrive as each module
         is hand-converted; the shell look is unified now. */
div[style*="position:fixed"][style*="inset:0"] > div[style*="background"] {
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg) !important;
  max-width: min(var(--modal-lg), calc(100vw - 48px));
}

/* 13.9  Class-based button skins (.btn-primary/.btn-secondary re-styled by
         theme-luxe AND per-module <style> blocks) — end the specificity war:
         geometry per §5.1, no pills, no shadows, no lifts, no shimmer. */
#content-area .btn-primary,
#content-area .btn-secondary,
#content-area .ai-btn,
#content-area .adopt-ai-btn,
#content-area .sup-btn,
#content-area .promo-filter-btn {
  border-radius: var(--btn-radius) !important;
}

/* 13.10 Fill tokens used as INK through runtime-assembled inline styles.
         --pass (2.2:1) / --partial (1.9:1) / --green / --yellow are fill
         colours; wherever a template stamped them as text colour, re-ink. */
#content-area [style*="color:var(--pass)"]    { color: var(--pass-ink, #047857) !important; }
#content-area [style*="color: var(--pass)"]   { color: var(--pass-ink, #047857) !important; }
#content-area [style*="color:var(--partial)"] { color: #b45309 !important; }
#content-area [style*="color: var(--partial)"]{ color: #b45309 !important; }
#content-area [style*="color:var(--green)"]   { color: var(--pass-ink, #047857) !important; }
#content-area [style*="color:var(--yellow)"]  { color: #b45309 !important; }
html[data-theme="dark"] #content-area [style*="color:var(--partial)"],
html[data-theme="dark"] #content-area [style*="color: var(--partial)"],
html[data-theme="dark"] #content-area [style*="color:var(--yellow)"] { color: #fbbf5c !important; }

/* 13.11 Creation CTAs tagged `create` on any *btn-primary class family. */
#content-area .btn-primary.create,
#content-area .a-btn-primary.create,
#content-area .env-btn-primary.create {
  background: var(--create-grad) !important;
  border: none !important;
  color: #fff !important;
  box-shadow: var(--create-glow) !important;
}
#content-area .btn-primary.create:hover,
#content-area .a-btn-primary.create:hover,
#content-area .env-btn-primary.create:hover { transform: translateY(-1px); }
/* Converted modules wrote flat var(--create) inline — same signature. */
#content-area button[style*="background:var(--create"],
#content-area button[style*="background: var(--create"] {
  background: var(--create-grad) !important;
  box-shadow: var(--create-glow) !important;
  border: none !important;
}

/* ==========================================================================
   14. THE ONE BUTTON  — §5.1, enforced at runtime by js/ui-normalize.js.
   Every button in content and modals is classified and re-dressed in exactly
   one geometry and one palette. Modules keep their handlers and layout;
   visual styling comes only from here.
   ========================================================================== */
body .u-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-height: 34px !important;
  padding: 0 15px !important;
  border: 1px solid transparent !important;
  border-radius: var(--btn-radius) !important;
  font-family: var(--font) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  line-height: 1 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition),
              transform var(--transition) !important;
  box-shadow: none !important;
}
body .u-btn--sm { min-height: 29px !important; padding: 0 12px !important; font-size: 12px !important; }
body .u-btn:disabled { opacity: 0.55 !important; cursor: not-allowed !important; }

body .u-btn--neutral,
body .u-btn--chip {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
  color: var(--edit-ink) !important;
}
body .u-btn--neutral:hover,
body .u-btn--chip:hover { background: var(--bg-page) !important; border-color: #cfd6df !important; }

body .u-btn--primary {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
  box-shadow: var(--accent-glow) !important;
}
body .u-btn--primary:hover { transform: translateY(-1px) !important; }

body .u-btn--create {
  background: var(--create-grad) !important;
  border: none !important;
  color: #fff !important;
  box-shadow: var(--create-glow) !important;
}
body .u-btn--create:hover { transform: translateY(-1px) !important; }

body .u-btn--run {
  background: var(--bg-card) !important;
  border-color: #16a34a !important;
  color: #15803d !important;
}
body .u-btn--run:hover { background: rgba(22, 163, 74, 0.06) !important; }
html[data-theme="dark"] body .u-btn--run { border-color: #34d399 !important; color: #34d399 !important; }

body .u-btn--danger {
  background: var(--bg-card) !important;
  border-color: rgba(193, 21, 58, 0.4) !important;
  color: var(--danger) !important;
}
body .u-btn--danger:hover { background: rgba(193, 21, 58, 0.06) !important; border-color: var(--danger) !important; }
html[data-theme="dark"] body .u-btn--danger { border-color: rgba(248, 113, 113, 0.5) !important; color: #f87171 !important; }

body .u-btn--icon {
  min-width: 30px !important;
  min-height: 30px !important;
  padding: 0 8px !important;
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
  color: var(--edit-ink) !important;
}
body .u-btn--icon:hover { background: var(--bg-page) !important; }

body .u-btn--chip.active,
body .u-btn--chip[aria-pressed="true"] {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
