/* Approved Compact A. Screen-only: historical print and phone layouts stay native. */
@media screen and (min-width: 1024px) {
  :root {
    --erp-primary: #087d72;
    --erp-primary-strong: #05665d;
    --erp-primary-soft: #e8f5f1;
    --erp-canvas: #f3f6f7;
    --erp-surface: #ffffff;
    --erp-surface-muted: #f8fafb;
    --erp-border: #dce5e9;
    --erp-border-strong: #bccbd2;
    --erp-text: #17252d;
    --erp-muted: #2d3c44;
    --erp-danger: #b91c1c;
    --erp-sidebar: #ffffff;
    --erp-shadow: 0 1px 2px #17252d05;
    --erp-shadow-lifted: 0 4px 14px #17252d0c;
    --erp-radius: 7px;
    --work-control: 34px;
    --work-radius: 5px;
    --vy-accent: #087d72;
    --vy-accent-soft: #e8f5f1;
    --vy-sidebar: #ffffff;
    --vy-sidebar-soft: #e8f5f1;
    --vy-page: #f3f6f7;
    --vy-surface: #ffffff;
    --vy-border: #dce5e9;
    --vy-text: #17252d;
    --vy-muted: #2d3c44;
    /* Launch 29-10: filled action buttons keep the Compact A teal (white text) in both themes. */
    --erp-action: #087d72;
    --erp-action-hover: #05665d;
    --erp-on-action: #ffffff;
    --erp-danger-action: #b42318;
    --erp-success: #047857;
    --erp-warning: #8a4b08;
  }
  .dark {
    --erp-primary: #5dd5c3;
    --erp-primary-strong: #9ce8dc;
    --erp-primary-soft: #123e3b;
    --erp-canvas: #10191f;
    --erp-surface: #18242c;
    --erp-surface-muted: #1f2f38;
    --erp-border: #354750;
    --erp-border-strong: #596c76;
    --erp-text: #f0f5f7;
    --erp-muted: #d0dce2;
    --erp-danger: #ffb4bf;
    --erp-sidebar: #18242c;
    --vy-accent: #5dd5c3;
    --vy-accent-soft: #123e3b;
    --vy-sidebar: #18242c;
    --vy-sidebar-soft: #123e3b;
    --vy-page: #10191f;
    --vy-surface: #18242c;
    --vy-border: #354750;
    --vy-text: #f0f5f7;
    --vy-muted: #d0dce2;
    --erp-action: #087d72;
    --erp-action-hover: #05665d;
    --erp-on-action: #ffffff;
    --erp-danger-action: #b42318;
    --erp-success: #7ee2b0;
    --erp-warning: #f4cf8e;
  }
  body.erp-body {
    font-family: "Segoe UI", "Nirmala UI", Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    color: var(--erp-text);
    background: var(--erp-canvas) !important;
  }
  body.erp-body.erp-daily-shell { --daily-nav-bg: var(--erp-sidebar); --daily-nav-hover: var(--erp-primary-soft); --daily-nav-text: var(--erp-text); --daily-nav-muted: var(--erp-muted); }
  body.erp-body :is(input, select, textarea, button) { font-family: inherit; }
  body.erp-body :is(input, select, textarea) { accent-color: #087d72; }
  body.erp-body :is(input[type="number"], .tabular-nums, td) { font-variant-numeric: tabular-nums; }
  body.erp-body :focus-visible { outline: 2px solid var(--erp-primary-strong); outline-offset: 2px; }
  body.erp-body .material-symbols-outlined { flex-shrink: 0; }

  /* A persistent compact navigation rail keeps long accounting menus accessible. */
  body.erp-body #sidebar { width: 214px !important; flex: 0 0 214px !important; background: var(--erp-sidebar) !important; border-color: var(--erp-border) !important; box-shadow: none !important; }
  body.erp-body.erp-nav-collapsed #sidebar { width: 0 !important; flex-basis: 0 !important; }
  #sidebar .erp-brand { height: 56px !important; min-height: 56px !important; padding: 8px 12px !important; }
  #sidebar .erp-brand > a { gap: 8px; }
  #sidebar .erp-brand-mark { width: 30px; height: 30px; border-radius: 6px !important; background: #087d72 !important; box-shadow: none !important; }
  #sidebar .erp-brand .text-base { font-size: 13px; letter-spacing: .01em; }
  #sidebar .erp-brand .tracking-\[0\.14em\] { letter-spacing: .04em; font-size: 11px; }
  #sidebar nav.sidebar-scroll { padding: 8px !important; scrollbar-width: thin; scrollbar-gutter: stable; }
  #sidebar .erp-page-search-trigger { width: calc(100% - 16px); margin: 7px 8px 0; min-height: 30px; padding: 5px 7px; font-size: 12px; border-radius: 5px; color: var(--erp-text); }
  #sidebar .erp-page-search-trigger kbd { color: var(--erp-text); font-size: 11px; }
  #sidebar .erp-nav-heading { margin: 9px 7px 4px; font-size: 10px; letter-spacing: .06em; color: var(--erp-muted) !important; }
  #sidebar :is(.erp-nav-link, .erp-nav-toggle) { min-height: 33px !important; padding: 6px 8px !important; gap: 7px; font-size: 12px !important; font-weight: 600 !important; border-radius: 5px !important; color: var(--erp-text) !important; }
  #sidebar :is(.erp-nav-link, .erp-nav-toggle) > .material-symbols-outlined:first-child { font-size: 19px !important; }
  #sidebar .erp-nav-submenu { margin-left: 11px; padding-left: 8px; border-left: 1px solid var(--erp-border); }
  #sidebar :is(.erp-nav-submenu a, .report-nav-tree summary) { padding: 5px 7px !important; min-height: 29px; font-size: 12px !important; line-height: 1.35; color: var(--erp-text) !important; border-radius: 4px; }
  #sidebar .report-nav-tree a { padding-left: 13px !important; }
  body.erp-body.erp-daily-shell #sidebar nav :is(a,button),
  body.erp-body.erp-daily-shell #sidebar > .border-t :is(p,button,.material-symbols-outlined) { color: var(--erp-text) !important; }
  body.erp-body.erp-daily-shell #sidebar .report-nav-tree > summary { padding: 0 !important; }
  body.erp-body.erp-daily-shell #sidebar .erp-nav-section-toggle { min-height: 30px; padding: 5px 7px; font-size: 12px; color: var(--erp-text) !important; }
  body.erp-body.erp-daily-shell #sidebar .erp-nav-section-toggle[aria-expanded="true"] { background: var(--erp-primary-soft); color: var(--erp-primary-strong) !important; }
  #sidebar :is(a,button,summary):hover { background-color: var(--erp-surface-muted); }
  #sidebar :is(.erp-nav-active, [aria-current="page"]) { color: var(--erp-primary-strong) !important; background: var(--erp-primary-soft) !important; box-shadow: inset 3px 0 0 var(--erp-primary) !important; font-weight: 700 !important; }
  body.erp-body.erp-daily-shell #sidebar nav :is(.erp-nav-active,[aria-current="page"]) { color: var(--erp-primary-strong) !important; }
  #sidebar .erp-quick-box { padding: 6px; margin-bottom: 8px; border-radius: 6px !important; box-shadow: none !important; background: var(--erp-surface-muted) !important; }
  #sidebar .erp-quick-title { padding: 3px 5px; margin-bottom: 2px; color: var(--erp-muted) !important; font-size: 10px; letter-spacing: .04em; }
  #sidebar .erp-quick-link { min-height: 28px !important; padding: 5px !important; font-size: 12px !important; gap: 7px; color: var(--erp-text) !important; }
  #sidebar > div:last-child { padding: 9px 10px !important; }
  #sidebar .erp-user-avatar { width: 29px; height: 29px; font-size: 11px; }
  #sidebar > div:last-child .text-sm { font-size: 12px; }
  #sidebar > div:last-child .text-xs { font-size: 11px; }

  /* Keep the company/branch/year visible; reduce repeated chrome around the page. */
  body.erp-body header.erp-topbar { min-height: 56px !important; padding: 7px 14px !important; gap: 10px !important; background: var(--erp-surface) !important; border-color: var(--erp-border) !important; box-shadow: none !important; }
  .erp-topbar .erp-header-left { gap: 8px; flex: 1 1 10rem; }
  .erp-topbar .erp-header-left h1 { font-size: 16px !important; font-weight: 650; line-height: 1.25; color: var(--erp-text); }
  .erp-topbar .erp-header-left p { font-size: 12px; color: var(--erp-muted) !important; }
  .erp-topbar .erp-header-left p[hidden] { display: none !important; }
  .erp-topbar .erp-header-actions { gap: 7px !important; }
  #erpSidebarToggle { padding: 5px; color: var(--erp-text); }
  .erp-topbar .erp-scope-selector { min-height: 38px; border: 1px solid var(--erp-border-strong) !important; border-radius: 5px !important; background: var(--erp-surface) !important; box-shadow: none !important; }
  .erp-topbar .erp-scope-cell { padding: 3px 8px !important; min-height: 37px !important; gap: 1px !important; border-color: var(--erp-border) !important; }
  .erp-topbar .erp-scope-label { color: var(--erp-muted) !important; font-size: 11px !important; font-weight: 600; line-height: 1.1; }
  .erp-topbar .erp-scope-value { color: var(--erp-text) !important; font-size: 12px !important; min-height: 21px !important; height: 21px !important; padding-block: 0 !important; line-height: 1.4; }
  .erp-topbar #global-company-selector.erp-scope-value { font-size: 13px !important; width: 258px; max-width: 100%; }
  .erp-topbar #global-branch-selector.erp-scope-value { font-size: 13px !important; width: 116px; max-width: 100%; }
  .erp-topbar #global-financial-year-selector.erp-scope-value { font-size: 13px !important; width: 98px !important; max-width: 98px !important; }
  .erp-topbar .erp-scope-company { max-width: 295px; min-width: 170px; }
  .erp-topbar .erp-scope-branch { max-width: 145px; }
  .erp-topbar .erp-scope-year { min-width: 99px; }
  .erp-topbar .erp-scope-add { width: 27px; height: 27px; margin: 4px; }
  .erp-topbar .erp-theme-toggle { flex-basis: 30px; width: 30px; padding: 5px; color: var(--erp-muted); }
  #erpModuleNav .erp-module-name { padding-inline: 12px; font-size: 11px; color: var(--erp-muted); }
  #erpModuleNav .erp-module-links a { min-height: 32px; padding: 6px 11px; font-size: 12px; color: var(--erp-muted); }
  /* Launch 29-10 (P-03): when the related-page strip scrolls to the open page, start on a whole tab
     instead of a half-cut one that looked hidden behind the module label (e.g. "ment / Payment Out"). */
  #erpModuleNav .erp-module-links { position: relative; scroll-snap-type: x mandatory; scroll-padding-inline: 0; }
  #erpModuleNav .erp-module-links a { scroll-snap-align: start; }
  #erpModuleNav .erp-module-name { position: relative; z-index: 1; background: var(--erp-surface); }
  body.erp-body main.erp-main { padding: 12px 14px 20px !important; background: var(--erp-canvas) !important; }
  body.erp-body .erp-main > .animate-fade-in { max-width: 1640px !important; }
  .erp-workspace .space-y-8 > :not([hidden]) ~ :not([hidden]) { margin-top: 18px; }
  .erp-workspace .space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 14px; }
  .erp-workspace .rounded-3xl, .erp-workspace .rounded-2xl { border-radius: 7px !important; }
  .erp-workspace :is(.shadow-xl,.shadow-2xl) { box-shadow: var(--erp-shadow-lifted); }
  .erp-workspace h1 { font-size: 20px; line-height: 1.25; letter-spacing: -.015em; }
  .erp-workspace h2 { line-height: 1.3; }
  .erp-workspace .text-3xl:not([id^="metric"]) { font-size: 21px; line-height: 1.25; }

  /* Owner requested near-black supporting text, including F-key and Ctrl labels. */
  html:not(.dark) body.erp-body :is(.text-slate-400,.text-slate-500,.text-slate-600,.text-gray-400,.text-gray-500,.text-gray-600,.text-zinc-400,.text-zinc-500,.text-neutral-500) { color: #29383f !important; }
  html:not(.dark) body.erp-body :is(kbd,.erp-field,.erp-scope-label,.erp-page-search-hint,.erp-page-search-group,.erp-draft-status,.erp-shortcut-hint,.entry-shortcuts,.erp-shortcuts) { color: #243239 !important; }
  html:not(.dark) body.erp-body .erp-workspace label { color: #26353d; }
  body.erp-body .erp-workspace :is(input,textarea)::placeholder { color: #596871; opacity: 1; }
  .dark body.erp-body :is(.text-slate-400,.text-slate-500,.text-slate-600,.text-gray-400,.text-gray-500,.text-gray-600,.erp-field,kbd,.erp-page-search-hint,.erp-page-search-group) { color: #d0dce2 !important; }
  .dark body.erp-body .erp-workspace :is(input,textarea)::placeholder { color: #b0c1cb; }
  /* Launch 29-10 (G-6): Tailwind semantic text colours with no dark: variant fall below 4.5:1 on
     dark surfaces. Elements that carry their own dark:text- variant, light chips (solid white/-50/-100
     background without a dark background) and the known light islands keep their light-theme ink. */
  .dark body.erp-body :is(.text-emerald-600,.text-emerald-700,.text-green-600,.text-green-700):not(:where([class*="dark:text-"],
      :is([class~="bg-white"],[class*="-50 "],[class$="-50"],[class*="-100 "],[class$="-100"]):not([class*="dark:bg-"]),
      #saleEntryRoot:is(.sale-standard-compact:not(.sale-grid-form),.sale-owner-preview) #entryView *,
      body:is(.erp-sale-standard-compact:not(.sale-grid-workspace),.erp-sale-owner-local) :is(#batchModal,#saleHistModal,.sale-fast-dialog) *,
      #aiBillModal *, .erp-connect-dialog *, [data-light-island], [data-light-island] *)) { color: #7ee2b0 !important; }
  .dark body.erp-body :is(.text-red-600,.text-red-700,.text-rose-600,.text-rose-700):not(:where([class*="dark:text-"],
      :is([class~="bg-white"],[class*="-50 "],[class$="-50"],[class*="-100 "],[class$="-100"]):not([class*="dark:bg-"]),
      #saleEntryRoot:is(.sale-standard-compact:not(.sale-grid-form),.sale-owner-preview) #entryView *,
      body:is(.erp-sale-standard-compact:not(.sale-grid-workspace),.erp-sale-owner-local) :is(#batchModal,#saleHistModal,.sale-fast-dialog) *,
      #aiBillModal *, .erp-connect-dialog *, [data-light-island], [data-light-island] *)) { color: #ffaeb5 !important; }
  .dark body.erp-body :is(.text-amber-600,.text-amber-700,.text-orange-600,.text-orange-700):not(:where([class*="dark:text-"],
      :is([class~="bg-white"],[class*="-50 "],[class$="-50"],[class*="-100 "],[class$="-100"]):not([class*="dark:bg-"]),
      #saleEntryRoot:is(.sale-standard-compact:not(.sale-grid-form),.sale-owner-preview) #entryView *,
      body:is(.erp-sale-standard-compact:not(.sale-grid-workspace),.erp-sale-owner-local) :is(#batchModal,#saleHistModal,.sale-fast-dialog) *,
      #aiBillModal *, .erp-connect-dialog *, [data-light-island], [data-light-island] *)) { color: #f4cf8e !important; }
  .dark body.erp-body :is(.text-primary,.text-teal-600,.text-teal-700,.text-indigo-600,.text-indigo-700,.text-sky-600,.text-sky-700):not(:where([class*="dark:text-"],
      :is([class~="bg-white"],[class*="-50 "],[class$="-50"],[class*="-100 "],[class$="-100"]):not([class*="dark:bg-"]),
      #saleEntryRoot:is(.sale-standard-compact:not(.sale-grid-form),.sale-owner-preview) #entryView *,
      body:is(.erp-sale-standard-compact:not(.sale-grid-workspace),.erp-sale-owner-local) :is(#batchModal,#saleHistModal,.sale-fast-dialog) *,
      #aiBillModal *, .erp-connect-dialog *, [data-light-island], [data-light-island] *)) { color: #7dddc7 !important; }
  /* A control that turns white in dark (dark:bg-white) needs dark ink. */
  .dark body.erp-body [class~="dark:bg-white"] { color: #0f172a !important; }
  body.erp-body .erp-workspace :is(input,select,textarea):disabled { opacity: 1; color: var(--erp-muted); background: var(--erp-surface-muted); cursor: not-allowed; }
  body.erp-body .erp-workspace button:disabled { opacity: .55; cursor: not-allowed; }
  body.erp-body .account-workspace :is([role="alert"],[data-status][data-error="true"]) { color: var(--erp-danger); }
  body.erp-body .erp-workspace :is(input,select,textarea):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not(.sr-only) { min-height: 34px; border-radius: 5px !important; font-size: 13px; }
  body.erp-body .erp-workspace select[multiple] { min-height: 130px; height: auto; }
  body.erp-body .erp-workspace :is(input[type="checkbox"],input[type="radio"]) { width: 15px; height: 15px; }
  body.erp-body .erp-workspace #companySearch { padding-left: 36px !important; }
  body.erp-body .erp-workspace label.uppercase { font-size: 11px; letter-spacing: .025em; }
  body.erp-body .erp-workspace table { font-size: 13px; }
  body.erp-body .erp-workspace table thead th { height: 32px; padding-block: 7px; font-size: 11px; line-height: 1.35; letter-spacing: .025em; color: var(--erp-text) !important; background: var(--erp-surface-muted) !important; }
  body.erp-body .erp-workspace table tbody td { padding-block: 6px; line-height: 1.4; }
  body.erp-body .erp-workspace :is(.erp-table-scroll,.overflow-x-auto) { scrollbar-width: thin; overscroll-behavior-x: contain; }
  body.erp-body :is(dialog,#erpPageSearch) { border-radius: 7px; }
  #erpPageSearch :is(input,button) { font-size: 13px; }
  #erpPageSearch kbd { color: var(--erp-text); }
  body.ledger-embedded #erpMain { padding: 10px !important; }
  /* Field/account workspaces use standalone shells, with the same desktop tokens. */
  body[data-desktop-compact] { --ink: #17252d; --muted: #2d3c44; --teal: #087d72; --line: #dce5e9; --border: #dce5e9; --paper: #ffffff; --mint: #e8f5f1; font: 13px/1.45 "Segoe UI", "Nirmala UI", Arial, sans-serif; background: #f3f6f7; color: #17252d; }
  body[data-desktop-compact] > main { max-width: 1440px; padding: 16px 22px 30px; }
  body[data-desktop-compact] header { margin-bottom: 18px; padding-bottom: 12px; gap: 14px; }
  body[data-desktop-compact] h1 { font-size: 23px; letter-spacing: -.02em; margin: 4px 0 8px; }
  body[data-desktop-compact] h2 { font-size: 17px; margin-bottom: 8px; }
  body[data-desktop-compact] :is(.muted,.intro p,small,label,footer,.eyebrow) { color: #29383f; }
  body[data-desktop-compact] .intro { margin-bottom: 14px; }
  body[data-desktop-compact] :is(.panel,section) { border-radius: 7px; padding: 16px; margin-block: 12px; box-shadow: none; }
  body[data-desktop-compact] .grid { gap: 10px; }
  body[data-desktop-compact] :is(input,select,textarea,button) { font: inherit; border-radius: 5px; }
  body[data-desktop-compact] :is(label input,label select,label textarea) { padding: 6px 9px; margin-top: 4px; min-height: 34px; }
  body[data-desktop-compact] button { min-height: 34px; padding: 6px 12px; font-size: 13px; }
  body[data-desktop-compact] button.primary,body[data-desktop-compact="account"] button { background: #087d72; border-color: #087d72; color: #fff; }
  body[data-desktop-compact] input[type="checkbox"] { min-height: 0; width: 16px; height: 16px; accent-color: #087d72; }
  body[data-desktop-compact] :is(th,td) { padding: 7px 9px; }
  body[data-desktop-compact] th { color: #243239; background: #f8fafb; font-size: 12px; }
  body[data-desktop-compact] td :is(input,select) { min-height: 32px; padding: 5px 7px; }
  body[data-desktop-compact] .brand { font-size: 21px; gap: 9px; }
  body[data-desktop-compact] .order-row { padding: 10px 12px; }
  body[data-desktop-compact] .order-row small { margin-top: 3px; }
  body[data-desktop-compact] fieldset { padding: 12px; margin-block: 12px; border-radius: 5px; }
  body[data-desktop-compact] .cards { gap: 16px; }
  body[data-desktop-compact] form { gap: 12px; }
  body[data-desktop-compact] :is(a,button,input,select,textarea):focus-visible { outline: 2px solid #05665d; outline-offset: 2px; }
  @media (max-width: 1279px) {
    .erp-topbar .erp-header-left p { display: none; }
    .erp-topbar .erp-scope-company { max-width: 230px; min-width: 150px; }
    .erp-topbar .erp-scope-branch { max-width: 115px; }
    .erp-topbar .erp-header-left h1 { font-size: 15px !important; }
  }
}
