/* =====================================================================
   "Windows" style — the WinForms app as Windows 10 draws it: SystemColors.Control grey
   (#f0f0f0) forms, white windows and grids, Segoe UI 9pt, square controls, light-blue
   hover, Highlight blue (#0078d7) selection, white title bars with a red close button,
   yellow tooltips. Ported from OrdersSolution1 (css/theme-windows.css); the last section
   covers this app's WinForms windows (js/bis/ui/winforms.js).

   Active while <html data-theme="windows"> (js/bis/theme.js); bis.css alone is the
   "Original" style. Every rule sits inside @scope, whose root adds no specificity,
   so each replaces exactly the bis.css rule with the same selector.
   Light only, as the desktop app: no dark variant.
   ===================================================================== */

html[data-theme="windows"] {
  --win-face: #f0f0f0;        /* SystemColors.Control */
  --win-window: #ffffff;      /* SystemColors.Window */
  --win-highlight: #0078d7;   /* SystemColors.Highlight */
  --win-btn: #e1e1e1;
  --win-btn-border: #adadad;
  --win-hot: #e5f1fb;
  --win-hot-border: #0078d7;
  --win-down: #cce4f7;
  --win-down-border: #005499;
  --win-menu-hot: #cce8ff;
  --win-menu-hot-border: #99d1ff;
  --win-tab-border: #d9d9d9;
  --win-tab-hot: #d8eaf9;
  --win-tab-hot-border: #7eb4ea;
  --win-field-border: #7a7a7a;
  --win-tip: #ffffe1;         /* SystemColors.Info */

  /* bis.css tokens, re-pointed at the Windows system colours */
  --bg: var(--win-face);
  --panel: var(--win-window);
  --text: #000;
  --muted: #6d6d6d;
  --border: var(--win-tab-border);
  --border-strong: var(--win-btn-border);
  --head: var(--win-face);
  --alt: var(--win-window);
  --sel: var(--win-highlight);
  --sel-strong: var(--win-highlight);
  --sel-text: #fff;
  --hover: var(--win-hot);
  --accent: var(--win-highlight);
  --danger: #c42b1c;
  --menu: var(--win-face);
  --input: var(--win-window);
  --shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 6px 18px rgba(0, 0, 0, 0.28);
  --font: "Segoe UI", Tahoma, "Noto Sans", system-ui, sans-serif;
  color-scheme: light;
}

