/* InfoSmart Global Theme Framework - 2026-08-23
   Shared Light / Dark / System theme. Screen only: printed documents remain unchanged. */
:root{
  --is-bg:#f4f7fb;--is-bg-soft:#eef3f8;--is-surface:#ffffff;--is-surface-2:#f8fafc;
  --is-surface-3:#f1f5f9;--is-text:#17233b;--is-text-soft:#536079;--is-muted:#6d7789;
  --is-line:#dfe5ee;--is-line-strong:#cbd7e4;--is-accent:#356ee8;--is-accent-soft:#edf4ff;
  --is-shadow:0 8px 28px rgba(29,53,87,.08);--is-input:#ffffff;--is-overlay:rgba(15,23,42,.58);
  color-scheme:light;
}
html[data-theme="dark"]{
  --is-bg:#0c121c;--is-bg-soft:#111a27;--is-surface:#151f2d;--is-surface-2:#1a2636;
  --is-surface-3:#202d3e;--is-text:#e7edf6;--is-text-soft:#bcc8d8;--is-muted:#91a0b4;
  --is-line:#2b394b;--is-line-strong:#3b4b60;--is-accent:#78a5ff;--is-accent-soft:#1a3154;
  --is-shadow:0 10px 32px rgba(0,0,0,.25);--is-input:#101927;--is-overlay:rgba(0,0,0,.70);
  color-scheme:dark;
  --bg:var(--is-bg);--card:var(--is-surface);--ink:var(--is-text);--muted:var(--is-muted);--line:var(--is-line);
}
@media screen{
  html[data-theme="dark"] body:not(.invoice-print-body):not(.os-print-body){background:var(--is-bg)!important;color:var(--is-text)!important}
  html[data-theme="dark"] .cs-main,html[data-theme="dark"] .admin-main,html[data-theme="dark"] .content-area,html[data-theme="dark"] .main-shell,
  html[data-theme="dark"] .master-body,html[data-theme="dark"] .master-body.master-embed{background:var(--is-bg)!important;color:var(--is-text)!important}

  /* Primary surfaces */
  html[data-theme="dark"] :is(.cs-module-card,.cs-menu-group,.invoice-panel,.master-list-panel,.master-form-panel,.rx-card,.rx-search-card,.cq-card,.cq-search-card,.os-card,.et-card,.panel,.kpi-card,.toolbar-card,.table-card,.summary-grid article,.permission-group,.editor-section,.check-card,.modal-card,.admin-header,.desktop-header,.mobile-appbar,.service-card,.card){background:var(--is-surface)!important;color:var(--is-text)!important;border-color:var(--is-line)!important;box-shadow:var(--is-shadow)!important}
  html[data-theme="dark"] :is(.cs-topbar,.rx-header,.cq-top,.os-topbar,.et-head){border-color:var(--is-line)!important}

  /* Text */
  html[data-theme="dark"] :is(h1,h2,h3,h4,strong,label,.cs-menu-item,.master-results>button,.invoice-heading h1,.master-heading h1){color:var(--is-text)}
  html[data-theme="dark"] :is(p,small,.muted-text,.cs-page-heading p,.cs-module-card small,.cs-topbar-title>span,.master-heading p,.invoice-field label,.invoice-section-title p,.rx-header p,.rx-fields label,.cq-fields label,.cq-form label,.os-muted,.admin-header p,.summary-grid span,.permission-option small,.form-grid small){color:var(--is-muted)!important}

  /* Inputs and selection controls */
  html[data-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea,.master-search,.rx-money,.cq-searchbox,.search-box){background:var(--is-input)!important;color:var(--is-text)!important;border-color:var(--is-line-strong)!important}
  html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#728299!important}
  html[data-theme="dark"] :is(input[readonly],input:disabled,select:disabled,textarea:disabled,.master-form-panel .invoice-field input:disabled){background:#1b2635!important;color:#8fa0b5!important}
  html[data-theme="dark"] option{background:#111a27;color:#e7edf6}

  /* Tables, lists and lookup results */
  html[data-theme="dark"] :is(table,td,th,.data-table td,.invoice-table td,.cq-table td,.rx-table td){border-color:var(--is-line)!important}
  html[data-theme="dark"] :is(th,.data-table th,.invoice-table th,.cq-table th,.rx-table th,.permission-group h3){background:var(--is-surface-2)!important;color:var(--is-text-soft)!important}
  html[data-theme="dark"] :is(.lookup-results,.master-results,.rx-results,.device-list){background:var(--is-surface)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] :is(.lookup-results button,.master-results>button,.rx-results button){background:var(--is-surface)!important;color:var(--is-text)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] :is(.lookup-results button:hover,.master-results>button:hover,.rx-results button:hover,.cq-row:hover){background:var(--is-surface-2)!important}
  html[data-theme="dark"] :is(.cq-row.active,.month-cell-button:hover){background:var(--is-accent-soft)!important}

  /* Secondary buttons / controls */
  html[data-theme="dark"] :is(.cs-top-link,.invoice-btn.secondary,.rx-actions button:not(.primary),.rx-mobile-actions button:not(.primary),.cq-action-buttons .secondary,.secondary-button,.icon-action,.icon-close,.mobile-menu,.month-cell-button,.segmented-control){background:var(--is-surface-2)!important;color:var(--is-text-soft)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .segmented-control button.active{background:var(--is-surface-3)!important;color:var(--is-text)!important}

  /* Main CS shell keeps the brand/navigation identity while reducing glare. */
  html[data-theme="dark"] .cs-topbar{background:#111a27!important}
  html[data-theme="dark"] .cs-sidebar{background:linear-gradient(180deg,#101a2b,#0b1320)!important;border-color:#26354a!important}
  html[data-theme="dark"] .cs-module-nav{color:#b8c6d8!important}
  html[data-theme="dark"] .cs-module-nav:hover,html[data-theme="dark"] .cs-module-nav.active{background:#1b2b43!important;color:#fff!important}
  html[data-theme="dark"] .cs-menu-item{border-color:var(--is-line)!important}
  html[data-theme="dark"] .cs-menu-item:hover{background:var(--is-surface-2)!important}

  /* Common overlays */
  html[data-theme="dark"] :is(.master-modal,.modal-backdrop,.drawer-backdrop.open,.invoice-dialog,.rx-modal){background:var(--is-overlay)!important}
  html[data-theme="dark"] .master-modal-card{background:var(--is-surface)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .master-modal-card iframe{background:var(--is-bg)!important}

  /* Sales invoice dialogs / popups */
  html[data-theme="dark"] :is(.invoice-dialog-card,.rx-modal-card,.history-results,.preview-lines,.readonly-description){background:var(--is-surface)!important;border-color:var(--is-line)!important;color:var(--is-text)!important}
  html[data-theme="dark"] .dialog-head{border-color:var(--is-line)!important}
  html[data-theme="dark"] .dialog-head h2{color:var(--is-text)!important}
  html[data-theme="dark"] .dialog-close{background:var(--is-surface-2)!important;color:var(--is-text)!important;border:1px solid var(--is-line)!important}
  html[data-theme="dark"] .dialog-actions{border-color:var(--is-line)!important}
  html[data-theme="dark"] .dialog-actions,
  html[data-theme="dark"] .confirm-actions,
  html[data-theme="dark"] .invoice-dialog-card .dialog-actions{background:transparent!important}
  html[data-theme="dark"] .history-results button{background:var(--is-surface)!important;color:var(--is-text)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .history-results button:hover{background:var(--is-surface-2)!important}
  html[data-theme="dark"] .history-results span,
  html[data-theme="dark"] .history-results small,
  html[data-theme="dark"] .lookup-empty,
  html[data-theme="dark"] .preview-company span,
  html[data-theme="dark"] .preview-meta small,
  html[data-theme="dark"] .preview-line small,
  html[data-theme="dark"] .confirm-copy p{color:var(--is-muted)!important}
  html[data-theme="dark"] .preview-line{border-color:var(--is-line)!important}
  html[data-theme="dark"] .preview-company{border-color:var(--is-accent)!important}
  html[data-theme="dark"] .preview-totals .grand{border-color:var(--is-accent)!important;color:var(--is-text)!important}
  html[data-theme="dark"] .confirm-icon{background:var(--is-accent-soft)!important;color:var(--is-accent)!important}
  html[data-theme="dark"] .readonly-description{background:var(--is-surface-2)!important;color:var(--is-text-soft)!important}
  html[data-theme="dark"] .danger-action{background:#3a1f24!important;color:#ffb4ab!important;border-color:#7f3a42!important}
  html[data-theme="dark"] .invoice-badge{background:var(--is-accent-soft)!important;color:var(--is-accent)!important}

  /* 2026-08-23c: complete dark-theme surface compatibility pass */

  /* Receipts */
  html[data-theme="dark"] :is(.rx-modal-card,.rx-history,.rx-print-card){background:var(--is-surface)!important;color:var(--is-text)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .rx-history button{background:var(--is-surface)!important;color:var(--is-text)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .rx-history button:hover{background:var(--is-surface-2)!important}
  html[data-theme="dark"] .rx-history :is(strong,span){color:var(--is-text)!important}
  html[data-theme="dark"] .rx-history em{color:var(--is-muted)!important}
  html[data-theme="dark"] .rx-close{color:var(--is-text)!important}
  html[data-theme="dark"] .rx-money span{background:var(--is-surface-3)!important;color:var(--is-text-soft)!important}
  html[data-theme="dark"] .rx-outline{background:var(--is-surface-2)!important;color:var(--is-accent)!important;border-color:var(--is-accent)!important}
  html[data-theme="dark"] .selected{background:var(--is-accent-soft)!important;color:var(--is-text)!important}
  html[data-theme="dark"] .rx-table-wrap{border-color:var(--is-line)!important}
  html[data-theme="dark"] .rx-totals div{background:var(--is-surface)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .rx-totals span{color:var(--is-muted)!important}
  html[data-theme="dark"] .rx-badge:not(.active):not(.canceled),
  html[data-theme="dark"] .rx-pill{background:var(--is-surface-3)!important;color:var(--is-text-soft)!important}
  html[data-theme="dark"] .rx-print-target{background:var(--is-surface-2)!important;color:var(--is-muted)!important}
  html[data-theme="dark"] .rx-print-label{color:var(--is-text-soft)!important}
  @media(max-width:720px){
    html[data-theme="dark"] .rx-docline,
    html[data-theme="dark"] .rx-mobile-actions{background:var(--is-surface)!important;border-color:var(--is-line)!important}
  }

  /* Operations Hub / Administration accordion */
  html[data-theme="dark"] .cs-menu-group summary{background:var(--is-surface)!important;color:var(--is-text)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .cs-menu-group[open] summary{background:var(--is-surface-2)!important;color:var(--is-accent)!important}
  html[data-theme="dark"] .cs-menu-items{background:var(--is-surface)!important}
  html[data-theme="dark"] .cs-menu-item.disabled{color:var(--is-muted)!important}
  html[data-theme="dark"] .cs-menu-item.disabled em{background:var(--is-surface-3)!important;color:var(--is-muted)!important}

  /* Entry Type Control Center */
  html[data-theme="dark"] :is(.et-list,.et-main,.et-toolbar,.et-tab,.et-matrix){background:var(--is-surface)!important;color:var(--is-text)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .et-tabs{background:var(--is-surface-2)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .et-tabs button{color:var(--is-text-soft)!important}
  html[data-theme="dark"] .et-tabs button.active{background:var(--is-accent-soft)!important;color:var(--is-accent)!important}
  html[data-theme="dark"] .et-list-item{background:var(--is-surface-2)!important;color:var(--is-text)!important;border-color:transparent!important}
  html[data-theme="dark"] .et-list-item:hover,
  html[data-theme="dark"] .et-list-item.active{background:var(--is-accent-soft)!important;border-color:var(--is-line-strong)!important}
  html[data-theme="dark"] .et-list-item strong{color:var(--is-text)!important}
  html[data-theme="dark"] .et-list-item span{color:var(--is-muted)!important}
  html[data-theme="dark"] :is(.et-toolbar small,.et-section-title p,.et-field small){color:var(--is-muted)!important}
  html[data-theme="dark"] :is(.et-list label,.et-field label){color:var(--is-text-soft)!important}
  html[data-theme="dark"] :is(.et-list input,.et-field input,.et-field select,.et-filter-select,.et-matrix select){background:var(--is-input)!important;color:var(--is-text)!important;border-color:var(--is-line-strong)!important}
  html[data-theme="dark"] .et-check{background:var(--is-surface-2)!important;color:var(--is-text)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .et-matrix-row{background:var(--is-surface)!important;color:var(--is-text)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .et-matrix-row.head{background:var(--is-surface-2)!important;color:var(--is-text-soft)!important}
  html[data-theme="dark"] .et-btn.ghost{background:var(--is-surface-2)!important;color:var(--is-text-soft)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .et-company{background:var(--is-accent-soft)!important;color:var(--is-accent)!important}

  /* Customer Outstanding */
  html[data-theme="dark"] :is(.os-panel,.os-table-panel,.os-table-head,.os-filters){background:var(--is-surface)!important;color:var(--is-text)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .os-filters label{color:var(--is-text-soft)!important}
  html[data-theme="dark"] :is(.os-filters input,.os-filters select){background:var(--is-input)!important;color:var(--is-text)!important;border-color:var(--is-line-strong)!important}
  html[data-theme="dark"] .os-btn.ghost{background:var(--is-surface-2)!important;color:var(--is-text-soft)!important}
  html[data-theme="dark"] .os-table-head h2{color:var(--is-text)!important}
  html[data-theme="dark"] .os-table-head span{color:var(--is-muted)!important}
  html[data-theme="dark"] .os-table{background:var(--is-surface)!important;color:var(--is-text)!important}
  html[data-theme="dark"] .os-table th{background:var(--is-surface-2)!important;color:var(--is-text-soft)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .os-table td{background:var(--is-surface)!important;color:var(--is-text)!important;border-color:var(--is-line)!important}
  html[data-theme="dark"] .os-table tbody tr:hover td{background:var(--is-surface-2)!important}
  html[data-theme="dark"] .os-table tfoot td{background:var(--is-surface-3)!important;color:var(--is-text)!important}
  html[data-theme="dark"] .os-table a{color:var(--is-accent)!important}
  html[data-theme="dark"] .age-pill{background:var(--is-accent-soft)!important;color:var(--is-accent)!important}
  html[data-theme="dark"] .os-card strong{color:var(--is-text)!important}
  html[data-theme="dark"] .os-card span,
  html[data-theme="dark"] .os-card small{color:var(--is-muted)!important}

  /* Theme switcher */
  .is-theme-control{position:fixed;top:12px;right:12px;z-index:1200;font:600 13px/1.2 Inter,"Segoe UI",Arial,sans-serif}
  .is-theme-trigger{width:40px;height:40px;border-radius:12px;border:1px solid rgba(127,145,170,.32);background:rgba(255,255,255,.86);color:#24344b;box-shadow:0 6px 20px rgba(20,35,60,.13);backdrop-filter:blur(14px);display:grid;place-items:center;cursor:pointer;font-size:18px}
  html[data-theme="dark"] .is-theme-trigger{background:rgba(21,31,45,.9);color:#e7edf6;border-color:#35465b;box-shadow:0 8px 24px rgba(0,0,0,.32)}
  .is-theme-menu{position:absolute;right:0;top:47px;width:152px;padding:6px;border-radius:13px;background:var(--is-surface);border:1px solid var(--is-line);box-shadow:0 14px 38px rgba(15,23,42,.20);display:none}
  .is-theme-control.open .is-theme-menu{display:block}
  .is-theme-option{width:100%;height:36px;border:0;border-radius:9px;background:transparent;color:var(--is-text);display:flex;align-items:center;gap:9px;padding:0 10px;cursor:pointer;text-align:left;font:inherit}
  .is-theme-option:hover{background:var(--is-surface-2)}
  .is-theme-option.active{background:var(--is-accent-soft);color:var(--is-accent);font-weight:800}
  .is-theme-option .is-check{margin-left:auto;opacity:0}.is-theme-option.active .is-check{opacity:1}
  @media(max-width:760px){.is-theme-control{top:8px;right:8px}.is-theme-trigger{width:36px;height:36px;border-radius:10px}.is-theme-menu{top:42px}}

  @media(max-width:720px){
    html[data-theme="dark"] .dialog-actions{background:var(--is-surface)!important}
  }

}

/* Theme UI and dark palette never alter print output. */
@media print{.is-theme-control{display:none!important}html{color-scheme:light!important}}
