/* Hesabyar · final visual layer, deliberately screen-only.
   Existing controls, RTL layout, local fonts and print styles remain authoritative.
   Primary = cobalt; navigation = navy; success = teal; danger = red.
*/
@media screen {
  :root {
    color-scheme: light;
    --ui-navy: #14263f;
    --ui-blue: #2458d3;
    --ui-blue-hover: #1c46ac;
    --ui-blue-soft: #edf3ff;
    --ui-teal: #0b6b58;
    --ui-teal-soft: #e8f7f1;
    --ui-danger: #b42336;
    --ui-danger-soft: #fff0f1;
    --ui-amber: #875309;
    --ui-amber-soft: #fff5df;
    --ui-text: #20334f;
    --ui-muted: #596b82;
    --ui-line: #dce3ed;
    --ui-field-line: #8293aa;
    --ui-canvas: #f4f6fa;
    --ui-surface: #fff;
    --ui-shadow: 0 3px 16px #14263f06;
    /* Bridge semantic legacy tokens; never infer success from --green. */
    --green: var(--ui-blue);
    --deep: var(--ui-blue-hover);
    --mint: var(--ui-blue-soft);
    --ink: var(--ui-text);
    --muted: var(--ui-muted);
    --line: var(--ui-line);
    --bg: var(--ui-canvas);
  }
  body { background: var(--ui-canvas); color: var(--ui-text); }
  .sidebar { background: var(--ui-navy); }
  .btn.primary { background: var(--ui-blue); border-color: var(--ui-blue); color: #fff; }
  .btn.primary:hover { background: var(--ui-blue-hover); border-color: var(--ui-blue-hover); }

  /* Navigation is a distinct, quiet anchor, not another white card. */
  .sidebar { border-inline-end: 1px solid #243c5c; padding-top: 24px; scrollbar-color: #566984 var(--ui-navy); }
  .sidebar .brand { padding-bottom: 24px; }
  .sidebar .brand strong { color: #fff; font-size: 25px; }
  .sidebar .brand small { color: #bdcce0; font-size: 11px; }
  .sidebar .brand-icon { background: #386be5; box-shadow: none; border: 1px solid #7da1f1; }
  .sidebar .workspace { background: #1d3554; border-color: #3d5573; margin-bottom: 24px; }
  .sidebar .workspace strong, .sidebar .profile strong, .sidebar .helpbox strong { color: #f5f8ff; }
  .sidebar .workspace small, .sidebar .profile small, .sidebar .helpbox p { color: #c0cfe2; font-size: 11px; }
  .sidebar .workspace .sq, .sidebar .avatar { background: #29486e; color: #dce8ff; }
  .sidebar .nav-label { color: #acbed5; font-size: 11px; }
  .sidebar .nav-btn { color: #d0dcef; font-size: 13px; min-height: 48px; border: 1px solid transparent; margin-bottom: 5px; }
  .sidebar .nav-btn:hover { background: #243f61; color: #fff; border-color: #3e5f87; }
  .sidebar .nav-btn.active { background: var(--ui-blue); color: #fff; border-color: #7195ee; box-shadow: 0 4px 12px #06162d30; }
  .sidebar .nav-btn.active:after { background: #fff; }
  .sidebar .nav-btn .chev { color: #bdd0e9; }
  .sidebar .helpbox { background: #1d3554; border-color: #3d5573; margin-block: 16px; padding: 14px; }
  .sidebar .helpbox button { color: #d7e5ff; min-height: 44px; font-size: 11px; }
  .sidebar .profile { border-color: #3d5573; padding-top: 16px; }
  .sidebar .profile .iconbutton { color: #d7e5ff; }
  .sidebar .profile .iconbutton:hover { background: #29486e; }
  .sidebar :is(button,a):focus-visible { outline-color: #a9c6ff; }

  /* White surfaces, dark numbers and a restrained blue/teal data language. */
  .topbar { border-color: var(--ui-line); background: #fff; }
  .topbar-title, .top-actions, .eyebrow, .subtitle, .footer { color: var(--ui-muted); }
  .topbar-title b, .page-head h1 { color: var(--ui-navy); }
  .eyebrow { font-size: 11px; }
  .subtitle { font-size: 13px; }
  .page-symbol { background: var(--ui-blue-soft); color: var(--ui-blue); border-color: #cbdaf7; }
  .searchbox { background: #f7f9fc; border-color: #c4d0e0; color: var(--ui-muted); }
  .chip { color: #526079; background: #edf1f7; font-size: 11px; border-radius: 6px; padding: 5px 8px; }
  .top-actions .chip { color: var(--ui-amber); background: var(--ui-amber-soft); border: 1px solid #e9d2a5; font-size: 11px; }
  .btn { color: #344d70; border-color: #bccadd; background: #fff; font-size: 13px; font-weight: 500; min-height: 44px; border-radius: 10px; padding: 10px 16px; box-shadow: none; }
  .btn:hover { background: #edf3fc; border-color: #879fbe; }
  .btn.primary { font-weight: 600; box-shadow: 0 3px 8px #2458d31a; }
  .btn.danger { color: var(--ui-danger); border-color: #df9da5; background: #fff; }
  .btn.danger:hover { background: var(--ui-danger-soft); border-color: var(--ui-danger); }
  button:disabled { cursor: not-allowed; }
  .iconbutton { min-width: 44px; width: 44px; min-height: 44px; height: 44px; border-radius: 10px; color: #435c7b; }
  .iconbutton:hover { background: var(--ui-blue-soft); }
  .text-link { min-height: 44px; color: var(--ui-blue); font-size: 12px; }
  .welcome-strip { background: #eaf1ff; border-color: #cddbf8; border-inline-start: 4px solid var(--ui-blue); border-radius: 14px; }
  .welcome-strip strong { color: #254a92; font-size: 14px; }
  .welcome-strip small { color: #4e6485; font-size: 12px; }
  .welcome-mark { color: var(--ui-blue); background: #d9e6ff; }
  .welcome-strip button { color: #1c48ac; font-size: 13px; min-height: 44px; }
  .stat, .panel, .module { background: #fff; border-color: var(--ui-line); border-radius: 16px; box-shadow: var(--ui-shadow); }
  .stat { border-top: 3px solid #b9ccef; }
  .stat:first-child { border-top-color: var(--ui-blue); }
  .stat:nth-child(2) { border-top-color: var(--ui-teal); }
  .stat:nth-child(3) { border-top-color: #b88022; }
  .stat:nth-child(4) { border-top-color: #7e6bb2; }
  .stat-top { color: #50637e; font-size: 13px; }
  .stat-value { color: var(--ui-navy); font-size: 27px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
  .stat-value small, .stat-foot { color: var(--ui-muted); font-size: 11px; }
  .stat-icon { color: var(--ui-blue); background: var(--ui-blue-soft); }
  .stat:nth-child(2) .stat-icon { color: var(--ui-teal); background: var(--ui-teal-soft); }
  .stat:nth-child(3) .stat-icon { color: var(--ui-amber); background: var(--ui-amber-soft); }
  .stat:nth-child(4) .stat-icon { color: #675099; background: #f2eef9; }
  .stat-foot .trend, .trend { background: var(--ui-teal-soft); color: var(--ui-teal); }
  .panel-head h2 { color: var(--ui-navy); font-size: 15px; font-weight: 700; }
  .panel-head small, .chart-meta { color: var(--ui-muted); font-size: 12px; }
  .chart text { fill: var(--ui-muted); }
  .chart polyline:first-of-type, .chart circle { stroke: var(--ui-blue); }
  .chart polyline:nth-of-type(2) { stroke: #a26712; }
  .chart linearGradient stop { stop-color: var(--ui-blue); }
  .legend:first-child i { background: var(--ui-blue); }
  .legend:last-of-type i { background: #a26712; }
  .segmented { background: #edf1f7; border-color: var(--ui-line); }
  .segmented button { color: #52647e; min-height: 44px; padding-inline: 12px; font-size: 11px; }
  .segmented button.active { background: #fff; color: #1c48ac; box-shadow: 0 1px 4px #14263f18; font-weight: 600; }
  .quick-item { color: #344d70; font-size: 12px; border-color: var(--ui-line); background: #fff; }
  .quick-item:hover { background: var(--ui-blue-soft); border-color: #a4bced; transform: none; box-shadow: 0 3px 10px #2458d30b; }
  .quick-item span { background: var(--ui-blue-soft); color: var(--ui-blue); }
  .quick-item:nth-child(2) span { background: #edf3ff; color: #3b5ba3; }
  .quick-item:nth-child(3) span { background: var(--ui-amber-soft); color: var(--ui-amber); }
  .quick-item:nth-child(4) span { background: var(--ui-teal-soft); color: var(--ui-teal); }
  .quick-item:nth-child(5) span { background: #fff0ea; color: #a14a26; }
  .quick-item:nth-child(6) span { background: #f2eef9; color: #675099; }
  .quick-note { color: var(--ui-muted); font-size: 11px; }
  .reminder strong { color: var(--ui-text); font-size: 12px; }
  .reminder small { color: var(--ui-muted); font-size: 11px; }
  .reminder time { color: var(--ui-amber); background: var(--ui-amber-soft); font-size: 10px; }
  .reminder-icon { color: var(--ui-amber); background: var(--ui-amber-soft); }
  .reminder:nth-child(2) .reminder-icon { color: #a14a26; background: #fff0ea; }
  .reminder:nth-child(3) .reminder-icon { color: var(--ui-blue); background: var(--ui-blue-soft); }
  .mini-banner { background: #f1f6fd; border-color: #dce6f5; color: #4c6386; font-size: 11px; }

  /* Module catalog and nested navigation use the same interaction hierarchy. */
  .module { transition: border-color .16s, background-color .16s, box-shadow .16s; }
  .module:hover { background: #fbfcff; border-color: #8ba9e9; box-shadow: 0 4px 18px #14263f0b; }
  .module strong, .module-section h2 { color: var(--ui-navy); font-size: 15px; }
  .module small { color: var(--ui-muted); font-size: 12px; }
  .module-icon, .tone-0 { background: var(--ui-blue-soft); color: var(--ui-blue); }
  .tone-1 { background: var(--ui-teal-soft); color: var(--ui-teal); }
  .tone-2 { background: #f2eef9; color: #675099; }
  .tone-3 { background: var(--ui-amber-soft); color: var(--ui-amber); }
  .tone-4 { background: #eaf4fb; color: #236585; }
  .module-toolbar > span, .frequent > span { color: var(--ui-muted); font-size: 12px; }
  .module-search { border-color: #aebed4; background: #fff; color: var(--ui-muted); }
  .frequent button { color: #315784; background: #fff; border: 1px solid #ccd8e8; min-height: 44px; font-size: 12px; border-radius: 9px; }
  .b-subnav { background: #edf1f7; border-color: #d1dceb; }
  .b-subnav button { min-height: 44px; color: #435a7a; font-size: 12px; }
  .b-subnav button:hover { background: #fff; color: var(--ui-blue); }
  .b-subnav button.active { background: var(--ui-blue); color: #fff; }

  /* Tables retain internal scrolling; document scrolling must stay vertical. */
  th { color: #4c607d; background: #f1f5fa; font-size: 12px; font-weight: 600; border-color: var(--ui-line); }
  td { color: #344c6b; font-size: 13px; border-color: #e8edf4; }
  tbody tr:hover td { background: #f7faff; }
  .cell-title { color: var(--ui-text); }
  .cell-sub, .pp-muted { color: var(--ui-muted); font-size: 11px; }
  .status { color: var(--ui-teal); background: var(--ui-teal-soft); border: 1px solid #bfe2d6; border-radius: 6px; font-size: 11px; padding: 4px 9px; font-weight: 500; }
  .status.pending { color: var(--ui-amber); background: var(--ui-amber-soft); border-color: #ead4ab; }
  .status.cancelled { color: var(--ui-danger); background: var(--ui-danger-soft); border-color: #edc6cc; }
  .status.draft { color: #526079; background: #edf1f7; border-color: #d5ddea; }
  .table-footer { color: var(--ui-muted); font-size: 11px; background: #fbfcfe; }
  .state-tabs .filter-chip, .filter-chip { color: #52647e; min-height: 44px; font-size: 12px; border-radius: 8px; }
  .state-tabs .filter-chip.active, .filter-chip.active { background: var(--ui-blue-soft); color: #1c48ac; font-weight: 600; }
  .row-actions button { min-height: 44px; min-width: 44px; border-radius: 8px; color: var(--ui-blue); }
  .list-summary { color: var(--ui-muted); }
  .list-summary b { color: var(--ui-navy); }
  .empty, .empty-state p { color: var(--ui-muted); font-size: 13px; }
  .empty-state h3 { color: var(--ui-navy); font-size: 17px; }

  /* Fields stay native, visibly bounded and easy to scan in long RTL forms. */
  input:not([type=checkbox]):not([type=radio]), select, textarea,
  .form-grid :is(input:not([type=checkbox]):not([type=radio]),select,textarea), .ai-line :is(input,select), .builder-label input,
  .enhanced-toolbar select {
    color: var(--ui-text); background: #fff; border: 1px solid var(--ui-field-line);
    border-radius: 9px; min-height: 46px; font-size: 14px; line-height: 1.7;
    box-shadow: inset 0 1px 2px #14263f03;
  }
  input::placeholder, textarea::placeholder,
  .form-grid input::placeholder, .form-grid textarea::placeholder { color: #64748b; opacity: 1; font-size: 13px; }
  :is(input,select,textarea):disabled, #person-form input:disabled { background: #edf1f6; color: #596b82; border-color: #b8c4d4; cursor: not-allowed; }
  input[type=checkbox], input[type=radio] { accent-color: var(--ui-blue); }
  :is(button,a,summary,input,select,textarea):focus-visible,
  #modal.ux-workspace :is(input,select,textarea,button):focus-visible,
  .product-form-tabs button:focus-visible {
    outline: 3px solid var(--ui-blue); outline-offset: 3px;
  }
  :is(input,select,textarea):focus { border-color: var(--ui-blue); box-shadow: 0 0 0 3px #2458d31a; }
  .toggle-control input:checked + span { background: var(--ui-blue); }
  .toggle-control input:focus-visible + span { outline-color: var(--ui-blue); }
  .form-grid label, .category-field > label, .builder-label, .pp-phone > label,
  .ex-filters label, .pp-toolbar label, .ai-line label, .iv-tier-row label,
  #modal.ux-workspace label { color: #344c6b; font-size: 13px; font-weight: 500; }

  /* A navy header identifies every dialog; surfaces below stay bright. */
  dialog { background: #f7f9fc; box-shadow: 0 24px 90px #071a3b44; border: 1px solid #cdd8e6; }
  dialog::backdrop { background: #0d1e3b80; backdrop-filter: blur(3px); }
  .modal-head, #modal.ux-workspace .modal-head { background: var(--ui-navy); border-bottom: 1px solid #29486e; padding-block: 16px; }
  .modal-head h2, #modal.ux-workspace .modal-head h2 { color: #fff; font-size: 20px; font-weight: 700; }
  .dialog-heading small { color: #c2d3eb; font-size: 12px; }
  .dialog-icon { background: #29486e; color: #dce9ff; border: 1px solid #4a6993; }
  .modal-head .iconbutton { background: #203c60; color: #fff; border: 1px solid #627e9e; }
  .modal-head .iconbutton:hover { background: #315780; }
  .modal-head .iconbutton:focus-visible { outline-color: #b6d0ff; }
  .modal-body { background: #f7f9fc; }
  #modal.ux-workspace { border-radius: 18px; }
  #modal.ux-workspace .btn { min-height: 44px; }
  #modal.ux-workspace :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { min-height: 46px; font-size: 14px; }
  #modal.ux-workspace :is(.form-actions,.pp-form-bottom) {
    background: #f7f9fc; border-color: #c5d2e3; padding-block: 14px;
    box-shadow: 0 -8px 18px #14263f08;
  }
  .ux-form-tools { border-color: #d5dfec; }
  .ux-form-meta, .ux-save-state { color: #4c6381; }
  .ux-save-state[data-dirty=true] { color: var(--ui-amber); }
  .entity-intro { background: var(--ui-blue-soft); border-color: var(--ui-blue); color: #355581; }
  .entity-section, #modal .fl-section { background: #fff; border-color: #d4deeb; border-radius: 13px; box-shadow: 0 2px 5px #14263f03; }
  .entity-section-title, #modal .fl-section > h3, .pp-heading, .pp-section-action h3,
  .tab-section-heading h3, .form-section-title { color: var(--ui-navy); font-size: 15px; font-weight: 700; }
  .entity-section-title { border-inline-start: 3px solid #9eb9ed; padding-inline-start: 10px; }
  .entity-section-hint, #modal .fl-hint, .pp-hint, .builder-hint, .tab-section-heading p,
  .form-section-title small, .shortcut-hint, .pp-form-bottom > span, .inline-note,
  .ai-base, #product-panel-pricing small, .switch-label, .switch-label small { color: var(--ui-muted); }
  .entity-section-hint, .pp-hint, .tab-section-heading p { font-size: 12px; }
  .notice, .ex-note { background: #edf3fc; border-color: #cbdaf0; color: #425d82; font-size: 12px; }
  .pp-help { background: #edf3fc; border-color: #cbdaf0; color: #425d82; }
  .pp-finance-note, .iv-warnings p, .iv-row-warning { background: var(--ui-amber-soft); border-color: #e5c994; color: var(--ui-amber); }
  .fw-inline-details, .fw-opening, .pm-controls, .pp-builder, .inline-builder, .iv-totals-input {
    background: #f3f6fb; border-color: #cbd8e9; border-radius: 12px; color: var(--ui-text);
  }
  .fw-opening h3, .pp-builder h3, .builder-heading strong { color: #2b476d; font-size: 14px; }
  .pp-builder p { color: var(--ui-muted); }
  .advanced-fields { border-color: #cbd8e9; }
  .advanced-fields summary { background: #f0f4fa; color: #35547d; min-height: 48px; }
  .advanced-fields summary > small { color: var(--ui-muted); }
  .entity-jumps button { color: #315784; background: #edf3fc; border-color: #bacce7; }
  .entity-jumps button:hover { color: #1c48ac; background: #dfeaff; }

  /* Selected tabs are unambiguous, even without relying on text color alone. */
  .pp-tabs, .product-form-tabs, .iv-tabs { background: #e9eef6; border: 1px solid #cfdbea; padding: 5px; border-radius: 11px; gap: 5px; }
  .pp-tabs button, .product-form-tabs button, .iv-tabs button { min-height: 44px; color: #455d7e; border: 1px solid transparent; border-radius: 8px; font-size: 12px; }
  .pp-tabs button:hover, .product-form-tabs button:hover, .iv-tabs button:hover { background: #fff; color: #1c48ac; }
  .pp-tabs button[aria-selected=true], .product-form-tabs button[aria-selected=true], .iv-tabs button[aria-selected=true] { background: var(--ui-blue); color: #fff; border-color: #1c46ac; font-weight: 600; box-shadow: 0 2px 5px #2458d329; }
  #modal .fl-nav { background: #f7f9fc; border-color: #c5d2e3; box-shadow: 0 6px 12px #14263f06; }
  #modal .fl-nav-links .btn { background: #fff; color: #3d5577; border-color: #bccadd; }
  #modal .fl-nav-links .btn:hover { background: var(--ui-blue-soft); border-color: #8faee6; }
  #modal .fl-form .total, .total { background: var(--ui-teal-soft); border-color: #b2d9ca; color: #125442; }
  #modal .fl-form .total strong { color: #075442; }
  .iv-sum-grid > span { color: #52647e; background: #f1f5fa; border-color: #d7e1ed; }
  .iv-sum-grid b { color: var(--ui-navy); font-variant-numeric: tabular-nums; }
  .ai-line { grid-template-columns: minmax(0,1.5fr) minmax(0,1.5fr) minmax(0,.8fr) minmax(0,.7fr) minmax(0,1fr) 44px; background: #f7f9fc; border-color: #cbd8e9; }
  .ai-line .iconbutton { margin-bottom: 0; }
  .ai-line [data-iv=remove], .pp-phone [data-pp-action=remove-phone] { color: var(--ui-danger); background: var(--ui-danger-soft); }
  .ai-line [data-iv=remove]:hover, .pp-phone [data-pp-action=remove-phone]:hover { background: #ffdee2; }
  .pp-phone { grid-template-columns: 100px minmax(130px,1.3fr) minmax(100px,1fr) 105px 44px; }
  .pp-phone > .iconbutton { margin-bottom: 0; }
  .iv-switch, .wa-check { background: #f0f4fa; min-height: 48px; cursor: pointer; }
  .pm-history-toggle, .switch-label, .pp-phone .pp-primary { min-height: 44px; cursor: pointer; }
  .form-error:not(:empty), .pp-error:not(:empty), .builder-error:not(:empty), .pp-group-error:not(:empty) { color: #a31b2d; background: var(--ui-danger-soft); border-radius: 8px; padding: 12px; }
  .required { color: var(--ui-danger); }
  #toast { background: #183b53; color: #fff; border: 1px solid #567b91; }
  #ux-command { background: #fff; border-color: #cbd8e9; }
  #ux-command :is(p,label,footer), #ux-command-results small { color: var(--ui-muted); }
  #ux-command h2 { color: var(--ui-navy); }
  #ux-command-results button { color: #2d486e; border-color: #e1e8f1; }
  #ux-command-results button[data-active=true], #ux-command-results button:hover { background: var(--ui-blue-soft); border-color: #8fadec; }

  /* Specialized lists, reporting, workspace settings and empty states. */
  .roadmap h3, .attributes-intro h2, .product-list-header h2, .b-detail-heading h2 { color: var(--ui-navy); }
  .roadmap p, .roadmap li, .roadmap label, .attribute-row, .attribute-footer p,
  .attributes-intro p, .attribute-header, .custom-attributes h3 { color: var(--ui-muted); }
  .attribute-header { background: #f0f4fa; }
  .attribute-row > span svg { color: #54749e; }
  .no-extra-fields { color: var(--ui-muted); background: #f4f7fc; border-color: #c3d2e8; }
  .no-extra-fields p, .no-extra-fields small { color: var(--ui-muted); }
  .product-guide, .product-form-help { background: #edf3fc; border-color: #cbdaf0; }
  .guide-bulb { color: var(--ui-blue); background: #dce8ff; }
  .guide-toggle strong, .guide-steps h3, .product-selection strong, .product-facts strong,
  .product-history strong { color: #2e4b74; }
  .guide-toggle small, .guide-toggle-end, .guide-steps p, .guide-tip,
  .product-form-help summary, .product-form-help p, .product-selection,
  .product-selection small, .product-action-note, .product-list-header h2 span,
  .product-facts > span, .product-history time, .product-history p, .import-instructions { color: var(--ui-muted); }
  .guide-tip { background: #e5edfc; }
  .guide-steps article > b { background: #dce8ff; color: #254d94; }
  .product-command { min-height: 44px; border-color: #bccadd; color: #344d70; border-radius: 9px; }
  .product-command.primary { background: var(--ui-blue); color: #fff; border-color: var(--ui-blue); }
  .product-command.primary:hover { background: var(--ui-blue-hover); }
  .product-command.delete-command:not(:disabled) { color: var(--ui-danger); border-color: #df9da5; }
  .product-command:disabled, .b-actionbar .btn:disabled { color: #65758b; background: #f0f3f7; border-color: #cdd7e4; }
  .product-command kbd { opacity: .85; }
  .pp-row-actions .btn { min-height: 44px; font-size: 11px; }
  .pp-list-bottom > span, .pp-history small, .pp-group-strip > span { color: var(--ui-muted); }
  .pp-history { color: #36547b; }
  .ex-metrics article, .q-summary article { background: #fff; border-color: var(--ui-line); box-shadow: var(--ui-shadow); }
  .ex-metrics small, .ex-bottom span, .ex-callout, .ex-checklist small { color: var(--ui-muted); }
  .ex-metrics strong { color: var(--ui-navy); }
  .q-section-head h2, .q-result-title h3, .q-summary strong { color: var(--ui-navy); }
  .q-section-head p, .q-muted, .q-summary small, .q-summary p, .q-vendor-head small,
  .q-result-title small, .q-footnote, .q-bottom > span, .q-result-empty, .q-picker > label { color: var(--ui-muted); }
  .q-guide { color: #425d82; background: #edf3fc; border-color: #cbdaf0; }
  .q-warning { color: var(--ui-amber); }
  .q-summary .q-best { background: var(--ui-teal-soft); border-color: #b2d9ca; }
  .q-summary .q-best strong, .q-winner { color: var(--ui-teal); }
  .q-panel table input { border-color: var(--ui-field-line); min-height: 44px; color: var(--ui-text); }
  .b-metric { border-color: var(--ui-line); border-radius: 15px; box-shadow: var(--ui-shadow); }
  .b-metric-icon, .b-recent-icon, .b-quick > button span { color: var(--ui-blue); background: var(--ui-blue-soft); }
  .b-metric:nth-child(2) .b-metric-icon { color: var(--ui-teal); background: var(--ui-teal-soft); }
  .b-metric:nth-child(3) .b-metric-icon { color: var(--ui-amber); background: var(--ui-amber-soft); }
  .b-metric:nth-child(4) .b-metric-icon { color: #675099; background: #f2eef9; }
  .b-metric strong, .b-recent strong, .b-board strong, .b-board b { color: var(--ui-navy); }
  .b-metric small, .b-metric > div > span, .b-recent small, .b-next-actions button,
  .b-help summary, .b-help summary > span, .b-help p, .b-help b,
  .b-toolbar > span, .b-toolbar > label, .b-selection, .b-board h3, .b-board h3 span,
  .b-board > section > small, .b-board small, .b-board p, .b-board span,
  .b-label, .b-form-intro, .b-template-picker label, .b-attachments summary,
  .b-attachments p, #b-attachment-name, .b-detail-heading > div > span:last-child,
  .b-detail-heading > small, .b-detail-fields dt, .b-history summary, .b-history p,
  .b-history time, .b-history small, .b-conversation time, .b-related { color: var(--ui-muted); }
  .b-detail-fields dd, .b-document-text p, .b-conversation strong, .b-conversation p,
  .b-document-text h3, .b-conversation h3, .b-related h3, .b-related button { color: #344d70; }
  .b-quick > button { color: #344d70; border-color: var(--ui-line); }
  .b-next-actions button, .b-related button, .b-help summary, .b-history summary { min-height: 44px; }
  .b-help, .b-form-intro { background: #edf3fc; border-color: #cbdaf0; }
  .b-help summary > span { font-size: 11px; }
  /* Two legacy text rules themselves use !important; these scoped exceptions
     are necessary for readable text, not a competing global specificity layer. */
  .b-local-note, .b-muted { color: #596b82 !important; }
  .b-status { background: #edf1f7; color: #526079; border: 1px solid #d5ddea; font-size: 11px; }
  .b-status-open, .b-status-new, .b-status-registered { background: var(--ui-blue-soft); color: #1c48ac; border-color: #c1d3f5; }
  .b-status-progress, .b-status-running, .b-status-proposal, .b-status-negotiation { background: var(--ui-amber-soft); color: var(--ui-amber); border-color: #ead4ab; }
  .b-status-waiting, .b-status-qualified { background: #f2eef9; color: #675099; border-color: #d8cce9; }
  .b-status-done, .b-status-held, .b-status-won, .b-status-converted, .b-status-active { background: var(--ui-teal-soft); color: var(--ui-teal); border-color: #bfe2d6; }
  .b-status-cancelled, .b-status-lost, .b-overdue { background: var(--ui-danger-soft); color: var(--ui-danger); border-color: #edc6cc; }
  .b-actionbar .btn { min-height: 44px; }
  :is(.searchbox,.module-search,.list-search-box,.b-toolbar) input:not([type=checkbox]):not([type=radio]) { border: 0; background: transparent; box-shadow: none; }

  @media (max-width: 900px) {
    .sidebar { box-shadow: -16px 0 40px #101e3433; }
    .topbar { min-height: 72px; height: auto; padding-block: 10px; }
  }
  @media (max-width: 650px) {
    #modal.ux-workspace { border-radius: 0; border: 0; }
    #modal.ux-workspace .modal-head h2 { font-size: 18px; }
    #modal.ux-workspace :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { font-size: 16px; min-height: 48px; }
    #modal .fl-form .ai-line { grid-template-columns: minmax(0,1fr); padding: 12px; }
    #modal .fl-form .ai-line > label, #modal .fl-form .ai-line > .iconbutton { grid-column: 1 / -1; grid-row: auto; }
    #modal .fl-form .ai-line > .iconbutton { justify-self: end; }
    .pp-phone { grid-template-columns: minmax(0,1fr) minmax(0,1.5fr) 44px; }
    .pp-tabs button, .iv-tabs button { font-size: 12px; }
    .pp-form-bottom .btn { padding-inline: 10px; }
    .top-actions { gap: 4px; }
    .top-actions .chip { font-size: 10px; padding-inline: 7px; }
    .topbar .ux-command-trigger { font-size: 12px; }
    .stat-value { font-size: 22px; flex-wrap: wrap; line-height: 1.6; gap: 2px 6px; letter-spacing: -.6px; }
    .stat-value small { flex-basis: 100%; }
    .stat-top { font-size: 12px; }
    .stat-foot { font-size: 10px; }
    .stat-value small { font-size: 11px; }
    .head-actions .btn, .enhanced-toolbar .btn { min-height: 44px; font-size: 12px; }
    .panel-head small { font-size: 11px; }
    .panel-head { flex-wrap: wrap; }
    .subtitle { font-size: 12px; }
    .welcome-strip small { font-size: 12px; }
    .welcome-strip button { font-size: 12px; }
  }
}