@scope (html[data-theme="windows"]) {

  body { font: 12px/1.3 var(--font); background: var(--win-face); color: #000; scrollbar-color: #c1c1c1 var(--win-face); }
  ::selection { background: var(--win-highlight); color: #fff; }
  a { color: #0066cc; }

  /* ---- Controls ---- */

  input, select, textarea { background: var(--win-window); border: 1px solid var(--win-field-border); border-radius: 0; accent-color: var(--win-highlight); }
  input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: #171717; }
  input:focus, select:focus, textarea:focus { outline: none; border-color: var(--win-highlight); }
  input:disabled, select:disabled, textarea:disabled { background: var(--win-face); border-color: #cccccc; color: #6d6d6d; }

  button { background: var(--win-btn); border: 1px solid var(--win-btn-border); border-radius: 0; color: #000; }
  button:hover:not(:disabled) { background: var(--win-hot); border-color: var(--win-hot-border); }
  button:active:not(:disabled) { background: var(--win-down); border-color: var(--win-down-border); }
  button:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
  button:disabled { opacity: 1; background: #cccccc; border-color: #bfbfbf; color: #838383; }
  /* The default button (AcceptButton): the blue frame Windows draws round it */
  button.primary { background: var(--win-btn); color: #000; border-color: var(--win-highlight); box-shadow: inset 0 0 0 1px var(--win-highlight); }
  button.primary:hover:not(:disabled) { filter: none; background: var(--win-hot); }
  button.danger { color: var(--danger); }
  /* A toggle that is switched on: a pressed CheckBox in Button appearance */
  button.on, button.on:hover:not(:disabled) { background: var(--win-down); border-color: var(--win-down-border); box-shadow: none; font-weight: 400; }

  /* The ComboBox drop-down (js/ui/combobox.js) */
  .combo-list { background: var(--win-window); border: 1px solid #7a7a7a; box-shadow: none; }
  .combo-item { padding: 1px 4px; }
  .combo-item.hover { background: var(--win-highlight); color: #fff; }

  /* ---- Menu strip ---- */

  .menubar { background: var(--win-face); border-bottom: 1px solid var(--win-tab-border); min-height: 22px; padding: 0 2px; }
  .menubar .mb-item { padding: 2px 7px; border: 1px solid transparent; border-radius: 0; }
  .menubar .mb-item:hover, .menubar .mb-item.open { background: var(--win-menu-hot); border-color: var(--win-menu-hot-border); }
  .menubar .user { color: #000; }
  .menubar .dbbadge { border-radius: 0; background: var(--win-tip); color: #000; border: 1px solid #767676; }
  .menubar button { min-height: 20px; padding: 0 8px; }

  /* ---- Context menus: the ToolStripDropDown ---- */

  .cm { background: #f2f2f2; border: 1px solid #cccccc; box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); padding: 2px; }
  .cm-item { padding: 3px 8px 3px 2px; border: 1px solid transparent; }
  .cm-item.hover:not(.disabled) { background: #91c9f7; color: #000; border-color: #91c9f7; }
  .cm-item.disabled { color: #6d6d6d; opacity: 1; }
  .cm-sep { background: #d7d7d7; margin: 3px 2px 3px 26px; }

  /* ---- Header: the filter panels are GroupBoxes on the form ---- */

  .header { background: var(--win-face); border-bottom: 0; }
  .hpanel { background: var(--win-face); border: 1px solid #dcdcdc; border-radius: 0; }
  .hpanel-title { font-weight: 400; color: #000; }
  .hgrid > label, .hrow.period-types label, label.small { color: #000; }

  /* ---- Tool strips, panes, splitters ---- */

  .toolbar { background: var(--win-face); border-bottom: 0; }
  .toolbar .sep { background: #bcbcbc; margin: 2px 3px; }
  .pane-title { background: var(--win-face); font-weight: 400; }
  .splitter-v, .splitter-h { background: var(--win-face); border: 0; }

  /* ---- TabControl ---- */

  .tabstrip { background: var(--win-face); border-bottom: 1px solid var(--win-tab-border); padding: 2px 2px 0; gap: 0; }
  .tabstrip .tab { background: var(--win-face); border: 1px solid var(--win-tab-border); border-bottom: none; border-radius: 0; padding: 2px 8px; margin-top: 2px; margin-right: -1px; }
  .tabstrip .tab:hover { background: var(--win-tab-hot); border-color: var(--win-tab-hot-border); position: relative; z-index: 1; }
  .tabstrip .tab.active { background: var(--win-window); border-color: var(--win-tab-border); font-weight: 400; margin-top: 0; padding: 3px 8px 4px; top: 1px; z-index: 2; }
  .tabpanels { background: var(--win-window); border: 1px solid var(--win-tab-border); border-top: 0; }
  .tabpanel .tabstrip { background: var(--win-window); }

  /* ---- DataGridView ---- */

  .dg-root { border: 1px solid #828790; background: var(--win-window); }
  .dg-root:focus-within { border-color: #828790; }
  .dg-head { background: var(--win-window); }
  .dg-hcell { font-weight: 400; color: #000; background: var(--win-window); }
  .dg-hcell:hover { background: #d9ebf9; }
  .dg-hcell.asc::after, .dg-hcell.desc::after { color: #6d6d6d; }
  .dg-filters { background: var(--win-face); }
  .dg-row, .dg-row.alt { background: var(--win-window); }
  .dg-row.sel, .dg-row.sel.alt { background: var(--win-highlight) !important; color: #fff; }
  .dg-row.focus { outline: 1px dotted #000; outline-offset: -1px; }
  .dg-footer { background: var(--win-face); color: #000; }
  .chk { border-color: #333; border-radius: 0; background: var(--win-window); }
  .chk.on { color: #000; }

  /* ---- Dialogs: a Windows 10 window ---- */

  .dlg-overlay { background: rgba(0, 0, 0, 0.12); }
  .dlg { background: var(--win-face); border: 1px solid #7a7a7a; border-radius: 0; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
  .dlg-title { background: var(--win-window); border-bottom: 0; font-weight: 400; padding: 0 0 0 10px; min-height: 30px; }
  .dlg-x, .dlg-x:hover:not(:disabled) { align-self: stretch; width: 46px; border: 0; border-radius: 0; background: transparent; font-size: 14px; }
  .dlg-x:hover:not(:disabled) { background: #e81123; color: #fff; }
  .dlg-body { background: var(--win-face); }
  .dlg-buttons { background: var(--win-face); border-top: 0; }
  .dlg-error { background: #fde7e9; color: #000; border: 1px solid #e81123; border-radius: 0; }
  .form-row > label { color: #000; }
  .form-section { font-weight: 400; color: #003399; border-bottom-color: #dcdcdc; }

  /* ---- Status strip, busy box, toast (a ToolTip) ---- */

  .statusbar { background: var(--win-face); color: #000; border-top: 1px solid var(--win-tab-border); }
  .busy-box { background: var(--win-face); border: 1px solid #7a7a7a; border-radius: 0; }
  .spinner { border-color: #dcdcdc; border-top-color: var(--win-highlight); }
  .toast { background: var(--win-tip); color: #000; border: 1px solid #767676; border-radius: 0; box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.3); }
  .toast.show { opacity: 1; }
  .badge { border-radius: 0; }

  /* ---- Route wizard price tabs (buttons that are tabs) ---- */

  .wz-tabs { border-bottom-color: var(--win-tab-border); gap: 0; }
  .wz-tab, .wz-tab:hover:not(:disabled) { background: var(--win-face); border: 1px solid var(--win-tab-border); border-bottom: none; border-radius: 0; margin-right: -1px; }
  .wz-tab:hover:not(:disabled) { background: var(--win-tab-hot); border-color: var(--win-tab-hot-border); }
  .wz-tab.active, .wz-tab.active:hover:not(:disabled) { background: var(--win-window); border-color: var(--win-tab-border); font-weight: 400; }
  .grpcopy-tab { border-radius: 0; }
  .grpcopy-tab.active { font-weight: 400; }

  /* ---- Login: a small window ---- */

  .login-box { background: var(--win-face); border: 1px solid #7a7a7a; border-radius: 0; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
  .login-box h1 { font-weight: 400; }
  .login-box label { color: #000; }

  /* ---- The WinForms windows (js/bis/ui/winforms.js) ---- */

  .wf-TabControl { background: var(--win-face); }
  .wf-tabheader { border-bottom: 1px solid var(--win-tab-border); gap: 0; }
  .wf-tab { background: var(--win-face); border: 1px solid var(--win-tab-border); border-bottom: none; border-radius: 0; padding: 2px 8px; margin-right: -1px; font-weight: 400; }
  .wf-tab:hover { background: var(--win-tab-hot); border-color: var(--win-tab-hot-border); position: relative; z-index: 1; }
  .wf-tab.active { background: var(--win-window); border-color: var(--win-tab-border); font-weight: 400; z-index: 2; }
  .wf-tabpage { background: var(--win-window); border-color: var(--win-tab-border); }
  .wf-toolstrip, .wf-statusstrip { background: var(--win-face); border-color: var(--win-tab-border); }
  .wf-tbutton:hover:not(:disabled) { background: var(--win-menu-hot); border-color: var(--win-menu-hot-border); }
  .wf-tsep { background: #bcbcbc; }
  .wf-group::before { border-color: #dcdcdc; border-radius: 0; }
  .wf-grid { border-color: #828790; }
  .wf-tree, .wf-checklist { border-color: #828790; }
  .wf-splitbar-v, .wf-splitbar-h { background: var(--win-face); }
}
