/*!
 * bootstra-win31 v0.1.0 — A Bootstrap 5 theme inspired by Windows 3.1,
 * Program Manager, File Manager and early-90s desktop GUIs.
 * Sister theme of bootstra-html32. Load AFTER bootstrap.min.css.
 *
 *   <html data-w31-scheme="default" class="w31-desktop w31-pattern-none">
 *
 * Schemes:   default arizona bordeaux emerald ocean valentine designer leather plasma rugby mono hotdog
 * Patterns:  w31-pattern-fifty -boxes -diamonds -weave -thatches -waffle -zigzag -spinner
 * Wallpaper: w31-wall-tartan w31-wall-redbrick w31-wall-rivets
 */

/* ------------------------------------------------------------------
   1. Colour schemes (Control Panel > Color palettes)
   A scheme sets four colours: button face, active title bar, desktop
   and window background, plus the title's -rgb variant for Bootstrap
   utilities and the text colour for desktop icon labels. Every other
   colour (bevels, highlight, menus, workspace) is derived below.
   ------------------------------------------------------------------ */
:root,
[data-w31-scheme="default"]  { --w31-face:#c0c0c0; --w31-title:#000080; --w31-title-rgb:0,0,128;   --w31-desktop:#008080; --w31-window:#ffffff; --w31-desktop-text:#fff; }
[data-w31-scheme="arizona"]  { --w31-face:#c0c0c0; --w31-title:#008080; --w31-title-rgb:0,128,128; --w31-desktop:#b49a6c; --w31-window:#fffcf0; --w31-desktop-text:#000; }
[data-w31-scheme="bordeaux"] { --w31-face:#c0c0c0; --w31-title:#800040; --w31-title-rgb:128,0,64;  --w31-desktop:#603048; --w31-window:#ffffff; --w31-desktop-text:#fff; }
[data-w31-scheme="emerald"]  { --w31-face:#c0c0c0; --w31-title:#008000; --w31-title-rgb:0,128,0;   --w31-desktop:#004000; --w31-window:#f4fff4; --w31-desktop-text:#fff; }
[data-w31-scheme="ocean"]    { --w31-face:#c0c0c0; --w31-title:#004080; --w31-title-rgb:0,64,128;  --w31-desktop:#000080; --w31-window:#f0ffff; --w31-desktop-text:#fff; }
[data-w31-scheme="valentine"]{ --w31-face:#d0c0c8; --w31-title:#c00040; --w31-title-rgb:192,0,64;  --w31-desktop:#ff80c0; --w31-window:#fff4fa; --w31-desktop-text:#000; }
[data-w31-scheme="designer"] { --w31-face:#c0c0c0; --w31-title:#404040; --w31-title-rgb:64,64,64;  --w31-desktop:#808080; --w31-window:#ffffff; --w31-desktop-text:#fff; }
[data-w31-scheme="leather"]  { --w31-face:#a0a0a0; --w31-title:#000000; --w31-title-rgb:0,0,0;     --w31-desktop:#202020; --w31-window:#ffffff; --w31-desktop-text:#fff; }
[data-w31-scheme="plasma"]   { --w31-face:#c0c0c0; --w31-title:#800080; --w31-title-rgb:128,0,128; --w31-desktop:#000000; --w31-window:#ffffff; --w31-desktop-text:#fff; }
[data-w31-scheme="rugby"]    { --w31-face:#c0c0c0; --w31-title:#800000; --w31-title-rgb:128,0,0;   --w31-desktop:#000080; --w31-window:#ffffff; --w31-desktop-text:#fff; }
[data-w31-scheme="mono"]     { --w31-face:#ffffff; --w31-title:#000000; --w31-title-rgb:0,0,0;     --w31-desktop:#ffffff; --w31-window:#ffffff; --w31-desktop-text:#000; }
[data-w31-scheme="hotdog"]   { --w31-face:#ffff00; --w31-title:#ff0000; --w31-title-rgb:255,0,0;   --w31-desktop:#ffff00; --w31-window:#ffff00; --w31-desktop-text:#000; }

:root,
[data-w31-scheme] {
  /* derived chrome palette */
  --w31-hi: #ffffff;                                            /* bevel highlight          */
  --w31-shadow: color-mix(in srgb, var(--w31-face) 67%, #000);  /* bevel shadow   (#808080) */
  --w31-light: color-mix(in srgb, var(--w31-face) 50%, #fff);   /* light face     (#e0e0e0) */
  --w31-frame: var(--w31-face);                                 /* sizing border            */
  --w31-ink: #000000;                                           /* window frame, text       */
  --w31-title-text: #ffffff;
  --w31-inactive: var(--w31-window);
  --w31-inactive-text: #000000;
  --w31-menu: var(--w31-window);
  --w31-workspace: var(--w31-window);
  --w31-hilite: var(--w31-title);
  --w31-hilite-text: #ffffff;
  --w31-gray: var(--w31-shadow);                                /* disabled text            */
  --w31-help: #ffffc0;
  --w31-link: #008000;                                          /* WinHelp jump green       */

  /* bevels: Win 3.x draws two pixels of light and shade inside a black outline */
  --w31-out: inset -2px -2px 0 var(--w31-shadow), inset 2px 2px 0 var(--w31-hi);
  --w31-out-thin: inset -1px -1px 0 var(--w31-shadow), inset 1px 1px 0 var(--w31-hi);
  --w31-in: inset 1px 1px 0 var(--w31-shadow);
  --w31-sunken: inset 1px 1px 0 var(--w31-shadow), inset -1px -1px 0 var(--w31-hi);

  --w31-font: "MS Sans Serif", "Microsoft Sans Serif", Arial, Helvetica, sans-serif;
  --w31-font-mono: Fixedsys, "Fixedsys Excelsior 3.01", "Courier New", Courier, monospace;
  --w31-font-help: "Times New Roman", Times, Georgia, serif;

  /* Bootstrap hooks */
  --bs-body-font-family: var(--w31-font);
  --bs-body-font-size: 14px;
  --bs-body-line-height: 1.4;
  --bs-body-color: var(--w31-ink);
  --bs-body-bg: var(--w31-window);
  --bs-emphasis-color: #000;
  --bs-secondary-color: var(--w31-gray);
  --bs-secondary-bg: var(--w31-face);
  --bs-tertiary-bg: var(--w31-light);
  --bs-font-monospace: var(--w31-font-mono);
  --bs-border-color: var(--w31-ink);
  --bs-border-radius: 0;
  --bs-border-radius-sm: 0;
  --bs-border-radius-lg: 0;
  --bs-border-radius-xl: 0;
  --bs-border-radius-xxl: 0;
  --bs-border-radius-pill: 0;
  --bs-box-shadow: none;
  --bs-box-shadow-sm: none;
  --bs-box-shadow-lg: none;
  --bs-link-color: var(--w31-link);
  --bs-link-color-rgb: 0,128,0;
  --bs-link-hover-color: var(--w31-link);
  --bs-link-hover-color-rgb: 0,128,0;
  --bs-focus-ring-color: transparent;
  --bs-primary: var(--w31-title);
  --bs-primary-rgb: var(--w31-title-rgb);
  --bs-secondary: var(--w31-face);
  --bs-success: #008000;   --bs-success-rgb: 0,128,0;
  --bs-info: #008080;      --bs-info-rgb: 0,128,128;
  --bs-warning: #ffff00;   --bs-warning-rgb: 255,255,0;
  --bs-danger: #800000;    --bs-danger-rgb: 128,0,0;
  --bs-dark: #000000;      --bs-dark-rgb: 0,0,0;
  --bs-light: #ffffff;     --bs-light-rgb: 255,255,255;
  color-scheme: light;
}

/* ------------------------------------------------------------------
   2. Desktop: colour, 8x8 patterns and wallpapers
   Put .w31-desktop on <html> (or any element) and add one pattern or
   wallpaper class. Patterns are drawn in black over the desktop colour,
   doubled to 16 px so the pixels stay visible on modern screens.
   ------------------------------------------------------------------ */
.w31-desktop {
  --w31-pattern: none;
  --w31-pattern-size: 16px;
  min-height: 100%;
  background: var(--w31-pattern) 0 0 / var(--w31-pattern-size) var(--w31-pattern-size) repeat, var(--w31-desktop);
  image-rendering: pixelated;
}
.w31-desktop * { image-rendering: auto; }

.w31-pattern-fifty    { --w31-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h1v1H0zM2 0h1v1H2zM4 0h1v1H4zM6 0h1v1H6zM1 1h1v1H1zM3 1h1v1H3zM5 1h1v1H5zM7 1h1v1H7zM0 2h1v1H0zM2 2h1v1H2zM4 2h1v1H4zM6 2h1v1H6zM1 3h1v1H1zM3 3h1v1H3zM5 3h1v1H5zM7 3h1v1H7zM0 4h1v1H0zM2 4h1v1H2zM4 4h1v1H4zM6 4h1v1H6zM1 5h1v1H1zM3 5h1v1H3zM5 5h1v1H5zM7 5h1v1H7zM0 6h1v1H0zM2 6h1v1H2zM4 6h1v1H4zM6 6h1v1H6zM1 7h1v1H1zM3 7h1v1H3zM5 7h1v1H5zM7 7h1v1H7z'/%3E%3C/svg%3E"); } /* 50% grey dither */
.w31-pattern-boxes    { --w31-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h8v1H0zM0 1h1v1H0zM7 1h1v1H7zM0 2h1v1H0zM2 2h4v1H2zM7 2h1v1H7zM0 3h1v1H0zM2 3h1v1H2zM5 3h1v1H5zM7 3h1v1H7zM0 4h1v1H0zM2 4h1v1H2zM5 4h1v1H5zM7 4h1v1H7zM0 5h1v1H0zM2 5h4v1H2zM7 5h1v1H7zM0 6h1v1H0zM7 6h1v1H7zM0 7h8v1H0z'/%3E%3C/svg%3E"); } /* nested boxes */
.w31-pattern-diamonds { --w31-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath d='M3 0h1v1H3zM2 1h1v1H2zM4 1h1v1H4zM1 2h1v1H1zM5 2h1v1H5zM0 3h1v1H0zM6 3h1v1H6zM1 4h1v1H1zM5 4h1v1H5zM2 5h1v1H2zM4 5h1v1H4zM3 6h1v1H3z'/%3E%3C/svg%3E"); } /* diamond lattice */
.w31-pattern-weave    { --w31-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h1v1H0zM4 0h1v1H4zM1 1h1v1H1zM3 1h1v1H3zM5 1h1v1H5zM2 2h1v1H2zM6 2h1v1H6zM1 3h1v1H1zM5 3h1v1H5zM7 3h1v1H7zM0 4h1v1H0zM4 4h1v1H4zM3 5h1v1H3zM5 5h1v1H5zM7 5h1v1H7zM2 6h1v1H2zM6 6h1v1H6zM1 7h1v1H1zM3 7h1v1H3zM7 7h1v1H7z'/%3E%3C/svg%3E"); } /* basket weave */
.w31-pattern-thatches { --w31-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h5v1H0zM1 1h3v1H1zM5 1h1v1H5zM2 2h1v1H2zM6 2h1v1H6zM1 3h1v1H1zM5 3h3v1H5zM0 4h1v1H0zM4 4h4v1H4zM3 5h1v1H3zM5 5h3v1H5zM2 6h1v1H2zM6 6h1v1H6zM1 7h3v1H1zM7 7h1v1H7z'/%3E%3C/svg%3E"); } /* thatched roof */
.w31-pattern-waffle   { --w31-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath d='M0 4h1v1H0zM0 5h1v1H0zM0 6h1v1H0zM0 7h5v1H0z'/%3E%3C/svg%3E"); } /* waffle grid */
.w31-pattern-zigzag   { --w31-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h1v1H0zM7 0h1v1H7zM1 1h1v1H1zM6 1h1v1H6zM2 2h1v1H2zM5 2h1v1H5zM3 3h2v1H3zM0 4h1v1H0zM7 4h1v1H7zM1 5h1v1H1zM6 5h1v1H6zM2 6h1v1H2zM5 6h1v1H5zM3 7h2v1H3z'/%3E%3C/svg%3E"); } /* chevrons */
.w31-pattern-spinner  { --w31-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath d='M3 0h1v1H3zM5 0h1v1H5zM4 1h2v1H4zM0 2h2v1H0zM4 2h1v1H4zM1 3h4v1H1zM7 3h1v1H7zM0 4h1v1H0zM3 4h4v1H3zM3 5h1v1H3zM6 5h2v1H6zM2 6h2v1H2zM2 7h1v1H2zM4 7h1v1H4z'/%3E%3C/svg%3E"); } /* pinwheels */

/* wallpapers: full-colour tiles that ignore the desktop colour */
.w31-wall-tartan {
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.35) 0 4px, transparent 4px 16px, rgba(255,255,0,.45) 16px 18px, transparent 18px 32px),
    repeating-linear-gradient(0deg, rgba(0,0,0,.35) 0 4px, transparent 4px 16px, rgba(255,255,0,.45) 16px 18px, transparent 18px 32px),
    #006040;
}
.w31-wall-redbrick {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='16' shape-rendering='crispEdges'%3E%3Cpath fill='%23c0c0c0' d='M0 7h32v1H0zM0 15h32v1H0zM15 0h1v7h-1zM31 8h1v7h-1z'/%3E%3Cpath fill='%23600000' d='M0 6h15v1H0zM16 6h15v1H16zM0 14h31v1H0z'/%3E%3C/svg%3E") 0 0 / 64px 32px,
    #a00000;
  image-rendering: pixelated;
}
.w31-wall-rivets {
  background:
    radial-gradient(circle at 9px 9px, #fff 0 1.5px, #404040 2px 3.5px, transparent 4px) 0 0 / 32px 32px,
    linear-gradient(135deg, rgba(255,255,255,.18) 25%, transparent 25% 50%, rgba(255,255,255,.18) 50% 75%, transparent 75%) 0 0 / 8px 8px,
    #707880;
}

/* ------------------------------------------------------------------
   3. Base
   ------------------------------------------------------------------ */
body { background: transparent; padding: 12px; }
a { color: var(--w31-link); text-decoration: underline; }
a:hover { color: var(--w31-link); }
a:visited { color: var(--w31-link); }
.w31-popup-link { text-decoration: underline dotted; text-underline-offset: 2px; }
h1,h2,h3,h4,h5,h6 { font-family: var(--w31-font); font-weight: 700; line-height: 1.2; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.2rem; } h4,h5,h6 { font-size: 1rem; }
b, strong { font-weight: 700; }
code, kbd, samp, pre { font-family: var(--w31-font-mono); }
code { color: var(--w31-title); font-size: .92em; }
pre { padding: 6px 8px; color: #000; background: var(--w31-window); border: 1px solid var(--w31-ink); }
kbd { padding: 1px 6px; color: #000; background: var(--w31-face); border: 1px solid var(--w31-ink); border-radius: 2px; box-shadow: var(--w31-out-thin); font: 700 12px var(--w31-font); }
hr { border: 0; border-top: 1px solid var(--w31-ink); opacity: 1; margin: 10px 0; }
mark { background: var(--w31-hilite); color: var(--w31-hilite-text); padding: 0 2px; }
::selection { color: var(--w31-hilite-text); background: var(--w31-hilite); }
:focus-visible { outline: 1px dotted var(--w31-ink); outline-offset: 1px; }
.text-body-secondary, .text-muted { color: var(--w31-gray) !important; }

/* system font: bold chrome text, as drawn by the 3.x System font */
.w31-sys { font: 700 13px/1.3 var(--w31-font); }

/* bevel utilities */
.w31-raised { background: var(--w31-face); border: 1px solid var(--w31-ink); box-shadow: var(--w31-out); }
.w31-sunken { background: var(--w31-face); box-shadow: var(--w31-sunken); }
.w31-field  { background: var(--w31-window); border: 1px solid var(--w31-ink); }
.w31-face   { background: var(--w31-face); }

/* centred page frame for websites: a maximised window */
.w31-page { max-width: 1000px; margin: 0 auto; }
.w31-page-narrow { max-width: 720px; margin: 0 auto; }

/* ------------------------------------------------------------------
   4. Windows: frame, title bar, menu bar, workspace, status bar
   <div class="w31-window">
     <div class="w31-titlebar"> .w31-sysmenu  .w31-title  .w31-ctl-min .w31-ctl-max </div>
     <nav class="w31-menubar">…</nav>
     <div class="w31-window-body">…</div>
   </div>
   ------------------------------------------------------------------ */
.w31-window {
  --w31-tick: linear-gradient(var(--w31-ink) 0 0);
  position: relative;
  display: flex; flex-direction: column;
  min-width: 0;
  padding: 3px;
  color: var(--w31-ink);
  background: var(--w31-frame);
  border: 1px solid var(--w31-ink);
}
/* the black corner notches cut into the sizing border */
.w31-window::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    var(--w31-tick) 22px 0 / 1px 3px no-repeat,
    var(--w31-tick) calc(100% - 22px) 0 / 1px 3px no-repeat,
    var(--w31-tick) 22px 100% / 1px 3px no-repeat,
    var(--w31-tick) calc(100% - 22px) 100% / 1px 3px no-repeat,
    var(--w31-tick) 0 22px / 3px 1px no-repeat,
    var(--w31-tick) 100% 22px / 3px 1px no-repeat,
    var(--w31-tick) 0 calc(100% - 22px) / 3px 1px no-repeat,
    var(--w31-tick) 100% calc(100% - 22px) / 3px 1px no-repeat;
}
.w31-window > * { border-left: 1px solid var(--w31-ink); border-right: 1px solid var(--w31-ink); }
.w31-window > :first-child { border-top: 1px solid var(--w31-ink); }
.w31-window > :last-child { border-bottom: 1px solid var(--w31-ink); }
/* a fixed dialog frame has no sizing notches */
.w31-window.w31-dialog::before { content: none; }
.w31-window.w31-dialog { padding: 4px; border-width: 1px; }
/* maximised: no frame at all */
.w31-window.w31-maximized { padding: 0; }
.w31-window.w31-maximized::before { content: none; }
.w31-window.w31-maximized > * { border-left: 0; border-right: 0; }

/* title bar */
.w31-titlebar {
  display: flex; align-items: stretch; flex: none;
  height: 20px;
  color: var(--w31-title-text);
  background: var(--w31-title);
  border-bottom: 1px solid var(--w31-ink);
  font: 700 13px/19px var(--w31-font);
  user-select: none;
}
.w31-title, .w31-titlebar > h1, .w31-titlebar > h2, .w31-titlebar > h3 {
  flex: 1; min-width: 0; margin: 0; padding: 0 4px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  text-align: center; font: inherit;
}
.w31-window.is-inactive > .w31-titlebar, .w31-titlebar.is-inactive { color: var(--w31-inactive-text); background: var(--w31-inactive); }

/* control-menu box (left) and min / max / restore buttons (right) */
.w31-sysmenu, .w31-ctl {
  position: relative; flex: none; display: grid; place-items: center;
  width: 20px; height: 19px; padding: 0; margin: 0;
  color: #000; background: var(--w31-face);
  border: 0; border-radius: 0; cursor: default;
}
.w31-sysmenu { border-right: 1px solid var(--w31-ink); }
.w31-sysmenu::before {
  content: ""; width: 13px; height: 3px;
  background: var(--w31-hi); box-shadow: 1px 1px 0 var(--w31-ink), 0 0 0 1px var(--w31-shadow);
}
.w31-workspace .w31-sysmenu::before, .w31-sysmenu-sm::before { width: 9px; height: 2px; }
.w31-sysmenu:active, .w31-sysmenu.show { background: var(--w31-hilite); }
.w31-ctl { width: 21px; border-left: 1px solid var(--w31-ink); box-shadow: var(--w31-out); }
.w31-ctl::before, .w31-ctl::after {
  content: ""; width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
}
.w31-ctl-min::before { border-top: 4px solid #000; }
.w31-ctl-max::before { border-bottom: 4px solid #000; }
.w31-ctl-restore { grid-template-rows: auto auto; align-content: center; gap: 1px; }
.w31-ctl-restore::before { border-bottom: 4px solid #000; }
.w31-ctl-restore::after  { border-top: 4px solid #000; }
.w31-ctl-min::after, .w31-ctl-max::after { content: none; }
.w31-ctl:active { box-shadow: var(--w31-in); padding: 1px 0 0 1px; }
.w31-sysmenu:focus-visible, .w31-ctl:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

/* menu bar */
.w31-menubar {
  display: flex; flex-wrap: wrap; align-items: stretch; flex: none;
  min-height: 19px; padding: 0 1px; margin: 0;
  color: #000; background: var(--w31-menu);
  border-bottom: 1px solid var(--w31-ink);
  font: 700 13px/1 var(--w31-font);
}
.w31-menubar.navbar { --bs-navbar-padding-y: 0; --bs-navbar-padding-x: 1px; --bs-navbar-nav-link-padding-x: 7px; }
.w31-menubar .navbar-nav { flex-direction: row; flex-wrap: wrap; }
.w31-menubar > a, .w31-menubar > .dropdown > a, .w31-menubar > button,
.w31-menubar .nav-link, .w31-menubar > .dropdown > button {
  display: block; padding: 3px 7px; margin: 0;
  color: #000; background: transparent; border: 0; border-radius: 0;
  font: inherit; line-height: 13px; text-decoration: none;
}
.w31-menubar .dropdown-toggle::after { content: none; }
.w31-menubar a:hover { color: #000; }
.w31-menubar a.show, .w31-menubar button.show, .w31-menubar a:active,
.w31-menubar .nav-link.show, .w31-menubar .nav-link.active, .w31-menubar .nav-link:focus-visible {
  color: var(--w31-hilite-text); background: var(--w31-hilite); outline: 0;
}
.w31-menubar u, .dropdown-item u { text-underline-offset: 1px; }
.w31-menubar .dropdown-menu { margin-top: 0 !important; }

/* window contents */
.w31-window-body { flex: 1 1 auto; min-height: 0; padding: 10px 12px; background: var(--w31-window); overflow: auto; }
.w31-window-body.w31-face { background: var(--w31-face); }
.w31-workspace {
  position: relative; flex: 1 1 auto; min-height: 0;
  padding: 6px; background: var(--w31-workspace); overflow: auto;
}
.w31-workspace > .w31-window + .w31-window { margin-top: 6px; }
/* split pane, as in File Manager's tree | contents view */
.w31-split { display: grid; grid-template-columns: minmax(150px, 40%) 1fr; gap: 0; min-height: 0; background: var(--w31-window); }
.w31-split > * { min-width: 0; overflow: auto; padding: 4px 6px; }
.w31-split > * + * { border-left: 1px solid var(--w31-ink); }

/* toolbar and drive bar */
.w31-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px; flex: none;
  padding: 3px 4px; background: var(--w31-face); border-bottom: 1px solid var(--w31-ink);
}
.w31-toolbar .btn { --bs-btn-padding-x: 5px; --bs-btn-padding-y: 1px; min-width: 0; min-height: 22px; }
.w31-toolbar-sep { width: 8px; flex: none; }

/* status bar */
.w31-statusbar {
  display: flex; flex-wrap: wrap; gap: 4px; flex: none;
  padding: 2px 3px; background: var(--w31-face);
  font: 700 12px/1.2 var(--w31-font);
}
.w31-status { flex: 1 1 auto; padding: 2px 5px; box-shadow: var(--w31-sunken); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w31-status-fixed { flex: 0 0 auto; }

/* ------------------------------------------------------------------
   5. Icons: program icons, minimised groups, file glyphs, tree view,
   message-box symbols. All glyphs are inline SVG or CSS shapes.
   ------------------------------------------------------------------ */
.w31-icons {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px 4px; padding: 6px 2px; margin: 0; list-style: none;
}
.w31-icon {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 0; padding: 0; text-align: center;
  color: inherit; background: none; border: 0;
  font: 400 12px/1.2 var(--w31-font); text-decoration: none; cursor: default;
}
.w31-icon:hover { color: inherit; }
.w31-icon-img { display: grid; place-items: center; width: 32px; height: 32px; flex: none; }
.w31-icon-img > img, .w31-icon-img > svg { max-width: 32px; max-height: 32px; image-rendering: pixelated; }
.w31-icon-label { padding: 0 2px; overflow-wrap: anywhere; }
.w31-icon:focus { outline: 0; }
.w31-icon.active .w31-icon-label, .w31-icon:focus .w31-icon-label { color: var(--w31-hilite-text); background: var(--w31-hilite); }
.w31-icon:focus-visible .w31-icon-label { outline: 1px dotted var(--w31-ink); outline-offset: 1px; }

/* icons sitting on the desktop (minimised windows) */
.w31-desktop-icons { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 8px 4px; }
.w31-desktop-icons .w31-icon { width: 84px; color: var(--w31-desktop-text); }

/* minimised program group: a tiny window full of tiny icons */
.w31-glyph-group {
  width: 32px; height: 28px;
  background:
    linear-gradient(var(--w31-title) 0 0) 1px 1px / 30px 4px no-repeat,
    conic-gradient(#ff0000 0 25%, #008000 0 50%, #0000ff 0 75%, #808000 0) 4px 8px / 5px 5px no-repeat,
    conic-gradient(#008080 0 25%, #ffff00 0 50%, #800080 0 75%, #000 0) 13px 8px / 5px 5px no-repeat,
    conic-gradient(#000080 0 50%, #ff0000 0) 22px 8px / 5px 5px no-repeat,
    conic-gradient(#808080 0 25%, #00ffff 0 50%, #800000 0 75%, #00ff00 0) 4px 18px / 5px 5px no-repeat,
    conic-gradient(#ffff00 0 50%, #000 0) 13px 18px / 5px 5px no-repeat,
    conic-gradient(#0000ff 0 25%, #ffffff 0 50%, #ff0000 0 75%, #008000 0) 22px 18px / 5px 5px no-repeat,
    #fff;
  border: 1px solid #000;
}

/* 16 px file glyphs: .w31-file + one of -folder -open -doc -app -drive -up */
.w31-file {
  --w31-file-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 1.5h7l3 3v10h-10z' fill='%23fff' stroke='%23000'/%3E%3Cpath d='M10.5 1.5v3h3' fill='none' stroke='%23000'/%3E%3C/svg%3E");
  display: inline-block; max-width: 100%;
  padding: 1px 3px 1px 21px;
  color: inherit; background: var(--w31-file-icon) 1px 50% / 16px 16px no-repeat;
  font: 400 13px/18px var(--w31-font); text-decoration: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; vertical-align: top; cursor: default;
}
a.w31-file:hover { color: inherit; }
.w31-file.active, a.w31-file:focus {
  color: var(--w31-hilite-text); outline: 0;
  background: var(--w31-file-icon) 1px 50% / 16px 16px no-repeat, linear-gradient(var(--w31-hilite) 0 0) 19px 0 / calc(100% - 19px) 100% no-repeat;
}
a.w31-file:focus-visible { outline: 1px dotted var(--w31-ink); outline-offset: -1px; }
.w31-file-folder { --w31-file-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 3.5h5l1 1.5h7v8.5h-13z' fill='%23ffff00' stroke='%23000' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.w31-file-open   { --w31-file-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 13.5v-10h5l1 1.5h5v2.5' fill='%23ffff00' stroke='%23000' stroke-linejoin='round'/%3E%3Cpath d='M1.5 13.5l2.5-6h11.5l-2.5 6z' fill='%23ffffa0' stroke='%23000' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.w31-file-doc    { --w31-file-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 1.5h7l3 3v10h-10z' fill='%23fff' stroke='%23000'/%3E%3Cpath d='M10.5 1.5v3h3M5 7.5h6M5 9.5h6M5 11.5h4' fill='none' stroke='%23000'/%3E%3C/svg%3E"); }
.w31-file-app    { --w31-file-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='1.5' y='2.5' width='13' height='11' fill='%23fff' stroke='%23000'/%3E%3Cpath d='M2 3h12v2H2z' fill='%23000080'/%3E%3C/svg%3E"); }
.w31-file-drive  { --w31-file-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='1.5' y='5.5' width='13' height='6' fill='%23c0c0c0' stroke='%23000'/%3E%3Cpath d='M3 8h2v1H3z' fill='%2300c000'/%3E%3Cpath d='M8 9.5h5' stroke='%23808080'/%3E%3C/svg%3E"); }
.w31-file-up     { --w31-file-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 13V4h7' fill='none' stroke='%23000' stroke-width='2'/%3E%3Cpath d='M9 1l4 3-4 3z'/%3E%3C/svg%3E"); }

/* file list (contents pane) */
.w31-files {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0 10px; align-content: start; padding: 2px 4px; margin: 0; list-style: none; background: var(--w31-window);
}

/* directory tree with connecting lines */
.w31-tree, .w31-tree ul { list-style: none; margin: 0; padding: 0; }
.w31-tree ul { padding-left: 20px; }
.w31-tree li { position: relative; }
.w31-tree ul > li::before { content: ""; position: absolute; left: -11px; top: 0; bottom: 0; border-left: 1px solid var(--w31-ink); }
.w31-tree ul > li:last-child::before { bottom: auto; height: 10px; }
.w31-tree ul > li::after { content: ""; position: absolute; left: -11px; top: 10px; width: 10px; border-top: 1px solid var(--w31-ink); }

/* message-box symbols */
.w31-msgicon {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; color: #000; background: #fff;
  border: 2px solid #000; border-radius: 50%;
  font: 700 22px/1 var(--w31-font-help);
}
.w31-msgicon-info::before     { content: "i"; color: var(--w31-title); font-style: italic; }
.w31-msgicon-question::before { content: "?"; color: var(--w31-title); }
.w31-msgicon-warning { background: #ffff00; }
.w31-msgicon-warning::before  { content: "!"; }
.w31-msgicon-stop {
  border: 0; border-radius: 0; color: #fff; background: #ff0000;
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
  font: 700 9px/1 var(--w31-font); letter-spacing: .3px;
}
.w31-msgicon-stop::before { content: "STOP"; }

/* ------------------------------------------------------------------
   6. Buttons
   Black outline, rounded corner pixels, two pixels of bevel. The
   default (.btn-primary) push button gets the thick black border.
   Pressing shifts the label one pixel down and right.
   ------------------------------------------------------------------ */
.btn {
  --w31-btn-face: var(--w31-face);
  --w31-btn-text: #000;
  --bs-btn-padding-x: 14px;
  --bs-btn-padding-y: 4px;
  --bs-btn-font-family: var(--w31-font);
  --bs-btn-font-size: 13px;
  --bs-btn-font-weight: 700;
  --bs-btn-line-height: 1.25;
  --bs-btn-border-width: 1px;
  --bs-btn-border-radius: 3px;
  --bs-btn-box-shadow: none;
  --bs-btn-focus-box-shadow: none;
  --bs-btn-color: var(--w31-btn-text);
  --bs-btn-bg: var(--w31-btn-face);
  --bs-btn-border-color: var(--w31-ink);
  --bs-btn-hover-color: var(--w31-btn-text);
  --bs-btn-hover-bg: var(--w31-btn-face);
  --bs-btn-hover-border-color: var(--w31-ink);
  --bs-btn-active-color: var(--w31-btn-text);
  --bs-btn-active-bg: var(--w31-btn-face);
  --bs-btn-active-border-color: var(--w31-ink);
  --bs-btn-disabled-color: color-mix(in srgb, var(--w31-btn-face) 67%, #000);
  --bs-btn-disabled-bg: var(--w31-btn-face);
  --bs-btn-disabled-border-color: var(--w31-ink);
  --bs-btn-disabled-opacity: 1;
  min-width: 2.25rem;
  box-shadow: inset -2px -2px 0 color-mix(in srgb, var(--w31-btn-face) 67%, #000), inset 2px 2px 0 var(--w31-hi);
  transition: none;
  cursor: default;
}
.btn:active, .btn.active, .btn.show,
.btn:first-child:active, :not(.btn-check) + .btn:active,
.btn-check:checked + .btn, .btn-check:active + .btn {
  box-shadow: inset 1px 1px 0 color-mix(in srgb, var(--w31-btn-face) 67%, #000);
  padding: calc(var(--bs-btn-padding-y) + 1px) calc(var(--bs-btn-padding-x) - 1px) calc(var(--bs-btn-padding-y) - 1px) calc(var(--bs-btn-padding-x) + 1px);
}
.btn:focus-visible, .btn-check:focus-visible + .btn { outline: 1px dotted #000; outline-offset: -5px; box-shadow: inset -2px -2px 0 color-mix(in srgb, var(--w31-btn-face) 67%, #000), inset 2px 2px 0 var(--w31-hi); }
.btn:disabled, .btn.disabled { box-shadow: inset -2px -2px 0 color-mix(in srgb, var(--w31-btn-face) 67%, #000), inset 2px 2px 0 var(--w31-hi); }
.btn-sm { --bs-btn-padding-x: 8px; --bs-btn-padding-y: 2px; --bs-btn-font-size: 12px; }
.btn-lg { --bs-btn-padding-x: 22px; --bs-btn-padding-y: 7px; --bs-btn-font-size: 15px; }
/* dialog button: the classic 75-dialog-unit OK / Cancel width */
.w31-btn-dialog { min-width: 88px; }

/* default push button: thick black border */
.btn-primary { --bs-btn-border-width: 2px; }

/* colour variants use the 16-colour VGA palette */
.btn-secondary, .btn-light { /* = button face */ }
.btn-light   { --w31-btn-face: var(--w31-window); }
.btn-success { --w31-btn-face: #008000; --w31-btn-text: #fff; }
.btn-danger  { --w31-btn-face: #800000; --w31-btn-text: #fff; }
.btn-warning { --w31-btn-face: #ffff00; }
.btn-info    { --w31-btn-face: #008080; --w31-btn-text: #fff; }
.btn-dark    { --w31-btn-face: #808080; --w31-btn-text: #fff; }
.btn-success:disabled, .btn-danger:disabled, .btn-info:disabled, .btn-dark:disabled { --bs-btn-disabled-color: color-mix(in srgb, var(--w31-btn-face) 40%, #fff); }

[class*="btn-outline-"] { --w31-btn-face: var(--w31-face); }
.btn-outline-primary { --w31-btn-text: var(--w31-title); }
.btn-outline-success { --w31-btn-text: #008000; }
.btn-outline-danger  { --w31-btn-text: #800000; }
.btn-outline-info    { --w31-btn-text: #008080; }
.btn-outline-warning { --w31-btn-text: #808000; }

.btn-link {
  --bs-btn-color: var(--w31-link); --bs-btn-hover-color: var(--w31-link); --bs-btn-active-color: var(--w31-link);
  --bs-btn-bg: transparent; --bs-btn-hover-bg: transparent; --bs-btn-active-bg: transparent;
  --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent;
  font-weight: 400; text-decoration: underline; box-shadow: none !important;
}

/* button groups keep each button's own outline */
.btn-group > .btn, .btn-group-vertical > .btn { border-radius: 3px; }
.btn-group > :not(.btn-check:first-child) + .btn, .btn-group > .btn-group:not(:first-child) { margin-left: 2px; }
.btn-group-vertical > .btn ~ .btn { margin-top: 2px; }

/* close button: a small push button with an X */
.btn-close {
  --bs-btn-close-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v1h1v1h2V1h1V0h2v1H7v1H6v1H5v2h1v1h1v1h1v1H6V7H5V6H3v1H2v1H0V7h1V6h1V5h1V3H2V2H1V1H0z'/%3E%3C/svg%3E");
  --bs-btn-close-opacity: 1; --bs-btn-close-hover-opacity: 1; --bs-btn-close-focus-shadow: none;
  width: 20px; height: 18px; padding: 0; box-sizing: border-box;
  background: var(--w31-face) var(--bs-btn-close-bg) center / 8px 8px no-repeat;
  border: 1px solid var(--w31-ink); border-radius: 2px; box-shadow: var(--w31-out-thin); opacity: 1;
  image-rendering: pixelated;
}
.btn-close:active { box-shadow: var(--w31-in); background-position: calc(50% + 1px) calc(50% + 1px); }
.btn-close:focus { box-shadow: var(--w31-out-thin); }
.btn-close:focus-visible { outline: 1px dotted #000; outline-offset: 1px; }

/* ------------------------------------------------------------------
   7. Forms
   Flat white fields with a one-pixel black outline, checkboxes with an
   X, combo boxes with a separate arrow button. Add .w31-3d to a
   container for the later "3-D controls" look (grey dialogs, sunken
   fields).
   ------------------------------------------------------------------ */
.form-label, .col-form-label, legend { font: 700 13px/1.3 var(--w31-font); }
.form-text { color: var(--w31-gray); font-size: 12px; }
.form-control, .form-select {
  padding: 3px 5px;
  color: #000; background-color: var(--w31-window);
  border: 1px solid var(--w31-ink); border-radius: 0;
  font: 400 14px/1.3 var(--w31-font);
}
.form-control:focus, .form-select:focus { color: #000; background-color: var(--w31-window); border-color: var(--w31-ink); box-shadow: none; outline: 0; }
.form-control:disabled, .form-select:disabled { color: var(--w31-gray); background-color: var(--w31-face); }
.form-control::placeholder { color: var(--w31-gray); }
.form-control-sm, .form-select-sm { padding: 1px 4px; font-size: 13px; }
.form-control-lg, .form-select-lg { padding: 6px 8px; font-size: 16px; }
.form-control::file-selector-button {
  margin: -3px 6px -3px -5px; padding: 3px 10px;
  color: #000; background: var(--w31-face); border: 0; border-right: 1px solid var(--w31-ink);
  box-shadow: var(--w31-out); font: 700 13px var(--w31-font);
}
.form-control:hover:not(:disabled):not([readonly])::file-selector-button { background: var(--w31-face); }
textarea.form-control { font-family: var(--w31-font-mono); }

/* drop-down list: arrow button with an underline, as in the drive list */
.form-select {
  padding-right: 26px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='6' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h7v1H6v1H5v1H2V2H1V1H0zM3 3h1v1H3zM0 5h7v1H0z'/%3E%3C/svg%3E") right 5px center / 7px 6px no-repeat,
    linear-gradient(var(--w31-hi) 0 0) right 16px top 0 / 1px 100% no-repeat,
    linear-gradient(var(--w31-hi) 0 0) right 0 top 0 / 17px 1px no-repeat,
    linear-gradient(var(--w31-shadow) 0 0) right 0 top 0 / 1px 100% no-repeat,
    linear-gradient(var(--w31-shadow) 0 0) right 0 bottom 0 / 17px 1px no-repeat,
    linear-gradient(var(--w31-face) 0 0) right 0 top 0 / 17px 100% no-repeat,
    linear-gradient(var(--w31-ink) 0 0) right 17px top 0 / 1px 100% no-repeat,
    var(--w31-window);
  image-rendering: pixelated;
}
.form-select[multiple], .form-select[size]:not([size="1"]) { padding-right: 5px; background: var(--w31-window); }
.form-select option:checked { color: var(--w31-hilite-text); background: var(--w31-hilite); }

/* checkboxes and radio buttons */
.form-check { min-height: 20px; }
.form-check-label { font: 700 13px/20px var(--w31-font); }
.form-check-input {
  width: 13px; height: 13px; margin-top: 3px;
  background-color: var(--w31-window); border: 1px solid var(--w31-ink);
  image-rendering: pixelated;
}
.form-check-input[type="checkbox"] { border-radius: 0; }
.form-check-input:focus { border-color: var(--w31-ink); box-shadow: none; }
.form-check-input:focus-visible + .form-check-label { outline: 1px dotted var(--w31-ink); outline-offset: -1px; }
.form-check-input:checked { background-color: var(--w31-window); border-color: var(--w31-ink); }
.form-check-input:checked[type="checkbox"] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 11'%3E%3Cpath d='M0 0l11 11M11 0L0 11' stroke='%23000' stroke-width='1.3'/%3E%3C/svg%3E");
  background-size: 11px 11px;
}
.form-check-input:indeterminate { --bs-form-check-bg-image: none; background-color: var(--w31-shadow); border-color: var(--w31-ink); box-shadow: inset 0 0 0 2px var(--w31-window); }
.form-check-input:checked[type="radio"] { --bs-form-check-bg-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='2.2'/%3E%3C/svg%3E"); }
.form-check-input:disabled ~ .form-check-label { color: var(--w31-gray); opacity: 1; }
.form-check-input:disabled { opacity: 1; filter: none; background-color: var(--w31-face); }

/* switch: a little slider with a bevelled thumb */
.form-switch .form-check-input {
  --bs-form-switch-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Crect x='.5' y='.5' width='9' height='11' fill='%23c0c0c0' stroke='%23000'/%3E%3Cpath d='M1 11V1h8' fill='none' stroke='%23fff'/%3E%3C/svg%3E");
  width: 30px; height: 14px; margin-top: 3px; border-radius: 0;
  background-size: auto 100%; background-color: var(--w31-window);
}
.form-switch .form-check-input:focus { --bs-form-switch-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Crect x='.5' y='.5' width='9' height='11' fill='%23c0c0c0' stroke='%23000'/%3E%3Cpath d='M1 11V1h8' fill='none' stroke='%23fff'/%3E%3C/svg%3E"); }
.form-switch .form-check-input:checked { --bs-form-switch-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Crect x='.5' y='.5' width='9' height='11' fill='%23c0c0c0' stroke='%23000'/%3E%3Cpath d='M1 11V1h8' fill='none' stroke='%23fff'/%3E%3C/svg%3E"); background-color: var(--w31-hilite); background-image: var(--bs-form-switch-bg); }

/* range: a horizontal scroll bar */
.form-range { height: 18px; }
.form-range:focus { box-shadow: none; }
.form-range:focus-visible { outline: 1px dotted var(--w31-ink); }
.form-range::-webkit-slider-runnable-track { height: 18px; background: var(--w31-light); border: 1px solid var(--w31-ink); border-radius: 0; }
.form-range::-webkit-slider-thumb {
  width: 16px; height: 16px; margin-top: 0;
  background: var(--w31-face); border: 1px solid var(--w31-ink); border-radius: 0; box-shadow: var(--w31-out-thin);
  -webkit-appearance: none; appearance: none;
}
.form-range::-webkit-slider-thumb:active { background: var(--w31-face); }
.form-range::-moz-range-track { height: 16px; background: var(--w31-light); border: 1px solid var(--w31-ink); border-radius: 0; }
.form-range::-moz-range-thumb { width: 14px; height: 14px; background: var(--w31-face); border: 1px solid var(--w31-ink); border-radius: 0; box-shadow: var(--w31-out-thin); }
.form-range:focus::-webkit-slider-thumb { box-shadow: var(--w31-out-thin); }
.form-range:focus::-moz-range-thumb { box-shadow: var(--w31-out-thin); }

/* input groups */
.input-group-text { padding: 3px 8px; color: #000; background: var(--w31-face); border: 1px solid var(--w31-ink); border-radius: 0; font: 700 13px var(--w31-font); }
.input-group > .btn { border-radius: 0; }

/* validation */
.form-control.is-invalid, .was-validated .form-control:invalid,
.form-select.is-invalid, .was-validated .form-select:invalid { border-color: #ff0000; box-shadow: inset 0 0 0 1px #ff0000; background-image: none; padding-right: 5px; }
.form-control.is-valid, .was-validated .form-control:valid { border-color: #008000; box-shadow: inset 0 0 0 1px #008000; background-image: none; padding-right: 5px; }
.invalid-feedback { color: #800000; font: 700 12px var(--w31-font); }
.valid-feedback { color: #008000; font: 700 12px var(--w31-font); }

/* group box: one black rectangle with the caption cut into it */
fieldset.w31-groupbox, .w31-groupbox {
  position: relative; margin: 10px 0 8px; padding: 12px 10px 8px;
  border: 1px solid var(--w31-ink);
}
.w31-groupbox > legend, .w31-groupbox-caption {
  float: none; width: auto; position: absolute; top: -9px; left: 7px;
  margin: 0; padding: 0 3px; background: var(--w31-window);
  font: 700 13px/16px var(--w31-font);
}
.w31-face .w31-groupbox > legend, .w31-3d .w31-groupbox > legend, .w31-face .w31-groupbox-caption, .w31-3d .w31-groupbox-caption { background: var(--w31-face); }

/* 3-D controls: grey dialogs with sunken fields */
.w31-3d.w31-window-body, .w31-3d .w31-window-body, .modal.w31-3d .modal-body { background: var(--w31-face); }
.w31-3d .form-control, .w31-3d .form-select:not([multiple]) { border-color: var(--w31-shadow) var(--w31-hi) var(--w31-hi) var(--w31-shadow); box-shadow: inset 1px 1px 0 var(--w31-ink); }
.w31-3d .w31-groupbox { border-color: var(--w31-shadow); box-shadow: 1px 1px 0 var(--w31-hi), inset 1px 1px 0 var(--w31-hi); }

/* ------------------------------------------------------------------
   8. Cards
   A card is a plain child window: black outline, title-bar header,
   grey footer. .card.w31-help is a yellow help note.
   ------------------------------------------------------------------ */
.card {
  --bs-card-border-width: 1px;
  --bs-card-border-color: var(--w31-ink);
  --bs-card-border-radius: 0;
  --bs-card-inner-border-radius: 0;
  --bs-card-bg: var(--w31-window);
  --bs-card-color: #000;
  --bs-card-cap-bg: var(--w31-title);
  --bs-card-cap-color: var(--w31-title-text);
  --bs-card-cap-padding-y: 0;
  --bs-card-cap-padding-x: 6px;
  --bs-card-spacer-y: 10px;
  --bs-card-spacer-x: 12px;
}
.card-header { min-height: 20px; border-bottom: 1px solid var(--w31-ink); font: 700 13px/19px var(--w31-font); text-align: center; }
.card-header.is-inactive { color: var(--w31-inactive-text); background: var(--w31-inactive); }
.card-footer { background: var(--w31-face); border-top: 1px solid var(--w31-ink); padding: 6px 10px; }
.card-title { font-size: 15px; }
.card-subtitle { color: var(--w31-gray) !important; font-size: 13px; }
.card-img-top { border-bottom: 1px solid var(--w31-ink); }
.card.w31-help { --bs-card-bg: var(--w31-help); }
.card.w31-face { --bs-card-bg: var(--w31-face); }

/* ------------------------------------------------------------------
   9. Tables
   A white list with raised column headers. .table-active rows are
   highlighted like a selected list item.
   ------------------------------------------------------------------ */
.table {
  --bs-table-color: #000;
  --bs-table-bg: var(--w31-window);
  --bs-table-border-color: var(--w31-light);
  --bs-table-striped-bg: var(--w31-light);
  --bs-table-striped-color: #000;
  --bs-table-hover-bg: var(--w31-light);
  --bs-table-hover-color: #000;
  --bs-table-active-bg: var(--w31-hilite);
  --bs-table-active-color: var(--w31-hilite-text);
  border: 1px solid var(--w31-ink);
  font-size: 13px;
}
.table > :not(caption) > * > * { padding: 3px 7px; }
.table > thead > tr > *, .table > thead th {
  --bs-table-bg: var(--w31-face); --bs-table-color: #000;
  font: 700 13px var(--w31-font); text-align: left;
  border-bottom: 1px solid var(--w31-ink);
  box-shadow: inset -1px -1px 0 var(--w31-shadow), inset 1px 1px 0 var(--w31-hi);
}
.table > thead > tr > * + * { border-left: 1px solid var(--w31-ink); }
.table > :not(:first-child) { border-top: 0; }
.table tr.table-active > *, .table > tbody > tr > .table-active { --bs-table-color-state: var(--w31-hilite-text); --bs-table-bg-state: var(--w31-hilite); }
.table caption { color: var(--w31-gray); font-size: 12px; }
.table-bordered > :not(caption) > * > * { border-color: var(--w31-ink); }
.table-dark { --bs-table-bg: #000; --bs-table-color: #fff; --bs-table-border-color: #808080; }

/* ------------------------------------------------------------------
   10. Navigation: dropdown menus, navbar, tabs, pills, breadcrumb,
   pagination
   ------------------------------------------------------------------ */
.dropdown-menu {
  --bs-dropdown-min-width: 150px;
  --bs-dropdown-padding-y: 1px;
  --bs-dropdown-padding-x: 0;
  --bs-dropdown-spacer: 0;
  --bs-dropdown-bg: var(--w31-menu);
  --bs-dropdown-color: #000;
  --bs-dropdown-border-color: var(--w31-ink);
  --bs-dropdown-border-radius: 0;
  --bs-dropdown-border-width: 1px;
  --bs-dropdown-inner-border-radius: 0;
  --bs-dropdown-box-shadow: 2px 2px 0 var(--w31-ink);
  --bs-dropdown-link-color: #000;
  --bs-dropdown-link-hover-color: var(--w31-hilite-text);
  --bs-dropdown-link-hover-bg: var(--w31-hilite);
  --bs-dropdown-link-active-color: #000;
  --bs-dropdown-link-active-bg: transparent;
  --bs-dropdown-link-disabled-color: var(--w31-gray);
  --bs-dropdown-item-padding-x: 18px;
  --bs-dropdown-item-padding-y: 2px;
  --bs-dropdown-header-color: var(--w31-gray);
  --bs-dropdown-divider-bg: var(--w31-ink);
  --bs-dropdown-divider-margin-y: 3px;
  box-shadow: var(--bs-dropdown-box-shadow);
  font: 700 13px/1.3 var(--w31-font);
}
.dropdown-item { position: relative; display: flex; gap: 24px; justify-content: space-between; font-weight: 700; }
.dropdown-item:focus, .dropdown-item:hover, .dropdown-item.active:focus, .dropdown-item.active:hover { color: var(--w31-hilite-text); background: var(--w31-hilite); outline: 0; }
/* .active marks a checked command, the way 3.x menus do it */
.dropdown-item.active::before { content: "\2713"; position: absolute; left: 5px; }
.w31-key { margin-left: auto; font-weight: 700; white-space: nowrap; }
.dropdown-divider { margin-inline: 0; opacity: 1; height: 0; border-top: 1px solid var(--w31-ink); }
.dropdown-header { font-size: 12px; }
.dropdown-toggle::after { border-top-width: 4px; border-left-width: 4px; border-right-width: 4px; vertical-align: 2px; }

/* navbar: every navbar is a menu bar */
.navbar {
  --bs-navbar-padding-x: 6px;
  --bs-navbar-padding-y: 2px;
  --bs-navbar-color: #000;
  --bs-navbar-hover-color: #000;
  --bs-navbar-active-color: var(--w31-hilite-text);
  --bs-navbar-disabled-color: var(--w31-gray);
  --bs-navbar-brand-color: #000;
  --bs-navbar-brand-hover-color: #000;
  --bs-navbar-brand-font-size: 15px;
  --bs-navbar-nav-link-padding-x: 8px;
  --bs-navbar-toggler-border-color: var(--w31-ink);
  --bs-navbar-toggler-border-radius: 3px;
  --bs-navbar-toggler-focus-width: 0;
  --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='%23000' stroke-width='3' d='M5 8h20M5 15h20M5 22h20'/%3E%3C/svg%3E");
  background: var(--w31-menu);
  border: 1px solid var(--w31-ink);
  font: 700 13px var(--w31-font);
}
.navbar-brand { font-weight: 700; }
.navbar .nav-link { padding-block: 3px; }
.navbar .nav-link.active, .navbar .nav-link.show { color: var(--w31-hilite-text); background: var(--w31-hilite); }
.navbar-toggler { padding: 2px 6px; background: var(--w31-face); box-shadow: var(--w31-out-thin); }
.navbar-toggler:focus { box-shadow: var(--w31-out-thin); }
.navbar-toggler:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.w31-menubar.navbar { border: 0; border-bottom: 1px solid var(--w31-ink); }
.w31-window > .w31-menubar.navbar { border-left: 1px solid var(--w31-ink); border-right: 1px solid var(--w31-ink); }

/* nav links */
.nav { --bs-nav-link-color: var(--w31-link); --bs-nav-link-hover-color: var(--w31-link); --bs-nav-link-disabled-color: var(--w31-gray); --bs-nav-link-font-weight: 700; --bs-nav-link-padding-y: 3px; }
.nav-link { font-size: 13px; }

/* tabs */
.nav-tabs {
  --bs-nav-tabs-border-width: 1px;
  --bs-nav-tabs-border-color: var(--w31-ink);
  --bs-nav-tabs-border-radius: 4px;
  --bs-nav-tabs-link-hover-border-color: var(--w31-ink);
  --bs-nav-tabs-link-active-color: #000;
  --bs-nav-tabs-link-active-bg: var(--w31-window);
  --bs-nav-tabs-link-active-border-color: var(--w31-ink);
  gap: 1px; padding-left: 4px;
}
.nav-tabs .nav-link {
  margin-top: 3px; padding: 2px 12px;
  color: #000; background: var(--w31-face);
  border-color: var(--w31-ink); border-bottom: 0;
  box-shadow: inset 1px 1px 0 var(--w31-hi), inset -1px 0 0 var(--w31-shadow);
}
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { margin-top: 0; padding-bottom: 6px; margin-bottom: -1px; box-shadow: none; position: relative; }
.nav-tabs .nav-link:focus-visible { outline: 1px dotted #000; outline-offset: -4px; box-shadow: none; }
.nav-tabs + .tab-content { padding: 10px; background: var(--w31-window); border: 1px solid var(--w31-ink); border-top: 0; }

/* pills: toggle buttons that light up in the highlight colour */
.nav-pills { --bs-nav-pills-border-radius: 0; --bs-nav-pills-link-active-color: var(--w31-hilite-text); --bs-nav-pills-link-active-bg: var(--w31-hilite); gap: 2px; }
.nav-pills .nav-link { color: #000; }
.nav-pills .nav-link:focus-visible { outline: 1px dotted currentColor; outline-offset: -3px; box-shadow: none; }

/* breadcrumb: a DOS path */
.breadcrumb {
  --bs-breadcrumb-divider: "\\";
  --bs-breadcrumb-divider-color: #000;
  --bs-breadcrumb-item-padding-x: 0;
  --bs-breadcrumb-item-active-color: #000;
  --bs-breadcrumb-padding-x: 6px;
  --bs-breadcrumb-padding-y: 2px;
  --bs-breadcrumb-bg: var(--w31-window);
  --bs-breadcrumb-border-radius: 0;
  border: 1px solid var(--w31-ink);
  font: 700 13px var(--w31-font);
  text-transform: uppercase;
}
.breadcrumb a { color: #000; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* pagination: a row of small push buttons */
.pagination {
  --bs-pagination-padding-x: 9px;
  --bs-pagination-padding-y: 2px;
  --bs-pagination-font-size: 13px;
  --bs-pagination-color: #000;
  --bs-pagination-bg: var(--w31-face);
  --bs-pagination-border-width: 1px;
  --bs-pagination-border-color: var(--w31-ink);
  --bs-pagination-border-radius: 3px;
  --bs-pagination-hover-color: #000;
  --bs-pagination-hover-bg: var(--w31-face);
  --bs-pagination-hover-border-color: var(--w31-ink);
  --bs-pagination-focus-color: #000;
  --bs-pagination-focus-bg: var(--w31-face);
  --bs-pagination-focus-box-shadow: none;
  --bs-pagination-active-color: var(--w31-hilite-text);
  --bs-pagination-active-bg: var(--w31-hilite);
  --bs-pagination-active-border-color: var(--w31-ink);
  --bs-pagination-disabled-color: var(--w31-gray);
  --bs-pagination-disabled-bg: var(--w31-face);
  --bs-pagination-disabled-border-color: var(--w31-ink);
  gap: 2px; font-weight: 700;
}
.page-link { border-radius: 3px !important; margin-left: 0 !important; box-shadow: var(--w31-out); }
.page-link:active, .active > .page-link { box-shadow: var(--w31-in); }
.page-link:focus-visible { outline: 1px dotted #000; outline-offset: -4px; box-shadow: var(--w31-out); }

/* ------------------------------------------------------------------
   11. Feedback: message boxes (alerts), badges, progress, the Setup
   gauge, the hourglass spinner, toasts, tooltips, popovers
   ------------------------------------------------------------------ */
.alert {
  --bs-alert-padding-x: 12px;
  --bs-alert-padding-y: 10px;
  --bs-alert-color: #000;
  --bs-alert-bg: var(--w31-window);
  --bs-alert-border-color: var(--w31-ink);
  --bs-alert-border-radius: 0;
  --bs-alert-link-color: var(--w31-link);
  position: relative;
  min-height: 54px;
}
.alert-heading { font-size: 14px; }
.alert-link { font-weight: 700; }
.alert-primary { --bs-alert-bg: color-mix(in srgb, var(--w31-title) 10%, var(--w31-window)); }
.alert-secondary { --bs-alert-bg: var(--w31-face); }
.alert-light { --bs-alert-bg: var(--w31-window); }
.alert-dark { --bs-alert-bg: #000; --bs-alert-color: #fff; --bs-alert-border-color: #000; }
/* message-box symbol on the left */
.alert-info, .alert-warning, .alert-danger, .alert-success { padding-left: 58px; }
.alert-info::before, .alert-warning::before, .alert-danger::before, .alert-success::before {
  position: absolute; left: 12px; top: 10px;
  display: grid; place-items: center; width: 32px; height: 32px;
  color: var(--w31-title); background: #fff; border: 2px solid #000; border-radius: 50%;
  font: italic 700 22px/1 var(--w31-font-help);
}
.alert-info::before { content: "i"; }
.alert-success::before { content: "\2713"; color: #008000; font-style: normal; font-size: 18px; }
.alert-warning::before { content: "!"; color: #000; background: #ffff00; font-style: normal; }
.alert-danger::before {
  content: "STOP"; color: #fff; background: #ff0000; border: 0; border-radius: 0;
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
  font: 700 9px/1 var(--w31-font); letter-spacing: .3px;
}
.alert-dismissible { padding-right: 40px; }
.alert-dismissible .btn-close { top: 8px; right: 8px; padding: 0; }

/* badges */
.badge {
  --bs-badge-padding-x: 5px;
  --bs-badge-padding-y: 2px;
  --bs-badge-font-size: 11px;
  --bs-badge-font-weight: 700;
  --bs-badge-color: #000;
  --bs-badge-border-radius: 0;
  border: 1px solid var(--w31-ink);
}
.badge:not([class*="bg-"]) { background: var(--w31-face); box-shadow: var(--w31-out-thin); }
.btn .badge { border-color: currentColor; }

/* progress */
.progress, .progress-stacked {
  --bs-progress-height: 20px;
  --bs-progress-font-size: 12px;
  --bs-progress-bg: var(--w31-window);
  --bs-progress-border-radius: 0;
  --bs-progress-box-shadow: none;
  --bs-progress-bar-color: var(--w31-hilite-text);
  --bs-progress-bar-bg: var(--w31-hilite);
  --bs-progress-bar-transition: none;
  border: 1px solid var(--w31-ink);
  font-weight: 700;
}

/* Setup gauge: the percentage flips colour where the bar passes it
   <div class="w31-gauge" style="--value:42" data-label="42%" role="progressbar" aria-valuenow="42" aria-valuemin="0" aria-valuemax="100"></div> */
.w31-gauge {
  --value: 0;
  position: relative; height: 22px;
  color: var(--w31-hilite); background: var(--w31-window);
  border: 1px solid var(--w31-ink);
  font: 700 13px/20px var(--w31-font); text-align: center;
}
.w31-gauge::before { content: attr(data-label); }
.w31-gauge::after {
  content: attr(data-label); position: absolute; inset: 0;
  color: var(--w31-hilite-text); background: var(--w31-hilite);
  clip-path: inset(0 calc(100% - var(--value) * 1%) 0 0);
}

/* spinners become the hourglass */
.spinner-border, .spinner-grow {
  --bs-spinner-width: 16px;
  --bs-spinner-height: 24px;
  --bs-spinner-animation-speed: 2s;
  --bs-spinner-animation-name: w31-hourglass;
  border: 0; border-radius: 0; opacity: 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 24' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h16v3H0zM0 21h16v3H0z'/%3E%3Cpath d='M2.5 3.5v3l4.5 5.5-4.5 5.5v3h11v-3L9 12l4.5-5.5v-3z' fill='%23fff' stroke='%23000'/%3E%3Cpath d='M5 7h6l-3 4zM4 20v-1.5l4-3.5 4 3.5V20z'/%3E%3C/svg%3E") center / contain no-repeat;
  image-rendering: pixelated;
}
.spinner-border-sm, .spinner-grow-sm { --bs-spinner-width: 11px; --bs-spinner-height: 16px; }
@keyframes w31-hourglass { 0%, 42% { transform: none; } 50%, 92% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }

/* toasts: a small window */
.toast {
  --bs-toast-bg: var(--w31-frame);
  --bs-toast-color: #000;
  --bs-toast-border-color: var(--w31-ink);
  --bs-toast-border-width: 1px;
  --bs-toast-border-radius: 0;
  --bs-toast-box-shadow: none;
  --bs-toast-padding-x: 10px;
  --bs-toast-padding-y: 8px;
  --bs-toast-header-color: var(--w31-title-text);
  --bs-toast-header-bg: var(--w31-title);
  --bs-toast-header-border-color: var(--w31-ink);
  padding: 3px;
  font-size: 13px;
}
.toast-header { min-height: 20px; padding: 0 4px 0 0; border: 1px solid var(--w31-ink); font: 700 13px/19px var(--w31-font); }
.toast-header small { color: inherit; font-weight: 400; }
.toast-body { background: var(--w31-window); border: 1px solid var(--w31-ink); border-top: 0; }
.toast-body:only-child { border-top: 1px solid var(--w31-ink); }

/* tooltips and popovers */
.tooltip {
  --bs-tooltip-bg: var(--w31-help);
  --bs-tooltip-color: #000;
  --bs-tooltip-opacity: 1;
  --bs-tooltip-border-radius: 0;
  --bs-tooltip-padding-x: 5px;
  --bs-tooltip-padding-y: 2px;
  --bs-tooltip-font-size: 12px;
  --bs-tooltip-arrow-height: 0;
  --bs-tooltip-arrow-width: 0;
  font-family: var(--w31-font);
}
.tooltip-inner { border: 1px solid var(--w31-ink); text-align: left; }
.popover {
  --bs-popover-bg: var(--w31-window);
  --bs-popover-border-color: var(--w31-ink);
  --bs-popover-border-radius: 0;
  --bs-popover-inner-border-radius: 0;
  --bs-popover-box-shadow: 2px 2px 0 var(--w31-ink);
  --bs-popover-font-size: 13px;
  --bs-popover-header-bg: var(--w31-title);
  --bs-popover-header-color: var(--w31-title-text);
  --bs-popover-header-padding-y: 1px;
  --bs-popover-header-padding-x: 6px;
  --bs-popover-header-font-size: 13px;
  --bs-popover-body-padding-y: 8px;
  --bs-popover-body-padding-x: 10px;
  font-family: var(--w31-font);
}
.popover-header { border-bottom: 1px solid var(--w31-ink); text-align: center; }

/* ------------------------------------------------------------------
   12. List boxes, accordion, dialogs (modals), offcanvas
   In title bars (modal, toast, offcanvas headers) .btn-close turns into
   the control-menu box on the left, as in a 3.x dialog.
   ------------------------------------------------------------------ */
.list-group {
  --bs-list-group-color: #000;
  --bs-list-group-bg: var(--w31-window);
  --bs-list-group-border-color: transparent;
  --bs-list-group-border-width: 0;
  --bs-list-group-border-radius: 0;
  --bs-list-group-item-padding-x: 5px;
  --bs-list-group-item-padding-y: 1px;
  --bs-list-group-action-color: #000;
  --bs-list-group-action-hover-color: #000;
  --bs-list-group-action-hover-bg: var(--w31-window);
  --bs-list-group-action-active-color: #000;
  --bs-list-group-action-active-bg: var(--w31-window);
  --bs-list-group-active-color: var(--w31-hilite-text);
  --bs-list-group-active-bg: var(--w31-hilite);
  --bs-list-group-active-border-color: var(--w31-hilite);
  --bs-list-group-disabled-color: var(--w31-gray);
  --bs-list-group-disabled-bg: var(--w31-window);
  border: 1px solid var(--w31-ink);
  font-size: 13px;
}
.list-group-flush { border: 0; }
.list-group-item-action:focus-visible { outline: 1px dotted currentColor; outline-offset: -1px; }

.accordion {
  --bs-accordion-color: #000;
  --bs-accordion-bg: var(--w31-window);
  --bs-accordion-border-color: var(--w31-ink);
  --bs-accordion-border-radius: 0;
  --bs-accordion-inner-border-radius: 0;
  --bs-accordion-btn-padding-x: 8px;
  --bs-accordion-btn-padding-y: 4px;
  --bs-accordion-btn-color: #000;
  --bs-accordion-btn-bg: var(--w31-face);
  --bs-accordion-active-color: var(--w31-hilite-text);
  --bs-accordion-active-bg: var(--w31-hilite);
  --bs-accordion-btn-focus-box-shadow: none;
  --bs-accordion-btn-icon-width: 9px;
  --bs-accordion-btn-icon-transition: none;
  --bs-accordion-btn-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h7v1H6v1H5v1H4v1H3V3H2V2H1V1H0z'/%3E%3C/svg%3E");
  --bs-accordion-btn-active-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' shape-rendering='crispEdges'%3E%3Cpath fill='%23fff' d='M0 0h7v1H6v1H5v1H4v1H3V3H2V2H1V1H0z'/%3E%3C/svg%3E");
  --bs-accordion-body-padding-x: 10px;
  --bs-accordion-body-padding-y: 8px;
}
.accordion-button { font: 700 13px var(--w31-font); box-shadow: var(--w31-out-thin); }
.accordion-button::after { background-size: 7px 4px; background-position: center; image-rendering: pixelated; }
.accordion-button:not(.collapsed) { box-shadow: none; }
.accordion-button:focus { box-shadow: var(--w31-out-thin); }
.accordion-button:not(.collapsed):focus { box-shadow: none; }
.accordion-button:focus-visible { outline: 1px dotted currentColor; outline-offset: -4px; }

/* dialog boxes */
.modal {
  --bs-modal-bg: var(--w31-window);
  --bs-modal-color: #000;
  --bs-modal-border-color: var(--w31-ink);
  --bs-modal-border-width: 1px;
  --bs-modal-border-radius: 0;
  --bs-modal-inner-border-radius: 0;
  --bs-modal-box-shadow: none;
  --bs-modal-padding: 14px;
  --bs-modal-header-padding: 0;
  --bs-modal-header-border-color: var(--w31-ink);
  --bs-modal-header-border-width: 1px;
  --bs-modal-title-line-height: 19px;
  --bs-modal-footer-border-width: 0;
  --bs-modal-footer-gap: 8px;
}
.modal-backdrop { --bs-backdrop-bg: #000; --bs-backdrop-opacity: .25; }
.modal-content { padding: 4px; background: var(--w31-frame); }
.modal-header, .offcanvas-header {
  align-items: stretch; height: 21px; padding: 0;
  color: var(--w31-title-text); background: var(--w31-title);
  border: 1px solid var(--w31-ink);
}
.modal-title, .offcanvas-title {
  flex: 1; min-width: 0; padding: 0 4px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  text-align: center; font: 700 13px/19px var(--w31-font);
}
.modal-body { background: var(--w31-window); border: 1px solid var(--w31-ink); border-top: 0; }
.modal-body:has(+ .modal-footer) { border-bottom: 0; }
.modal-footer { justify-content: center; background: var(--w31-window); border: 1px solid var(--w31-ink); border-top: 0; padding-top: 0; }
.modal-footer > * { margin: 0; }
.modal-footer .btn { min-width: 88px; }
.w31-3d .modal-body, .w31-3d .modal-footer { background: var(--w31-face); }

/* title-bar close button = control-menu box */
.modal-header .btn-close, .offcanvas-header .btn-close, .toast-header .btn-close {
  order: -1; align-self: stretch;
  width: 20px; height: auto; margin: 0 !important; padding: 0;
  background:
    linear-gradient(var(--w31-hi) 0 0) center / 13px 3px no-repeat,
    linear-gradient(var(--w31-ink) 0 0) calc(50% + 1px) calc(50% + 1px) / 13px 3px no-repeat,
    var(--w31-face);
  border: 0; border-right: 1px solid var(--w31-ink); border-radius: 0; box-shadow: none;
}
.toast-header .btn-close { width: 18px; margin-right: 4px !important; background-size: 9px 2px, 9px 2px, auto; }
.modal-header .btn-close:active, .offcanvas-header .btn-close:active, .toast-header .btn-close:active { background-color: var(--w31-hilite); box-shadow: none; }
.modal-header .btn-close:focus-visible, .offcanvas-header .btn-close:focus-visible, .toast-header .btn-close:focus-visible { outline: 1px dotted #000; outline-offset: -3px; }

/* offcanvas: a window docked to the edge */
.offcanvas {
  --bs-offcanvas-bg: var(--w31-frame);
  --bs-offcanvas-color: #000;
  --bs-offcanvas-border-color: var(--w31-ink);
  --bs-offcanvas-border-width: 1px;
  --bs-offcanvas-box-shadow: none;
  --bs-offcanvas-padding-x: 12px;
  --bs-offcanvas-padding-y: 10px;
  padding: 3px;
}
.offcanvas-body { background: var(--w31-window); border: 1px solid var(--w31-ink); border-top: 0; }

/* ------------------------------------------------------------------
   13. Scroll bars
   Arrow buttons with black pixel triangles and a square thumb. Blink
   and WebKit draw the full look; Firefox gets the colours only.
   ------------------------------------------------------------------ */
::-webkit-scrollbar { width: 17px; height: 17px; }
::-webkit-scrollbar-track { background: var(--w31-light); }
::-webkit-scrollbar-track:vertical { box-shadow: inset 1px 0 0 var(--w31-ink); }
::-webkit-scrollbar-track:horizontal { box-shadow: inset 0 1px 0 var(--w31-ink); }
::-webkit-scrollbar-thumb { background: var(--w31-face); border: 1px solid var(--w31-ink); box-shadow: var(--w31-out-thin); }
::-webkit-scrollbar-corner { background: var(--w31-face); }
::-webkit-scrollbar-button:single-button {
  display: block; width: 17px; height: 17px;
  background-color: var(--w31-face); background-repeat: no-repeat; background-position: center;
  border: 1px solid var(--w31-ink); box-shadow: var(--w31-out-thin);
}
::-webkit-scrollbar-button:single-button:active { box-shadow: var(--w31-in); background-position: calc(50% + 1px) calc(50% + 1px); }
::-webkit-scrollbar-button:single-button:vertical:decrement   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M3 0h1v1H3zM2 1h3v1H2zM1 2h5v1H1zM0 3h7v1H0z'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:vertical:increment   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h7v1H0zM1 1h5v1H1zM2 2h3v1H2zM3 3h1v1H3z'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:horizontal:decrement { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='7' shape-rendering='crispEdges'%3E%3Cpath d='M0 3h1v1H0zM1 2h1v3H1zM2 1h1v5H2zM3 0h1v7H3z'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:horizontal:increment { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='7' shape-rendering='crispEdges'%3E%3Cpath d='M3 3h1v1H3zM2 2h1v3H2zM1 1h1v5H1zM0 0h1v7H0z'/%3E%3C/svg%3E"); }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-color: var(--w31-face) var(--w31-light); }
}

/* ------------------------------------------------------------------
   14. Narrow screens and reduced motion
   ------------------------------------------------------------------ */
@media (max-width: 575.98px) {
  body { padding: 6px; }
  .w31-window-body { padding: 8px; }
  .w31-split { grid-template-columns: 1fr; }
  .w31-split > * + * { border-left: 0; border-top: 1px solid var(--w31-ink); }
  .w31-icons { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .w31-desktop-icons .w31-icon { width: 72px; }
  .modal-dialog { margin: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner-border, .spinner-grow { animation: none; }
}
