/* © 2026 KANRAM INC — All Rights Reserved. */
:root {
  /* Brand + semantic tokens -- all six (primary/accent/success/warning/error/sidebar) are
     overridden per install from Company Profile > Theme (see theme_style_tag() in functions.php),
     which also sets [data-theme] below for light/dark/system mode. */
  --primary: #4F46E5;
  --primary-deep: #4338CA;
  --primary-dark: #1E1B4B;
  --accent: #14B8A6;
  --accent-deep: #0F766E;
  --success: #16A34A;
  --success-deep: #15803D;
  --dark: #111827;
  --grey: #4B5563;
  --grey-light: #6B7280;
  --border: #E5E7EB;
  --border-hover: #C7CCD4;
  --hover-bg: #FAFBFC;
  --bg: #F5F6FA;
  --card: #FFFFFF;
  /* Input fields: a touch darker than the card so they stand out, with a faint tint of the company colour. */
  --field-bg: color-mix(in srgb, var(--primary) 3%, #FCFCFE);
  --field-readonly-bg: #ECEEF2;
  --field-border: #CBD2DC;
  --field-border-hover: #A9B3C1;
  --red: #DC2626;
  --amber: #B45309;
  /* The popup's header band -- a light tint of the company's own Primary theme color (Company
     Profile > Theme), not a fixed brand color, so it visibly changes when Primary does. */
  --modal-header-1: color-mix(in srgb, var(--primary) 8%, var(--card));
  --modal-header-2: color-mix(in srgb, var(--primary) 20%, var(--card));
  --modal-header-border: var(--primary);
  --modal-header-ink: var(--primary-dark);
  --modal-header-close-bg: color-mix(in srgb, var(--primary) 5%, var(--card));
  --modal-header-close-border: color-mix(in srgb, var(--primary) 30%, var(--card));
  --sidebar-w: 256px;
  --topbar-h: 58px;
  --footer-h: 22px;
  --font: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* ---------- Dark mode ----------
   Only the neutral surface/text tokens change -- brand colors (primary/accent) and semantic
   colors (success/warning/error) stay exactly what Company Profile > Theme set, so a company's
   look is still recognizably "theirs" in either mode. Badges, status pills and icon-button tints
   intentionally keep their light pastel chips in both modes (the same reason light-mode-style
   tags still read fine in most dark UIs elsewhere) -- only page/card/input surfaces and body text
   flip. [data-theme="dark"] is explicit (set on <html> by theme_style_tag() for mode 'dark', or by
   the user's own toggle, stored in a cookie that wins over the company default); the
   prefers-color-scheme block covers mode 'system' (no data-theme attribute at all), and excludes
   an explicit "light" or "dark" choice so those always win over the OS setting. */
:root[data-theme="dark"] a:not([class]), :root[data-theme="dark"] .rev-more { color: var(--badge-blue-ink); }   /* plain links: the dark primary is too dim on dark cards */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not([data-theme="dark"]) a:not([class]), :root:not([data-theme="light"]):not([data-theme="dark"]) .rev-more { color: var(--badge-blue-ink); } }
:root[data-theme="dark"] {
  color-scheme: dark;
  --dark: #E8EAED; --grey: #A0A8B4; --grey-light: #7C8698;
  --border: #2A3244; --border-hover: #3A4560; --hover-bg: #202838;
  --bg: #10151F; --card: #1A2130;
  --field-bg: #1F2737; --field-border: #36405A; --field-border-hover: #4A5674; --field-readonly-bg: #151B27;
  --modal-header-1: color-mix(in srgb, var(--primary) 20%, var(--card));
  --modal-header-2: color-mix(in srgb, var(--primary) 35%, var(--card));
  --modal-header-border: var(--primary);
  --modal-header-ink: #fff;
  --modal-header-close-bg: rgba(255,255,255,0.12); --modal-header-close-border: rgba(255,255,255,0.3);
  --badge-blue-ink: color-mix(in srgb, var(--primary) 45%, #fff);
  --red-ink: #F87171; --amber-ink: #FBBF24; --purple-bg: color-mix(in srgb, #8B5CF6 22%, var(--card)); --purple-ink: #C4B5FD;   /* text colours readable on dark cards */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --dark: #E8EAED; --grey: #A0A8B4; --grey-light: #7C8698;
    --border: #2A3244; --border-hover: #3A4560; --hover-bg: #202838;
    --bg: #10151F; --card: #1A2130;
    --field-bg: #1F2737; --field-border: #36405A; --field-border-hover: #4A5674; --field-readonly-bg: #151B27;
    --modal-header-1: color-mix(in srgb, var(--primary) 20%, var(--card));
    --modal-header-2: color-mix(in srgb, var(--primary) 35%, var(--card));
    --modal-header-border: var(--primary);
    --modal-header-ink: #fff;
    --modal-header-close-bg: rgba(255,255,255,0.12); --modal-header-close-border: rgba(255,255,255,0.3);
    --badge-blue-ink: color-mix(in srgb, var(--primary) 45%, #fff);
    --red-ink: #F87171; --amber-ink: #FBBF24; --purple-bg: color-mix(in srgb, #8B5CF6 22%, var(--card)); --purple-ink: #C4B5FD;
  }
}

/* Type scale: every font size in the app comes from these steps (base = body text). */
/* Type scale, app-wide (the compact scale first used on the Customers split view). */
:root { --fs-2xs: 9px; --fs-xs: 9.5px; --fs-sm: 10px; --fs-base: 11px; --fs-md: 11.5px; --fs-lg: 13px; --fs-xl: 15px; --fs-2xl: 18px; --fs-3xl: 22px; }
/* Larger text for easier reading (the person's Aa choice, or the company default): every size steps up together. */
html[data-text="medium"] { --fs-2xs: 10px; --fs-xs: 10.5px; --fs-sm: 11px; --fs-base: 12px; --fs-md: 12.5px; --fs-lg: 14px; --fs-xl: 16px; --fs-2xl: 19px; --fs-3xl: 23px; }
html[data-text="large"] { --fs-2xs: 11px; --fs-xs: 11.5px; --fs-sm: 12px; --fs-base: 13px; --fs-md: 13.5px; --fs-lg: 15px; --fs-xl: 17px; --fs-2xl: 20px; --fs-3xl: 24px; }
/* Corners: every rounded corner in the app comes from these tokens (no fixed radius anywhere else; tests/audit_css.php fails
   on one). --corner is the company's choice (Administration > Organisation > Theme > Corners; data-corners on <html> and
   theme_style_tag()). --r-sm small parts (fields, buttons, tabs, badges, chips); --r-md cards, tables, drop-downs, alerts;
   --r-lg pop-ups, panels, modals, the sign-in card; never above 12px. --r-pill status tags and search boxes. True circles stay
   50%. Square ("0") is 0 everywhere and 2px on pills. .corner-scope re-derives the tokens inside an element that carries its own
   data-corners (the Theme page's live sample). */
:root { --corner: 8px; }
:root, .corner-scope { --r-sm: var(--corner); --r-md: min(calc(var(--corner) + 2px), 12px); --r-lg: min(calc(var(--corner) + 4px), 12px); --r-pill: 999px; }
[data-corners="4"] { --corner: 4px; }
[data-corners="6"] { --corner: 6px; }
[data-corners="8"] { --corner: 8px; }
[data-corners="10"] { --corner: 10px; }
[data-corners="12"] { --corner: 12px; }
html[data-corners="0"], .corner-scope[data-corners="0"] { --corner: 0px; --r-sm: 0px; --r-md: 0px; --r-lg: 0px; --r-pill: 2px; }
html[data-text="xlarge"] { --fs-2xs: 12px; --fs-xs: 12.5px; --fs-sm: 13px; --fs-base: 14px; --fs-md: 14.5px; --fs-lg: 16px; --fs-xl: 18px; --fs-2xl: 21px; --fs-3xl: 25px; }
* { box-sizing: border-box; }
/* Compact UI: everything (inline sizes included) renders at 96% on screen. Print is never scaled,
   and the newsletter editor keeps 1:1 so GrapesJS drag-and-drop coordinates stay exact. */
@media screen { html { zoom: 0.96; --ui-zoom: 0.96; } html:has(#gjs) { zoom: 1; --ui-zoom: 1; } }
button, input, select, textarea { font-family: inherit; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--dark);
  font-family: var(--font);
  font-size: var(--fs-base);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font); font-weight: 650; letter-spacing: -0.01em; margin: 0; color: var(--dark); }
a { color: var(--primary-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout shell ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--primary-dark);
  display: flex; flex-direction: column;
  z-index: 20;
}
.sidebar-logo {
  padding: 0 20px; height: var(--topbar-h); box-sizing: border-box; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo img { max-height: 26px; max-width: 200px; width: auto; height: auto; object-fit: contain; }
.sidebar-nav { flex: 1 1 auto; min-height: 0; padding: 6px 0 16px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; overflow-anchor: none; scroll-behavior: auto; }
.sidebar-logo, .sidebar-footer { flex: none; }   /* logo and user footer stay pinned; only the list scrolls */
.nav-toggle-all { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: calc(var(--r-sm) * .875); background: transparent; color: rgba(255,255,255,0.55); cursor: pointer; }
.nav-toggle-all:hover { background: rgba(255,255,255,0.09); color: #fff; }
.nav-toggle-all:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.nav-toggle-all[hidden] { display: none; }
.nav-toggle-all .ic-expand { display: none; }
.nav-toggle-all.is-collapsed .ic-expand { display: block; }
.nav-toggle-all.is-collapsed .ic-collapse { display: none; }
.nav-item-soon { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 1px 12px 1px 12px; padding: 7px 12px 7px 41px; font-size: var(--fs-base); color: rgba(255,255,255,0.38); cursor: default; }
.sidebar-nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  margin: 1px 12px; padding: 9px 12px; border-radius: var(--r-sm);
  color: rgba(255,255,255,0.72); font-size: var(--fs-base); font-weight: 500; text-decoration: none;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,0.13); color: #fff; font-weight: 600; }
.sidebar-nav a.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 calc(var(--r-sm) * .375) calc(var(--r-sm) * .375) 0; background: var(--accent);
}
.sidebar-nav .icon { width: 18px; text-align: center; font-size: var(--fs-md); opacity: 0.9; display: inline-flex; align-items: center; justify-content: center; }

/* ---- Collapsible module groups (Sales, Operations, Financials): click the group name to expand
   it, same look as an ordinary nav link but with a chevron that rotates open. Keeps the sidebar
   short no matter how many modules a company has on -- only the group you're in opens by default. */
.nav-group-toggle {
  width: calc(100% - 24px); position: relative; display: flex; align-items: center; gap: 11px;
  margin: 1px 12px; padding: 9px 12px; border-radius: var(--r-sm); border: none; background: none; cursor: pointer;
  color: rgba(255,255,255,0.72); font-size: var(--fs-base); font-weight: 500; font-family: var(--font); text-align: left;
}
.nav-group-toggle:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-group.open > .nav-group-toggle { color: #fff; }
.nav-group-label { flex: 1; }
.nav-group-toggle .chev { margin-left: auto; flex: none; opacity: .55; transition: transform .15s ease; }
.nav-group.open > .nav-group-toggle .chev { transform: rotate(180deg); }
.nav-group-body { display: flex; flex-direction: column; }
.nav-group-body[hidden] { display: none; }   /* author CSS beats the UA's [hidden] rule otherwise */
.nav-group-body a { margin-left: 12px; padding-left: 41px; }   /* text lines up under the heading's label */
/* Keyboard focus on the menu: a visible ring on headings and links. */
.nav-group-toggle:focus-visible, .sidebar-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Administration lists its four sub-groups, each a small heading above its pages. */
.nav-subhead { margin: 8px 12px 2px 12px; padding: 4px 12px 2px 41px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: rgba(255,255,255,0.4); }
.nav-subgroup:first-child > .nav-subhead { margin-top: 2px; }
/* Manufacturing: shown greyed with a small badge; not a link and not a button. */
.nav-soon-row { display: flex; align-items: center; gap: 11px; margin: 1px 12px; padding: 9px 12px; border-radius: var(--r-sm); color: rgba(255,255,255,0.32); font-size: var(--fs-base); font-weight: 500; cursor: not-allowed; user-select: none; }
.nav-soon-row .nav-group-label { flex: 1; }
.nav-soon-badge { flex: none; font-size: var(--fs-xs); font-weight: 600; padding: 1px 7px; border-radius: var(--r-pill); background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.55); white-space: nowrap; }
.sidebar-nav a .nav-count { margin-left: auto; }
.sidebar-nav a { min-width: 0; overflow-wrap: anywhere; }
.sidebar-footer {
  padding: 16px 22px; border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-sm); flex: none;
}
.sidebar-user-name { color: #fff; font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; }
.sidebar-user-role { color: rgba(255,255,255,0.5); font-size: var(--fs-xs); }
.sidebar-footer .logout { color: rgba(255,255,255,0.55); font-size: var(--fs-sm); }
.sidebar-footer .logout:hover { color: #fff; }
/* Log out is a POST form (2.50.0): the button looks like the link it replaced */
.logout-form { display: inline-flex; margin: 0; }
.logout-form button.logout, .logout-form button.portal-logout { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; font: inherit; line-height: inherit; display: inline-flex; align-items: center; }
.portal-topbar-nav .portal-logout { color: rgba(255,255,255,0.85); font-size: var(--fs-base); font-weight: 600; }
.portal-topbar-nav .portal-logout:hover { color: #fff; text-decoration: underline; }

.topbar {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0; height: var(--topbar-h);
  background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 10;
}
.topbar-title { font-size: var(--fs-lg); font-weight: 700; font-family: var(--font); line-height: 1.1; }
.topbar-breadcrumb { font-size: var(--fs-xs); color: var(--grey-light); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 18px 26px 26px;
  height: calc(100vh / var(--ui-zoom, 1) - var(--topbar-h) - var(--footer-h));
  overflow-y: auto;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: 0 1px 2px rgba(20,25,30,0.04);
  padding: 10px 14px; margin-bottom: 7px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 7px;
}
.card-header h3 { font-size: var(--fs-md); }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
.kpi-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 20px 22px; box-shadow: 0 1px 2px rgba(20,25,30,0.04);
  border-left: 4px solid var(--primary);
}
.kpi-card.green { border-left-color: var(--success); }
.kpi-card.amber { border-left-color: var(--amber); }
.kpi-card.red { border-left-color: var(--red); }

/* ---------- Report cards ---------- */
.report-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.report-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: calc((var(--r-sm) + var(--r-md)) / 2);
  padding: 14px 16px; text-decoration: none;
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.report-card:hover {
  border-color: var(--primary); text-decoration: none; transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(20,25,30,0.10);
}
.report-card:hover .report-card-icon { transform: scale(1.08); }
.report-card-icon {
  flex: none; width: 34px; height: 34px; border-radius: var(--r-sm); margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--primary);
}
/* One bold color per report category, each with a matching-tint border, so the grid reads at a
   glance instead of all-one-color. */
.report-card-icon { border: 1.5px solid transparent; transition: transform .15s ease; }
.report-card-icon--sales      { background: #EEF2FF; color: #4338CA; border-color: #C7D2FE; }
.report-card-icon--operations { background: #FFF3E8; color: #B04A06; border-color: #FDD9AE; }
.report-card-icon--finance    { background: #E7FAF0; color: #0E7A3D; border-color: #A7EFC7; }
.report-card-icon--customers  { background: #E6FBF8; color: #0B6F68; border-color: #9CEFE5; }
.report-card-icon--system     { background: #EEF1F5; color: #38445A; border-color: #CBD5E1; }
.report-card-icon--distribution { background: #F3EEFC; color: #6B46C1; border-color: #D6C8F5; }
.report-card-icon--vendors    { background: #E8F0FA; color: #0F4C81; border-color: #B9CEE8; }
.report-card-icon--assets     { background: #FDF5E6; color: #975A16; border-color: #F2D7A6; }
.report-card-icon--customerassets { background: #FDF5E6; color: #975A16; border-color: #F2D7A6; }
.report-card-body { min-width: 0; }
.report-card-title { font-weight: 700; font-size: var(--fs-base); color: var(--dark); margin-bottom: 4px; }
/* Clamped to 3 lines so one report with a long description (e.g. 1099 Vendor Payments) doesn't
   balloon its card way past its neighbors -- every card in the grid stays the same size. */
.report-card-desc {
  font-size: var(--fs-sm); color: var(--grey-light); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.kpi-label { font-size: var(--fs-sm); color: var(--grey); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-value { font-family: var(--font); font-size: var(--fs-3xl); font-weight: 700; margin-top: 6px; color: var(--dark); }
.kpi-sub { font-size: var(--fs-sm); color: var(--grey-light); margin-top: 2px; }

/* ---------- Dashboard: KPI/tables, then a full-width pipeline map ---------- */
.dashboard-layout { display: flex; flex-direction: column; gap: 20px; }
.pipeline-map-card { padding-bottom: 18px; }
.pm-caption { font-size: var(--fs-sm); color: var(--grey-light); margin: 0 0 12px; line-height: 1.5; max-width: 900px; }
.pipeline-map-wrap { overflow-x: auto; }
.pipeline-map { width: 100%; max-width: 880px; height: auto; display: block; margin: 0 auto; min-width: 700px; }

/* Hover/focus zoom tooltip for the pipeline map -- a single floating card
   reused for whichever box is currently hovered (see assets/js/app.js). */
.pm-tooltip {
  --tip: #92A8D1; --tip-ink: #2F3B52;
  position: fixed; z-index: 500; max-width: 320px;
  background: color-mix(in srgb, var(--tip) 12%, #fff);
  color: #374151; padding: 14px 16px 15px; border-radius: var(--r-md);
  border: 1px solid color-mix(in srgb, var(--tip) 40%, #fff);
  border-top: 4px solid var(--tip);
  box-shadow: 0 14px 34px color-mix(in srgb, var(--tip) 28%, transparent);
  pointer-events: none; opacity: 0; transform: translateY(4px) scale(0.98);
  transition: opacity .12s ease, transform .12s ease;
}
/* Tone follows the hovered box (Pantone-inspired, same hues as the map itself) */
.pm-tooltip[data-tone="quote"] { --tip: #5A5B9F; --tip-ink: #2E2F5C; }   /* Blue Iris 18-3943 */
.pm-tooltip[data-tone="po"]    { --tip: #0F4C81; --tip-ink: #0B3559; }   /* Classic Blue 19-4052 */
.pm-tooltip[data-tone="wo"]    { --tip: #00785C; --tip-ink: #00513E; }   /* Emerald 17-5641 */
.pm-tooltip[data-tone="inv"]   { --tip: #BB2649; --tip-ink: #7E1830; }   /* Viva Magenta 18-1750 */
.pm-tooltip[data-tone="head"]  { --tip: #955251; --tip-ink: #663637; }   /* Marsala 18-1438 */
.pm-tooltip[data-tone="found"] { --tip: #2F3B52; --tip-ink: #1F2837; }
.pm-tooltip[data-tone="rib"]   { --tip: #92A8D1; --tip-ink: #2F3B52; }   /* Serenity 15-3919 */
.pm-tooltip.show { opacity: 1; transform: translateY(0) scale(1); }
.pm-tooltip-title { font-family: var(--font); font-size: var(--fs-md); font-weight: 700; color: var(--tip-ink); margin-bottom: 6px; }
.pm-tooltip-desc { font-family: var(--font); font-size: var(--fs-sm); line-height: 1.55; color: #374151; }
.pm-tooltip-locked { font-family: var(--font); font-size: var(--fs-xs); font-weight: 700; color: #B45309; margin-top: 8px; }
.pm-tooltip-locked:empty { display: none; }

/* ---------- Buttons ----------
   One standard: 36px tall (sm 30px), 8px radius, 600 weight. A bare .btn is the neutral (secondary)
   look, so every variant and every legacy "btn btn-sm" renders the same way. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--card); color: var(--dark);
  font-family: var(--font); font-size: var(--fs-base); font-weight: 600; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, color .12s ease;
}
.btn:hover { background: var(--hover-bg); border-color: var(--border-hover); text-decoration: none; }
.btn:active { background: #E5E7EB; }
.btn:focus-visible, .dx-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn svg { flex: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
.btn-primary:active { background: var(--primary-deep); }
.btn-secondary { background: var(--card); border-color: var(--border); color: var(--dark); }
.btn-danger { background: var(--card); border-color: #FCA5A5; color: var(--red); }
.btn-danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
/* ---------- show / hide on password fields (password-toggle.js) ---------- */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap > input { width: 100%; padding-right: 42px; }
.pw-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: calc(var(--r-sm) * .75); padding: 0; color: var(--grey); cursor: pointer; }
.pw-toggle:hover { color: var(--primary); background: var(--hover-bg); }
.pw-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.pw-toggle[aria-pressed="true"] { color: var(--primary); }
.pw-wrap > input::-ms-reveal, .pw-wrap > input::-ms-clear { display: none; }   /* Edge's own eye would sit under ours */
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { filter: brightness(0.92); }
/* Delete on a record's own page (record_delete_button): quiet until pointed at, so it never competes with Save */
.btn-delete { display: inline-flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--red) 7%, var(--card)); border-color: color-mix(in srgb, var(--red) 28%, var(--card)); color: var(--red-ink, var(--red)); font-weight: 600; }
.btn-delete:hover { background: var(--red); border-color: var(--red); color: #fff; }
.record-delete-form { display: inline-flex; }
.btn-sm { min-height: 30px; padding: 0 12px; font-size: var(--fs-sm); border-radius: calc(var(--r-sm) * .875); }
.btn[disabled], .btn.disabled, button.btn:disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
@media (max-width: 900px) { .card-actions { flex-wrap: wrap; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
table.data-table th {
  text-align: left; padding: 5px 12px; background: var(--hover-bg);
  color: var(--grey); font-weight: 700; font-size: var(--fs-xs);
  text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}
table.data-table td {
  padding: 5px 12px; border-bottom: 1px solid var(--border); color: var(--dark);
}
table.data-table tr:hover td { background: var(--hover-bg); }
table.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
/* A table squeezed into a narrow card (e.g. one of 3 in a snap-grid-3 row): tighter padding, and any
   cell marked .truncate clips with an ellipsis instead of forcing the table wider than its card. */
table.data-table-snug { table-layout: fixed; }
table.data-table-snug th, table.data-table-snug td { padding: 6px 8px; }
table.data-table-snug .truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions a { margin-right: 12px; font-size: var(--fs-sm); font-weight: 600; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--grey-light); }
.empty-state .icon { font-size: var(--fs-3xl); margin-bottom: 10px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.2px;
}
.badge-blue   { background: color-mix(in srgb, var(--primary) 12%, var(--card)); color: var(--badge-blue-ink, var(--primary-deep)); }
.badge-green  { background: color-mix(in srgb, var(--success) 15%, var(--card)); color: var(--success-deep); }
.badge-grey   { background: var(--hover-bg); color: var(--grey); }
.badge-amber  { background: color-mix(in srgb, var(--amber) 20%, var(--card)); color: var(--amber-ink, var(--amber)); }
.badge-red    { background: color-mix(in srgb, var(--red) 15%, var(--card)); color: var(--red-ink, var(--red)); }
.badge-purple { background: var(--purple-bg, #EDE9FE); color: var(--purple-ink, #5B21B6); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.form-grid.single { grid-template-columns: 1fr; }
.form-group { margin-bottom: 0; }
.form-group.full { grid-column: 1 / -1; }
label {
  display: block; font-size: var(--fs-xs); font-weight: 700; color: var(--grey);
  margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.3px;
}
/* One standard for every text-like control: 27px tall, 8px radius, same border and focus ring. */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel],
input[type=url], input[type=search], input[type=time], input[type=datetime-local], input[type=month], select, textarea {
  width: 100%; min-height: 27px; padding: 5px 10px; border: 1px solid var(--field-border); border-radius: var(--r-sm);
  font-size: var(--fs-base); font-family: var(--font); color: var(--dark); background-color: var(--field-bg); line-height: 1.35;
  transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
select[multiple] { background-image: none; padding-right: 11px; }
.sort-select { min-width: 165px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
/* Small icon-only action buttons on a list row (View, Edit, Delete, PDF, Email, ...) instead of a
   row of plain text links. */
/* Not display:flex -- a flex container inside a <td> can (in some Chrome versions) inflate
   documentElement.scrollWidth without any actual visible overflow, tripping up the horizontal-
   overflow check on a page with a wide table. Plain inline elements avoid that quirk entirely. */
.row-actions-icons .icon-btn, .row-actions-icons form { vertical-align: middle; margin-right: 5px; }
.row-actions-icons .icon-btn:last-child, .row-actions-icons form:last-child { margin-right: 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 24px; border-radius: var(--r-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { text-decoration: none; color: #fff; }
/* Each action type gets its own tinted background at rest (standard icon-button pattern), then
   switches to a solid fill of the same color on hover/focus. */
/* A thin border matching each icon's own tint, same idea as .report-card-icon's -- so a row's
   action icons read as distinct buttons at rest, not just flat color blobs. Applies everywhere
   action_icon_html() is used (every listing page's row actions), from this one shared rule. */
.icon-btn-view, .icon-btn-pdf, .icon-btn-convert { background: var(--hover-bg); color: var(--grey); border-color: var(--border); }
.icon-btn-view:hover, .icon-btn-pdf:hover, .icon-btn-convert:hover { background: var(--grey); border-color: var(--grey); }
.icon-btn-edit { background: color-mix(in srgb, var(--primary) 12%, var(--card)); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 35%, var(--card)); }
.icon-btn-edit:hover { background: var(--primary); border-color: var(--primary); }
.icon-btn-email { background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent-deep); border-color: color-mix(in srgb, var(--accent) 35%, var(--card)); }
.icon-btn-email:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.icon-btn-delete { background: color-mix(in srgb, var(--red) 12%, var(--card)); color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--card)); }
.icon-btn-delete:hover { background: var(--red); border-color: var(--red); }
.list-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.list-toolbar input[type=search], .list-toolbar input[type=text] { max-width: 300px; }
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pagination-ellipsis { padding: 0 4px; color: var(--muted); }
.pagination-info { color: var(--muted); margin-left: 8px; font-size: var(--fs-base); }
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: var(--field-border-hover); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); background-color: var(--card); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
input::placeholder, textarea::placeholder { color: #9CA3AF; opacity: 1; }
input:disabled, select:disabled, textarea:disabled, input[readonly], textarea[readonly] {
  background-color: var(--field-readonly-bg); color: var(--grey); cursor: not-allowed; border-color: var(--border);
}
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; vertical-align: middle; margin: 0 6px 0 0; }
/* File picker: the "Choose file" button matches the app's secondary button. */
input[type=file] {
  width: 100%; padding: 6px; border: 1px dashed var(--border-hover); border-radius: var(--r-sm); background: var(--hover-bg);
  font-family: var(--font); font-size: var(--fs-sm); color: var(--grey); cursor: pointer;
  transition: border-color .12s ease, background-color .12s ease;
}
input[type=file]:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 4%, #fff); }
input[type=file]:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
input[type=file]::file-selector-button {
  min-height: 30px; margin-right: 12px; padding: 0 14px; border: 1px solid var(--border); border-radius: calc(var(--r-sm) * .875);
  background: var(--card); color: var(--dark); font-family: var(--font); font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease;
}
input[type=file]::file-selector-button:hover { background: var(--hover-bg); border-color: var(--border-hover); }
textarea { resize: vertical; min-height: 48px; }
.form-actions { margin-top: 10px; display: flex; gap: 10px; }
.field-hint { font-size: var(--fs-2xs); color: var(--grey-light); margin-top: 1px; }
.view-value { padding: 7px 0; font-size: var(--fs-base); color: var(--dark); min-height: 17px; }
.view-value a { color: var(--primary); text-decoration: none; }
.view-value a:hover { text-decoration: underline; }

/* ---------- Alerts ---------- */
.alert {
  padding: 9px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); margin-bottom: 12px;
  border: 1px solid transparent;
}
.alert-success { background: color-mix(in srgb, var(--success) 12%, var(--card)); color: var(--success-deep); border-color: color-mix(in srgb, var(--success) 35%, var(--card)); }
.alert-error   { background: color-mix(in srgb, var(--red) 12%, var(--card)); color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--card)); }
/* Support Diagnostics (views/diagnostics) */
.diag-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12px; }
.diag-stats div { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; }
.diag-stats strong { display: block; font-size: var(--fs-2xl); line-height: 1.1; }
.diag-stats span { font-size: var(--fs-sm); color: var(--grey-light); }
.diag-files { display: flex; flex-wrap: wrap; gap: 6px; }
.diag-files code { font-size: var(--fs-xs); background: var(--bg); border: 1px solid var(--border); border-radius: calc(var(--r-sm) * .75); padding: 2px 7px; }
.diag-repairs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.diag-repairs form { display: flex; gap: 14px; align-items: center; justify-content: space-between; border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; }
.diag-repairs p { font-size: var(--fs-sm); color: var(--grey-light); margin: 2px 0 0; }
@media (max-width: 900px) { .diag-stats { grid-template-columns: 1fr 1fr; } .diag-repairs { grid-template-columns: 1fr; } }
/* the licence notice under the top bar (includes/licence.php) */
.licence-notice { margin: 0 0 14px; font-weight: 500; }
.licence-notice a { font-weight: 600; margin-left: 6px; }
/* support access for the publisher (includes/support_access.php; the card is on Support Diagnostics) */
.support-notice { margin: 0 0 14px; font-weight: 500; }
.support-notice a { font-weight: 600; margin-left: 6px; }
.support-code { border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--card)); background: color-mix(in srgb, var(--amber) 8%, var(--card)); border-radius: var(--r-md); padding: 12px 14px; margin: 12px 0; }
.support-code strong { display: block; margin-bottom: 8px; }
.support-code textarea { width: 100%; font-family: Consolas, monospace; font-size: var(--fs-md); margin-bottom: 8px; resize: none; }
.support-form { display: grid; grid-template-columns: 1fr 1fr 2fr 1.4fr; gap: 10px 12px; margin-top: 12px; align-items: end; }
.support-form-foot { grid-column: 1 / -1; display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; }
.support-form-foot ul { margin: 0; padding-left: 18px; font-size: var(--fs-sm); }
@media (max-width: 900px) { .support-form { grid-template-columns: 1fr; } .support-form-foot { flex-direction: column; align-items: flex-start; } }
.alert-warning { background: color-mix(in srgb, var(--amber) 12%, var(--card)); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--card)); }
.alert-info    { background: color-mix(in srgb, var(--primary) 8%, var(--card)); color: var(--dark); border-color: color-mix(in srgb, var(--primary) 30%, var(--card)); }
/* Several tables stacked under one heading (e.g. one per account type) line their columns up. */
.table-fixed { table-layout: fixed; width: 100%; }
.table-fixed td, .table-fixed th { overflow: hidden; text-overflow: ellipsis; }

/* ---------- Login page ---------- */
.login-body {
  min-height: calc(100vh / var(--ui-zoom, 1)); display: flex; align-items: center; justify-content: center;
  padding-bottom: var(--footer-h);
  background: var(--primary-dark);
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 26px 26px;
}
.login-card {
  width: 380px; background: var(--card); border-radius: var(--r-lg); padding: 38px 34px 32px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.4);
}
.login-logo { text-align: center; margin-bottom: 22px; }
.login-logo img { max-height: 34px; max-width: 100%; width: auto; height: auto; object-fit: contain; }
.login-tagline { text-align: center; font-size: var(--fs-sm); color: var(--grey-light); margin: -14px 0 24px; }
.login-title { font-size: var(--fs-xl); font-weight: 700; margin-bottom: 20px; text-align: center; font-family: var(--font); }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 11px; margin-top: 6px; }
.login-footnote { text-align: center; font-size: var(--fs-xs); color: var(--grey-light); margin-top: 18px; }

/* ---------- in-page confirm/prompt/alert (replaces native browser popups) ---------- */
.kr-modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: rgba(20, 25, 30, 0.45); display: flex; align-items: center; justify-content: center;
}
.kr-modal-box {
  background: var(--card); border-radius: var(--r-md); padding: 22px 24px; max-width: 420px; width: calc(100% - 40px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.kr-modal-box h4 { margin: 0 0 8px; font-size: var(--fs-md); font-weight: 700; color: var(--dark); }
.kr-modal-box p { margin: 0 0 16px; font-size: var(--fs-base); color: var(--dark); line-height: 1.5; }
.kr-modal-box input[type=text] { margin-bottom: 16px; }
.kr-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
#kr-toast-container {
  position: fixed; top: 18px; right: 18px; z-index: 1100;
  display: flex; flex-direction: column; gap: 8px; max-width: 360px;
}
.kr-toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); line-height: 1.4; box-shadow: 0 4px 16px rgba(0,0,0,0.15); animation: kr-toast-in 0.15s ease-out;
}
.kr-toast span { flex: 1; }
.kr-toast-close { background: none; border: none; cursor: pointer; font-size: var(--fs-md); line-height: 1; opacity: 0.6; padding: 0; }
.kr-toast-close:hover { opacity: 1; }
.kr-toast-success { background: color-mix(in srgb, var(--success) 12%, var(--card)); color: var(--success-deep); border: 1px solid color-mix(in srgb, var(--success) 35%, var(--card)); }
.kr-toast-warning { background: color-mix(in srgb, var(--amber) 15%, var(--card)); color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 40%, var(--card)); }
.kr-toast-error   { background: color-mix(in srgb, var(--red) 12%, var(--card)); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 35%, var(--card)); }
@keyframes kr-toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- same-page View/Edit popup (app.js openRecordModal) ---------- */
.record-modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: rgba(13, 18, 24, 0.58); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 4vh 16px; overflow-y: auto;
  animation: record-modal-fade .12s ease-out;
}
.record-modal-box {
  background: var(--bg); border-radius: var(--r-lg); width: 100%; max-width: 880px; position: relative;
  box-shadow: 0 28px 80px rgba(10,14,20,0.4); overflow: hidden;
  animation: record-modal-pop .16s cubic-bezier(.22,.9,.36,1.1);
  display: flex; flex-direction: column; max-height: 92vh;
}
/* A colored header band on every popup instead of a flat white box -- the one visual cue that
   ties View/Edit-in-a-popup together as one consistent feature across every module. MOQENTA's
   own brand colors (the gold "M" tile + cream "Q" ring, both always drawn on navy elsewhere), but
   very light here -- a soft cream-gold wash rather than a bold, saturated bar. */
.record-modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none;
  padding: 17px 56px 17px 22px; background: linear-gradient(to bottom, var(--modal-header-1), var(--modal-header-2));
  border-bottom: 2px solid var(--modal-header-border);
}
.record-modal-title { font-size: var(--fs-md); font-weight: 700; color: var(--modal-header-ink); letter-spacing: .1px; }
.record-modal-title:empty::before { content: '\00a0'; }
.record-modal-close {
  position: absolute; top: 13px; right: 14px; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--modal-header-close-border); background: var(--modal-header-close-bg); color: var(--modal-header-ink); font-size: var(--fs-xl); line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
  z-index: 2;
}
.record-modal-close:hover { background: var(--red); border-color: var(--red); color: #fff; transform: scale(1.06); }
.record-modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 22px 22px; }
.record-modal-body .card { border-radius: var(--r-lg); }
.record-modal-body .card:last-child { margin-bottom: 0; }
.record-modal-loading { padding: 70px 10px 60px; text-align: center; color: var(--muted); font-size: var(--fs-base); }
.record-modal-loading::before {
  content: ''; display: block; width: 30px; height: 30px; margin: 0 auto 16px;
  border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%;
  animation: record-modal-spin .7s linear infinite;
}
@keyframes record-modal-spin { to { transform: rotate(360deg); } }
@keyframes record-modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes record-modal-pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 600px) {
  .record-modal-box { border-radius: var(--r-lg); }
  .record-modal-header { padding: 14px 50px 12px 16px; }
  .record-modal-body { padding: 16px 14px 18px; }
}

/* ---------- misc ---------- */
.hidden { display: none; }
.text-muted { color: var(--grey-light); }
.status-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.status-col { background: var(--hover-bg); border-radius: var(--r-md); padding: 14px; border: 1px solid var(--border); }
.status-col h4 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.4px; color: var(--grey); margin-bottom: 12px; }
.wo-card {
  background: var(--card); border: 1px solid var(--border); border-radius: calc((var(--r-sm) + var(--r-md)) / 2);
  padding: 12px 14px; margin-bottom: 10px; font-size: var(--fs-sm);
}
.progress-bar { height: 8px; background: var(--bg); border-radius: calc(var(--r-sm) / 2); overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--success); border-radius: calc(var(--r-sm) / 2); }
.progress-bar-sm { height: 5px; margin-top: 6px; }
.wo-card .wo-num { font-weight: 700; color: var(--badge-blue-ink, var(--primary-deep)); }
.wo-card .wo-cust { color: var(--grey); font-size: var(--fs-sm); margin-top: 2px; }
.wo-card .wo-custid { color: var(--grey-light); font-size: var(--fs-xs); margin-top: 0; }
.wo-card-overdue { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); background: color-mix(in srgb, var(--red) 5%, var(--card)); border-left: 3px solid var(--red); }

/* ---------- Module access checkboxes (Employees) ---------- */
.module-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px; }
.module-check {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  border: 1px solid var(--border); border-radius: calc(var(--r-sm) * .875); font-size: var(--fs-sm);
}
.module-check input { width: auto; }
table.module-access-table td.radio-cell, table.module-access-table th.radio-cell { text-align: center; }
table.module-access-table td.radio-cell input[type=radio] { width: auto; cursor: pointer; }

/* ---------- Customer portal ---------- */
.portal-topbar {
  background: var(--primary-dark); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; flex-wrap: wrap; gap: 10px;
}
.portal-topbar-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-family: var(--font); font-size: var(--fs-md); }
.portal-topbar-brand img { max-height: 28px; max-width: 160px; width: auto; height: auto; object-fit: contain; }
.portal-topbar-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.portal-topbar-nav a { color: rgba(255,255,255,0.85); font-size: var(--fs-base); font-weight: 600; }
.portal-topbar-nav a:hover { color: #fff; text-decoration: none; }
.portal-content { max-width: 980px; margin: 0 auto; padding: 26px 20px 60px; }
.portal-kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.portal-ticket-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit;
}
.portal-ticket-item:hover { background: var(--hover-bg); text-decoration: none; }
.portal-ticket-item:last-child { border-bottom: none; }
.portal-comment { padding: 12px 0; border-bottom: 1px solid var(--border); }
.portal-comment:last-child { border-bottom: none; }
.portal-comment.from-staff .portal-comment-author { color: var(--primary-deep); }
.portal-comment.from-me .portal-comment-author { color: var(--accent-deep); }
.star-rating { display: flex; gap: 4px; }
.star-rating-btn { background: none; border: none; font-size: var(--fs-3xl); line-height: 1; cursor: pointer; color: #D99A06; padding: 2px; }
.star-rating-btn:hover { transform: scale(1.1); }
@media (max-width: 640px) {
  .portal-kpi-grid { grid-template-columns: 1fr; }
  .portal-topbar { padding: 12px 16px; }
}

/* ---------- Printable documents (invoices / work orders / POs) ---------- */
.print-page { max-width: 760px; margin: 0 auto; padding: 40px 20px 80px; }
.print-toolbar { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 18px; }
.print-doc {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 44px 48px; box-shadow: 0 1px 2px rgba(20,25,30,0.04);
}
.print-doc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 30px; }
.print-doc-header img { height: 30px; margin-bottom: 10px; }
.print-doc-title { font-family: var(--font); font-size: var(--fs-2xl); font-weight: 800; color: var(--dark); text-align: right; }
.print-doc-number { color: var(--grey); font-size: var(--fs-sm); text-align: right; margin-top: 2px; }
.print-doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 26px; }
.print-doc-meta .label { font-size: var(--fs-xs); font-weight: 700; color: var(--grey); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.print-doc table.data-table { margin-bottom: 6px; }
.print-doc .totals { max-width: 320px; margin-left: auto; margin-top: 16px; }
.print-doc .totals div { display: flex; justify-content: space-between; padding: 6px 0; }
.print-doc .totals .grand { border-top: 2px solid var(--dark); font-size: var(--fs-md); padding-top: 10px; }
.print-doc-footer { margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--grey-light); white-space: pre-line; }

/* ---------- Printable agreement (Quotes) ---------- */
.agreement-section { margin: 22px 0; }
.agreement-section-title { font-size: var(--fs-xs); font-weight: 700; color: #fff; background: var(--primary-deep); text-transform: uppercase; letter-spacing: 0.4px; padding: 6px 10px; border-radius: calc(var(--r-sm) / 2); margin-bottom: 10px; }
.agreement-check { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-sm); margin-bottom: 8px; }
.agreement-check .box { flex: none; width: 14px; height: 14px; border: 1.5px solid var(--dark); border-radius: calc(var(--r-sm) / 4); margin-top: 2px; text-align: center; line-height: 12px; font-size: var(--fs-2xs); }
.agreement-check .box.checked { background: var(--primary-deep); border-color: var(--primary-deep); color: #fff; }
.agreement-sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 30px; }
.agreement-sig-grid .sig-line { border-top: 1px solid var(--dark); margin-top: 40px; padding-top: 6px; font-size: var(--fs-sm); }

/* ---------- Analytics ---------- */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chart-grid .card { margin-bottom: 0; min-width: 0; }
.chart-wrap { position: relative; height: 192px; }
.chart-wrap canvas { max-width: 100%; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }

/* ---- Analytics: small charts ---- */
.chart-wrap-sm { height: 150px; }

/* Every printed/PDF'd document (invoices, quotes, POs, work orders, statements, ...) is US Letter,
   regardless of the browser's or OS's own default page size (which can silently be A4 depending on
   locale) -- @page forces the print dialog's paper size instead of just hoping it's already right. */
@page { size: letter; margin: 0.5in; }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .print-page { max-width: none; margin: 0; padding: 0; }
  .print-doc { border: none; box-shadow: none; padding: 0; border-radius: 0; }
  /* Anchors the totals block (and whatever follows it -- payment terms/bank details/notes) to the
     bottom of the page instead of hugging the line-items table, the way a real invoice/PO/bill
     reads -- the gap this opens up is the point, not a bug. Only on a single-page document: on a
     longer one the browser's own pagination takes over and this simply has no free space left to
     use, so nothing gets clipped or pushed onto a page of its own. */
  .print-doc { display: flex; flex-direction: column; min-height: 9.5in; }
  .print-doc .totals { margin-top: auto; }
}


/* ---------- Brand wordmark (used when no logo is uploaded) ---------- */
.brand-wordmark { font-weight: 700; font-size: var(--fs-lg); letter-spacing: -0.01em; color: #fff; display: inline-flex; align-items: center; gap: 9px; }
.brand-wordmark::before {
  content: attr(data-initial); display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--accent); color: #fff; font-size: var(--fs-base);
}
.login-logo .brand-wordmark { color: var(--dark); }

/* ---------- Topbar: menu button + quick jump ---------- */
.topbar-left { display: flex; align-items: center; gap: 12px; }
.menu-btn {
  display: none; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--card); color: var(--dark); cursor: pointer; align-items: center; justify-content: center;
}
.quick-jump {
  display: inline-flex; align-items: center; gap: 10px; min-width: 230px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--hover-bg);
  color: var(--grey-light); font: inherit; font-size: var(--fs-sm); cursor: pointer;
}
.quick-jump:hover { border-color: var(--primary); color: var(--dark); }
.quick-jump kbd {
  margin-left: auto; font: 600 var(--fs-xs) var(--font); padding: 1px 6px; border: 1px solid var(--border);
  border-radius: calc(var(--r-sm) * .625); background: var(--card); color: var(--grey);
}
.sidebar-backdrop { display: none; }

/* ---------- Command palette (Ctrl/Cmd+K) ---------- */
.cp-overlay {
  position: fixed; inset: 0; z-index: 1200; background: rgba(17,24,39,0.5);
  display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 0;
}
.cp-box {
  width: 100%; max-width: 580px; background: var(--card); border-radius: var(--r-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,0.3); overflow: hidden;
  display: flex; flex-direction: column; max-height: 70vh;
}
.cp-search { display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--border); flex: none; }
.cp-search svg { flex: none; color: var(--grey-light); }
/* .cp-box prefix: the global input[type=text] / input:focus rules would otherwise win on specificity */
.cp-box .cp-input {
  flex: 1; width: auto; min-width: 0; border: 0; border-radius: 0; background: transparent;
  padding: 18px 0; font-size: var(--fs-md); box-shadow: none;
}
.cp-box .cp-input:focus { border: 0; box-shadow: none; }
.cp-esc { flex: none; font: 600 var(--fs-xs) var(--font); padding: 2px 7px; border: 1px solid var(--border); border-radius: calc(var(--r-sm) * .625); color: var(--grey-light); }
.cp-list { flex: 1; overflow-y: auto; padding: 8px 10px 10px; }
.cp-group { padding: 12px 12px 6px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--grey-light); }
.cp-group:first-child { padding-top: 6px; }
.cp-item {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  padding: 10px 12px; margin: 1px 0; border-radius: var(--r-sm);
  color: var(--dark); font-size: var(--fs-base); font-weight: 500; text-decoration: none;
}
.cp-item small { margin-left: auto; color: var(--grey-light); font-size: var(--fs-xs); font-weight: 400; }
.cp-item.sel, .cp-item:hover { background: color-mix(in srgb, var(--primary) 12%, var(--card)); text-decoration: none; }
.cp-item.sel small, .cp-item:hover small { color: var(--badge-blue-ink, var(--primary-deep)); }
.cp-empty { padding: 28px 18px; text-align: center; color: var(--grey-light); font-size: var(--fs-sm); }
.cp-foot {
  flex: none; display: flex; gap: 16px; padding: 10px 20px; border-top: 1px solid var(--border);
  background: var(--hover-bg); font-size: var(--fs-xs); color: var(--grey-light);
}
.cp-foot kbd { font: 600 var(--fs-2xs) var(--font); padding: 1px 5px; margin-right: 4px; border: 1px solid var(--border); border-radius: calc(var(--r-sm) / 2); background: var(--card); color: var(--grey); }

/* ---------- Responsive: sidebar becomes a slide-in drawer ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar { height: calc(100vh / var(--ui-zoom, 1)); height: calc(100dvh / var(--ui-zoom, 1)); }   /* the page is zoomed (--ui-zoom) */   /* the drawer follows the visible screen height so the footer is not under the browser bar */
  @supports (height: 100dvh) { .sidebar { bottom: auto; } }
  .nav-toggle-all { width: 40px; height: 36px; }
  .nav-group-toggle, .nav-soon-row { min-height: 44px; }
  .sidebar-nav .nav-group-body a { min-height: 40px; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.35); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(17,24,39,0.45); }
  .topbar { left: 0; padding: 0 14px; }
  .content { margin-left: 0; padding: 14px 14px 26px; }
  .menu-btn { display: inline-flex; }
  .quick-jump { min-width: 0; }
  .quick-jump span, .quick-jump kbd { display: none; }
  .topbar-right .text-muted { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .status-board { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
}

/* ---------- First-run installer ---------- */
.install-body { align-items: flex-start; padding: 40px 16px; }
.install-wrap { width: 100%; max-width: 760px; margin: 0 auto; }
.install-wrap.install-narrow { max-width: 460px; }
.install-head { color: #fff; margin-bottom: 20px; }
.install-head .brand-wordmark { margin-bottom: 4px; }
.install-head h1 { color: #fff; font-size: var(--fs-2xl); margin-bottom: 6px; }
.install-head p { margin: 0; color: rgba(255,255,255,0.78); font-size: var(--fs-base); line-height: 1.55; max-width: 620px; }
.install-wrap .card { margin-bottom: 16px; padding: 18px 22px; }
.install-help { font-size: var(--fs-sm); margin: -4px 0 12px; line-height: 1.5; }
.install-checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; font-size: var(--fs-sm); }
.install-checks li .mark { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; align-items: center; justify-content: center; font-size: var(--fs-xs); font-weight: 700; margin-right: 6px; }
.install-checks li.ok .mark { background: #E7F6EC; color: var(--success-deep); }
.install-checks li.bad .mark { background: #FEE2E2; color: var(--red); }
.install-checks small { color: var(--red); }
.install-done { text-align: center; padding: 34px 30px !important; }
.install-done h1 { font-size: var(--fs-2xl); margin-bottom: 8px; }
.install-tick { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; background: #E7F6EC; color: var(--success-deep); font-size: var(--fs-3xl); display: flex; align-items: center; justify-content: center; }
.install-next { text-align: left; background: var(--hover-bg); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 18px; margin: 18px 0; font-size: var(--fs-sm); }
.install-next ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }
@media (max-width: 640px) { .install-checks { grid-template-columns: 1fr; } }

/* ---------- MOQENTA product logo (always on the dark indigo) ---------- */
:root { --mq-gold: #F6B818; --mq-cream: #FFF6E0; --mq-gold-ink: #C98A00; --kr-green: #74BB00; --kr-blue: #0270C5; }
/* One lockup, sized in em from the wordmark so icon, name and tagline keep their proportions at every text
   size and on every page. The tile runs exactly from the top of the name's capitals to the tagline's baseline:
   the name's line below its cap top (.888em) + the gap between the two lines + .939 of the tagline's size (Inter metrics, checked in a render). */
.mq-logo { --mq-f: .55; --mq-gap: .2em; --mq-tile: calc(.888em + var(--mq-gap) + .939em * var(--mq-f)); display: inline-flex; align-items: center; gap: .62em; font-size: min(calc(var(--fs-xl) * 1.27), 19px); min-width: 0; text-align: left; }
.mq-tile { width: var(--mq-tile); height: var(--mq-tile); flex: none; }
.mq-word { font-family: var(--font); font-weight: 800; font-size: 1em; letter-spacing: .13em; line-height: 1; color: var(--mq-cream); white-space: nowrap; }
.mq-g { color: var(--mq-gold); }
.mq-stack { display: inline-flex; flex-direction: column; align-items: flex-start; gap: var(--mq-gap); min-width: 0; }
.mq-tagline { font-family: var(--font); font-size: calc(1em * var(--mq-f)); font-weight: 500; letter-spacing: .02em; line-height: 1.15; color: rgba(255,246,224,.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 168px; }
.sidebar-logo .mq-home { min-width: 0; text-decoration: none; }
.mq-q { display: inline-block; width: .96em; height: .96em; vertical-align: -.17em; margin: 0 .1em 0 .02em; }
.mq-lg { --mq-f: .47; font-size: min(calc(var(--fs-3xl) * 1.23), 27px); }   /* the caps keep the lockup on one line in the sidebar and the sign-in plate */
.mq-tagline-full { max-width: none; white-space: normal; overflow: visible; }
/* the publisher's own mark (a signed branding file, includes/branding.php) */
.mq-custom-logo { height: var(--mq-tile); width: auto; max-width: 170px; object-fit: contain; flex: none; display: block; }
.mq-lg .mq-custom-logo { max-width: 240px; }
.mq-custom-word { letter-spacing: .04em; }
.mq-tags { display: inline-block; text-wrap: balance; }
.mq-nm { color: var(--mq-gold); font-weight: 700; letter-spacing: .06em; }
.mq-home { display: inline-flex; text-decoration: none; }
.login-brandplate { background: var(--primary-dark); border-radius: var(--r-lg); padding: 20px 16px 16px; margin-bottom: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.login-client { margin-bottom: 14px; }
.topbar-client { display: flex; align-items: center; padding-left: 14px; margin-left: 4px; border-left: 1px solid var(--border); }
.topbar-client img { max-height: 24px; max-width: 150px; width: auto; height: auto; object-fit: contain; }
.topbar-client .brand-wordmark { color: var(--dark); font-size: var(--fs-base); }
.install-head .mq-logo { margin-bottom: 16px; }
@media (max-width: 720px) { .topbar-client { display: none; } }

.sidebar-footer .about-link { margin-left: auto; margin-right: 12px; display: inline-flex; }


/* ---------- Excel import / export ---------- */
.dx-actions { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 8px; padding-right: 12px; margin-right: 4px; border-right: 1px solid var(--border); }
.dx-btn {
  --dx: var(--primary);
  display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; min-width: 112px; min-height: 34px; padding: 0 14px 0 5px; white-space: nowrap;
  border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--card); color: var(--dark);
  font-family: var(--font); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; cursor: pointer;
  box-shadow: 0 1px 0 rgba(17,24,39,.03);
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.dx-btn svg {
  flex: none; box-sizing: content-box; width: 16px; height: 16px; padding: 5px; border-radius: 50%;
  color: var(--dx); background: color-mix(in srgb, var(--dx) 12%, #fff);
}
.dx-btn:hover { border-color: color-mix(in srgb, var(--dx) 45%, #fff); background: color-mix(in srgb, var(--dx) 5%, #fff); box-shadow: 0 2px 6px rgba(17,24,39,.08); transform: translateY(-1px); text-decoration: none; color: var(--dark); }
.dx-btn:active { transform: none; box-shadow: none; }
.dx-template { --dx: #0F766E; }
.dx-import { --dx: var(--primary); }
.dx-export { --dx: #15803D; }
.dx-template-btn { --dx: #0F766E; padding-left: 12px; }
.dx-template-btn svg { color: #0F766E; }
@media (max-width: 720px) { .dx-btn span { display: none; } .dx-btn { min-width: 0; padding: 0 5px; } }
.dx-lead { max-width: 720px; margin: 0 0 14px; font-size: var(--fs-base); line-height: 1.6; }
.dx-steps { max-width: 760px; margin: 0; padding: 0; list-style: none; counter-reset: dx; }
.dx-steps > li { position: relative; padding: 0 0 18px 42px; font-size: var(--fs-base); line-height: 1.6; counter-increment: dx; }
.dx-steps > li::before {
  content: counter(dx); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700; font-size: var(--fs-sm); display: flex; align-items: center; justify-content: center;
}
.dx-upload { margin-top: 12px; }
.dx-tip { margin-top: 4px; padding: 10px 14px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--primary) 6%, #fff); font-size: var(--fs-sm); }
.dx-map th, .dx-map td { vertical-align: middle; }
.dx-map select { min-width: 260px; }
.dx-unmatched td { background: #FFFBEB; }
.dx-radio { display: flex; align-items: flex-start; gap: 4px; margin: 0 0 8px; text-transform: none; letter-spacing: 0; font-size: var(--fs-base); font-weight: 400; color: var(--dark); cursor: pointer; }
.dx-radio input { margin-top: 3px; }
.dx-actions-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.dx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 4px 0 12px; }
.dx-kpi { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; background: var(--card); }
.dx-kpi b { display: block; font-size: var(--fs-2xl); line-height: 1.1; color: var(--dark); }
.dx-kpi span { font-size: var(--fs-sm); color: var(--grey-light); }
.dx-kpi.ok b { color: var(--success-deep); }
.dx-kpi.bad { border-color: #FCA5A5; background: #FEF2F2; }
.dx-kpi.bad b { color: var(--red); }

label.check-label { display: flex; align-items: center; gap: 0; text-transform: none; letter-spacing: 0; font-size: var(--fs-base); font-weight: 600; color: var(--dark); cursor: pointer; margin: 6px 0 2px; }

.form-grid > .form-group > label.check-label:first-child { margin-top: 24px; }

/* ---------- About page (white boxes, soft shadow, grey type, two equal-height columns; fits one screen) ---------- */
.about-page { --about-text: #A8A8A8; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: stretch; color: var(--about-text); }
.about-page .about-hero, .about-page .card { background: var(--card); border: 1px solid var(--border); box-shadow: 0 8px 22px rgba(17,24,39,.09), 0 1px 3px rgba(17,24,39,.06); margin-bottom: 0; }
.about-page .about-hero { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 12px; border-radius: var(--r-lg); }
.about-page .card { padding: 10px 14px; }
.about-page .card, .about-page .card h3, .about-page .card label, .about-page .card div, .about-page .card p, .about-page .card span { color: var(--about-text); font-size: var(--fs-sm); }
.about-page .card-header { padding-bottom: 6px; margin-bottom: 8px; border-bottom-color: var(--border); }
.about-page .card-header h3 { font-size: var(--fs-sm); font-weight: 700; }
.about-page .form-grid { gap: 2px 14px; }
.about-page .form-group { margin-bottom: 0; }
.about-page .form-group label, .about-page .card .about-mod-h { font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 0; }
.about-page .about-ver { color: var(--about-text); font-size: var(--fs-xs); }
.about-page .mq-tagline { color: var(--about-text); }
.about-page .mq-word { color: #1E1B4B; }                 /* the logo's dark-lettered variant on a white box */
.about-page .mq-g, .about-page .mq-nm { color: #C98A00; }
.about-page .mq-q circle { stroke: #1E1B4B; }
.about-page .card .btn { font-size: var(--fs-xs); }
.about-lead { margin: 0 0 8px; line-height: 1.55; font-size: var(--fs-sm); }
.about-small { margin: 0; font-size: var(--fs-xs); line-height: 1.6; }
.about-sub { font-weight: 700; font-size: var(--fs-xs); display: block; margin-top: 8px; }
.about-notes { white-space: pre-line; font-size: var(--fs-sm); line-height: 1.55; margin-top: 4px; }
.about-modules { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; font-size: var(--fs-sm); line-height: 1.55; }
.about-checks { margin-top: 6px; font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.about-checks .ok { color: #4ADE80 !important; }
.about-checks .bad { color: #F87171 !important; }
@media (max-width: 1000px) { .about-page { grid-template-columns: 1fr; } }

/* ---- Help & Knowledge ---- */
.help-search { padding-bottom: 16px; }
.help-search-label { display: block; margin: 14px 16px 6px; font-weight: 600; }
.help-search input[type=search] { display: block; width: calc(100% - 32px); margin: 0 16px; }
.help-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 16px 0; }
.help-chip { font-size: var(--fs-sm); padding: 4px 10px; border: 1px solid var(--border, #e2e2e2); border-radius: var(--r-pill); text-decoration: none; background: var(--card); }
.help-chip:hover { border-color: var(--primary, #1e3a5f); }
.help-none { margin: 12px 16px 0; color: var(--grey-light, #888); }
.help-section { margin: 22px 0 0; scroll-margin-top: 12px; }
.help-section > h2 { font-size: var(--fs-md); margin: 0 0 8px; }
.help-item { background: var(--card); border: 1px solid var(--border, #e2e2e2); border-radius: var(--r-md); margin: 0 0 8px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.help-item summary { cursor: pointer; padding: 11px 14px; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.help-item summary::-webkit-details-marker { display: none; }
/* Down/up chevron, not +/-, matching the same disclosure arrow used on the "Tips for this page"
   panel (.page-help, every page) and the sidebar/FAQ-topic accordions -- one arrow style app-wide. */
.help-item summary::before { content: '\25BE'; float: right; font-weight: 700; color: var(--grey-light, #888); transition: transform .15s ease; }
.help-item[open] summary::before { transform: rotate(180deg); }
.help-q { font-weight: 600; padding-right: 22px; }
/* FAQ questions (not guide titles, which stay bolder as real headings): smaller, lighter weight,
   indented under their topic button so they read as nested content, not siblings of it. */
.help-section-body { margin: -2px 0 18px 20px; }
.help-section-body .help-q { font-weight: 500; font-size: var(--fs-sm); }
.help-sum { font-size: var(--fs-sm); color: var(--grey-light, #888); }

/* ---- Step-by-step guides beside the Platform Pipeline Map, in two columns ---- */
.help-guides-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-top: 22px; }
.help-guides-layout .help-section { margin-top: 0; min-width: 0; }
.help-pipeline-col { position: sticky; top: 12px; min-width: 0; }
.help-pipeline-col > h2 { font-size: var(--fs-md); margin: 0 0 8px; }
.help-pipeline-col .pipeline-map { min-width: 0; }   /* narrower column than the Dashboard's -- let it shrink instead of forcing a scrollbar */
@media (max-width: 1000px) { .help-guides-layout { grid-template-columns: 1fr; } .help-pipeline-col { position: static; } }

/* One color per topic (matches the Sales/Operations/Financials/Reports palette elsewhere), plus a
   violet "overview" tone and a slate "system" tone -- shared by the guides and every FAQ item. */
.help-item.help-tone { border-left: 3px solid var(--border); transition: box-shadow .15s ease, transform .15s ease; }
.help-item.help-tone:hover { box-shadow: 0 4px 14px rgba(20,25,30,.08); transform: translateY(-1px); }
.help-tone summary { flex-direction: row; align-items: center; gap: 11px; }
.help-tone-icon { flex: none; width: 30px; height: 30px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; border: 1.5px solid transparent; }
.help-guide .help-tone-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* summary is flex now (icon + text on the left), so float:right (line above) no longer works --
   float is ignored on a flex item. Push the +/- with order + margin-left instead. */
.help-tone summary::before { order: 2; margin-left: auto; align-self: flex-start; margin-top: 2px; float: none; }
/* .help-item.help-tone (2 classes) beats a bare .help-tone--x (1 class) for border-left-color, so
   these must match or exceed that specificity to actually win -- otherwise every box stays grey. */
.help-item.help-tone--overview   { border-left-color: #7C3AED; } .help-tone--overview   .help-tone-icon { background: #F3EEFF; color: #6D28D9; border-color: #DDD1FB; }
.help-item.help-tone--sales      { border-left-color: #4338CA; } .help-tone--sales      .help-tone-icon { background: #EEF2FF; color: #4338CA; border-color: #C7D2FE; }
.help-item.help-tone--operations { border-left-color: #B04A06; } .help-tone--operations .help-tone-icon { background: #FFF3E8; color: #B04A06; border-color: #FDD9AE; }
.help-item.help-tone--finance    { border-left-color: #0E7A3D; } .help-tone--finance    .help-tone-icon { background: #E7FAF0; color: #0E7A3D; border-color: #A7EFC7; }
.help-item.help-tone--system     { border-left-color: #475569; } .help-tone--system     .help-tone-icon { background: #EEF1F5; color: #38445A; border-color: #CBD5E1; }
/* FAQ items reuse the same icon badge but sit inline with the question text, not stacked. */
.help-item .help-tone-icon ~ .help-q { padding-right: 0; }
/* Every FAQ topic (Signing in and your account .. Troubleshooting) is click-to-expand, closed by
   default, so the page is one short list of topic buttons instead of a long scroll of every
   question at once -- opening one topic reveals just its own questions below the button. */
.help-section-title, .help-section-toggle { display: flex; align-items: center; gap: 9px; }
.help-section-toggle {
  width: 100%; border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: var(--r-md); background: var(--card); cursor: pointer;
  padding: 12px 14px; margin: 0 0 8px; font-family: var(--font); text-align: left;
  transition: box-shadow .15s ease, transform .15s ease;
}
.help-section-toggle.help-tone--overview   { border-left-color: #7C3AED; }
.help-section-toggle.help-tone--sales      { border-left-color: #4338CA; }
.help-section-toggle.help-tone--operations { border-left-color: #B04A06; }
.help-section-toggle.help-tone--finance    { border-left-color: #0E7A3D; }
.help-section-toggle.help-tone--system     { border-left-color: #475569; }
.help-section-toggle:hover { box-shadow: 0 4px 14px rgba(20,25,30,.08); transform: translateY(-1px); }
.help-section-toggle .help-section-label { font-weight: 650; font-size: var(--fs-base); color: var(--dark); flex: 1; }
.help-section-toggle .chev { flex: none; opacity: .55; transition: transform .15s ease; color: var(--grey-light); }
.help-section-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.help-section-title .help-tone-icon { width: 26px; height: 26px; }
.help-a, .help-steps { padding: 0 16px 12px 16px; margin: 0; font-size: var(--fs-sm); }
.help-a p { margin: 0 0 8px; line-height: 1.5; }
/* Bullets instead of numbers, each a small dot in the guide's own tone color. */
.help-steps { list-style: none; padding-left: 40px; line-height: 1.5; }
.help-steps li { position: relative; margin: 0 0 7px; }
.help-steps li::before {
  content: ''; position: absolute; left: -20px; top: 6px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--border);
}
.help-tone--overview   .help-steps li::before { background: #7C3AED; }
.help-tone--sales      .help-steps li::before { background: #4338CA; }
.help-tone--operations .help-steps li::before { background: #B04A06; }
.help-tone--finance    .help-steps li::before { background: #0E7A3D; }
.help-tone--system     .help-steps li::before { background: #475569; }
.help-gloss { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.help-term { padding: 10px 14px; margin: 0; }
.help-term dt { font-weight: 600; }
.help-term dd { margin: 2px 0 0; color: var(--grey-light, #666); font-size: var(--fs-sm); }
.help-item.help-term { display: block; }
table.help-term { width: 100%; }
kbd { font: var(--fs-sm) ui-monospace, Consolas, monospace; background: #f4f4f4; border: 1px solid #d8d8d8; border-radius: calc(var(--r-sm) / 2); padding: 1px 6px; }
.help-foot { margin: 22px 0 8px; color: var(--grey-light, #888); }
@media print { .sidebar, .topbar, .help-search input, .help-chips, .card-actions { display: none !important; } .help-item[hidden] { display: block; } }

/* ---- In-page help tips ---- */
/* Tinted from the company's own Primary theme color (Company Profile > Theme) instead of a fixed
   gold, and mixed with --card rather than a flat white/black so it also follows light/dark mode
   automatically -- one formula covers both instead of two hardcoded color pairs. */
.page-help { background: color-mix(in srgb, var(--primary) 7%, var(--card)); border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--card)); border-radius: var(--r-md); padding: 0 14px; margin: 0 0 16px; font-size: var(--fs-sm); }
.page-help summary { cursor: pointer; padding: 9px 0; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
.page-help summary::-webkit-details-marker { display: none; }
.page-help summary::after { content: '\25BE'; margin-left: auto; color: var(--grey-light, #888); }
.page-help[open] summary::after { content: '\25B4'; }
.page-help .ph-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); color: #fff; font-size: var(--fs-sm); font-weight: 700; }
.page-help ul { margin: 0 0 8px; padding-left: 20px; line-height: 1.55; }
.page-help li { margin: 0 0 3px; }
.page-help .ph-more { display: inline-block; margin: 0 0 10px; font-weight: 600; }
.tip-btn { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 6px; padding: 0; border: 1px solid var(--border-hover); border-radius: 50%; background: var(--card); color: #6b7280; font: 700 9px/1 inherit; cursor: pointer; vertical-align: middle; }
.tip-btn:hover, .tip-btn:focus-visible, .tip-btn[aria-expanded=true] { background: var(--primary, #4F46E5); border-color: var(--primary, #4F46E5); color: #fff; outline: none; }
.tip-pop { position: absolute; z-index: 1000; max-width: 300px; background: #1f2937; color: #f9fafb; padding: 9px 12px; border-radius: var(--r-sm); font-size: var(--fs-sm); line-height: 1.5; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
@media print { .page-help, .tip-btn, .tip-pop { display: none !important; } }

/* ---- Dashboard: financial snapshot (aging donuts, mini-lists) ---- */
.snap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.snap-grid .card { margin-bottom: 0; min-width: 0; }
.snap-grid .table-wrap { overflow-x: auto; }
@media (max-width: 900px) { .snap-grid { grid-template-columns: 1fr; } }
/* Aged Receivables / Aged Payables / Recent Purchase Orders, kept in one row (1-3 cards depending on role access) */
.snap-grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.snap-list { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.snap-list th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--grey-light, #888); font-weight: 600; padding: 0 10px 8px; }
.snap-list th.num, .snap-list td.num { text-align: right; }
.snap-list td { padding: 7px 10px; border-top: 1px solid var(--border, #eef0f3); }
.snap-list tr:first-child td { border-top: none; }
.snap-list a { font-weight: 600; }
.snap-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border, #eef0f3); font-size: var(--fs-sm); }
.aging-widget { display: flex; align-items: center; gap: 18px; }
.aging-donut { position: relative; width: 128px; height: 128px; flex: 0 0 auto; }
.aging-donut canvas { width: 128px !important; height: 128px !important; }
.aging-donut-total { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.aging-donut-total .lbl { font-size: var(--fs-2xs); color: var(--grey-light, #888); text-transform: uppercase; letter-spacing: .04em; }
.aging-donut-total .amt { font-size: var(--fs-sm); font-weight: 700; color: var(--dark, #1f2937); }
.aging-legend { flex: 1 1 auto; font-size: var(--fs-sm); min-width: 0; }
.aging-legend-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.aging-legend-row .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.aging-legend-row .lbl { flex: 1 1 auto; color: var(--grey, #4b5563); }
.aging-legend-row .amt { font-weight: 600; text-align: right; min-width: 70px; }
.aging-legend-row .pct { color: var(--grey-light, #888); min-width: 38px; text-align: right; }
.aging-legend-row.total { border-top: 1px solid var(--border, #eef0f3); margin-top: 4px; padding-top: 6px; font-weight: 700; }

/* ---- Dashboard: compact KPI row (about half the height of the standard .kpi-card) ---- */
.kpi-grid-compact { gap: 12px; margin-bottom: 18px; }
.kpi-grid-compact .kpi-card { padding: 9px 16px; border-radius: var(--r-sm); border-left-width: 3px; }
.kpi-grid-compact .kpi-label { font-size: var(--fs-2xs); letter-spacing: .3px; }
.kpi-grid-compact .kpi-value { font-size: var(--fs-xl); margin-top: 2px; }
.kpi-grid-compact .kpi-value.kpi-value-money { font-size: var(--fs-lg); }
.kpi-grid-compact .kpi-sub { font-size: var(--fs-2xs); margin-top: 0; }

/* ---- Small "product by KANRAM" footer line, pinned to the bottom of the viewport on every
   page (not just the end of the page's own scroll) so it reads the same everywhere. ---- */
.app-footer-note {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  margin: 0; padding: 4px 24px; height: var(--footer-h); box-sizing: border-box;
  /* A plain block, centered by line-height (bar height less its padding and top border). As a flex
     row each colored span and each run of text became its own item, which dropped the spaces
     between the words and stopped the ellipsis from working. */
  display: block; line-height: calc(var(--footer-h) - 9px);
  background: var(--card); border-top: 1px solid var(--border);
  text-align: center; color: var(--grey-light, #9CA3AF); font-size: var(--fs-2xs); letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Inside the main app shell the sidebar owns the left edge, so the bar starts after it. */
.app-footer-note-shell { left: var(--sidebar-w); }
@media (max-width: 900px) { .app-footer-note-shell { left: 0; } }
/* Too narrow to fit on one line: let it wrap to two and grow past --footer-h rather than clip it. */
@media (max-width: 560px) {
  .app-footer-note { white-space: normal; overflow: visible; height: auto; line-height: 1.4; padding: 4px 16px; }
  .content { height: calc(100vh / var(--ui-zoom, 1) - var(--topbar-h) - 34px); }
}
/* MOQENTA and KANRAM keep their own real brand colors here -- fixed, not the per-tenant
   --primary/--accent theme, since this line names the actual software maker either way. A hair
   of margin on each side of the colored spans keeps the bold weight from crowding the neighboring word. */
.footer-mq, .footer-kr-a, .footer-kr-b { font-weight: 700; }
.footer-mq { color: var(--mq-gold-ink); margin-right: .15em; }
.footer-kr-a { color: var(--kr-green); margin-left: .15em; }
.footer-kr-b { color: var(--kr-blue); margin-right: .15em; }

/* ---------- Theme management page (theme.php) ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 14px; }
@media (max-width: 760px) { .theme-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .theme-grid { grid-template-columns: 1fr; } }
.theme-swatch-row { display: flex; gap: 8px; align-items: center; }
.theme-swatch-row input[type=color] { width: 42px; height: 36px; padding: 2px; flex: none; border: 1px solid var(--border); border-radius: calc(var(--r-sm) * .875); background: var(--card); }
.theme-hex-input { font-family: monospace; text-transform: uppercase; }
.theme-preset-btn { display: inline-flex; align-items: center; gap: 8px; }
.theme-preset-dots { display: inline-flex; gap: 3px; }
.theme-preset-dots i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.12); }
.theme-preview { display: grid; grid-template-columns: 160px 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.theme-preview-sidebar { background: var(--primary-dark); padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; }
.theme-preview-sidebar-item { color: rgba(255,255,255,0.75); font-size: var(--fs-sm); padding: 7px 10px; border-radius: calc(var(--r-sm) * .875); }
.theme-preview-sidebar-item.active { background: rgba(255,255,255,0.15); color: #fff; font-weight: 600; }
.theme-preview-main { padding: 18px; background: var(--bg); flex: 1; }
@media (max-width: 480px) { .theme-preview { grid-template-columns: 1fr; } .theme-preview-sidebar { flex-direction: row; flex-wrap: wrap; } }
/* Theme > Corners: the six choices as chips, and a live sample (field, button, card, pop-up) that follows the clicked choice. */
.corner-choices { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0 0 12px; }
.corner-choice { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--card); cursor: pointer; font-size: var(--fs-md); font-weight: 600; color: var(--dark); text-transform: none; letter-spacing: normal; margin: 0; }
.corner-choice input { position: absolute; opacity: 0; pointer-events: none; }
.corner-choice:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--card)); color: var(--primary); }
.corner-choice:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.corner-choice-shape { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right: 0; border-bottom: 0; border-top-left-radius: var(--r-sm); }
.corner-sample { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); }
.corner-sample .card { margin: 0; }
.corner-sample-pop { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card); box-shadow: 0 8px 24px rgba(15, 23, 42, .14); overflow: hidden; }
.corner-sample-pop-head { padding: 8px 12px; background: linear-gradient(180deg, var(--modal-header-1), var(--modal-header-2)); border-bottom: 2px solid var(--modal-header-border); color: var(--modal-header-ink); font-weight: 700; font-size: var(--fs-md); }
.corner-sample-pop-body { padding: 12px; font-size: var(--fs-base); color: var(--grey); }

/* ---------- Newsletter composer: template gallery ---------- */
.template-card {
  display: block; width: 100%; text-align: left; border: 1px solid var(--border); border-left: 3px solid var(--border);
  border-radius: var(--r-md); padding: 13px 15px; background: var(--card); cursor: pointer; position: relative;
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.template-card:hover { box-shadow: 0 4px 14px rgba(20,25,30,.08); transform: translateY(-1px); border-left-color: var(--primary); }
.template-card-icon {
  width: 28px; height: 28px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 8px; background: color-mix(in srgb, var(--primary) 12%, var(--card)); color: var(--primary); flex: none;
}
.template-card.template-card-saved .template-card-icon { background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent-deep); }
.template-card.template-card-saved { border-left-color: var(--border); }
.template-card.template-card-saved:hover { border-left-color: var(--accent-deep); }
.template-card-title { font-weight: 700; font-size: var(--fs-base); color: var(--dark); margin-bottom: 3px; padding-right: 16px; }
.template-card-desc { font-size: var(--fs-sm); color: var(--grey-light); }
.template-card-delete {
  position: absolute; top: 8px; right: 8px; background: none; border: none; color: var(--grey-light);
  cursor: pointer; font-size: var(--fs-lg); line-height: 1; padding: 2px 6px; border-radius: calc(var(--r-sm) * .625);
}
.template-card-delete:hover { background: color-mix(in srgb, var(--red) 12%, var(--card)); color: var(--red); }

/* ---------- Customer 360: header, avatar, tabs, activity timeline ---------- */
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; flex: none; font-family: var(--font); }
.cust-header-card { padding-bottom: 18px; }
.cust-header-row { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.cust-header-main { flex: 1 1 260px; min-width: 0; }
.cust-header-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cust-header-title h2 { margin: 0; font-size: var(--fs-md); font-weight: 800; color: var(--dark); }
.cust-header-sub { font-size: var(--fs-sm); margin-top: 4px; }
.cust-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.cust-nav { display: flex; align-items: center; gap: 6px; }

.detail-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.detail-tab-btn {
  border: none; background: none; padding: 8px 12px; font-size: var(--fs-sm); font-weight: 600; color: var(--grey);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px;
}
.detail-tab-btn:hover { color: var(--dark); }
.detail-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.detail-tab-count {
  background: var(--hover-bg); color: var(--grey); border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700;
  padding: 1px 7px; line-height: 1.5;
}
.detail-tab-btn.active .detail-tab-count { background: color-mix(in srgb, var(--primary) 15%, var(--card)); color: var(--badge-blue-ink, var(--primary-deep)); }

.activity-timeline { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-left: 2px solid var(--border); margin-left: 5px; padding-left: 18px; position: relative; }
.activity-item:last-child { border-left-color: transparent; }
.activity-dot { position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--card); }
.activity-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: var(--fs-sm); margin-bottom: 3px; }
.activity-details { font-size: var(--fs-base); color: var(--dark); }

/* Clickable sort-by column headers -- see sortable_th_html() in includes/functions.php. */
.sortable-th { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 3px; }
.sortable-th:hover { color: var(--primary); text-decoration: none; }
.sort-arrow { font-size: 7.5px; }

/* Opt-in tighter variant of .list-toolbar, for a list page with extra filter controls (dropdowns,
   checkboxes) alongside the usual search+sort -- tighter gaps, and filter <select>s + checkbox
   labels sized to their content instead of the app-wide "select { width:100% }" default, which
   otherwise stretches each one to a full row of its own and wraps the toolbar much taller than it
   needs to be. Add class="filter-select" to any <select> that should get this treatment. */
.compact-list-toolbar { gap: 6px; margin-bottom: 12px; row-gap: 6px; }
.compact-list-toolbar select.filter-select { width: auto; flex: 0 0 auto; min-width: 120px; font-size: var(--fs-sm); min-height: 24px; padding: 3px 28px 3px 8px; }
.compact-list-toolbar .check-label { text-transform: none; font-weight: 400; font-size: var(--fs-sm); gap: 4px; margin: 0; }
.compact-list-toolbar .sort-select { min-width: 140px; font-size: var(--fs-sm); min-height: 24px; padding: 3px 28px 3px 8px; }

/* ---------- Notifications bell + list ---------- */
.notif-bell-wrap { position: relative; }
.notif-bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--card); color: var(--grey); cursor: pointer;
}
.notif-bell:hover { border-color: var(--primary); color: var(--dark); }
/* the map button beside the bell: opens the Platform Pipeline Map in a pop-up; its tooltips must lie above that pop-up */
.topbar-map { text-decoration: none; }
.pm-tooltip.pm-tooltip-top { z-index: 1100; }
.notif-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--red); color: #fff; font-size: var(--fs-xs); font-weight: 700; line-height: 18px; text-align: center;
}
.notif-count[hidden] { display: none; }
.notif-panel {
  position: absolute; right: 0; top: 44px; z-index: 1100; width: 360px; max-width: calc(100vw - 24px); max-height: 70vh; overflow: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 10px 30px rgba(17,24,39,0.15);
}
.notif-panel[hidden] { display: none; }
.notif-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: var(--fs-base); }
.notif-panel-head a, .notif-panel-foot a { font-size: var(--fs-sm); font-weight: 600; }
.notif-panel-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border); }
.notif-panel-empty { padding: 22px 12px; text-align: center; color: var(--grey-light); font-size: var(--fs-base); }
.notif-row { margin: 0; border-bottom: 1px solid var(--border); }
.notif-row button {
  display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; font: inherit; color: var(--dark); cursor: pointer;
}
.notif-row button:hover { background: var(--hover-bg); }
.notif-row.unread button { background: color-mix(in srgb, var(--primary) 6%, var(--card)); }
.notif-row.unread .notif-title::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--primary); vertical-align: middle; }
.notif-title { display: block; font-weight: 600; font-size: var(--fs-base); }
.notif-body { display: block; color: var(--grey); font-size: var(--fs-sm); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.notif-when { display: block; color: var(--grey-light); font-size: var(--fs-xs); margin-top: 3px; }
@media (max-width: 720px) { .notif-panel { position: fixed; left: 12px; right: 12px; top: 58px; width: auto; } }

/* ---------- Tasks calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal-grid > div { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); min-height: 96px; padding: 4px 5px; font-size: var(--fs-sm); overflow: hidden; }
.cal-grid .cal-dow { min-height: 0; font-weight: 700; text-align: center; background: var(--hover-bg); color: var(--grey); }
.cal-grid .cal-out { background: var(--hover-bg); color: var(--grey-light); }
.cal-grid .cal-today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-day-num { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 3px; }
.cal-grid .cal-addable { cursor: pointer; }
.cal-grid .cal-addable:hover { background: color-mix(in srgb, var(--primary) 5%, var(--card)); }
.cal-add { width: 20px; height: 20px; line-height: 18px; text-align: center; border-radius: 50%; border: 1px solid var(--border); color: var(--primary); font-weight: 700; text-decoration: none; opacity: 0; transition: opacity .12s; }
.cal-addable:hover .cal-add, .cal-add:focus { opacity: 1; text-decoration: none; }
@media (hover: none) { .cal-add { opacity: 1; } }
.cal-item { display: block; margin: 2px 0; padding: 1px 5px; border-radius: calc(var(--r-sm) / 2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-xs); text-decoration: none; }
.cal-item:hover { text-decoration: none; filter: brightness(0.95); }
.cal-task { background: color-mix(in srgb, var(--primary) 14%, var(--card)); color: var(--primary-dark); }
.cal-task.done { opacity: .55; text-decoration: line-through; }
.cal-invoice { background: color-mix(in srgb, var(--success) 15%, var(--card)); color: var(--success-deep); }
.cal-bill { background: color-mix(in srgb, var(--amber) 15%, var(--card)); color: var(--amber); }
.cal-wo { background: color-mix(in srgb, var(--accent) 16%, var(--card)); color: var(--accent-deep); }
.cal-quote { background: var(--hover-bg); color: var(--grey); border: 1px solid var(--border); }
.cal-overdue { background: color-mix(in srgb, var(--red) 14%, var(--card)); color: var(--red); }
.cal-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: var(--fs-sm); margin: 8px 0; }
.cal-legend .cal-item { display: inline-block; }
@media (max-width: 720px) { .cal-grid > div { min-height: 64px; padding: 2px; } .cal-item { font-size: var(--fs-2xs); padding: 0 2px; } }

/* ---------- Approvals / API pages ---------- */
.approval-steps { list-style: none; padding: 0; margin: 0; }
.approval-steps li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-base); }
.approval-steps .step-no { flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--hover-bg); border: 1px solid var(--border); text-align: center; line-height: 22px; font-weight: 700; font-size: var(--fs-sm); }
.approval-steps .current .step-no { background: var(--primary); border-color: var(--primary); color: #fff; }
.secret-once { font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-base); padding: 10px 12px; border: 1px dashed var(--primary); border-radius: var(--r-sm); background: var(--hover-bg); word-break: break-all; user-select: all; }
.code-block { font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-sm); padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--hover-bg); white-space: pre-wrap; word-break: break-word; }
.scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 14px; }

/* ---------- Asset Management ---------- */
/* Compact KPI strip: value first, small-caps label, a thin left accent that carries the state. */
.asset-kpis { display: flex; flex-wrap: nowrap; gap: 5px; margin-bottom: 8px; overflow-x: auto; scrollbar-width: thin; }
.asset-kpi { position: relative; flex: 1 1 0; min-width: 78px; margin: 0; padding: 4px 6px 4px 9px; border-radius: calc(var(--r-sm) * .75); text-decoration: none; color: inherit; box-shadow: none; overflow: hidden; transition: background .15s; }
.asset-kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border); }
.asset-kpi.is-warn::before { background: var(--amber); }
.asset-kpi.is-bad::before { background: var(--red); }
.asset-kpi.is-good::before { background: var(--success); }
.asset-kpi-value { font-size: var(--fs-md); font-weight: 700; line-height: 1.2; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.asset-kpi.is-warn .asset-kpi-value { color: var(--amber); }
.asset-kpi.is-bad .asset-kpi-value { color: var(--red); }
.asset-kpi.is-good .asset-kpi-value { color: var(--success); }
.asset-kpi-value small { font-size: var(--fs-2xs); font-weight: 600; color: var(--muted); }
.asset-kpi-label { font-size: var(--fs-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.asset-kpi:hover { background: var(--hover-bg); text-decoration: none; }
.cal-asset { background: color-mix(in srgb, var(--grey) 14%, var(--card)); color: var(--dark); }
#scan-feed > div { padding: 4px 8px; border-radius: calc(var(--r-sm) * .75); margin-bottom: 3px; }
.st-found { background: color-mix(in srgb, var(--success) 14%, var(--card)); color: var(--success-deep); }
.st-misplaced, .st-repeat { background: color-mix(in srgb, var(--amber) 14%, var(--card)); color: var(--amber); }
.st-unknown, .st-error { background: color-mix(in srgb, var(--red) 12%, var(--card)); color: var(--red); }
/* One-line table cell: long text is cut with an ellipsis, full value in the title tooltip. */
.cell-1l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.cell-1l.w-s { max-width: 150px; }

/* Dashboard revenue card: legend + summary strip under the chart. */
.rev-legend { display: flex; gap: 10px; font-size: var(--fs-xs); color: var(--muted); }
.rev-legend i { display: inline-block; width: 10px; height: 2px; margin-right: 4px; vertical-align: middle; border-radius: calc(var(--r-sm) / 8); }
.rev-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.rev-stats > div { min-width: 0; }
.rev-stats span { display: block; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.rev-stats strong { display: block; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.rev-stats em { display: block; font-style: normal; font-size: var(--fs-xs); color: var(--muted); }
.rev-stats em.up { color: var(--success); } .rev-stats em.down { color: var(--red); }
.rev-stats .rev-wide { grid-column: 1 / -1; }
.rev-more { display: inline-block; margin-top: 10px; font-size: var(--fs-sm); }

/* ---- Administration navigation (views/layout/settings_tabs.php): grouped, compact ---- */
/* One tab style across the app: a boxed bar of small buttons with icons (the .btn.btn-sm look of the AR, AP, GL, stock and attendance bars). */
.admin-nav { padding: 6px; display: block; }
.admin-nav-group { display: block; padding: 0; }
.admin-nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }   /* read by screen readers; the nav has the name too */
.admin-nav-links { display: flex; flex-wrap: wrap; gap: 4px; }
.admin-nav-link { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 30px; padding: 0 12px; border-radius: calc(var(--r-sm) * .875); border: 1px solid var(--border); background: var(--card);
  font-family: var(--font); font-size: var(--fs-sm); font-weight: 600; line-height: 1.2; color: var(--dark); text-decoration: none; white-space: nowrap; transition: background-color .12s ease, border-color .12s ease, color .12s ease; }
.admin-nav-link:hover { background: var(--hover-bg); border-color: var(--border-hover); text-decoration: none; }
.admin-nav-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.admin-nav-link.active:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
.admin-nav-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.admin-nav-link .tab-ic { margin-right: 0; }
/* the second row of tabs (Company Profile's sections): flat, underlined, clearly below the page tabs above */
.card.sub-tabs { display: flex; gap: 2px; flex-wrap: wrap; padding: 0 8px; background: transparent; box-shadow: none; border-radius: 0; border-width: 0 0 1px 0; }
.sub-tabs .btn { min-height: 32px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--grey); font-weight: 500; }
.sub-tabs .btn:hover { background: none; color: var(--dark); border-color: transparent; }
.sub-tabs .btn.btn-primary { background: none; color: var(--primary-deep); border-bottom-color: var(--primary); font-weight: 600; }
.sub-tabs .btn .tab-ic { margin-right: 0; }
:root[data-theme="dark"] .sub-tabs .btn.btn-primary { color: var(--badge-blue-ink); }
/* Roles screen: modules grouped like the menu; administrator-only rows are shown but locked */
.module-access-table .module-group-row td { background: var(--hover-bg); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--grey); padding-top: 9px; padding-bottom: 6px; }
.module-access-table .module-admin-only td { opacity: .6; }
/* Administration > System > Modules */
.mod-cat { margin: 16px 0 8px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--grey); }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
/* compact module tiles: one fixed height (75px max); the details open on hover / focus / tap */
.mod-card { position: relative; margin: 0; height: 72px; box-sizing: border-box; padding: 10px 12px; display: flex; align-items: center; gap: 10px; cursor: default; outline: none;
            box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(15, 23, 42, .08); transition: box-shadow .15s, transform .15s; }
.mod-card:hover, .mod-card:focus-within { z-index: 40; border-color: var(--primary); box-shadow: 0 2px 4px rgba(15, 23, 42, .08), 0 10px 24px rgba(15, 23, 42, .16); transform: translateY(-1px); }
.mod-card.mod-off { background: var(--hover-bg); }
.mod-icon { flex: 0 0 38px; width: 38px; height: 38px; border-radius: var(--r-md); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(15, 23, 42, .18); }
.mod-card.mod-off .mod-icon { filter: grayscale(.85); opacity: .55; box-shadow: none; }
.mod-main { flex: 1; min-width: 0; }
.mod-name { font-weight: 700; font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-tags { display: flex; gap: 4px; margin-top: 4px; white-space: nowrap; overflow: hidden; }
.mod-tags .badge { font-size: var(--fs-2xs); padding: 1px 6px; }
.mod-actions { flex: 0 0 auto; }
.mod-actions form { margin: 0; }
.mod-lock { font-size: var(--fs-xs); color: var(--grey); border: 1px dashed var(--border); border-radius: calc(var(--r-sm) * .75); padding: 3px 7px; }
.mod-info { display: none; position: absolute; left: -1px; right: -1px; top: calc(100% - 2px); background: var(--card); border: 1px solid var(--primary); border-top: none;
            border-radius: 0 0 var(--r-md) var(--r-md); box-shadow: 0 10px 22px rgba(15, 23, 42, .16); padding: 8px 12px 10px; }
.mod-card:hover .mod-info, .mod-card:focus-within .mod-info { display: block; }
.mod-card:hover, .mod-card:focus-within { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.mod-desc { margin: 0 0 6px; font-size: var(--fs-sm); color: var(--dark); }
.mod-meta { font-size: var(--fs-xs); color: var(--grey); display: grid; gap: 2px; }
.mod-danger summary { cursor: pointer; font-size: var(--fs-xs); color: var(--red); margin-top: 6px; }
.mod-danger form { display: grid; gap: 2px; margin-top: 6px; }
/* Checkbox lists laid out in columns (Groups members/roles, Access) */
.check-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 16px; }

/* ---------- Customers: split view (list | selected customer) ---------- */
.ws { --ws-list: 360px; display: grid; grid-template-columns: var(--ws-list) 8px minmax(0, 1fr); height: calc(100vh - 170px); min-height: 480px; }
.ws-list { display: flex; flex-direction: column; min-height: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.ws-list-head { padding: 10px; border-bottom: 1px solid var(--border); display: grid; gap: 8px; }
.ws-search-row { display: flex; gap: 6px; }
.ws-search-row input { flex: 1; min-width: 0; }
.ws-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ws-chip { border: 1px solid var(--border); background: var(--card); color: var(--grey); border-radius: var(--r-pill); padding: 2px 9px; font-size: var(--fs-xs); cursor: pointer; }
.ws-chip:hover { border-color: var(--primary); color: var(--primary); }
.ws-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.ws-chip-n { opacity: .75; margin-left: 2px; }
.ws-sort-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.ws-sort-row select { max-width: 170px; }
.ws-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.ws-rows { overflow-y: auto; flex: 1; min-height: 0; }
.ws-row { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; text-decoration: none; color: inherit; }
.ws-row:hover { background: var(--hover-bg); text-decoration: none; }
.ws-row.selected { background: color-mix(in srgb, var(--primary) 9%, var(--card)); border-left-color: var(--primary); }
.ws-row.ws-hold { border-left-color: var(--red); }
.ws-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ws-row-top, .ws-row-sub { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-width: 0; }
.ws-row-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-row-bal { font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; }
.ws-row-bal.ws-od { color: var(--red); }
.ws-row-place { color: var(--grey-light); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-sig { font-size: var(--fs-2xs); font-weight: 600; border-radius: var(--r-pill); padding: 0 7px; white-space: nowrap; }
.ws-sig-red { background: color-mix(in srgb, var(--red) 13%, var(--card)); color: var(--red); }
.ws-sig-amber { background: color-mix(in srgb, var(--amber) 15%, var(--card)); color: var(--amber); }
.ws-sig-blue { background: color-mix(in srgb, var(--primary) 12%, var(--card)); color: var(--primary); }
.ws-sig-grey { background: var(--hover-bg); color: var(--grey); }
.ws-more { margin: 10px auto; display: block; }
.ws-empty { padding: 24px 12px; text-align: center; color: var(--grey); }
.ws-split { cursor: col-resize; position: relative; }
.ws-split::after { content: ""; position: absolute; top: 40%; bottom: 40%; left: 3px; width: 2px; border-radius: calc(var(--r-sm) / 4); background: var(--border); }
.ws-split:hover::after { background: var(--primary); }
.ws-panel { overflow-y: auto; min-height: 0; padding-right: 2px; }
.ws-panel.loading { opacity: .55; transition: opacity .1s; }
.ws-placeholder { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--grey); background: var(--card); border: 1px dashed var(--border); border-radius: var(--r-md); padding: 24px; }
.ws-placeholder .icon { font-size: 38px; opacity: .4; }
.ws-placeholder kbd, .ws kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: calc(var(--r-sm) / 2); padding: 0 5px; font-size: var(--fs-xs); background: var(--hover-bg); }
.ws-panel-head { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 8px; display: grid; gap: 10px; }
.ws-back { display: none; justify-self: start; }
.ws-head-row { display: flex; gap: 12px; align-items: center; }
.ws-head-main { flex: 1; min-width: 0; }
.ws-head-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ws-head-title h2 { margin: 0; font-size: var(--fs-xl); }
.ws-head-sub { font-size: var(--fs-sm); margin-top: 2px; }
.ws-head-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.ws-health { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.ws-kpi { text-align: left; border: 1px solid var(--border); border-radius: calc((var(--r-sm) + var(--r-md)) / 2); background: var(--hover-bg); padding: 7px 10px; cursor: pointer; display: grid; gap: 1px; color: inherit; font: inherit; }
.ws-kpi:hover { border-color: var(--primary); }
.ws-kpi-label { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .04em; color: var(--grey); font-weight: 700; }
.ws-kpi-value { font-size: var(--fs-lg); font-weight: 800; }
.ws-kpi-sub { font-size: var(--fs-2xs); color: var(--grey-light); }
.ws-kpi-red .ws-kpi-value { color: var(--red); } .ws-kpi-amber .ws-kpi-value { color: var(--amber); } .ws-kpi-green .ws-kpi-value { color: var(--success-deep); } .ws-kpi-blue .ws-kpi-value { color: var(--primary); }
.ws-bar { height: 4px; border-radius: calc(var(--r-sm) / 2); background: var(--border); overflow: hidden; margin: 2px 0; }
.ws-bar span { display: block; height: 100%; background: var(--amber); }
.ws-bar span.ws-bar-over { background: var(--red); }
.ws-actions { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .ws { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .ws-split { display: none; }
  .ws-list { max-height: calc(100vh - 150px); }
  .ws.show-panel .ws-list { display: none; }
  .ws:not(.show-panel) .ws-panel { display: none; }
  .ws-back { display: inline-flex; }
  .ws-head-row { flex-wrap: wrap; }
}
.ws-search-row input { width: auto; }
.ws-search-row .btn { flex: 0 0 auto; }
.ws-list-head { min-width: 0; }
.ws .dx-actions { gap: 4px; }
.ws .dx-btn { padding: 4px 7px; }
.ws .dx-btn span { display: none; }   /* icons only in the narrow list column; the titles say what they do */
.ws .dx-btn { min-width: 0; min-height: 30px; padding: 0 6px; }
.ws .dx-actions { border-right: none; padding-right: 0; margin-right: 0; }
/* Page content, every page: fields, buttons, tables and badges at the small size, headings one step down --
   the same as the Customers split view. */
.ws { font-size: var(--fs-base); }
.content input, .content select, .content textarea, .content .btn, .content table, .content .badge,
.record-modal-body input, .record-modal-body select, .record-modal-body textarea, .record-modal-body .btn, .record-modal-body table, .record-modal-body .badge { font-size: var(--fs-sm); }
.content h2, .record-modal-body h2 { font-size: var(--fs-xl); } .content h3, .record-modal-body h3 { font-size: var(--fs-lg); } .content h4, .record-modal-body h4 { font-size: var(--fs-md); }
.ws .ws-row { padding: 7px 10px; }
.ws .ws-kpi { padding: 6px 9px; }
/* Scrollbars, app-wide: thin rounded thumb on a clear track, no arrow buttons; it fades in on hover of the
   area and takes the brand colour while dragged. The dark sidebar gets a light, even thinner variant.
   Chrome/Edge/Safari use the ::-webkit-scrollbar rules; Firefox the standard properties. */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--grey) 28%, transparent); border-radius: var(--r-sm); border: 2px solid transparent; background-clip: padding-box; }
:hover::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--grey) 45%, transparent); }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--primary) 60%, transparent); }
::-webkit-scrollbar-thumb:active { background-color: var(--primary); }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.sidebar ::-webkit-scrollbar, .sidebar::-webkit-scrollbar { width: 6px; }
.sidebar ::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.10); }
.sidebar :hover::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.22); }
.sidebar ::-webkit-scrollbar-thumb:hover, .sidebar ::-webkit-scrollbar-thumb:active { background-color: rgba(255,255,255,.40); }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--grey) 40%, transparent) transparent; }
  .sidebar, .sidebar * { scrollbar-color: rgba(255,255,255,.22) transparent; }
}
/* Document split views (quotes, orders, invoices, bills): rows have no avatar; the panel holds the record's own page. */
.ws-doc-row { padding-left: 12px; }
.ws-row-party { font-weight: 500; color: var(--grey); margin-left: 4px; }
.ws-row-tags { display: inline-flex; gap: 4px; align-items: center; flex: 0 0 auto; }
.ws-row-tags .badge { font-size: var(--fs-2xs); padding: 1px 7px; }
.ws-doc-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 12px; margin-bottom: 8px; box-shadow: 0 2px 6px rgba(15,23,42,.05); }
.ws-doc-title { flex: 1; min-width: 0; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-doc-tools { display: flex; gap: 6px; flex: 0 0 auto; }
.ws-doc-body > .card:first-child, .ws-doc-body > div:first-child > .card:first-child { margin-top: 0; }
/* Reports split view: grouped list with the category colour icons. */
.ws-group-head { position: sticky; top: 0; z-index: 1; background: var(--hover-bg); color: var(--grey); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 5px 12px; border-bottom: 1px solid var(--border); }
.ws-rep-row { gap: 9px; }
.ws-rep-row .ws-row-name { font-weight: 600; }
.ws-rep-row .ws-row-place { white-space: nowrap; }
.ws-rep-icon { width: 26px; height: 26px; flex: 0 0 26px; border-radius: calc(var(--r-sm) * .875); display: inline-flex; align-items: center; justify-content: center; border: 1px solid; }
.ws-rep-body a[href="/reports"] { display: none; }
.ws-panel .ws-empty-field { display: none !important; }
.ws-nothing { background: var(--card); border: 1px dashed var(--border); border-radius: var(--r-md); padding: 14px; color: var(--grey); font-size: var(--fs-sm); margin-bottom: 8px; }
/* Document toolbar (doc_toolbar_start): status + number on the left, Print / Download PDF / Email then the
   document's own actions on the right -- the same on every document page. */
.doc-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; }
.card.doc-toolbar { padding: 10px 14px; }
.doc-toolbar-card > .doc-toolbar { padding: 2px 0 10px; }
.doc-toolbar-id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.doc-toolbar-label { font-weight: 700; font-size: var(--fs-md); color: var(--dark); white-space: nowrap; }
.doc-toolbar-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.doc-toolbar-actions form { margin: 0; }
.doc-toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }
.doc-toolbar-sep:last-child { display: none; }
/* ---- Marketing: tabs, summary strip, pipeline, outreach panel, newsletter cards ---- */
.mkt-tabs { display: flex; gap: 6px; align-items: center; padding: 8px 10px; }
.mkt-tabs-new { margin-left: auto; }
.mkt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-bottom: 10px; }
.mkt-kpi { display: grid; gap: 2px; text-align: left; background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: var(--r-md); padding: 8px 12px; color: inherit; font: inherit; text-decoration: none; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
button.mkt-kpi, a.mkt-kpi { cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
button.mkt-kpi:hover, a.mkt-kpi:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(15,23,42,.08); transform: translateY(-1px); text-decoration: none; }
.mkt-kpi-v { font-size: var(--fs-xl); font-weight: 800; line-height: 1.1; color: var(--dark); }
.mkt-kpi-v small { font-size: var(--fs-xs); font-weight: 700; color: var(--success-deep); margin-left: 3px; }
.mkt-kpi-l { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--grey); }
.mkt-kpi-blue { border-left-color: var(--primary); } .mkt-kpi-green { border-left-color: var(--success-deep); } .mkt-kpi-red { border-left-color: var(--red); }
.mkt-pipe { display: grid; grid-template-columns: repeat(4, 1fr) 0.8fr; gap: 8px; padding: 10px; }
.mkt-stage { display: grid; gap: 4px; text-align: left; background: var(--hover-bg); border: 1px solid transparent; border-radius: calc((var(--r-sm) + var(--r-md)) / 2); padding: 8px 10px; cursor: pointer; color: inherit; font: inherit; transition: border-color .12s, background .12s; }
.mkt-stage:hover { border-color: var(--border); background: var(--card); }
.mkt-stage.active { border-color: var(--primary); background: var(--card); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 14%, transparent); }
.mkt-stage-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.mkt-stage-l { font-size: var(--fs-xs); font-weight: 700; color: var(--grey); text-transform: uppercase; letter-spacing: .04em; }
.mkt-stage-n { font-size: var(--fs-lg); font-weight: 800; }
.mkt-stage-bar { height: 5px; border-radius: calc(var(--r-sm) * .625); background: var(--border); overflow: hidden; }
.mkt-stage-bar span { display: block; height: 100%; border-radius: calc(var(--r-sm) * .625); }
.mkt-stage-p { font-size: var(--fs-2xs); color: var(--grey-light); }
.mkt-tone-grey .mkt-stage-bar span { background: #94A3B8; } .mkt-tone-blue .mkt-stage-bar span { background: var(--primary); }
.mkt-tone-amber .mkt-stage-bar span { background: var(--amber); } .mkt-tone-green .mkt-stage-bar span { background: var(--success-deep); }
.mkt-tone-red .mkt-stage-bar span { background: var(--red); }
#mktWs .ws-row { border-left-width: 3px; }
.mkt-row-blue { border-left-color: color-mix(in srgb, var(--primary) 55%, transparent) !important; }
.mkt-row-amber { border-left-color: color-mix(in srgb, var(--amber) 70%, transparent) !important; }
.mkt-row-green { border-left-color: color-mix(in srgb, var(--success-deep) 60%, transparent) !important; }
#mktWs .ws-row.selected { border-left-color: var(--primary) !important; }
.mkt-ago { font-size: var(--fs-2xs); color: var(--grey-light); white-space: nowrap; }
.mkt-ago-late { color: var(--red); font-weight: 700; }
.mkt-warn { color: var(--red); }
.mkt-steps { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.mkt-step { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--card); color: var(--grey); border-radius: var(--r-pill); padding: 3px 11px 3px 4px; font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; }
.mkt-step:hover:not([disabled]) { border-color: var(--primary); color: var(--primary); }
.mkt-step[disabled] { cursor: default; }
.mkt-step-dot { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--hover-bg); font-size: var(--fs-2xs); font-weight: 800; }
.mkt-step.done { color: var(--success-deep); border-color: color-mix(in srgb, var(--success-deep) 35%, var(--border)); }
.mkt-step.done .mkt-step-dot { background: var(--success-deep); color: #fff; }
.mkt-step.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.mkt-step.current .mkt-step-dot { background: rgba(255,255,255,.25); color: #fff; }
.mkt-step-lost { margin-left: auto; }
.mkt-step-lost.current { background: var(--red); border-color: var(--red); }
.mkt-inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: var(--hover-bg); border-radius: var(--r-sm); padding: 8px; }
.mkt-inline-form[hidden] { display: none; }
.mkt-inline-form input[type=text] { flex: 1; min-width: 200px; width: auto; }
.mkt-inline-label { font-size: var(--fs-sm); }
.mkt-panel-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); gap: 8px; align-items: start; }
.mkt-card { margin: 0 0 8px; }
.mkt-log { display: grid; gap: 6px; margin-bottom: 10px; }
.mkt-kinds { display: flex; gap: 4px; flex-wrap: wrap; }
.mkt-kind { border: 1px solid var(--border); background: var(--card); border-radius: calc(var(--r-sm) * .875); padding: 3px 9px; font: inherit; font-size: var(--fs-xs); cursor: pointer; color: var(--grey); }
.mkt-kind.active { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--card)); font-weight: 700; }
.mkt-log-row { display: flex; gap: 6px; }
.mkt-log-row input { flex: 1; width: auto; }
.mkt-empty { color: var(--grey); font-size: var(--fs-sm); padding: 8px 0; }
.mkt-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.mkt-timeline::before { content: ""; position: absolute; left: 12px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.mkt-tl { display: flex; gap: 10px; padding: 6px 0; position: relative; }
.mkt-tl-icon { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; background: var(--card); border: 2px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; z-index: 1; }
.mkt-tl-blue .mkt-tl-icon { border-color: var(--primary); } .mkt-tl-amber .mkt-tl-icon { border-color: var(--amber); }
.mkt-tl-green .mkt-tl-icon { border-color: var(--success-deep); } .mkt-tl-red .mkt-tl-icon { border-color: var(--red); }
.mkt-tl-body { flex: 1; min-width: 0; }
.mkt-tl-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: var(--fs-sm); }
.mkt-tl-head .text-muted { font-size: var(--fs-2xs); }
.mkt-tl-text { font-size: var(--fs-sm); margin-top: 2px; white-space: pre-line; }
.mkt-sub { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mkt-sub form { margin: 0; }
.mkt-eng { display: flex; gap: 12px; font-size: var(--fs-xs); color: var(--grey); margin-bottom: 6px; }
.mkt-eng strong { color: var(--dark); font-size: var(--fs-md); }
.mkt-sends, .mkt-people { list-style: none; margin: 0; padding: 0; }
.mkt-sends li { display: flex; justify-content: space-between; gap: 6px; align-items: center; padding: 5px 0; border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.mkt-send-subj { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mkt-people li { padding: 5px 0; border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.mkt-people li:first-child, .mkt-sends li:first-child { border-top: none; }
.mkt-nl-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.mkt-nl-list { display: grid; gap: 8px; }
.mkt-nl { display: grid; grid-template-columns: minmax(0, 1fr) 220px auto; gap: 14px; align-items: center; border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: var(--r-md); padding: 10px 14px; background: var(--card); transition: box-shadow .12s; }
.mkt-nl:hover { box-shadow: 0 4px 14px rgba(15,23,42,.07); }
.mkt-nl[hidden] { display: none; }
.mkt-nl-blue { border-left-color: var(--primary); } .mkt-nl-green { border-left-color: var(--success-deep); } .mkt-nl-amber { border-left-color: var(--amber); }
.mkt-nl-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: var(--fs-md); min-width: 0; }
.mkt-nl-title a { color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mkt-nl-title a:hover { color: var(--primary); }
.mkt-nl-meta { font-size: var(--fs-xs); margin-top: 3px; }
.mkt-nl-stats { display: grid; gap: 4px; }
.mkt-meter { display: grid; grid-template-columns: 48px 1fr 34px; align-items: center; gap: 6px; font-size: var(--fs-2xs); color: var(--grey); }
.mkt-meter-bar { height: 6px; border-radius: calc(var(--r-sm) * .75); background: var(--border); overflow: hidden; }
.mkt-meter-bar span { display: block; height: 100%; background: var(--primary); border-radius: calc(var(--r-sm) * .75); }
.mkt-meter-click .mkt-meter-bar span { background: var(--success-deep); }
.mkt-meter-v { text-align: right; font-weight: 700; color: var(--dark); }
.mkt-nl-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.mkt-nl-actions form { margin: 0; }
.mkt-btn-danger { color: var(--red); }
.mkt-btn-danger:hover { border-color: var(--red); background: color-mix(in srgb, var(--red) 6%, var(--card)); }
.mkt-empty-big { text-align: center; padding: 30px 16px; color: var(--grey); }
.mkt-empty-big .icon { font-size: 34px; opacity: .45; }
@media (max-width: 900px) {
  .mkt-pipe { grid-template-columns: repeat(2, 1fr); }
  .mkt-panel-grid { grid-template-columns: 1fr; }
  .mkt-nl { grid-template-columns: 1fr; }
  .mkt-nl-actions { justify-content: flex-start; }
  .mkt-step-lost { margin-left: 0; }
}
.mkt-noemail { font-size: 11px; color: var(--grey-light); opacity: .55; text-decoration: line-through; }

/* Text size picker (sidebar footer, Aa) */
.ts-wrap { position: relative; }
.ts-menu { position: absolute; bottom: calc(100% + 8px); left: -120px; width: 220px; background: var(--card); color: var(--dark); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 10px 30px rgba(15,23,42,.22); padding: 6px; z-index: 60; }
.ts-menu[hidden] { display: none; }
.ts-menu-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--grey); padding: 4px 8px 6px; }
.ts-opt { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none; border-radius: calc(var(--r-sm) * .875); padding: 6px 8px; font: inherit; font-size: 12px; color: var(--dark); cursor: pointer; text-align: left; }
.ts-opt:hover { background: var(--hover-bg); }
.ts-opt.active { background: color-mix(in srgb, var(--primary) 10%, var(--card)); color: var(--primary); font-weight: 700; }
.ts-opt .ts-a { width: 26px; text-align: center; font-weight: 700; line-height: 1; }
.ts-opt .ts-check { margin-left: auto; visibility: hidden; }
.ts-opt.active .ts-check { visibility: visible; }
.ts-foot { border-top: 1px solid var(--border); margin-top: 4px; padding: 6px 8px 2px; font-size: 10px; color: var(--grey); }
.ts-foot button { background: none; border: none; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
/* Sidebar footer with the Aa text-size button: the name shortens with "..." instead of running under the buttons. */
.sidebar-footer { gap: 8px; padding-left: 16px; padding-right: 14px; }
.sidebar-user { flex: 1; min-width: 0; }
.sidebar-user > div:last-child { min-width: 0; }
.sidebar-user-name, .sidebar-user-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-wrap, .sidebar-footer .logout { flex: none; }
.rg-preview { display: grid; gap: 2px; background: var(--hover-bg); border: 1px dashed var(--border); border-radius: var(--r-sm); padding: 8px 10px; font-size: var(--fs-sm); }
.rg-preview strong { font-size: var(--fs-lg); }
.ts-lang { width: calc(100% - 16px); margin: 0 8px 4px; min-height: 26px; font-size: 12px; }
/* Administration > Translations */
.tr-progress { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; font-size: var(--fs-sm); }
.tr-bar { flex: 0 0 220px; height: 8px; border-radius: var(--r-sm); background: var(--border); overflow: hidden; }
.tr-bar span { display: block; height: 100%; background: var(--success-deep); }
.tr-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tr-search input { min-width: 220px; width: auto; }
.tr-import { display: flex; gap: 6px; align-items: center; margin: 0; }
.tr-import input[type=file] { max-width: 220px; }
.tr-table td { vertical-align: top; }
.tr-src { white-space: pre-line; color: var(--dark); }
.tr-input { min-height: 28px; resize: vertical; transition: background-color .3s; }
.tr-input.saving { opacity: .6; }
.tr-input.saved { background: color-mix(in srgb, var(--success-deep) 12%, var(--card)); }

/* Address filling: suggestion list under a street or ZIP field (app.js) */
.addr-suggest { position: absolute; z-index: 1150; max-width: 520px; background: var(--card, #fff); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 4px 0; font-size: var(--fs-base, 12px); }
.addr-suggest-item { padding: 7px 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addr-suggest-item:hover, .addr-suggest-item.active { background: var(--hover-bg, #F3F4F6); }

/* ---- Time Clock & Payroll (views/attendance, the clock card on Timesheets) ---- */
.att-fields { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: end; }
.att-fields .form-group { min-width: 190px; }
.att-inline h4 { margin: 0 0 8px; }
.att-shift { display: inline-block; padding: 1px 8px; margin: 1px 2px 1px 0; border-radius: var(--r-md); background: var(--bg, #F3F4F6); border: 1px solid var(--border, #E5E7EB); white-space: nowrap; }
.att-shift.att-hand { border-style: dashed; }
.att-weekend td { background: rgba(0, 0, 0, .018); }
.att-removed td { color: var(--grey-light); }
.att-removed td a { color: inherit; }
.att-new td { background: #FEF9E7; }
.att-void { display: flex; gap: 6px; justify-content: flex-end; }
.att-void input[type=text] { width: 150px; }
.att-sample { max-height: 260px; overflow: auto; }
.att-sample td, .att-sample th { white-space: nowrap; font-size: var(--fs-sm); }
.att-sample pre, .att-ruler { margin: 0; font-family: Consolas, Menlo, monospace; font-size: 12.5px; }
.att-ruler { color: var(--grey-light); padding: 4px 13px; }
.att-employees input[type=text], .att-employees select { margin: 0; }

/* Retention details: backups by week and by day, each opened with its plus */
.ret-tree details { border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 8px; background: var(--card); }
.ret-tree details.ret-day { margin: 6px 10px 6px 34px; }
.ret-tree summary { list-style: none; cursor: pointer; padding: 10px 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ret-tree summary::-webkit-details-marker { display: none; }
.ret-tree details.ret-week > summary { background: var(--hover-bg); border-radius: var(--r-md); }
.ret-tree .ret-pm { flex: 0 0 22px; width: 22px; height: 22px; border-radius: calc(var(--r-sm) * .75); border: 1.5px solid var(--primary); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; line-height: 1; }
.ret-tree .ret-pm::before { content: '+'; }
.ret-tree details[open] > summary > .ret-pm::before { content: '\2212'; }
.ret-tree .ret-sum { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ret-tree details.ret-day .table-wrap { padding: 0 10px 10px; }

/* Backup plan: the on/off switch */
.kr-switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.kr-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kr-switch-track { width: 52px; height: 28px; border-radius: var(--r-pill); background: var(--border); position: relative; transition: background .15s ease; flex: 0 0 52px; }
.kr-switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .15s ease; }
.kr-switch input:checked + .kr-switch-track { background: var(--success); }
.kr-switch input:checked + .kr-switch-track::after { left: 27px; }
.kr-switch input:focus-visible + .kr-switch-track { outline: 2px solid var(--primary); outline-offset: 2px; }
.kr-switch input:disabled + .kr-switch-track { opacity: .5; }
.plan-live { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--hover-bg); }

/* Platform Pipeline Map: a box with a plus opens into its screens (the panel takes the place of the map) */
.pm-caption-plus { margin-top: -6px; }
.pm-plus-key { display: inline-flex; width: 16px; height: 16px; border-radius: 50%; background: #F6B818; color: #1E1B4B; font-weight: 800; font-size: 12px; align-items: center; justify-content: center; line-height: 1; vertical-align: -2px; }
.pipeline-map-wrap.pm-inside { overflow: visible; }
.pm-inner { margin-top: 16px !important; position: relative; }
.pm-inner { --pm-c: #2F3B52; --pm-c2: #46536E; max-width: 880px; margin: 0 auto; border-radius: var(--r-lg); overflow: hidden; background: var(--card); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(15, 23, 42, .10); animation: pmInnerIn .28s cubic-bezier(.2, .8, .2, 1); }
.pm-inner[data-tone="quote"] { --pm-c: #5A5B9F; --pm-c2: #7C7DC4; }
.pm-inner[data-tone="po"] { --pm-c: #0F4C81; --pm-c2: #2A74B5; }
.pm-inner[data-tone="wo"] { --pm-c: #00785C; --pm-c2: #1FA584; }
.pm-inner[data-tone="inv"] { --pm-c: #BB2649; --pm-c2: #DD5275; }
@keyframes pmInnerIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.pm-inner-head { position: relative; padding: 18px 22px 20px; color: #fff; background: linear-gradient(120deg, var(--pm-c) 0%, var(--pm-c2) 100%); border-bottom: 4px solid #F6B818; overflow: hidden; }
.pm-inner-head::after { content: ''; position: absolute; right: -70px; top: -90px; width: 240px; height: 240px; border-radius: 50%; border: 34px solid rgba(255, 255, 255, .10); pointer-events: none; }
.pm-inner-back { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill); border: 1px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .14); color: #fff; font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; transition: background .15s ease, transform .15s ease; }
.pm-inner-back:hover, .pm-inner-back:focus-visible { background: rgba(255, 255, 255, .28); transform: translateX(-2px); outline: none; }
.pm-inner-title { position: relative; z-index: 1; margin-top: 12px; font-size: 22px; font-weight: 800; letter-spacing: .2px; display: flex; align-items: center; gap: 10px; }
.pm-inner-desc { position: relative; z-index: 1; margin: 6px 0 0; max-width: 760px; font-size: var(--fs-sm); line-height: 1.5; color: rgba(255, 255, 255, .92); }
.pm-inner-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; padding: 18px 20px 22px; background: linear-gradient(180deg, color-mix(in srgb, var(--pm-c) 5%, var(--card)), var(--card)); }
.pm-inner-group { display: flex; flex-direction: column; gap: 8px; animation: pmInnerIn .34s cubic-bezier(.2, .8, .2, 1) backwards; }
.pm-inner-group:nth-child(2) { animation-delay: .04s; } .pm-inner-group:nth-child(3) { animation-delay: .08s; } .pm-inner-group:nth-child(4) { animation-delay: .12s; } .pm-inner-group:nth-child(5) { animation-delay: .16s; }
.pm-inner-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--pm-c); padding-left: 2px; }
.pm-inner-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--pm-c); color: var(--text); font-weight: 600; font-size: var(--fs-base); text-decoration: none; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease; }
a.pm-inner-btn:hover, a.pm-inner-btn:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(15, 23, 42, .14); background: color-mix(in srgb, var(--pm-c) 8%, var(--card)); border-color: var(--pm-c); outline: none; text-decoration: none; }
.pm-inner-go { color: var(--pm-c); font-weight: 800; transition: transform .16s ease; }
a.pm-inner-btn:hover .pm-inner-go, a.pm-inner-btn:focus-visible .pm-inner-go { transform: translateX(4px); }
.pm-inner-btn.pm-locked { opacity: .5; border-left-color: var(--border); cursor: default; }
@media (prefers-reduced-motion: reduce) { .pm-inner, .pm-inner-group { animation: none; } .pm-inner-btn, .pm-inner-go, .pm-inner-back { transition: none; } }

/* Platform Pipeline Map: the opened panel, compact */
.pm-inner { border-radius: var(--r-lg); margin-top: 12px !important; }
.pm-inner-head { padding: 10px 16px 12px; border-bottom-width: 3px; display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; }
.pm-inner-head::after { right: -50px; top: -70px; width: 150px; height: 150px; border-width: 22px; }
.pm-inner-back { grid-column: 2; grid-row: 1; padding: 3px 10px; font-size: 12px; }
.pm-inner-title { grid-column: 1; grid-row: 1; margin-top: 0; font-size: 16px; gap: 8px; }
.pm-inner-desc { grid-column: 1 / -1; margin-top: 4px; font-size: 12px; line-height: 1.4; max-width: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pm-inner-desc:hover { -webkit-line-clamp: unset; }
.pm-inner-groups { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 10px 14px 14px; }
.pm-inner-group { gap: 5px; }
.pm-inner-label { font-size: 10px; }
.pm-inner-btn { padding: 6px 10px; border-radius: var(--r-sm); border-left-width: 3px; font-size: 12.5px; gap: 6px; }

/* Platform Pipeline Map: on a click the map moves aside and the screens of the box line up beside it
   (on the left of the map for a box in its left half, on the right for one in its right half) */
.pipeline-map-wrap { display: flex; justify-content: center; align-items: flex-start; flex-wrap: wrap; gap: 0; }
.pipeline-map-wrap > .pipeline-map { flex: 0 1 880px; margin: 0; transition: flex-basis .38s cubic-bezier(.2, .8, .2, 1); }
.pipeline-map-wrap.pm-inside { gap: 14px; overflow: visible; }
.pipeline-map-wrap.pm-inside > .pipeline-map { flex: 1 1 54%; min-width: min(430px, 100%); max-width: none; }
.pipeline-map-wrap.pm-inside > .pm-inner { flex: 1 1 36%; min-width: min(300px, 100%); max-width: none; margin: 0 !important; align-self: stretch; animation: pmSideIn .38s cubic-bezier(.2, .8, .2, 1); }
.pipeline-map-wrap.pm-inside.pm-side-left > .pm-inner { order: -1; animation-name: pmSideInLeft; }
@keyframes pmSideIn { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes pmSideInLeft { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
.pipeline-map-wrap.pm-inside > .pm-inner .pm-inner-groups { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
@media (prefers-reduced-motion: reduce) { .pipeline-map-wrap > .pipeline-map { transition: none; } .pipeline-map-wrap.pm-inside > .pm-inner { animation: none; } }

/* Platform Pipeline Map: the screens are lettered like the boxes of the map (same font, small capitals) */
.pm-inner, .pm-inner-btn, .pm-inner-back, .pm-inner-title, .pm-inner-label, .pm-inner-desc { font-family: var(--font); }
.pm-inner-title { font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.pm-inner-desc { font-size: 10.5px; line-height: 1.38; }
.pm-inner-back { font-size: 10.5px; padding: 2px 9px; letter-spacing: .25px; }
.pm-inner-label { font-size: 9px; letter-spacing: .5px; }
.pm-inner-btn { font-size: 10px; font-weight: 700; letter-spacing: .25px; text-transform: uppercase; padding: 5px 8px; border-radius: calc(var(--r-sm) * .875); line-height: 1.25; }
.pm-inner-go { font-size: 11px; }
.pm-inner-groups { gap: 8px 10px; padding: 9px 12px 12px; }
.pm-inner-group { gap: 4px; }
.pipeline-map-wrap.pm-inside > .pm-inner { flex: 1 1 30%; min-width: min(260px, 100%); }
.pipeline-map-wrap.pm-inside > .pipeline-map { flex: 1 1 60%; }
.pipeline-map-wrap.pm-inside > .pm-inner .pm-inner-groups { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

/* Platform Pipeline Map: a slower, softer move when the screens open beside the map */
.pipeline-map-wrap > .pipeline-map { transition: flex-basis .55s cubic-bezier(.22, 1, .36, 1); }
.pipeline-map-wrap.pm-inside > .pm-inner { animation-duration: .55s; animation-timing-function: cubic-bezier(.22, 1, .36, 1); }
@keyframes pmSideIn { from { opacity: 0; transform: translateX(40px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes pmSideInLeft { from { opacity: 0; transform: translateX(-40px) scale(.97); } to { opacity: 1; transform: none; } }
.pm-inner-group { animation-duration: .5s; }
.pm-link rect { transition: filter .35s ease, stroke-width .25s ease; }
/* Map boxes follow the Corners setting (SVG rx as a CSS property; the rx attribute is only the fallback) */
.pipeline-map rect.pm-found, .pipeline-map rect.pm-rib, .pipeline-map rect.pm-node { rx: var(--r-md); }
.pipeline-map rect.pm-head { rx: var(--r-lg); }

/* Platform Pipeline Map: the screens, one size smaller */
.pm-inner-head { padding: 8px 12px 9px; }
.pm-inner-title { font-size: 11.5px; gap: 6px; }
.pm-inner-desc { font-size: 9.5px; line-height: 1.35; margin-top: 3px; }
.pm-inner-back { font-size: 9.5px; padding: 1px 8px; }
.pm-inner-label { font-size: 8px; }
.pm-inner-btn { font-size: 8.8px; padding: 4px 7px; border-radius: calc(var(--r-sm) * .75); border-left-width: 3px; gap: 5px; line-height: 1.2; }
.pm-inner-go { font-size: 9.5px; }
.pm-inner-groups { gap: 6px 8px; padding: 7px 10px 10px; }
.pm-inner-group { gap: 3px; }
.pipeline-map-wrap.pm-inside > .pm-inner { flex: 0 1 25%; min-width: min(230px, 100%); align-self: flex-start; }
.pipeline-map-wrap.pm-inside > .pipeline-map { flex: 1 1 66%; }
.pipeline-map-wrap.pm-inside > .pm-inner .pm-inner-groups { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }

/* Platform Pipeline Map: the map is never resized. It keeps the width it had and only slides aside; the
   screens take the room beside it (and go under it where there is none). */
.pipeline-map-wrap > .pipeline-map { transition: none; }
.pipeline-map-wrap.pm-inside > .pipeline-map { flex: 0 0 var(--pm-map-w, 880px); width: var(--pm-map-w, 880px); min-width: var(--pm-map-w, 880px); max-width: none; }
.pipeline-map-wrap.pm-inside { gap: 12px; }
.pipeline-map-wrap.pm-inside > .pm-inner { flex: 1 1 0; min-width: min(165px, 100%); max-width: 300px; align-self: flex-start; overflow: hidden; }
.pipeline-map-wrap.pm-inside > .pm-inner .pm-inner-groups { grid-template-columns: repeat(auto-fit, minmax(min(100px, 100%), 1fr)); }
.pm-inner-btn-text { min-width: 0; overflow-wrap: anywhere; }

/* The map in the pop-up of the top bar: when a box opens, the pop-up widens to the side for its screens
   instead of growing downward */
.record-modal-box { transition: max-width .5s cubic-bezier(.22, 1, .36, 1), width .5s cubic-bezier(.22, 1, .36, 1); }
.record-modal-box:has(.pipeline-map-wrap.pm-inside) { max-width: min(1320px, 97vw) !important; width: min(1320px, 97vw) !important; }
.record-modal-body .pipeline-map-wrap.pm-inside { flex-wrap: nowrap; }
.record-modal-body .pipeline-map-wrap.pm-inside > .pm-inner { min-width: 230px; max-width: 330px; }
@media (max-width: 900px) { .record-modal-body .pipeline-map-wrap.pm-inside { flex-wrap: wrap; } }

/* Platform Pipeline Map on a phone: with a box open the map and its screens scroll sideways inside the card, never the page */
@media (max-width: 900px) { .pipeline-map-wrap.pm-inside { overflow-x: auto; } }

/* Mail account edit form sits in a wide table row: on a phone keep it inside the card so hints wrap. */
@media (max-width: 700px) { .smtp-edit-form { width: calc(100vw - 110px); max-width: 100%; } .smtp-edit-form .field-hint { white-space: normal; } }

/* ---------- Setup wizard (installer + Change business profile): stepper, type cards, Yes/No toggles, review rows ---------- */
.bp-stepper { list-style: none; display: flex; gap: 6px; margin: 4px 0 18px; padding: 0; }
.bp-stepper li { flex: 1 1 0; display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--grey-light); padding-bottom: 8px; border-bottom: 3px solid var(--border); min-width: 0; }
.bp-stepper li.current { color: var(--dark); font-weight: 600; border-bottom-color: var(--primary); }
.bp-stepper li.done { color: var(--success-deep); border-bottom-color: var(--success); }
.bp-dot { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-xs); font-weight: 700; background: var(--hover-bg); color: var(--grey); }
.bp-stepper li.current .bp-dot { background: var(--primary); color: #fff; }
.bp-stepper li.done .bp-dot { background: var(--success); color: #fff; }
.bp-step-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-intro { font-size: var(--fs-sm); margin: -4px 0 12px; }
.bp-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.bp-type { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; background: var(--card); text-transform: none; letter-spacing: 0; font-weight: 500; margin: 0; color: var(--dark); }
.bp-type:hover { border-color: var(--primary); }
.bp-type:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--card)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.bp-type input { margin-top: 3px; flex: 0 0 auto; }
.bp-type-body { display: block; min-width: 0; }
.bp-type-body strong { display: block; font-size: var(--fs-base); }
.bp-type-desc { display: block; font-size: var(--fs-sm); color: var(--grey); line-height: 1.45; margin-top: 2px; }
.bp-type-note { display: block; font-size: var(--fs-xs); color: var(--grey-light); line-height: 1.4; margin-top: 6px; font-weight: 400; }
.bp-q { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.bp-q[hidden] { display: none; }
.bp-q-child { margin-left: 22px; padding-left: 14px; border-left: 3px solid var(--border); }
.bp-q-label { font-weight: 600; font-size: var(--fs-base); color: var(--dark); }
.bp-seg { display: inline-flex; flex: 0 0 auto; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; position: relative; }
.bp-seg label { margin: 0; text-transform: none; letter-spacing: 0; cursor: pointer; }
.bp-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bp-seg span { display: block; min-width: 56px; text-align: center; padding: 6px 14px; font-size: var(--fs-sm); font-weight: 600; color: var(--grey); background: var(--card); }
.bp-seg label + label span { border-left: 1px solid var(--border); }
.bp-seg input:checked + span { background: var(--primary); color: #fff; }
.bp-seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.bp-summary { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 12px; font-size: var(--fs-sm); }
.bp-summary-k { color: var(--grey-light); margin-right: 4px; }
.bp-cat { margin: 18px 0 6px; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--grey); }
.bp-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bp-row { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 12px; background: var(--card); min-width: 0; }
.bp-row label.check-label { margin: 0; flex-wrap: wrap; row-gap: 4px; }
.bp-row label.check-label .badge { margin-left: 8px; }
.bp-row.bp-locked { background: var(--hover-bg); }
.bp-desc { font-size: var(--fs-xs); color: var(--grey-light); margin: 2px 0 0 22px; line-height: 1.4; }
.bp-note { font-size: var(--fs-xs); color: var(--grey); margin: 4px 0 0 22px; }
.bp-note-warn { color: var(--amber); }
.bp-areas { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; }
.bp-areas li { padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--r-pill); font-size: var(--fs-sm); background: var(--hover-bg); }
.bp-later { font-size: var(--fs-sm); margin: 10px 0 0; }
.bp-chosen { font-size: var(--fs-sm); margin: 0 0 12px; color: #fff; }
.bp-profile-line { font-size: var(--fs-sm); color: var(--grey); margin: -4px 0 8px; }
.install-done-wrap { max-width: 560px; }
.bp-done-count { font-weight: 600; margin: 0 0 12px; }
.bp-done-areas { text-align: left; margin: 0 0 14px; font-size: var(--fs-sm); }
@media (max-width: 640px) {
  .bp-rows { grid-template-columns: 1fr; }
  .bp-q { flex-direction: column; align-items: flex-start; gap: 8px; }
  .bp-q-child { margin-left: 8px; }
  .bp-stepper { gap: 4px; }
  .bp-stepper li { flex-direction: column; gap: 4px; text-align: center; font-size: var(--fs-2xs); }
  .bp-step-label { white-space: normal; }
}
/* the installer sits on a dark background */
.install-body .bp-stepper li { color: rgba(255,255,255,0.6); border-bottom-color: rgba(255,255,255,0.22); }
.install-body .bp-stepper li.current { color: #fff; border-bottom-color: var(--gold, #F5B301); }
.install-body .bp-stepper li.done { color: rgba(255,255,255,0.85); border-bottom-color: var(--success); }
.install-body .bp-dot { background: rgba(255,255,255,0.16); color: #fff; }

/* ---------- Inventory screens (items tabs, warehouses & bins, reorder list) ---------- */
.inv-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.inv-sub { margin: 14px 0 6px; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--grey); }
.inv-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inv-actions form { margin: 0; display: inline-block; }
.inv-why { margin: 10px 0 0; padding-left: 18px; font-size: var(--fs-sm); }
.inv-why-line { font-size: var(--fs-xs); margin-top: 4px; text-align: right; }
.inv-inline-form { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); align-items: end; }
.inv-inline-btns { display: flex; gap: 6px; align-items: center; }
.item-tab[hidden], .form-actions[hidden], .btn[hidden], .form-group[hidden] { display: none; }
select option[hidden] { display: none; }
/* Business profile review: core and standard modules folded into one row. */
.bp-rows.bp-rows-1 { grid-template-columns: 1fr; }
.bp-always { border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--hover-bg); margin: 0 0 4px; }
.bp-always-toggle { display: flex; align-items: baseline; gap: 12px; width: 100%; text-align: left; background: none; border: 0; padding: 10px 14px; cursor: pointer; font: inherit; color: var(--dark); }
.bp-always-title { font-weight: 700; flex: 0 0 auto; }
.bp-always-names { flex: 1 1 auto; min-width: 0; font-size: var(--fs-sm); color: var(--grey); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-always-more { flex: 0 0 auto; font-size: var(--fs-sm); color: var(--primary); font-weight: 600; }
.bp-always.open .bp-always-names { white-space: normal; }
.bp-always-list { list-style: none; margin: 0; padding: 0 14px 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
.bp-always-list[hidden] { display: none; }
.bp-always-list li { font-size: var(--fs-sm); min-width: 0; }
.bp-always-list .badge { margin-left: 6px; }
.bp-desc-inline { display: block; font-size: var(--fs-xs); color: var(--grey-light); line-height: 1.4; }
@media (max-width: 720px) {
  .bp-always-toggle { flex-wrap: wrap; row-gap: 4px; }
  .bp-always-names { flex-basis: 100%; order: 3; }
  .bp-always-list { grid-template-columns: 1fr; }
  .inv-why-line { text-align: left; }
}

/* ---------- Manufacturing (work centres, bills of materials, production orders) ---------- */
.mfg-dim, tr.mfg-dim td { opacity: .6; }
.mfg-fig { font-size: var(--fs-xl); font-weight: 800; }
.mfg-fig-sm { font-size: var(--fs-md); font-weight: 700; }
.doc-toolbar-label.mfg-label { white-space: normal; overflow-wrap: anywhere; }
.doc-toolbar-actions .btn.active { box-shadow: inset 0 0 0 2px var(--primary); }
.mfg-inline-form { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mfg-panel[hidden], .bom-tab[hidden], .mo-tab[hidden] { display: none; }
table.mfg-edit td { vertical-align: top; }
table.mfg-edit td input, table.mfg-edit td select { min-width: 70px; }
table.mfg-edit td input[type=text] { min-width: 120px; }
.mfg-remove { display: inline-block; padding: 2px 8px; font-size: var(--fs-lg); line-height: 1; color: var(--red); text-decoration: none; }
.mfg-indent { display: inline-flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.mfg-branch { color: var(--grey-light); }
table.mfg-tree tr.mfg-byprod td { font-style: italic; }
table.data-table tr.mfg-short td { background: color-mix(in srgb, var(--amber) 10%, var(--card)); }
table.data-table tr.mfg-current td { background: color-mix(in srgb, var(--primary) 7%, var(--card)); }
table.data-table tr.mfg-total td, table.data-table tfoot tr.mfg-total td { border-top: 2px solid var(--border); background: var(--hover-bg); }
table.data-table td.mfg-blank { border-bottom: 1px solid var(--dark); min-width: 60px; height: 26px; }
.mfg-pop { position: relative; }
.mfg-pop > summary { list-style: none; cursor: pointer; }
.mfg-pop > summary::-webkit-details-marker { display: none; }
.mfg-pop form { position: absolute; right: 0; z-index: 5; display: flex; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.mfg-pop form input[type=text] { min-width: 200px; }
.mfg-switches { display: grid; gap: 12px; }
.mfg-switch { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); }
@media (max-width: 700px) {
  .mfg-pop form { position: static; flex-wrap: wrap; margin-top: 6px; box-shadow: none; }
  .mfg-pop form input[type=text] { min-width: 0; width: 100%; }
}

/* ---------- Barcodes and scanning (scan field, camera, item barcodes, labels, station) ---------- */
.scan-field { margin: 0 0 8px; min-width: 0; }
.scan-label { display: block; font-size: var(--fs-xs); font-weight: 700; color: var(--grey); margin-bottom: 4px; }
.scan-row { display: flex; gap: 6px; align-items: stretch; min-width: 0; }
.scan-row .scan-input { flex: 1 1 auto; min-width: 0; width: 100%; transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
.scan-cam-btn { display: none; flex: none; gap: 6px; padding: 0 12px; }
.scan-has-cam .scan-cam-btn { display: inline-flex; }
.scan-snd { flex: none; padding: 0 9px; min-width: 36px; }
.scan-snd .scan-snd-on { display: none; }
.scan-snd[aria-pressed="true"] .scan-snd-on { display: inline; }
.scan-snd[aria-pressed="true"] .scan-snd-off { display: none; }
.scan-snd.active { color: var(--primary); border-color: var(--primary); }
.scan-result { min-height: 1.4em; margin-top: 4px; font-size: var(--fs-sm); color: var(--grey); overflow-wrap: anywhere; }
.scan-result-ok { color: var(--success-deep); font-weight: 600; }
.scan-result-fail { color: var(--red); font-weight: 600; }
.scan-input.scan-ok { border-color: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent); background-color: color-mix(in srgb, var(--success) 8%, var(--card)); }
.scan-input.scan-fail { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 25%, transparent); background-color: color-mix(in srgb, var(--red) 8%, var(--card)); }
.scan-input.scan-busy { opacity: .7; }
.scan-bar { margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.scan-bar .scan-field { flex: 1 1 280px; margin: 0; }
.scan-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 14px; }
tr.scan-row-hit td { background: color-mix(in srgb, var(--success) 14%, var(--card)); transition: background-color .4s ease; }
.vp-summary { margin-top: 8px; font-weight: 700; min-height: 1.4em; }
.vp-extra { margin: 8px 0 0; }
.vp-extra[hidden] { display: none; }

/* the box in the top bar: the full box on a desktop, an icon that opens the box on a phone */
.top-scan { display: flex; align-items: center; }
.top-scan-toggle { display: none; }
.top-scan .scan-form { margin: 0; }
.top-scan .scan-field { margin: 0; }
.top-scan .scan-input { width: 190px; padding: 8px 10px; }
.top-scan .scan-cam-text, .top-scan .scan-result { display: none; }
.top-scan .scan-cam-btn { min-height: 36px; padding: 0 10px; }

/* camera window: full screen on a phone */
html.scan-cam-lock { overflow: hidden; }
.scan-cam-overlay { position: fixed; inset: 0; z-index: 1100; background: rgba(10, 14, 20, .72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.scan-cam-overlay[hidden] { display: none; }
.scan-cam-box { background: var(--card); color: var(--dark); border-radius: var(--r-lg); width: 100%; max-width: 520px; max-height: 100%; overflow: auto; display: flex; flex-direction: column; box-shadow: 0 16px 48px rgba(0,0,0,.4); }
.scan-cam-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.scan-cam-view { position: relative; background: #000; aspect-ratio: 4 / 3; overflow: hidden; }
.scan-cam-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-cam-frame { position: absolute; inset: 22% 10%; border: 3px solid rgba(255,255,255,.85); border-radius: var(--r-md); box-shadow: 0 0 0 9999px rgba(0,0,0,.28); pointer-events: none; }
.scan-cam-status { padding: 10px 14px; font-size: var(--fs-md); min-height: 2.6em; }
.scan-cam-opts { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0 14px 14px; }
.scan-cam-opts label[hidden] { display: none; }
@media (max-width: 600px) {
  .scan-cam-overlay { padding: 0; align-items: stretch; }
  .scan-cam-box { max-width: none; border-radius: 0; height: 100%; }
  .scan-cam-view { aspect-ratio: auto; flex: 1 1 auto; min-height: 240px; }
}
@media (max-width: 900px) {
  .top-scan-toggle { display: inline-flex; }
  .top-scan .scan-form { display: none; position: fixed; left: 0; right: 0; top: var(--topbar-h); z-index: 30; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--border); box-shadow: 0 8px 20px rgba(0,0,0,.12); }
  .top-scan.scan-open .scan-form { display: block; }
  .top-scan .scan-input { width: 100%; }
  .top-scan .scan-cam-btn { min-height: 44px; }
}
/* 44 px tap targets for scanning on a phone */
@media (max-width: 700px) {
  .scan-row .scan-input, .scan-row .btn { min-height: 44px; }
  .scan-bar .scan-field { flex-basis: 100%; }
}

/* item Barcodes tab */
.bc-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.bc-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bc-intro { margin: -4px 0 10px; font-size: var(--fs-sm); }
.bc-warn { margin: 10px 0 0; }
.bc-table td { vertical-align: middle; }
.bc-code { font-family: Consolas, "Courier New", monospace; font-size: var(--fs-md); overflow-wrap: anywhere; }
.bc-note { font-size: var(--fs-xs); }
tr.bc-off td { opacity: .55; }
.bc-preview svg { max-width: 160px; height: auto; max-height: 40px; display: block; background: #fff; }
.bc-actions { white-space: nowrap; }
.bc-inline { display: inline; margin: 0; }
.bc-linkbtn { background: none; border: 0; padding: 0; margin-right: 12px; font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--primary); cursor: pointer; }
.bc-linkbtn:hover { text-decoration: underline; }
.bc-linkbtn.bc-danger { color: var(--red); }
tr.bc-edit-row[hidden], .bc-form [hidden] { display: none; }
tr.bc-edit-row > td { background: var(--hover-bg); }
.bc-form { align-items: end; }
.bc-wide { grid-column: 1 / -1; }
.bc-checks { display: flex; flex-direction: column; gap: 6px; justify-content: flex-end; }
.bc-form-btns { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }
.bc-gen { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bc-gen select { width: auto; min-width: 240px; max-width: 100%; }
.bc-pick { width: 34px; text-align: center; }
.bc-bulk { margin: 0 0 10px; }
.bc-bulk > summary { list-style: none; display: inline-flex; cursor: pointer; }
.bc-bulk > summary::-webkit-details-marker { display: none; }
.bc-bulk-body { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--hover-bg); }
.bc-bulk-body p { margin: 0 0 8px; font-size: var(--fs-sm); }
.bc-bulk-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bc-bulk-row select { width: auto; min-width: 220px; max-width: 100%; }
.bc-doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 16px; }
@media (max-width: 700px) {
  .bc-preview svg { max-width: 120px; }
  .bc-gen select, .bc-bulk-row select { width: 100%; min-width: 0; }
}

/* Label Printing screen */
.lp-kinds { margin-bottom: 14px; }
a.detail-tab-btn { text-decoration: none; display: inline-flex; align-items: center; }
.lp-help { margin: 0 0 10px; font-size: var(--fs-sm); }
.lp-search { display: flex; gap: 8px; flex-wrap: wrap; }
.lp-search input[type=text] { max-width: 280px; }
.lp-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.lp-head-tools { display: flex; gap: 6px; }
.lp-table select { width: auto; max-width: 260px; min-width: 150px; }
.lp-copies { width: 80px; text-align: right; }
tr.lp-blocked td { opacity: .7; }
.lp-link { font-size: var(--fs-sm); font-weight: 600; }
.lp-sample-row { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.lp-sample { border: 2px solid var(--primary); background: var(--card); border-radius: calc(var(--r-sm) * .375); max-width: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.lp-fields { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.lp-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.lp-note { font-size: var(--fs-sm); margin: 0 0 14px; }
@media (max-width: 700px) {
  .lp-copies { width: 64px; }
  .lp-table select { max-width: 150px; min-width: 100px; }
  .lp-search input[type=text] { max-width: none; flex: 1 1 100%; }
}

/* Barcodes on printed documents */
.print-codes { margin-top: 6px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.print-codes svg, .doc-barcode { height: 10mm; width: auto; max-width: 70mm; display: block; }
.line-barcode { height: 7mm; width: auto; max-width: 48mm; display: block; }
.qr-link { height: 18mm; width: 18mm; display: block; }
.print-code-cell { padding-top: 3px; padding-bottom: 3px; }
.print-code-cell svg { height: 7mm; width: auto; max-width: 48mm; display: block; }
.slip-card { max-width: 820px; }
.slip-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.slip-title { font-weight: 800; font-size: var(--fs-lg); }
.slip-codes { display: flex; gap: 22px; flex-wrap: wrap; }
.slip-cap { font-size: var(--fs-xs); margin-bottom: 2px; }
.slip-codes svg { height: 12mm; width: auto; max-width: 70mm; display: block; }
.slip-lines { margin-top: 12px; }
@media print {
  body.printing-slip .sidebar, body.printing-slip .topbar, body.printing-slip .app-footer-note, body.printing-slip .content > *:not(.slip-card) { display: none !important; }
  body.printing-slip .content { height: auto; overflow: visible; margin: 0; padding: 0; }
  body.printing-slip .slip-card { border: 0; box-shadow: none; max-width: none; }
}

/* Shop-floor station: big targets for a shared tablet */
.stn { max-width: 720px; margin: 0 auto; }
.stn-banner { padding: 16px 18px; border-radius: var(--r-lg); font-size: var(--fs-2xl); font-weight: 800; text-align: center; margin-bottom: 14px; }
.stn-banner[hidden] { display: none; }
.stn-ok { background: color-mix(in srgb, var(--success) 14%, var(--card)); color: var(--success-deep); border: 2px solid var(--success); }
.stn-bad { background: color-mix(in srgb, var(--red) 12%, var(--card)); color: var(--red); border: 2px solid var(--red); }
.stn-card { padding: 22px; }
.stn-card[hidden] { display: none; }
.stn-title { font-size: var(--fs-3xl); font-weight: 800; margin-bottom: 14px; }
.stn-card .scan-input { min-height: 56px; font-size: var(--fs-2xl); }
.stn-card .scan-row .btn { min-height: 56px; }
.stn-note { font-size: var(--fs-sm); margin: 10px 0 0; }
.stn-hello { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: var(--fs-3xl); font-weight: 800; margin-bottom: 16px; }
.stn-notme { font-size: var(--fs-base); font-weight: 600; }
.stn-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.stn-form { margin: 0; }
.stn-btn { min-height: 72px; min-width: 220px; font-size: var(--fs-xl); padding: 0 28px; flex: 1 1 220px; }
.stn-op { margin-top: 6px; font-size: var(--fs-lg); font-weight: 700; color: var(--success-deep); min-height: 1.4em; }
.stn-grid input, .stn-grid select { min-height: 48px; font-size: var(--fs-lg); }
@media (max-width: 700px) {
  .stn-card { padding: 14px; }
  .stn-btn { min-width: 0; flex-basis: 100%; }
}

/* ---------- Lots, expiry and stock status (hold / quarantine) ---------- */
.kr-modal-overlay[hidden] { display: none; }
.ss-box { max-height: calc(100% - 40px); overflow: auto; }
.ss-box .form-group { margin-bottom: 12px; }
.ss-box input, .ss-box select { width: 100%; }
.lot-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.lot-head-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.lot-help { margin: -4px 0 10px; font-size: var(--fs-sm); }
.lot-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 12px; align-items: end; margin-bottom: 12px; }
.lot-filters .form-group { margin: 0; min-width: 0; }
.lot-filters input, .lot-filters select { width: 100%; }
.lot-filter-go { display: flex; gap: 6px; flex-wrap: wrap; }
.lot-days { font-size: var(--fs-xs); white-space: nowrap; }
.lot-exp { white-space: nowrap; }
.lot-settings-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.lot-settings-row input[type=number] { max-width: 140px; }
.lot-facts { margin-top: 4px; }
.lot-cap { font-size: var(--fs-sm); }
.lot-actions { white-space: nowrap; }
.lot-actions .btn { margin: 2px 4px 2px 0; }
.lot-trace { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 24px; }
.lot-trace-col { min-width: 0; overflow-wrap: anywhere; }
.lot-trace-wide { grid-column: 1 / -1; }
.lot-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.lot-strip { display: flex; gap: 8px 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.lot-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--r-pill); text-decoration: none; background: var(--card); }
.lot-assign { grid-column: auto; }
.lot-wide { grid-column: 1 / -1; }
.lot-ship { font-size: var(--fs-sm); margin-top: 2px; }
.lot-pick-cell { min-width: 190px; }
.lot-pick-cell select { width: 100%; max-width: 280px; }
.lot-plan { margin-top: 4px; font-size: var(--fs-xs); display: flex; flex-wrap: wrap; gap: 2px 10px; }
.lot-plan-row { white-space: nowrap; }
.lot-short { margin-top: 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--red); }
tr.lot-line-row td { border-bottom-color: transparent; }
tr.lot-sub-row > td { background: color-mix(in srgb, var(--primary) 4%, var(--card)); padding-top: 4px; }
.lot-sub { padding: 4px 0 8px 12px; border-left: 3px solid var(--primary); }
.lot-sub-head { margin-bottom: 6px; }
.lot-sub-table { border-collapse: collapse; width: 100%; max-width: 760px; }
.lot-sub-table th { text-align: left; font-size: var(--fs-xs); color: var(--grey); padding: 2px 6px; }
.lot-sub-table th.num { text-align: right; }
.lot-sub-table td { padding: 3px 6px; vertical-align: middle; }
.lot-sub-table input { width: 100%; min-width: 90px; }
.lot-sub-table input.lot-f-qty { min-width: 80px; max-width: 120px; text-align: right; }
.lot-sub-foot { margin-top: 6px; display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; }
.lot-sub-note { font-size: var(--fs-xs); }
a.lot-remove { display: inline-block; padding: 2px 8px; font-size: var(--fs-lg); line-height: 1; color: var(--red); text-decoration: none; }
tr.lot-row.scan-row-hit td { background: color-mix(in srgb, var(--success) 14%, var(--card)); }
@media (max-width: 700px) {
  .lot-sub { padding-left: 8px; }
  .lot-pick-cell { min-width: 150px; }
  .lot-actions { white-space: normal; }
}

/* ---------- Stock transfers, stock counts, adjustment documents ---------- */
.sd-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.sd-head-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sd-help { margin: -4px 0 10px; font-size: var(--fs-sm); }
.sd-due { margin: 0 0 10px; }
.sd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sd-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--card); color: var(--dark); text-decoration: none; font-size: var(--fs-sm); }
.sd-chip:hover { border-color: var(--border-hover); }
.sd-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.sd-chip-n { font-size: var(--fs-xs); opacity: .75; }
.sd-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 12px; align-items: end; margin-bottom: 12px; }
.sd-filters .form-group { margin: 0; min-width: 0; }
.sd-filters input, .sd-filters select { width: 100%; }
.sd-filter-go { display: flex; gap: 6px; flex-wrap: wrap; }
.sd-age { font-size: var(--fs-xs); }
.sd-late { color: var(--red); font-weight: 600; }
.sd-note { font-size: var(--fs-xs); }
.sd-k { font-size: var(--fs-sm); }
.sd-plus { color: var(--success-deep); font-weight: 600; }
.sd-minus { color: var(--red); font-weight: 600; }
tr.sd-recount td { background: color-mix(in srgb, var(--amber) 10%, var(--card)); }
.sd-row-actions { white-space: nowrap; text-align: right; }
.sd-nw { white-space: nowrap; }
.sd-table .badge { white-space: nowrap; }
.sd-table td select { min-width: 120px; max-width: 200px; }
.sd-grid { margin-bottom: 8px; }
.sd-span { grid-column: 1 / -1; }
.sd-form input[type=text], .sd-form input[type=date], .sd-form input[type=number], .sd-form select, .sd-form textarea { width: 100%; }
.sd-binmove { margin: 8px 0; }
.sd-lines-head h4 { margin: 14px 0 6px; }
.sd-line-tools { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; font-size: var(--fs-sm); margin: 8px 0; }
.sd-actions { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.sd-facts { margin-top: 4px; }
.sd-route { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; }
.sd-route-box { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--hover-bg); min-width: 0; overflow-wrap: anywhere; }
.sd-route-arrow { font-size: 22px; color: var(--grey-light); }
.sd-act { display: grid; gap: 14px; }
.sd-inline-form { display: flex; gap: 8px 12px; align-items: end; flex-wrap: wrap; }
.sd-inline-form .form-group { margin: 0; }
.sd-inline-form .sd-grow { flex: 1 1 260px; min-width: 0; }
.sd-inline-form .sd-grow input { width: 100%; }
.sd-act-help { font-size: var(--fs-sm); flex: 1 1 220px; }
.sd-recv-date { margin-bottom: 8px; }
.sd-recv-qty { width: 110px; text-align: right; }
.sd-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 0 0 14px; }
.sd-cards-tight { margin-bottom: 10px; }
.sd-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; min-width: 0; }
.sd-card-n { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.sd-prog { height: 6px; border-radius: calc(var(--r-sm) * .375); background: var(--border); overflow: hidden; min-width: 90px; margin-bottom: 3px; }
.sd-prog span { display: block; height: 100%; background: var(--success); }
.sd-opts { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 12px; margin: 10px 0; display: grid; gap: 6px; }
.sd-opts legend { font-size: var(--fs-sm); color: var(--grey); padding: 0 6px; }
.sd-spot { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0; }
.sd-spot[hidden], .sd-type-help[hidden], .cc-add-lot[hidden], #scAbcWrap[hidden] { display: none; }
.sd-spot-col { min-width: 0; }
.sd-pick-filter { width: 100%; margin: 4px 0; }
.sd-pick { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 4px 8px; }
.sd-pick-row { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.sd-pick-row:last-child { border-bottom: 0; }
.sd-pick-row[hidden] { display: none; }
.sd-last { font-size: var(--fs-xs); }
.sd-post { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 10px; }
.sd-post h4 { margin: 0 0 4px; }
.sd-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 16px; align-items: start; }
.sd-settings input { width: 100%; max-width: 260px; }
/* transfer form rows */
.sd-lines select, .sd-lines input[type=text], .sd-lines input[type=number] { width: 100%; min-width: 90px; }
.st-qty-wrap { display: flex; gap: 6px; align-items: center; }
.st-qty-wrap input { max-width: 110px; text-align: right; }
.st-lot-cell .st-lot { display: none; }
.st-lot-cell.st-lot-on .st-lot { display: block; }
.st-lot-cell.st-lot-on .st-nolot { display: none; }
a.st-remove { display: inline-block; padding: 2px 8px; font-size: var(--fs-lg); line-height: 1; color: var(--red); text-decoration: none; }
tr.st-row.scan-row-hit td, tr.cc-row.scan-row-hit td { background: color-mix(in srgb, var(--success) 14%, var(--card)); }
/* count entry sheet */
.cc-panel { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 12px; background: var(--hover-bg); }
.cc-bin-row { display: flex; gap: 8px 16px; align-items: end; flex-wrap: wrap; margin-bottom: 8px; }
.cc-bin-pick { margin: 0; min-width: 200px; flex: 0 1 280px; }
.cc-bin-pick select { width: 100%; }
.cc-now { font-size: var(--fs-lg); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.cc-now strong { font-size: 20px; }
.cc-progress { font-size: var(--fs-sm); }
.cc-modes { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-top: 8px; }
.cc-wh { font-size: var(--fs-sm); }
.cc-qty-wrap { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.cc-qty { width: 120px; text-align: right; font-size: var(--fs-lg); }
.cc-lot-mobile { display: none; }
.cc-row .cc-state-chip .badge { display: none; margin-left: 4px; }
.cc-row.cc-none .cc-s-none, .cc-row.cc-done .cc-s-done, .cc-row.cc-recount .cc-s-recount { display: inline-block; }
.cc-table .cc-notecell input { width: 100%; min-width: 120px; }
.cc-save { position: sticky; bottom: 0; background: var(--card); padding: 8px 0; border-top: 1px solid var(--border); z-index: 2; }
.cc-add summary { cursor: pointer; font-weight: 600; }
.cc-add form { margin-top: 10px; }
.cc-add input, .cc-add select { width: 100%; }
/* printing */
.print-box { display: inline-block; min-width: 60px; border-bottom: 1px solid #000; }
.print-bin { margin-bottom: 14px; break-inside: avoid; }
.print-bin-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.print-bin-code svg { height: 9mm; width: auto; max-width: 60mm; display: block; }
.print-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 28px; }
.print-sign div { border-top: 1px solid #000; padding-top: 4px; font-size: var(--fs-sm); }

@media (max-width: 700px) {
  .sd-spot { grid-template-columns: 1fr; }
  .sd-route-arrow { transform: rotate(90deg); }
  .sd-inline-form .sd-grow { flex-basis: 100%; }
  .sd-recv-qty { width: 100%; }
  .sd-stack thead, .sd-stack-form thead { display: none; }
  .sd-stack, .sd-stack tbody, .sd-stack tr, .sd-stack-form, .sd-stack-form tbody, .sd-stack-form tr, .sd-stack-form td { display: block; width: 100%; }
  .sd-stack tr, .sd-stack-form tr { border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 10px; padding: 6px 10px; background: var(--card); }
  table.sd-stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border: 0; padding: 3px 0; text-align: right; overflow-wrap: anywhere; width: 100%; }
  table.sd-stack td::before, table.sd-stack-form td::before { content: attr(data-label); flex: 0 0 38%; text-align: left; color: var(--grey); font-size: var(--fs-xs); }
  table.sd-stack td.sd-row-actions::before, table.sd-stack-form td.st-del::before { content: none; }
  table.sd-stack td.sd-row-actions { justify-content: flex-end; }
  table.sd-stack td select, table.sd-stack td input { max-width: 58%; }
  table.sd-stack-form td { border: 0; padding: 4px 0; text-align: left; }
  table.sd-stack-form td::before { display: block; margin-bottom: 2px; }
  table.sd-stack-form td.num { text-align: left; }
  table.sd-stack-form td.st-del { text-align: right; }
  .sd-lines select, .sd-lines input[type=text], .sd-lines input[type=number] { min-width: 0; }
  .st-qty-wrap input { max-width: none; }
  /* count sheet: a card per line, big quantity box */
  .cc-table .cc-lotcell { display: none; }
  .cc-lot-mobile { display: block; }
  table.cc-table td.cc-bincell { padding: 2px 0 0; }
  table.cc-table td.cc-bincell::before { display: inline; margin: 0 6px 0 0; }
  table.cc-table td.cc-bincell strong { display: inline; }
  table.cc-table td.cc-itemcell::before { display: none; }
  .cc-qty-wrap { justify-content: flex-start; }
  .cc-qty { width: 100%; max-width: 180px; min-height: 46px; font-size: 20px; }
  .cc-table .cc-notecell input { min-width: 0; }
  .cc-panel { padding: 8px 10px; }
  .cc-bin-pick { flex-basis: 100%; }
  .print-sign { grid-template-columns: 1fr; }
}

/* Inventory Accounting (perpetual inventory switch) and GL pages for it */
.ig-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.ig-head-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.ig-note { font-size: var(--fs-sm); margin: 6px 0; }
.ig-k { font-size: var(--fs-xs); }
.ig-list { margin: 6px 0 10px 20px; padding: 0; font-size: var(--fs-sm); }
.ig-list li { margin: 4px 0; }
.ig-irrev { margin: 8px 0; }
.ig-prop { font-size: var(--fs-sm); overflow-wrap: anywhere; }
.ig-roles select { width: 100%; min-width: 200px; max-width: 420px; }
.ig-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.ig-card { border: 1px solid var(--border); border-radius: calc((var(--r-sm) + var(--r-md)) / 2); padding: 8px 12px; min-width: 0; overflow-wrap: anywhere; }
.ig-card-n { font-size: var(--fs-lg); font-weight: 700; }
.ig-card-diff { border-color: var(--amber); }
.ig-total td { border-top: 2px solid var(--border); }
.ig-sub { margin: 14px 0 6px; }
.ig-off { max-width: 520px; }
.gl-map-section th { text-align: left; background: color-mix(in srgb, var(--primary) 8%, var(--card)); font-size: var(--fs-sm); }
@media (max-width: 600px) {
  .ig-roles select { min-width: 0; }
  .ig-cards { grid-template-columns: 1fr 1fr; }
}
.ig-facts { margin: 6px 0; }
.ig-rules { margin-top: 10px; }

/* ---------- Analytics Studio (2.44): gallery, dashboard grid, widgets, builder, pop-ups, Home Pages, My Work ----------
   Built only on the app's tokens (Company Profile > Theme), so the company's primary colour and dark mode carry through.
   Series colours: a fixed, colour-blind-checked categorical order (never cycled; the server folds a 9th series into
   "Other"), stepped separately for the dark surface; the same label keeps the same colour on every widget of a page. */
:root { --an-s1: #2a78d6; --an-s2: #eb6834; --an-s3: #1baf7a; --an-s4: #eda100; --an-s5: #e87ba4; --an-s6: #008300; --an-s7: #6250d6; --an-s8: #e34948;
  --an-other: #B4BAC4; --an-grid: #EEF0F4; --an-row: 80px; --an-gap: 14px; --an-radius: var(--r-lg);
  --an-shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06); --an-shadow-hi: 0 6px 18px rgba(16,24,40,.10); --an-shadow-pop: 0 12px 32px rgba(16,24,40,.18); }
:root[data-theme="dark"] { --an-s1: #3987e5; --an-s2: #d95926; --an-s3: #199e70; --an-s4: #c98500; --an-s5: #d55181; --an-s6: #008300; --an-s7: #9085e9; --an-s8: #e66767;
  --an-other: #5B6577; --an-grid: #232B3B; --an-shadow: 0 1px 2px rgba(0,0,0,.3); --an-shadow-hi: 0 6px 18px rgba(0,0,0,.4); --an-shadow-pop: 0 12px 32px rgba(0,0,0,.5); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) { --an-s1: #3987e5; --an-s2: #d95926; --an-s3: #199e70; --an-s4: #c98500; --an-s5: #d55181; --an-s6: #008300; --an-s7: #9085e9; --an-s8: #e66767;
    --an-other: #5B6577; --an-grid: #232B3B; --an-shadow: 0 1px 2px rgba(0,0,0,.3); --an-shadow-hi: 0 6px 18px rgba(0,0,0,.4); --an-shadow-pop: 0 12px 32px rgba(0,0,0,.5); }
}
@keyframes an-rot { to { transform: rotate(360deg); } }

/* page header: title, description, home source, last refreshed; actions on the right, the rest in an overflow menu */
.an-page-head { margin: 2px 0 20px; }
.an-ph-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; }
.an-ph-text { flex: 1 1 320px; min-width: 0; }
.an-ph-titlerow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an-ph-title { margin: 0; font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.01em; line-height: 1.2; color: var(--dark); overflow-wrap: anywhere; }
.an-ph-desc { margin: 4px 0 0; max-width: 90ch; font-size: var(--fs-base); color: var(--grey); overflow-wrap: anywhere; }
.an-ph-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; font-size: var(--fs-sm); color: var(--grey-light); }
.an-ph-meta a { font-weight: 600; }
.an-ph-home { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-weight: 600;
  color: var(--primary-deep); background: color-mix(in srgb, var(--primary) 10%, var(--card)); }
.an-home-src { color: inherit; }
.an-ph-updated:empty { display: none; }
.an-ph-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an-ph-actions .btn, .an-card-foot .btn, .an-pin-btn { gap: 6px; }
.an-icon-btn { width: 30px; padding: 0; justify-content: center; font-size: var(--fs-lg); line-height: 1; }
#an-refresh-all.is-busy svg { animation: an-rot .8s linear infinite; }
.an-edit-badge { padding: 2px 9px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, var(--card)); }
.an-inline-form { display: inline-flex; margin: 0; }
.an-update-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -6px 0 14px; padding: 8px 12px; border-radius: var(--r-md); font-size: var(--fs-sm);
  color: var(--primary-deep); background: color-mix(in srgb, var(--primary) 8%, var(--card)); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--card)); }
.an-update-icon { display: inline-flex; }
.an-update-text { flex: 1 1 220px; min-width: 0; font-weight: 600; }
.an-note { font-size: var(--fs-sm); margin: 4px 0; overflow-wrap: anywhere; }
.an-note-warn { color: var(--amber); }
.an-note-ok { color: var(--success-deep); }
.an-note.is-loading { color: var(--grey-light); display: flex; align-items: center; }
.an-spin { display: inline-block; flex: none; width: 12px; height: 12px; margin-right: 6px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: an-rot .7s linear infinite; }
.an-save-status { font-size: var(--fs-sm); color: var(--grey); }
.an-save-status.an-bad { color: var(--red); }
.an-grow { flex: 1 1 auto; }
.an-inline-label { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.an-prio { width: 84px; }

/* overflow menus (<details class="an-menu">) and small pop-overs */
.an-menu, .an-change, .an-new { position: relative; }
.an-menu > summary, .an-new > summary, .an-change > summary { list-style: none; }
.an-menu > summary::-webkit-details-marker, .an-new > summary::-webkit-details-marker, .an-change > summary::-webkit-details-marker { display: none; }
.an-menu-list { position: absolute; z-index: 60; right: 0; top: calc(100% + 6px); min-width: 210px; padding: 6px; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--an-shadow-pop); }
.an-menu-up .an-menu-list { top: auto; bottom: calc(100% + 6px); }
.an-menu-list form { margin: 0; }
.an-menu-item { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: calc(var(--r-sm) * .875); background: none; text-align: left; text-decoration: none; cursor: pointer;
  font: 500 var(--fs-base) var(--font); color: var(--dark); }
.an-menu-item:hover, .an-menu-item:focus-visible { background: var(--hover-bg); outline: none; text-decoration: none; }
.an-menu-item.an-danger, .an-w-menu button.an-danger { color: var(--red); }
.an-change > summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: var(--fs-sm); }
.an-change > summary::after { content: " \25BE"; }
.an-change-box { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; min-width: 280px; max-width: calc(100vw - 32px); padding: 12px 14px; border-radius: var(--r-lg);
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--an-shadow-pop); }
.an-ph-actions .an-change-box, .mywork-home .an-change-box { left: auto; right: 0; }
.an-home-choice { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 0; }
.an-hc-field { min-width: 0; flex: 1 1 200px; }

/* filter bar: a compact sticky row of pills; a pill with a value is highlighted */
.an-filterbar { position: sticky; top: 0; z-index: 25; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--an-radius); box-shadow: var(--an-shadow); }
/* while stuck, the page's top padding above the bar is covered so nothing scrolls through the gap */
.an-filterbar::before { content: ""; position: absolute; left: -2px; right: -2px; top: -19px; height: 18px; background: var(--bg); pointer-events: none; }
.an-filterbar[hidden] { display: none; }
.an-fb-icon { display: inline-flex; padding: 0 2px 0 4px; color: var(--grey-light); }
.an-fp { position: relative; min-width: 0; }
.an-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; max-width: 280px; padding: 0 10px 0 12px; border: 1px solid var(--border); border-radius: var(--r-pill);
  background: var(--card); color: var(--dark); font: 500 var(--fs-sm) var(--font); cursor: pointer; transition: border-color .12s ease, background-color .12s ease; }
.an-pill:hover { border-color: var(--border-hover); }
.an-pill:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.an-pill-k { color: var(--grey-light); white-space: nowrap; }
.an-pill-v { font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-pill svg { flex: none; opacity: .65; }
.an-pill.is-active { color: var(--primary-deep); background: color-mix(in srgb, var(--primary) 10%, var(--card)); border-color: color-mix(in srgb, var(--primary) 45%, var(--card)); }
.an-pill.is-active .an-pill-k { color: inherit; opacity: .75; }
.an-fp.is-open .an-pill { border-color: var(--primary); }
.an-fp-pop { position: absolute; z-index: 70; left: 0; top: calc(100% + 6px); width: 270px; max-width: calc(100vw - 32px); padding: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--an-shadow-pop); }
.an-fp-pop[hidden] { display: none; }
.an-fp-list { display: flex; flex-direction: column; max-height: 270px; overflow-y: auto; }
.an-fp-opt { padding: 7px 10px; border: 0; border-radius: calc(var(--r-sm) * .875); background: none; text-align: left; cursor: pointer; font: 500 var(--fs-base) var(--font); color: var(--dark); }
.an-fp-opt:hover, .an-fp-opt:focus-visible { background: var(--hover-bg); outline: none; }
.an-fp-opt.is-on { color: var(--primary-deep); background: color-mix(in srgb, var(--primary) 10%, var(--card)); font-weight: 600; }
.an-fp-custom { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.an-fp-sub { font-size: var(--fs-xs); font-weight: 700; color: var(--grey); text-transform: uppercase; letter-spacing: .3px; }
.an-fp-dates { display: flex; gap: 6px; }
.an-fp-dates input { flex: 1 1 0; min-width: 0; }
.an-fp-custom .btn { align-self: flex-end; }
.an-fp-pop .an-pick-list { position: static; margin-top: 6px; border: 0; padding: 0; box-shadow: none; max-height: 230px; }
.an-fb-clear { margin-left: auto; padding: 4px 8px; border: 0; border-radius: calc(var(--r-sm) * .75); background: none; cursor: pointer; font: 600 var(--fs-sm) var(--font); color: var(--primary); }
.an-fb-clear:hover { background: color-mix(in srgb, var(--primary) 8%, var(--card)); }
.an-fb-clear[hidden] { display: none; }
.an-pick { position: relative; min-width: 0; }
.an-pick input[type=search] { padding-right: 28px; }
.an-pick-clear { display: none; position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--hover-bg); color: var(--grey); cursor: pointer; line-height: 1; }
.an-pick-has .an-pick-clear { display: block; }
.an-pick-clear:hover { background: var(--red); color: #fff; }
.an-pick input[type=search]::-webkit-search-cancel-button { display: none; }
.an-pick-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 2px); max-height: 240px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--card); border: 1px solid var(--border); border-radius: calc((var(--r-sm) + var(--r-md)) / 2); box-shadow: var(--an-shadow-pop); }
.an-pick-list[hidden] { display: none; }
.an-pick-list li { padding: 7px 8px; border-radius: calc(var(--r-sm) * .75); cursor: pointer; font-size: var(--fs-base); overflow-wrap: anywhere; }
.an-pick-list li.active, .an-pick-list li:hover { background: color-mix(in srgb, var(--primary) 12%, var(--card)); }
.an-pick-list li.an-pick-none { color: var(--grey-light); cursor: default; background: none; }

/* the 12-column grid: rows of 80 px with even gutters; widgets are placed by grid-column / grid-row from x, y, w, h */
.an-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: var(--an-row); gap: var(--an-gap); margin-bottom: 16px; position: relative; }
.an-w { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--an-radius); box-shadow: var(--an-shadow); transition: box-shadow .15s ease, border-color .15s ease; }
.an-w:hover { box-shadow: var(--an-shadow-hi); }
.an-w:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent); }
.an-w-head { display: flex; align-items: flex-start; gap: 8px; padding: 12px 10px 6px 16px; flex: none; }
.an-w-titles { flex: 1 1 auto; min-width: 0; }
.an-w-title { margin: 0; font-size: var(--fs-md); font-weight: 700; line-height: 1.3; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-w-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 2px; min-height: 14px; max-height: 30px; overflow: hidden; font-size: var(--fs-xs); color: var(--grey-light); }
.an-w-sub-t { min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-w-tag { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; color: var(--amber); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-w-tag svg { flex: none; }
.an-w-tools { position: relative; flex: none; }
.an-w-menu-btn { width: 28px; height: 26px; border: 1px solid transparent; border-radius: calc(var(--r-sm) * .875); background: none; color: var(--grey); cursor: pointer; font-size: var(--fs-xl); line-height: 1; opacity: .5; transition: opacity .12s ease, background-color .12s ease; }
.an-w:hover .an-w-menu-btn, .an-w:focus-within .an-w-menu-btn, .an-w-menu-btn[aria-expanded="true"] { opacity: 1; }
.an-w-menu-btn:hover, .an-w-menu-btn[aria-expanded="true"] { background: var(--hover-bg); border-color: var(--border); }
.an-w-menu-btn:focus-visible { opacity: 1; outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
@media (hover: none) { .an-w-menu-btn { opacity: 1; } }
.an-w-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 35; min-width: 180px; padding: 6px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--an-shadow-pop); }
.an-w-menu[hidden] { display: none; }
.an-w-menu button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: calc(var(--r-sm) * .875); background: none; text-align: left; cursor: pointer; font: 500 var(--fs-base) var(--font); color: var(--dark); }
.an-w-menu button:hover, .an-w-menu button:focus-visible { background: var(--hover-bg); outline: none; }
.an-w-body { position: relative; flex: 1 1 auto; min-height: 0; padding: 4px 16px 14px; overflow: auto; container-type: size; }
.an-chart { position: relative; width: 100%; height: 100%; min-height: 80px; }
.an-chart canvas { max-width: 100%; }
.an-trunc { position: absolute; left: 16px; right: 16px; bottom: 4px; font-size: var(--fs-2xs); color: var(--amber); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* KPI tile: label (the title), big compact value, change against the comparison period, sparkline */
.an-w-kpi .an-w-head { padding-bottom: 0; }
.an-w-kpi .an-w-title { font-size: var(--fs-sm); font-weight: 600; color: var(--grey); }
.an-w-kpi .an-w-body { padding-top: 2px; }
.an-kpi { display: flex; flex-direction: column; justify-content: center; gap: 6px; height: 100%; min-width: 0; }
.an-kpi-value { max-width: 100%; padding: 0; border: 0; background: none; text-align: left; font-family: var(--font); font-size: clamp(20px, 32cqh, 34px); font-weight: 800; letter-spacing: -.02em;
  line-height: 1.05; color: var(--dark); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.an-kpi-value { cursor: pointer; border-radius: calc(var(--r-sm) / 2); }
button.an-kpi-value:hover { color: var(--primary); }
button.an-kpi-value:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.an-kpi-none { color: var(--grey-light); font-weight: 600; }
.an-kpi-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--fs-sm); min-width: 0; }
.an-kpi-cmp { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--r-pill); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-kpi-good { color: var(--success-deep); background: color-mix(in srgb, var(--success) 13%, var(--card)); }
.an-kpi-bad { color: var(--red); background: color-mix(in srgb, var(--red) 11%, var(--card)); }
.an-kpi-flat { color: var(--grey); background: var(--hover-bg); }
.an-kpi-arrow { font-size: var(--fs-2xs); }
.an-kpi-vs { color: var(--grey-light); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-spark { display: block; width: 100%; height: 28px; margin-top: 2px; flex: none; overflow: visible; }
.an-spark-line { fill: none; stroke: var(--an-s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.an-spark-area { fill: color-mix(in srgb, var(--an-s1) 14%, transparent); stroke: none; }
@container (max-height: 96px) { .an-spark { display: none; } }

/* states: loading skeleton in the shape of what is coming; empty, no access and error with an icon */
.an-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 100%; min-height: 70px; padding: 8px; text-align: center; color: var(--grey); }
.an-state-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--hover-bg); color: var(--grey-light); flex: none; }
.an-state-text { max-width: 34ch; font-size: var(--fs-base); font-weight: 600; color: var(--grey); }
.an-state-hint { max-width: 38ch; font-size: var(--fs-sm); color: var(--grey-light); }
.an-state-denied .an-state-icon { color: var(--amber); background: color-mix(in srgb, var(--amber) 13%, var(--card)); }
.an-state-error .an-state-icon { color: var(--red); background: color-mix(in srgb, var(--red) 11%, var(--card)); }
@container (max-height: 110px) { .an-state-icon, .an-state-hint { display: none; } }
.an-skel { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 6px 0; }
.an-skel-bar, .an-skel-col { display: block; border-radius: calc(var(--r-sm) * .75); background: linear-gradient(90deg, var(--hover-bg) 0%, color-mix(in srgb, var(--border) 75%, var(--card)) 50%, var(--hover-bg) 100%);
  background-size: 200% 100%; animation: an-shimmer 1.2s linear infinite; }
.an-skel-bar { height: 12px; }
.an-skel-big { height: 30px; width: 62%; }
.an-skel-short { width: 40%; }
.an-skel-rows .an-skel-bar { height: 14px; }
.an-skel-chart { display: flex; align-items: flex-end; gap: 7%; flex: 1; padding: 0 3%; border-bottom: 1px solid var(--border); }
.an-skel-col { flex: 1 1 0; border-radius: calc(var(--r-sm) * .75) calc(var(--r-sm) * .75) calc(var(--r-sm) / 4) calc(var(--r-sm) / 4); }
@keyframes an-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .an-skel-bar, .an-skel-col, .an-spin, #an-refresh-all.is-busy svg { animation: none; } }

/* table and pivot widgets: compact, zebra rows, sticky header, numbers right-aligned */
table.data-table.an-table { table-layout: auto; font-size: var(--fs-sm); }
.an-table-wrap { max-width: 100%; }
.an-table th { position: sticky; top: 0; z-index: 1; white-space: nowrap; background: var(--card); box-shadow: inset 0 -1px 0 var(--border); }
table.data-table.an-table td { padding: 6px 8px; }
table.data-table.an-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--hover-bg) 75%, var(--card)); }
table.data-table.an-table tbody tr:hover td { background: color-mix(in srgb, var(--primary) 6%, var(--card)); }
.an-sort { padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.an-sort:hover { color: var(--primary); }
.an-sort:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
table.data-table tr.an-click, table.data-table td.an-click { cursor: pointer; }
table.data-table tr.an-click:focus-visible td, table.data-table td.an-click:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
table.data-table td.an-click:hover { background: color-mix(in srgb, var(--primary) 10%, var(--card)); }
.an-total td { font-weight: 700; border-top: 2px solid var(--border); background: var(--card); }
table.data-table.an-pivot th.an-pivot-rh { position: sticky; left: 0; min-width: 90px; max-width: 220px; text-align: left; font-weight: 600; text-transform: none; letter-spacing: 0;
  font-size: var(--fs-sm); color: var(--dark); white-space: normal; overflow-wrap: anywhere; background: var(--card); }
.an-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 0 0; font-size: var(--fs-sm); }
.an-pager:empty { display: none; }

/* builder: drag by the title bar, resize from the corner; turned off below 760 px */
.an-grid-edit { min-height: 180px; border-radius: var(--r-md);
  background-image: linear-gradient(to right, color-mix(in srgb, var(--primary) 9%, transparent) 1px, transparent 1px); background-size: calc((100% + var(--an-gap)) / 12) 100%; }
.an-grid-edit .an-w { border-style: dashed; border-color: var(--border-hover); }
.an-grid-edit .an-w-head { cursor: grab; touch-action: none; }
.an-w-resize { display: none; }
.an-grid-edit .an-w-resize { display: block; position: absolute; right: 4px; bottom: 4px; width: 18px; height: 18px; border-radius: calc(var(--r-sm) * .625); cursor: nwse-resize; touch-action: none; opacity: .55;
  background: linear-gradient(135deg, transparent 45%, var(--grey-light) 45%, var(--grey-light) 55%, transparent 55%, transparent 68%, var(--grey-light) 68%, var(--grey-light) 78%, transparent 78%); }
.an-grid-edit .an-w:hover .an-w-resize { opacity: 1; }
.an-grid-edit .an-w.an-dragging { z-index: 20; cursor: grabbing; border-style: solid; border-color: var(--primary); box-shadow: 0 18px 40px rgba(16,24,40,.22), 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.an-grid-edit .an-w.an-dragging .an-w-head { cursor: grabbing; }
.an-grid-edit .an-w.an-grabbed { border-style: solid; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent); }
.an-empty[hidden] { display: none; }
.an-empty .empty-state p { margin: 0 0 10px; }

/* pop-ups (drill-down, share): the record pop-up look */
.an-pop[hidden] { display: none; }
.an-pop-box { max-width: 640px; }
.an-pop-wide { max-width: 980px; }
.an-pop-open { overflow: hidden; }
.an-pop-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.an-pop-section { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.an-pop-section h4 { margin: 0 0 6px; font-size: var(--fs-md); }
.an-drill-table td { overflow-wrap: anywhere; }
.an-drill-open { white-space: nowrap; text-align: right; }
.an-share-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.an-share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card); }
.an-share-name { flex: 1 1 140px; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.an-share-edit { margin: 0; }
.an-share-cov { flex-basis: 100%; margin: 0; }
.an-share-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.an-share-add select { flex: 1 1 150px; width: auto; min-width: 0; }

/* widget editor: a side panel next to the grid (full screen on phones) */
.an-editor { position: fixed; z-index: 900; top: var(--topbar-h); right: 0; bottom: 0; width: min(460px, 100vw); background: var(--bg); border-left: 1px solid var(--border); box-shadow: -18px 0 40px rgba(16,24,40,.16); }
.an-editor[hidden] { display: none; }
.an-editor-form { display: flex; flex-direction: column; height: 100%; margin: 0; }
.an-editor-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 14px 54px 12px 18px; background: var(--card); border-bottom: 1px solid var(--border); }
.an-editor-head h3 { margin: 0; font-size: var(--fs-lg); font-weight: 700; color: var(--dark); }
.an-editor-x { top: 9px; }
.an-editor-scroll { flex: 1 1 auto; overflow-y: auto; padding: 14px 18px; }
.an-editor-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 18px; background: var(--card); border-top: 1px solid var(--border); }
.an-editor-errors ul { margin: 0; padding-left: 18px; }
.an-editor-errors[hidden] { display: none; }
.an-ed-sec { min-width: 0; margin: 0 0 12px; padding: 10px 12px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card); }
.an-ed-sec > legend { padding: 0 6px; font-size: var(--fs-xs); font-weight: 700; color: var(--grey); text-transform: uppercase; letter-spacing: .3px; background: var(--card); border-radius: calc(var(--r-sm) / 2); }
.an-ed-sec > .btn { margin-top: 6px; }
.an-ed-row { display: flex; align-items: center; gap: 6px; margin: 4px 0; min-width: 0; }
.an-ed-row > select, .an-ed-row > input { flex: 1 1 0; width: auto; min-width: 0; }
.an-ed-row > .btn { flex: none; }
.an-ed-inline { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.an-ed-inline label { flex: 0 0 auto; margin: 0; }
.an-ed-inline input, .an-ed-inline select { flex: 1 1 auto; width: auto; min-width: 0; max-width: 220px; }
.an-ed-filter { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.an-ed-filter:last-of-type { border-bottom: 0; }
.an-ed-choices { display: flex; flex-wrap: wrap; gap: 0 14px; }
.an-ed-title { margin-bottom: 12px; }
.an-editor-fields { min-width: 0; }
.an-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.an-type { position: relative; margin: 0; text-transform: none; letter-spacing: 0; cursor: pointer; }
.an-type input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.an-type-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 4px; border: 1px solid var(--border); border-radius: calc((var(--r-sm) + var(--r-md)) / 2); text-align: center; font-size: var(--fs-sm); font-weight: 600; color: var(--grey); background: var(--card); }
.an-type:hover .an-type-tile { border-color: var(--border-hover); background: var(--hover-bg); }
.an-type input:checked + .an-type-tile { color: var(--primary-deep); border-color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, var(--card)); box-shadow: inset 0 0 0 1px var(--primary); }
.an-type input:focus-visible + .an-type-tile { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.an-preview-card { height: 290px; box-shadow: none; }
.an-preview-card:hover { box-shadow: none; }
.an-preview { flex: 1 1 auto; height: auto; }
.an-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.an-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 4px 2px 8px; border-radius: var(--r-pill); font-size: var(--fs-sm); color: var(--primary-deep); background: color-mix(in srgb, var(--primary) 10%, var(--card)); overflow-wrap: anywhere; }
.an-chip button { padding: 0 2px; border: 0; background: none; color: inherit; cursor: pointer; font-size: var(--fs-md); line-height: 1; }
@media (min-width: 1200px) { body.an-editing .content { margin-right: 460px; } }

/* builder settings */
.an-settings-wrap { margin-top: 10px; }
.an-settings-wrap > summary { cursor: pointer; font-size: var(--fs-base); font-weight: 600; color: var(--primary); }
.an-settings { margin-top: 8px; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--an-radius); box-shadow: var(--an-shadow); }
.an-set-tags { display: flex; flex-wrap: wrap; gap: 0 16px; }
.an-set-defaults { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px 12px; }

/* gallery: cards with a small preview, badges, owner; Open, Pin and an overflow menu */
.an-gallery-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin: 2px 0 18px; }
.an-gh-text { flex: 1 1 320px; min-width: 0; }
.an-new-form { position: absolute; z-index: 60; top: calc(100% + 6px); right: 0; width: min(520px, calc(100vw - 32px)); box-shadow: var(--an-shadow-pop); }
.an-section { margin-bottom: 22px; }
.an-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.an-section-title { margin: 0; font-size: var(--fs-lg); font-weight: 700; color: var(--dark); }
.an-section-title .text-muted { font-weight: 500; }
.an-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.an-card { display: flex; flex-direction: column; min-width: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--an-shadow);
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease; }
.an-card:hover { border-color: var(--border-hover); box-shadow: var(--an-shadow-hi); transform: translateY(-2px); }
.an-card:focus-within { border-color: color-mix(in srgb, var(--primary) 45%, var(--card)); }
.an-card-archived { opacity: .72; }
.an-thumb { --th: var(--primary); position: relative; display: block; height: 92px; overflow: hidden; border-radius: var(--r-lg) var(--r-lg) 0 0; color: var(--th);
  background: linear-gradient(135deg, color-mix(in srgb, var(--th) 16%, var(--card)) 0%, color-mix(in srgb, var(--th) 5%, var(--card)) 100%); border-bottom: 1px solid color-mix(in srgb, var(--th) 14%, var(--border)); }
.an-thumb-0 { --th: var(--primary); }
.an-thumb-1 { --th: var(--an-s1); }
.an-thumb-2 { --th: var(--an-s3); }
.an-thumb-3 { --th: var(--an-s6); }
.an-thumb-4 { --th: var(--an-s4); }
.an-thumb-7 { --th: var(--an-s7); }
.an-thumb-motif { position: absolute; right: 14px; top: 12px; width: calc(100% - 96px); height: 68px; }
.an-thumb-motif rect { fill: color-mix(in srgb, var(--th) 20%, transparent); }
.an-thumb-motif path { fill: none; stroke: color-mix(in srgb, var(--th) 65%, transparent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.an-thumb-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: var(--r-lg);
  background: var(--card); color: var(--th); box-shadow: 0 2px 8px rgba(16,24,40,.10); }
.an-card-body { display: flex; flex-direction: column; flex: 1 1 auto; gap: 6px; min-width: 0; padding: 12px 16px 4px; }
.an-card-badges { display: flex; flex-wrap: wrap; gap: 4px; min-height: 18px; }
.an-card-name { margin: 0; font-size: var(--fs-lg); font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.an-card-name a { color: var(--dark); text-decoration: none; }
.an-card-name a:hover { color: var(--primary); }
.an-card-desc { margin: 0; font-size: var(--fs-sm); line-height: 1.45; color: var(--grey); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.an-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: auto 0 0; padding-top: 4px; font-size: var(--fs-xs); color: var(--grey-light); }
.an-avatar { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: var(--fs-2xs); font-weight: 700;
  color: var(--primary-deep); background: color-mix(in srgb, var(--primary) 15%, var(--card)); }
.an-card-foot { display: flex; align-items: center; gap: 6px; padding: 10px 16px 14px; }
.an-card-foot .an-menu { margin-left: auto; }
.an-pin-btn.is-on { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, var(--card)); background: color-mix(in srgb, var(--amber) 8%, var(--card)); }

/* Home Pages */
.an-hp-rules { margin: 6px 0 0 18px; padding: 0; }
.an-hp-save { text-align: right; white-space: nowrap; }
.an-hp-save form { margin: 0; }
.an-stack select { min-width: 200px; }

/* My Work strip */
.mywork-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.mywork-tile { display: inline-flex; align-items: baseline; gap: 10px; padding: 10px 16px; border-radius: var(--an-radius); background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--an-shadow); color: var(--dark); text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease; }
.mywork-tile:hover { border-color: var(--primary); box-shadow: var(--an-shadow-hi); text-decoration: none; }
.mywork-n { font-size: var(--fs-2xl); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--grey-light); }
.mywork-due .mywork-n { color: var(--primary); }
.mywork-l { font-size: var(--fs-sm); font-weight: 600; }
.mywork-home { margin-left: auto; }
.nav-pins a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* phones and narrow windows: widgets stack in (y, x) order, editing by drag is off, tables become cards */
@media (max-width: 760px) {
  .an-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; gap: 12px; }
  .an-grid .an-w { grid-column: 1 / -1 !important; grid-row: auto !important; height: max(150px, calc(var(--h, 3) * 68px)); }
  .an-grid .an-w-kpi { height: 132px; }
  .an-grid-edit { background-image: none; }
  .an-ph-title { font-size: var(--fs-xl); }
  .an-ph-actions { width: 100%; }
  .an-filterbar { padding: 6px 8px; }
  .an-fp { position: static; }
  .an-fp-pop { left: 8px; right: 8px; width: auto; }
  .an-pill { max-width: calc(100vw - 80px); }
  .an-fb-clear { margin-left: 0; }
  .an-change-box, .an-ph-actions .an-change-box { position: fixed; left: 16px; right: 16px; top: auto; min-width: 0; }
  .an-cards { grid-template-columns: minmax(0, 1fr); }
  .mywork-home { margin-left: 0; flex-basis: 100%; }
  .mywork-tile { flex: 1 1 140px; }
  .an-stack thead { display: none; }
  .an-stack, .an-stack tbody, .an-stack tr, .an-stack td { display: block; width: 100%; }
  .an-stack tr { margin-bottom: 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--r-md); }
  table.an-stack td { padding: 4px 0; border: 0; text-align: left; }
  table.an-stack td[data-label]::before { content: attr(data-label); display: block; font-size: var(--fs-xs); font-weight: 700; color: var(--grey); }
  table.an-stack td.num { text-align: left; }
  .an-stack select { min-width: 0; }
  .an-hp-save { text-align: left; }
}

/* ---------- Analytics Studio (2.45): targets, gauges and bullets, forecasts, PDF snapshot schedules, Planning ----------
   Scale bands follow the good direction (bad / warn / good, or neutral without a target); they are tints of the
   status tokens, so they keep their contrast on the dark surface. Forecasts are dashed and always labelled. */
:root { --an-band-good: color-mix(in srgb, var(--success) 26%, var(--card)); --an-band-warn: color-mix(in srgb, var(--amber) 28%, var(--card));
  --an-band-bad: color-mix(in srgb, var(--red) 24%, var(--card)); --an-band-neutral: color-mix(in srgb, var(--grey-light) 22%, var(--card)); --an-fc: var(--an-s7); }
.an-tgt-chip { gap: 5px; }
.an-tgt-dot { width: 7px; height: 7px; border-radius: 50%; border: 2px solid currentColor; flex: none; }
.an-tgt-center { justify-content: center; }
/* gauge: a half circle that scales with the card */
.an-gauge { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%; min-height: 0; }
.an-gauge-face { display: flex; flex: 1 1 auto; min-height: 0; width: 100%; max-width: 300px; padding: 0; border: 0; background: none; color: inherit; font: inherit; }
button.an-gauge-face { cursor: pointer; border-radius: var(--r-sm); }
button.an-gauge-face:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.an-gauge-svg { display: block; width: 100%; height: 100%; min-height: 50px; overflow: visible; }
.an-gauge-track { fill: none; stroke: var(--hover-bg); stroke-width: 16; stroke-linecap: butt; }
.an-gauge-band { fill: none; stroke-width: 5; }
.an-gauge-val { fill: none; stroke-width: 16; stroke-linecap: butt; }
.an-gauge-band.an-band-good { stroke: var(--an-band-good); }
.an-gauge-band.an-band-warn { stroke: var(--an-band-warn); }
.an-gauge-band.an-band-bad { stroke: var(--an-band-bad); }
.an-gauge-band.an-band-neutral { stroke: var(--an-band-neutral); }
.an-gauge-val.an-band-good { stroke: var(--success); }
.an-gauge-val.an-band-warn { stroke: var(--an-s4); }
.an-gauge-val.an-band-bad { stroke: var(--red); }
.an-gauge-val.an-band-neutral { stroke: var(--an-s1); }
.an-gauge-target { stroke: var(--dark); stroke-width: 3; stroke-linecap: round; }
.an-gauge-num { fill: var(--dark); font: 800 26px var(--font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.an-gauge-num.an-kpi-none { fill: var(--grey-light); }
.an-gauge-lim { fill: var(--grey-light); font: 500 10px var(--font); }
button.an-gauge-face:hover .an-gauge-num { fill: var(--primary); }
/* bullet: value bar over the bands, target mark, scale ends */
.an-bullet { display: flex; flex-direction: column; justify-content: center; gap: 6px; height: 100%; min-width: 0; }
.an-bullet-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; }
.an-bullet-value { font-size: clamp(18px, 24cqh, 28px); }
.an-bullet-rows { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.an-bullet-track { position: relative; height: 22px; border-radius: calc(var(--r-sm) / 2); background: var(--an-band-neutral); flex: none; }
.an-bullet-band { position: absolute; top: 0; bottom: 0; }
.an-bullet-band:first-child { border-radius: calc(var(--r-sm) / 2) 0 0 calc(var(--r-sm) / 2); }
.an-bullet-band.an-band-good { background: var(--an-band-good); }
.an-bullet-band.an-band-warn { background: var(--an-band-warn); }
.an-bullet-band.an-band-bad { background: var(--an-band-bad); }
.an-bullet-band.an-band-neutral { background: var(--an-band-neutral); }
.an-bullet-bar { position: absolute; top: 7px; height: 8px; border-radius: calc(var(--r-sm) / 4); background: var(--dark); }
.an-bullet-target { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-left: -1.5px; border-radius: calc(var(--r-sm) / 4); background: var(--dark); }
.an-bullet-scale { display: flex; justify-content: space-between; font-size: var(--fs-2xs); color: var(--grey-light); font-variant-numeric: tabular-nums; }
@container (max-height: 70px) { .an-bullet-scale { display: none; } }
/* forecast: the label in the title bar, the caption under the widget */
.an-w-fc { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 0 7px; border-radius: var(--r-pill); font-size: var(--fs-2xs); font-weight: 700; line-height: 16px;
  color: var(--an-fc); background: color-mix(in srgb, var(--an-fc) 12%, var(--card)); }
.an-w-body.an-has-fc { display: flex; flex-direction: column; }
.an-w-body.an-has-fc > .an-chart, .an-w-body.an-has-fc > .an-table-wrap { flex: 1 1 auto; min-height: 60px; height: auto; }
.an-fc-cap { display: flex; align-items: center; gap: 6px; flex: none; min-width: 0; margin-top: 4px; font-size: var(--fs-2xs); color: var(--grey-light); }
.an-fc-key { flex: none; width: 18px; border-top: 2px dashed currentColor; }
.an-fc-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-state-fc .an-state-icon { color: var(--an-fc); background: color-mix(in srgb, var(--an-fc) 12%, var(--card)); }
.an-state-fc .an-state-text { max-width: 44ch; font-weight: 500; }
/* targets in the widget editor */
.an-tg-rows { display: flex; flex-direction: column; gap: 2px; }
.an-tg-row input[type=month], .an-tg-row input[type=date] { flex: 1.3 1 0; }
/* dashboard header: number of schedules on the button */
.an-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); font-size: var(--fs-2xs); font-weight: 700;
  color: var(--primary-deep); background: color-mix(in srgb, var(--primary) 14%, var(--card)); }
.an-count[hidden] { display: none; }
.an-menu-item.is-busy { opacity: .6; cursor: progress; }
/* schedule pop-up */
.an-snap-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.an-snap-row { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card); }
.an-snap-row.is-paused { background: var(--hover-bg); }
.an-snap-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.an-snap-when { font-size: var(--fs-base); color: var(--dark); }
.an-snap-to { font-size: var(--fs-sm); overflow-wrap: anywhere; }
.an-snap-last { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.an-snap-ftitle { margin: 0 0 8px; font-size: var(--fs-md); }
.an-snap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.an-snap-grid .form-group[hidden] { display: none; }
.an-snap-preview { font-weight: 600; color: var(--primary-deep); }
.an-snap-rec { margin-top: 10px; }
.an-mysnap-dash { margin: 12px 0 4px; font-size: var(--fs-md); overflow-wrap: anywhere; }
.pl-err { margin: 4px 0 0; }
.an-note-bad { color: var(--red); font-weight: 600; }
.pl-pager { padding-top: 10px; }
.pl-pager span.btn[aria-disabled] { opacity: .45; pointer-events: none; }
.pl-run-errors { margin: 10px 0 0; max-width: 90ch; }
.pl-run-errors ul { margin: 4px 0 0 18px; padding: 0; }
/* Planning and forecast pages */
.pl-set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; }
.pl-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.pl-tile { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--an-radius); background: var(--card); box-shadow: var(--an-shadow); }
.pl-tile-n { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.15; color: var(--dark); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pl-tile-text { font-size: var(--fs-lg); }
.pl-tile-l { font-size: var(--fs-sm); color: var(--grey-light); }
.pl-tile-warn .pl-tile-n { color: var(--amber); }
.pl-tile-bad .pl-tile-n { color: var(--red); }
.pl-sec { margin-bottom: 16px; padding: 14px 16px; border-radius: var(--an-radius); box-shadow: var(--an-shadow); }
.pl-sec-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.pl-sec-head > div:first-child { flex: 1 1 280px; min-width: 0; }
.pl-sec-title { margin: 0; font-size: var(--fs-lg); font-weight: 700; color: var(--dark); }
details > summary.pl-sec-title { cursor: pointer; }
.pl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.pl-tools input[type=search] { width: 200px; max-width: 100%; }
.pl-tools select { width: auto; max-width: 100%; }
.pl-subtools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 4px 0 8px; }
.pl-subtools select { width: auto; }
.pl-state { min-height: 90px; }
.pl-scroll { max-height: 70vh; overflow: auto; }
.pl-table .pl-sku { font-weight: 700; white-space: nowrap; }
.pl-table .pl-name { color: var(--grey); }
.pl-level { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: var(--r-pill); font-size: var(--fs-2xs); font-weight: 600; color: var(--grey); background: var(--hover-bg); }
.pl-open { text-align: right; white-space: nowrap; }
.pl-cb { width: 34px; }
.pl-cb input { margin: 0; }
.pl-sugg strong { font-variant-numeric: tabular-nums; }
.pl-needs .pl-c { display: none; }
.pl-needs.pl-calc-on .pl-c { display: table-cell; color: var(--grey); }
.pl-needs tr.pl-done td { color: var(--grey-light); }
table.data-table.pl-needs tbody tr.is-selected td { background: color-mix(in srgb, var(--primary) 9%, var(--card)); }
.pl-st .badge { margin-right: 4px; }
.pl-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 8px; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: var(--r-md); background: color-mix(in srgb, var(--primary) 5%, var(--card)); }
.pl-all { margin: 0; }
.pl-sel { font-size: var(--fs-sm); font-weight: 600; color: var(--grey); }
.pl-bar .btn.is-busy, .an-ph-actions .btn.is-busy { opacity: .7; cursor: progress; }
.pl-result .alert { margin: 0 0 8px; }
.pl-result ul { margin: 4px 0 0 18px; padding: 0; }
.pl-result-foot { margin-bottom: 8px; }
.pl-made a { font-weight: 600; }
body.pl-working { cursor: progress; }
.fc-chart { position: relative; height: 320px; }
.fc-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 16px; }
.fc-chosen td { font-weight: 600; }
.fc-reason { display: block; font-size: var(--fs-xs); }
.fc-future td { color: var(--grey); }
.an-ph-desc.an-fc-note:empty { display: none; }
@media (max-width: 760px) {
  .an-grid .an-w-gauge { height: 210px; }
  .an-grid .an-w-bullet { height: 150px; }
  .pl-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pl-tools, .pl-tools input[type=search] { width: 100%; }
  .pl-tools select { flex: 1 1 0; min-width: 0; }
  .pl-scroll { max-height: none; overflow: visible; }
  .pl-needs.pl-calc-on .pl-c { display: block; }
  table.an-stack.pl-needs td.pl-cb { width: auto; }
  .fc-chart { height: 240px; }
  .fc-cols { grid-template-columns: minmax(0, 1fr); }
  .pl-bar { top: auto; bottom: 0; box-shadow: var(--an-shadow-pop); }
}

/* 2.46: approval state, credit strip, trash children, numbering table */
.ap-state { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; vertical-align: middle; min-width: 0; }
.ap-state a { text-decoration: none; }
.ap-note { display: block; font-size: var(--fs-sm); color: var(--grey); overflow-wrap: anywhere; }
.ap-hint { font-size: var(--fs-sm); color: var(--grey); }
.credit-strip { display: grid; gap: 8px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card); }
.credit-strip.over { border-color: color-mix(in srgb, var(--red) 45%, var(--card)); background: color-mix(in srgb, var(--red) 8%, var(--card)); }
.credit-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px 14px; }
.credit-fig { min-width: 0; }
.credit-fig .k { display: block; font-size: var(--fs-xs); color: var(--grey); }
.credit-fig strong { overflow-wrap: anywhere; }
.credit-fig small { display: block; font-size: var(--fs-xs); color: var(--grey); }
.credit-fig.neg strong { color: var(--red); }
.credit-over { font-weight: 600; color: var(--red); }
.credit-override-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
.credit-override-form .form-group { flex: 1 1 260px; min-width: 0; margin: 0; }
.credit-override-form input { width: 100%; }
.trash-sub { display: block; font-size: var(--fs-sm); color: var(--grey); overflow-wrap: anywhere; }
.trash-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.link-btn { background: none; border: none; padding: 0; font: inherit; cursor: pointer; font-weight: 600; color: var(--primary); }
.link-btn.danger { color: var(--red); }
.num-table input[type=text] { width: 100%; max-width: 130px; }
.num-table input[type=number] { width: 100%; max-width: 150px; }
.num-table .num-will { font-weight: 600; overflow-wrap: anywhere; }
.num-table .num-hint { display: block; font-size: var(--fs-xs); color: var(--grey); }
.num-table .num-ro { overflow-wrap: anywhere; }
.num-table tr.num-bad input { border-color: var(--red); }
.num-warn { display: block; font-size: var(--fs-xs); color: var(--red); }
.hist-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--card); font-size: var(--fs-sm); margin-bottom: 10px; }
.hist-chip a { text-decoration: none; font-weight: 700; color: var(--grey); }
.num-cell { min-width: 0; }
@media (max-width: 700px) {
  table.num-table.sd-stack td .num-cell { flex: 1 1 auto; max-width: 62%; text-align: left; }
  table.num-table.sd-stack td .num-cell input { max-width: none; width: 100%; }
}
.ap-save-extra .ap-note-field { max-width: 560px; }
.ap-save-extra input[type=text] { width: 100%; max-width: 560px; }
.ap-note-form { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: flex-end; margin: 0; }
.ap-note-field { display: grid; gap: 2px; min-width: 0; flex: 1 1 220px; }
.ap-note-field label { font-size: var(--fs-xs); color: var(--grey); text-transform: none; letter-spacing: 0; }
.ap-note-field textarea { width: 100%; min-height: 34px; max-height: 120px; resize: vertical; }
@media (max-width: 700px) { .ap-note-form { width: 100%; } .ap-note-form .btn { flex: 0 0 auto; } }

/* ---------- 2.47: quote item lines, Create sales order, unbilled time and expenses, billed-on marks ---------- */
.ql-opp { margin: 0 0 12px; font-size: var(--fs-base); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.ql-row .ql-kind, .ql-row .ql-find, .ql-row .ql-service, .ql-row .ql-model, .ql-row .ql-uom { width: 100%; min-width: 0; }
.ql-row .ql-kind { margin-bottom: 4px; }
.ql-row .hidden, .bill-sec.hidden, .bill-row.hidden { display: none !important; }
.ql-next { flex-wrap: wrap; align-items: center; margin-top: 14px; }
.ql-converted { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kr-dialog { padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card); color: var(--dark); width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; box-shadow: 0 18px 50px rgba(0, 0, 0, .3); }
.kr-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.kr-dialog form { padding: 18px; }
.kr-dialog h3 { margin: 0 0 8px; font-size: var(--fs-lg); }
.kr-dialog select { width: 100%; min-width: 0; }
.bill-intro { font-size: var(--fs-sm); margin-top: -8px; }
.bill-filters { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; margin-bottom: 10px; }
.bill-filters .form-group { margin: 0; min-width: 0; flex: 0 1 170px; }
.bill-filters input, .bill-filters select { width: 100%; }
.bill-status { margin: 4px 0 10px; font-size: var(--fs-base); }
.bill-sec { margin: 0 0 16px; }
.bill-sec-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; margin-bottom: 4px; }
.bill-sec-head h4 { margin: 0; font-size: var(--fs-base); }
.bill-all { font-size: var(--fs-sm); }
.bill-subline { font-size: var(--fs-sm); margin-left: auto; }
table.bill-table th.bill-c, table.bill-table td.bill-c { width: 34px; }
table.bill-table .bill-rate { width: 100%; max-width: 110px; text-align: right; }
.bill-total { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 24px; padding-top: 10px; border-top: 1px solid var(--border); font-size: var(--fs-base); }
.bill-total strong { font-size: var(--fs-lg); }
.billed-badge { text-decoration: none; white-space: nowrap; }
a.billed-badge:hover { text-decoration: underline; }
.billed-line { margin-top: 4px; }
.bill-by { font-size: var(--fs-xs); }
.bill-note { font-size: var(--fs-sm); margin: -4px 0 8px; }
.bill-src { display: block; font-size: var(--fs-xs); color: var(--grey); }
@media (max-width: 700px) {
  table.bill-table.sd-stack td.bill-c { justify-content: flex-start; }
  table.bill-table.sd-stack td.bill-c::before { flex: 0 0 auto; }
  table.bill-table .bill-rate { max-width: 100%; }
  .bill-filters .form-group { flex: 1 1 140px; }
  #quote-lines.sd-stack-form tfoot { display: block; width: 100%; }
  #quote-lines.sd-stack-form tfoot td { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; }
}
.ql-blocked { color: var(--red); font-size: var(--fs-sm); }
/* ---------- 2.50: customer returns (RMA): line picker, tabs, receive by lot, inspection, credit totals, RMA print ---------- */
.rma-tab[hidden], .rma-panel[hidden] { display: none; }
.rma-inv { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; margin: 0 0 12px; min-width: 0; }
.rma-inv-focus { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
.rma-inv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 6px; }
table.rma-pick select { min-width: 140px; }
tr.rma-off td { color: var(--grey); }
tr.rma-void td { color: var(--grey); }
tr.rma-over td { background: color-mix(in srgb, var(--red) 8%, var(--card)); }
.rma-lots { display: grid; gap: 6px; justify-items: end; }
.rma-lot-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin: 0; font-weight: 400; text-transform: none; text-align: right; }
.rma-lot-row .sd-note { display: block; }
.rma-void-pop { position: relative; display: inline-block; }
.rma-void-pop > summary { list-style: none; }
.rma-void-pop > summary::-webkit-details-marker { display: none; }
.rma-void-pop form { position: absolute; right: 0; z-index: 5; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px; display: flex; gap: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.rma-void-pop input[type=text] { min-width: 200px; }
.rma-totals { max-width: 360px; margin: 8px 0 0 auto; font-size: var(--fs-base); }
.rma-totals > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; }
.rma-totals .grand { border-top: 2px solid var(--border); padding-top: 8px; font-size: var(--fs-md); }
.rma-totals label { margin: 0; font-weight: 400; text-transform: none; font-size: var(--fs-base); }
.rma-totals input { text-align: right; }
.rma-adv { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; }
.rma-print-instr { border: 2px dashed var(--border); border-radius: var(--r-sm); padding: 10px 12px; margin: 14px 0; white-space: pre-line; }
.rma-print-addr { white-space: pre-line; font-weight: 600; }
.portal-rma-lines td, .portal-rma-lines th { white-space: normal; }
@media (max-width: 700px) {
  .rma-void-pop form { position: static; flex-wrap: wrap; margin-top: 6px; box-shadow: none; }
  .rma-void-pop input[type=text] { min-width: 0; flex: 1 1 140px; }
  .rma-lots { justify-items: stretch; }
  .rma-lot-row { justify-content: space-between; text-align: left; }
  .rma-totals { max-width: none; }
}

/* ---------- 2.51: price lists, price source chips, backorders, cancel remaining, invoice non-stock lines ---------- */
.dl-src { display: inline-block; margin-top: 3px; font-size: var(--fs-2xs); padding: 1px 6px; white-space: nowrap; cursor: default; }
.dl-src-wrap:empty { display: none; }
.dl-price-hint { margin: 6px 0 0; }
.so-inv-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.so-with-nonstock { font-size: var(--fs-sm); margin: 0; }
.so-panel > summary { cursor: pointer; list-style: none; }
.so-panel > summary::-webkit-details-marker { display: none; }
.so-panel > summary h3::before { content: '\25B8'; display: inline-block; margin-right: 6px; transition: transform .15s; }
.so-panel[open] > summary h3::before { transform: rotate(90deg); }
.so-panel-help { font-size: var(--fs-sm); margin-top: -6px; }
.so-mo-warn { color: var(--amber); }
.prl-help { font-size: var(--fs-sm); margin-top: -6px; }
.prl-lines [hidden], .prl-lines td[hidden], .prl-lines th[hidden] { display: none !important; }
.prl-preview { white-space: nowrap; }
.prl-result { align-items: start; }
@media (max-width: 640px) {
  .so-inv-form { width: 100%; }
}

/* ---------- 2.51.2: document lines (Quantity + Unit), item search box, Preview / Print, watermark ---------- */
/* Item search box (views/layout/item_search.php + assets/js/item-search.js). The list is position: fixed (placed by the
   script under the box), so a table's scroll box never cuts it off. */
.is-box { position: relative; min-width: 0; }
.is-box .is-input { width: 100%; min-width: 0; }
.is-pop { position: fixed; z-index: 1200; background: var(--card); color: var(--dark); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 10px 28px rgba(0,0,0,.16); overflow-y: auto; overscroll-behavior: contain; }
.is-pop[hidden] { display: none; }
.is-list { list-style: none; margin: 0; padding: 4px; }
.is-list:empty { display: none; }
.is-opt { padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; line-height: 1.35; }
.is-opt + .is-opt { margin-top: 1px; }
.is-opt:hover, .is-opt.active { background: color-mix(in srgb, var(--primary) 12%, var(--card)); }
.is-opt.active { box-shadow: inset 3px 0 0 var(--primary); }
.is-opt-top { display: flex; gap: 8px; align-items: baseline; font-size: var(--fs-base); min-width: 0; }
.is-sku { font-weight: 700; white-space: nowrap; }
.is-name { overflow-wrap: anywhere; }
.is-opt-meta { font-size: var(--fs-xs); color: var(--grey); margin-top: 2px; }
.is-opt-desc { font-size: var(--fs-xs); color: var(--grey-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.is-note { padding: 6px 10px; font-size: var(--fs-sm); color: var(--grey); border-top: 1px solid var(--border); }
.is-note:empty, .is-note[hidden] { display: none; }
.is-list:empty + .is-note { border-top: 0; }
.ql-findbox { margin-top: 4px; }
.ql-row .is-box.hidden { display: none !important; }
/* Lines: Quantity, then Unit (a select of the item's units, or Hours / Fixed / Month / Each on a service line) */
.dist-lines .dl-uom, #quote-lines .ql-model, #quote-lines .ql-uom { min-width: 84px; }
#procLines .pl-unit { color: var(--grey); white-space: nowrap; }
/* Bottom row of a document form: Preview · Save · Cancel (in page order; app.js makes Enter in a field press Save) */
.doc-form-actions { flex-wrap: wrap; align-items: center; }
.doc-form-actions .doc-form-end { margin-left: auto; }
/* Printed documents: the DRAFT watermark (fixed, so it repeats on every printed page) and the problems a Preview found */
.print-watermark { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 50; overflow: hidden; }
.print-watermark span { transform: rotate(-32deg); font-family: var(--font); font-weight: 800; font-size: clamp(28px, 7vw, 72px); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  color: rgba(110,116,128,.20); border: 5px solid rgba(110,116,128,.20); border-radius: var(--r-lg); padding: 6px 26px; }
.print-problems { border: 1px solid var(--red); background: color-mix(in srgb, var(--red) 8%, var(--card)); color: var(--red); border-radius: var(--r-md); padding: 8px 12px; margin: 0 0 18px; font-size: var(--fs-sm); }
.print-problems ul { margin: 0; padding-left: 18px; }
.print-line-flag td { border-bottom: 0; }
.print-line-problem td { color: var(--red); font-size: var(--fs-sm); padding-top: 0; }
.print-doc table.print-lines { margin: 4px 0 12px; }
@media print {
  .print-watermark, .print-problems, .print-line-problem td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-watermark span { font-size: 72px; }
}
@media (max-width: 700px) {
  .doc-form-actions .btn { flex: 1 1 auto; justify-content: center; text-align: center; }
  .doc-form-actions .doc-form-end { margin-left: 0; }
  table.sd-stack-form td .is-box, table.sd-stack-form td select, table.sd-stack-form td input[type=number], table.sd-stack-form td input[type=text] { width: 100%; max-width: none; }
  .print-doc-header { flex-wrap: wrap; gap: 12px; }
}

/* ---------- 2.51.3: work orders, requisitions, returns, stock transfers, production order item ---------- */
/* Print in the toolbar's id part: the id part grows, so Print stays at the top right when the other buttons wrap below */
.doc-toolbar-id.has-print { flex: 1 1 auto; }
.doc-toolbar-print { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding-left: 8px; }
.doc-toolbar-id.has-print + .doc-toolbar-actions { margin-left: auto; }
/* Item search box extras: lots at the source (transfers), the invoice line found (returns) */
.is-opt-lots { font-size: var(--fs-xs); color: var(--grey); margin-top: 2px; }
.rma-find { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin: 0 0 12px; max-width: 560px; }
.rma-find .is-box { flex: 1 1 260px; }
.rma-find-label { font-size: var(--fs-sm); font-weight: 600; color: var(--grey); }
/* Return lines: the SKU on one line, the name below it in at most two lines (full text on hover) */
.rma-pick td.rma-item { min-width: 200px; max-width: 320px; }
.rma-pick .rma-sku { display: block; white-space: nowrap; }
.rma-pick .rma-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--fs-sm); }
/* Read-only Unit cells (requisitions: the item's base unit or Each; transfers: the base unit) */
.req-unit, .st-uom { color: var(--grey); white-space: nowrap; }
.mo-nobom { color: var(--amber); }
/* Work order time entries as Quantity + Unit; the inline edit row spans the stacked card on a phone */
table.wo-time td.wo-time-edit::before { content: none; }
/* Printed requisition: the reason, and a refused line on a Preview (listed, not counted) */
.req-print-reason { margin: 0 0 18px; font-size: 13px; }
.req-print-reason .label { font-size: var(--fs-xs); font-weight: 700; color: var(--grey); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.req-print-reason-text { white-space: pre-line; }
.print-line-failed td { color: var(--grey); font-style: italic; }
@media (max-width: 700px) {
  table.sd-stack.wo-time td.wo-time-edit { display: block; }
  .doc-toolbar-print { padding-left: 0; }
  .rma-find { max-width: none; }
  .rma-pick td.rma-item { min-width: 0; max-width: none; }
}

/* ---------- 2.52.0: landed costs (list, form, view, print), the bill line type, the receipt box, the item Costing tab ---------- */
.lc-help { font-size: var(--fs-sm); margin: -4px 0 10px; }
.lc-open-note { margin: 0 0 10px; }
.lc-picker { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-items: center; margin: 0 0 12px; max-width: 720px; }
.lc-picker-label { font-size: var(--fs-sm); font-weight: 600; color: var(--grey); margin: 0; }
.lc-picker-input { width: 100%; }
.lc-results { grid-column: 1 / -1; font-size: var(--fs-sm); color: var(--grey); }
.lc-results:empty { display: none; }
.lc-result-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-md); max-height: 300px; overflow-y: auto; background: var(--card); }
.lc-result { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; color: var(--dark); }
.lc-result + .lc-result { border-top: 1px solid var(--border); }
.lc-result-text { min-width: 0; overflow-wrap: anywhere; }
.lc-result .btn { flex: none; }
.lc-remove { background: none; border: none; cursor: pointer; color: var(--red); font-size: var(--fs-xl); line-height: 1; padding: 0 4px; border-radius: var(--r-sm); }
.lc-del-h { width: 34px; }
.lc-doc-amt { font-size: var(--fs-xs); }
.lc-empty { font-size: var(--fs-sm); margin: 6px 0 0; }
.lc-sku { white-space: nowrap; }
.lc-item-name { font-size: var(--fs-sm); }
.lc-void td { color: var(--grey); }
.lc-void-badge { margin-left: 6px; }
.lc-grid th.lc-col { white-space: nowrap; }
.lc-col-sub { font-weight: 400; font-size: var(--fs-2xs); text-transform: none; letter-spacing: 0; }
.lc-grid input.lc-manual { width: 100px; text-align: right; }
.lc-grid .lc-grid-total td { font-weight: 700; border-top: 2px solid var(--border); }
.lc-unit { font-weight: 600; }
.lc-up { color: var(--amber); }
.lc-down { color: var(--success-deep); }
.lc-problems:empty { display: none; }
.lc-problems { border: 1px solid var(--amber); background: color-mix(in srgb, var(--amber) 8%, var(--card)); color: var(--dark); border-radius: var(--r-md); padding: 8px 12px; margin: 0 0 12px; font-size: var(--fs-sm); }
.lc-problems ul, .lc-problem-list { margin: 4px 0 0; padding-left: 18px; }
.lc-facts { margin-top: 6px; }
.lc-k { font-size: var(--fs-sm); }
.lc-alert { margin: 10px 0 0; }
.lc-notes { margin: 10px 0 0; }
.lc-inline-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.lc-inline-form .form-group { margin: 0; flex: 1 1 260px; }
.lc-inline-go { flex: 0 0 auto !important; }
.lc-pick-h { width: 34px; }
/* bill lines: the landed-cost type */
.bl-landed-cell select { min-width: 130px; }
.bl-landed-note { margin-top: 3px; font-size: var(--fs-xs); }
/* receipt view: the landed costs box */
.rcv-landed-note { font-size: var(--fs-sm); margin: 8px 0 0; }
.item-last-landed a { font-weight: 600; }
/* the print: a wider page for the allocation grid */
.print-page.print-page-wide { max-width: 1000px; }
.lc-print-h { font-size: var(--fs-md); margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .4px; color: var(--grey); }
.lc-print-notes { white-space: pre-line; font-size: 13px; margin: 0 0 12px; }
.lc-print-note { font-size: var(--fs-sm); margin: 6px 0 0; }
.lc-print-grid th, .lc-print-grid td { font-size: 11.5px; }
.lc-print-grid td:first-child { white-space: nowrap; }
.lc-grid td:first-child { min-width: 150px; }
.table-wrap + .lc-help { margin-top: 8px; }
@media (max-width: 700px) {
  .lc-picker { grid-template-columns: 1fr; }
  .lc-result { flex-wrap: wrap; }
  .lc-grid input.lc-manual { width: 80px; }
}

/* ---------- 2.53.0: separate database accounts (Security > Database Accounts, migrate fields, installer) ---------- */
.dba-intro { font-size: var(--fs-base); margin: -4px 0 10px; }
.dba-purpose-hint { font-size: var(--fs-sm); margin-top: 2px; }
.dba-table td:first-child { min-width: 200px; }
.dba-status-note { font-size: var(--fs-sm); color: var(--grey); margin-top: 3px; }
.dba-status-list { margin: 4px 0 0; padding-left: 16px; font-size: var(--fs-sm); color: var(--amber); }
.dba-rights { font-size: var(--fs-xs); white-space: normal; overflow-wrap: anywhere; }
.dba-sql { margin: 10px 0 14px; }
.dba-sql > summary { cursor: pointer; font-weight: 600; font-size: var(--fs-base); }
.dba-sql-text { background: var(--hover-bg); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; font-size: var(--fs-xs); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; margin: 6px 0 0; }
.dba-form { margin-top: 6px; }
.dba-accounts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.dba-account, .dba-migrate { border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 12px 10px; margin: 0; min-width: 0; }
.dba-account legend, .dba-migrate legend { font-weight: 700; font-size: var(--fs-base); padding: 0 4px; }
.dba-account .form-group, .dba-migrate .form-group { margin-bottom: 8px; }
.dba-account.has-problem { border-color: var(--red); }
.dba-field-problems { margin: 0; padding-left: 16px; color: var(--red); font-size: var(--fs-sm); }
.dba-migrate { margin: 0 0 10px; max-width: 560px; background: var(--card); }
.dba-migrate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }
.dba-field-error { color: var(--red); font-size: var(--fs-sm); margin-top: 3px; }
.dba-field-error[hidden] { display: none; }
.dba-migrate input[aria-invalid="true"] { border-color: var(--red); }
.dba-warn { margin: 0 0 10px; }
.dba-offer { margin: 10px 0 0; font-size: var(--fs-sm); }
.su-install-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.su-install-row form { margin: 0; }
/* the migrate password, shown once */
.dba-once { border: 2px solid var(--amber); background: color-mix(in srgb, var(--amber) 8%, var(--card)); border-radius: var(--r-md); padding: 10px 14px; margin: 8px 0 0; text-align: left; }
.dba-once h4 { margin: 0 0 6px; font-size: var(--fs-md); }
.dba-once-users { margin-bottom: 8px; }
.dba-once-users td { padding: 4px 8px; }
.dba-once-pass label { font-weight: 700; font-size: var(--fs-sm); }
.dba-once-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.dba-once-input { flex: 1 1 260px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: var(--fs-base); }
.dba-once-warn { margin: 8px 0 0; font-size: var(--fs-sm); font-weight: 600; color: var(--amber); }
/* Backup & Restore: Restore… opens the migrate fields under the row */
.dba-restore-pop { display: inline-block; position: relative; }
.dba-restore-pop > summary { list-style: none; cursor: pointer; color: var(--primary); font-weight: 600; }
.dba-restore-pop > summary::-webkit-details-marker { display: none; }
.dba-restore-form { position: absolute; right: 0; z-index: 5; min-width: 340px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.12); text-align: left; white-space: normal; }
.dba-restore-form .dba-migrate { border: 0; padding: 0; max-width: none; }
.dba-upload-form .dba-migrate { flex: 1 1 100%; }
.dba-upload-form > .form-group { flex: 1 1 220px !important; }
.dba-created-next { margin: 12px 0 0; }
/* installer */
.install-dba-check { font-weight: 600; }
.install-dba-done { margin: 12px 0; text-align: left; }
.install-dba-note { text-align: left; }
@media (max-width: 700px) {
  .dba-table td:first-child { min-width: 0; }
  table.sd-stack.dba-table td:first-child, table.sd-stack.dba-table td:last-child { display: block; text-align: left; }
  table.sd-stack.dba-table td:first-child::before, table.sd-stack.dba-table td:last-child::before { display: block; margin-bottom: 2px; }
  .dba-restore-form { position: static; min-width: 0; margin-top: 6px; box-shadow: none; }
  .dba-once-input { flex-basis: 100%; }
}

/* ---------- 2.54.0: document storage (the Documents box on records, Document Storage) ---------- */
.doc-panel .card-header { margin-bottom: 4px; }
.doc-missing { margin: 0 0 10px; }
.doc-missing-row + .doc-missing-row { margin-top: 2px; }
.doc-missing-block { font-weight: 600; }
.doc-paused { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 10px; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--amber) 40%, var(--border)); background: color-mix(in srgb, var(--amber) 8%, var(--card)); border-radius: var(--r-md); color: var(--dark); }
.doc-attach-form { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--hover-bg); }
.doc-attach-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.doc-attach-row .doc-type-select { flex: 0 1 260px; min-width: 0; }
.doc-attach-row .doc-file-input { flex: 1 1 220px; min-width: 0; }
.doc-hint { margin: 6px 0 0; }
.doc-hint-nojs[hidden] { display: none; }
.doc-drop { margin-top: 8px; padding: 14px 12px; border: 2px dashed var(--border-hover); border-radius: var(--r-md); text-align: center; color: var(--grey); font-size: var(--fs-sm); background: var(--card); transition: border-color .15s, background-color .15s, color .15s; }
.doc-drop[hidden] { display: none; }
.doc-drop.doc-drop-on { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--card)); }
.doc-queue:empty { display: none; }
.doc-queue { margin-top: 8px; }
.doc-q-row { padding: 8px 0; border-top: 1px solid var(--border); }
.doc-q-row:first-child { border-top: 0; }
.doc-q-name { font-weight: 600; font-size: var(--fs-base); overflow-wrap: anywhere; }
.doc-q-path { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: var(--fs-xs); }
.doc-q-bar { display: block; width: 100%; height: 8px; margin: 4px 0 2px; border: 0; border-radius: var(--r-pill); overflow: hidden; background: var(--border); appearance: none; -webkit-appearance: none; }
.doc-q-bar::-webkit-progress-bar { background: var(--border); border-radius: var(--r-pill); }
.doc-q-bar::-webkit-progress-value { background: var(--primary); border-radius: var(--r-pill); transition: width .2s; }
.doc-q-bar::-moz-progress-bar { background: var(--primary); border-radius: var(--r-pill); }
.doc-q-done .doc-q-bar::-webkit-progress-value { background: var(--success); }
.doc-q-done .doc-q-bar::-moz-progress-bar { background: var(--success); }
.doc-q-done .doc-q-status { color: var(--success-deep); }
.doc-q-error { color: var(--red); }
.doc-q-failed .doc-q-bar::-webkit-progress-value { background: var(--red); }
.doc-q-failed .doc-q-bar::-moz-progress-bar { background: var(--red); }
.doc-q-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0 0; border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.doc-empty { margin: 0 0 8px; }
.doc-table .doc-file-name { overflow-wrap: anywhere; }
.doc-table .doc-original { overflow-wrap: anywhere; }
.doc-table .doc-nowrap { white-space: nowrap; }
.doc-table tr.doc-group-more td { border-top-color: transparent; }
.doc-actions-cell { text-align: right; width: 1%; white-space: nowrap; }
.doc-panel .table-wrap { overflow: visible; } /* the Remove pop-up must not be clipped; the table stacks on phones */
.doc-remove { position: relative; display: inline-block; }
.doc-remove > summary { list-style: none; cursor: pointer; }
.doc-remove > summary::-webkit-details-marker { display: none; }
.doc-remove-form { position: absolute; right: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; width: 300px; margin-top: 6px; padding: 10px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 6px 20px rgba(0,0,0,.12); white-space: normal; text-align: left; }
.doc-remove-form input[type=text] { flex: 1 1 160px; min-width: 0; }
.doc-remove-hint { flex: 1 1 100%; margin: 0; }
.doc-legacy { margin: 8px 0 4px; padding-top: 8px; border-top: 1px dashed var(--border); }
.doc-legacy-title { margin-bottom: 4px; font-weight: 600; }
.doc-legacy-row { padding: 2px 0; overflow-wrap: anywhere; }
.doc-location { margin: 8px 0 0; }
@media (max-width: 700px) {
  .doc-attach-row .doc-type-select, .doc-attach-row .doc-file-input { flex: 1 1 100%; }
  .doc-attach-row .btn { flex: 1 1 100%; justify-content: center; }
  .doc-drop { display: none; }
  table.sd-stack.doc-table tr.doc-group-more td.doc-type-cell { display: none; }
  table.sd-stack.doc-table td.doc-file-cell, table.sd-stack.doc-table td.doc-type-cell { display: block; text-align: right; }
  table.sd-stack.doc-table td.doc-file-cell::before, table.sd-stack.doc-table td.doc-type-cell::before { float: left; width: 38%; }
  .doc-actions-cell { width: auto; }
  .doc-remove-form { position: static; width: auto; box-shadow: none; }
}
/* 2.54.1: the Documents section of a create form, the linked documents, the bulk attach page */
.doc-flash { margin: 0 0 10px; }
.doc-create > summary { list-style: none; cursor: pointer; margin-bottom: 0; user-select: none; }
.doc-create > summary::-webkit-details-marker { display: none; }
.doc-create > summary::after { content: '\25BE'; color: var(--grey-light); font-size: var(--fs-md); line-height: 1; }
.doc-create[open] > summary { margin-bottom: 6px; }
.doc-create[open] > summary::after { content: '\25B4'; }
.doc-create > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }
.doc-create-intro { margin: 0 0 8px; }
/* files sent ahead before the form came back with an error: they go with the next Save */
.doc-create-ahead { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 6px 10px; border: 1px solid color-mix(in srgb, var(--success) 35%, var(--border)); border-radius: var(--r-md); background: color-mix(in srgb, var(--success) 7%, var(--card)); overflow-wrap: anywhere; }
.doc-create-ahead::before { content: '\2713'; flex: 0 0 auto; color: var(--success); font-weight: 700; }
.doc-create-ahead .field-hint { color: var(--dark); }
.doc-create-rows { display: flex; flex-direction: column; gap: 6px; }
.doc-create-row { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--hover-bg); }
.doc-create-row .doc-type-select { width: 100%; min-width: 0; }
.doc-create-row .doc-create-file { width: 100%; min-width: 0; }
.doc-create-status { max-width: 220px; overflow-wrap: anywhere; }
.doc-create-status:empty { display: none; }
.doc-create-remove { min-width: 32px; justify-content: center; font-size: var(--fs-md); line-height: 1; }
.doc-create-remove[hidden] { display: none; }
.doc-create-add { margin-top: 8px; }
.doc-create .doc-paused { margin-bottom: 0; }
.doc-linked { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.doc-linked-title { margin: 0; font-size: var(--fs-base); }
.doc-linked > .field-hint { margin: 2px 0 0; }
.doc-linked-source { margin-top: 8px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.doc-linked-head { padding: 6px 12px; background: var(--hover-bg); border-bottom: 1px solid var(--border); font-weight: 600; font-size: var(--fs-sm); }
.doc-linked-source .table-wrap { margin: 0; }
.doc-linked-table { margin: 0; }
.doc-linked-table { table-layout: fixed; }   /* the same columns in every source, so they line up */
.doc-linked-table td:nth-child(1) { width: 30%; }
.doc-linked-table td:nth-child(2) { width: 42%; }
.doc-linked-table td:nth-child(3) { width: 10%; }
.doc-linked-table td:nth-child(4) { width: 18%; }
.doc-linked-table .doc-file-name { overflow-wrap: anywhere; }
.doc-linked-table tr:first-child td { border-top: 0; }
.doc-bulk-intro { margin: 0 0 10px; }
.doc-bulk-body { margin: 0 0 10px; }
.doc-bulk-form input[type=file] { width: 100%; padding: 18px 14px; }
.doc-bulk-progress:empty { display: none; }
.doc-bulk-progress { margin-top: 4px; overflow-wrap: anywhere; }
.doc-bulk-skip td { color: var(--grey); }
.doc-bulk-path { font-size: var(--fs-xs); overflow-wrap: anywhere; word-break: break-all; }
.doc-bulk-confirm { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
@media (max-width: 700px) {
  .doc-create-row { grid-template-columns: minmax(0, 1fr) auto; padding: 8px; }
  .doc-create-row .doc-type-select { grid-column: 1; grid-row: 1; }
  .doc-create-row .doc-create-remove { grid-column: 2; grid-row: 1; }
  .doc-create-row .doc-create-file, .doc-create-row .doc-create-status { grid-column: 1 / -1; max-width: none; }
  .doc-create-add { width: 100%; justify-content: center; }
  table.sd-stack.doc-linked-table td { width: 100%; }
  table.sd-stack.doc-linked-table td.doc-file-cell, table.sd-stack.doc-linked-table td.doc-type-cell { display: block; text-align: right; }
  table.sd-stack.doc-linked-table td.doc-file-cell::before, table.sd-stack.doc-linked-table td.doc-type-cell::before { float: left; width: 38%; }
  .doc-linked-source { border: 0; border-radius: 0; overflow: visible; }
  .doc-linked-head { border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 6px; }
  .doc-bulk-confirm .btn { flex: 1 1 auto; justify-content: center; }
  table.sd-stack.doc-bulk-table td { display: block; text-align: right; }
  table.sd-stack.doc-bulk-table td::before { float: left; width: 38%; }
  table.sd-stack.doc-bulk-table td .doc-bulk-path { display: inline-block; max-width: 60%; text-align: left; }
}
/* Work order form: Completed / Invoiced shown as a label where the status drop-down would be */
.wo-status-fixed { display: flex; align-items: center; min-height: 32px; }
/* Document Storage (Administration): the card already has its padding, so text and forms sit flush with the tables */
.ds-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ds-intro { margin: 0 0 8px; }
.ds-foot { margin: 10px 0 0; }
.ds-form { padding-top: 4px; }
.ds-delete-form { margin-top: 8px; }
.ds-cleanup-form { margin-top: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ds-settings-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.ds-head-wrap { flex-wrap: wrap; gap: 8px; }
.ds-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.ds-inline { display: inline; }
.ds-nowrap { white-space: nowrap; }
.ds-path { font-size: var(--fs-xs); overflow-wrap: anywhere; word-break: break-all; }
.ds-move-bar { width: 100%; }
.ds-after-table { margin-top: 10px; }
.ds-steps { margin: 6px 0 0 18px; }
.ds-runs { margin-top: 8px; }
.ds-runs > summary { cursor: pointer; }
.ds-kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; margin-top: 6px; }
.ds-rule-table { margin-top: 6px; }
.ds-rule-table td:last-child { width: 1%; }
.ds-rule-table select { width: 200px; max-width: 100%; }
.ds-tpl-input { width: 100%; min-width: 220px; }
.ds-naming-table th:nth-child(2), .ds-naming-table th:nth-child(3) { width: 38%; }
.ds-naming-table .ds-sample { overflow-wrap: anywhere; }
.ds-token-table td:first-child { white-space: nowrap; width: 1%; }
/* Locations: the long root path wraps and the buttons wrap, so the table fits its card */
.ds-loc-table { table-layout: auto; }
.ds-loc-table .ds-loc-name { min-width: 120px; }
.ds-loc-table .ds-loc-root { min-width: 160px; max-width: 340px; }
.ds-loc-table .ds-loc-test { min-width: 150px; }
.ds-actions-cell { width: 1%; }
.ds-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; min-width: 150px; max-width: 230px; margin-left: auto; }
.ds-actions .ds-inline { display: contents; }
.ds-test-row td { background: var(--hover-bg); }
@media (max-width: 1100px) {
  .ds-actions { flex-direction: column; align-items: stretch; min-width: 0; max-width: none; }
  .ds-actions .btn { justify-content: center; }
  .ds-loc-table .ds-loc-root { min-width: 120px; max-width: 240px; }
  .ds-loc-table .ds-loc-test { min-width: 0; }
}
@media (max-width: 700px) {
  .ds-loc-table .ds-loc-root, .ds-loc-table .ds-loc-name, .ds-loc-table .ds-loc-test { min-width: 0; max-width: none; }
  table.sd-stack.ds-table td.ds-loc-root .ds-path { text-align: right; }
  .ds-actions { flex-direction: row; align-items: center; max-width: none; min-width: 0; justify-content: flex-end; }
  table.sd-stack.ds-loc-table td.ds-loc-test { display: block; text-align: right; }
  table.sd-stack.ds-loc-table td.ds-loc-test::before { float: left; }
  table.sd-stack.ds-table td.ds-tick:empty { display: none; }
  table.sd-stack.ds-table td.ds-tick::before { content: none; }
  table.sd-stack.ds-table td.ds-tick { justify-content: flex-start; }
  .ds-naming-table td.ds-naming-record { padding-bottom: 2px; }
  .ds-tpl-input { min-width: 0; }
  .ds-settings-form .form-group { flex: 1 1 100%; }
}


/* classification headings inside an area, as dropdowns */

/* Website Management: the enquiries inbox and one enquiry (moved here from the views) */
.wi-stats { display:grid; grid-template-columns:repeat(5, minmax(0,1fr)); gap:12px; margin-bottom:14px; }
.wi-stats .kpi-card { margin:0; }
.wi-filters { display:flex; gap:8px; flex-wrap:wrap; align-items:flex-end; margin:10px 0 14px; }
.wi-filters label { display:block; font-size:var(--fs-xs); color:var(--grey); margin-bottom:2px; }
.wi-filters input, .wi-filters select { max-width:170px; }
.wi-filters input[type=search] { max-width:230px; }
.wi-dot { display:inline-block; width:9px; height:9px; border-radius:50%; background:var(--primary); }
.wi-unread td { font-weight:600; }
.wi-sub { font-weight:400; color:var(--grey); font-size:var(--fs-sm); max-width:340px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.wi-tags .badge { margin:0 3px 3px 0; }
.wi-bulk { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin:0 0 10px; padding:8px 10px; background:var(--hover-bg); }
.wi-bulk .wi-arg { display:none; }
.wi-table td, .wi-table th { vertical-align:top; }
@media (max-width: 1080px) { .wi-stats { grid-template-columns:repeat(2, minmax(0,1fr)); } .wi-grid { grid-template-columns:minmax(0,1fr); } .wi-msg { max-width:100%; } }
.wi-grid { display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:16px; align-items:start; }
.wi-side .card { margin-bottom:14px; }
.wi-side dl { margin:0; display:grid; grid-template-columns:96px minmax(0,1fr); gap:5px 10px; font-size:var(--fs-sm); }
.wi-side dt { color:var(--grey); }
.wi-side dd { margin:0; overflow-wrap:anywhere; white-space:pre-wrap; }
.wi-msg { max-width:86%; margin:0 0 12px; padding:9px 12px; border:1px solid var(--border); }
.wi-msg .wi-meta { font-size:var(--fs-xs); color:var(--grey); margin-bottom:4px; display:flex; gap:8px; flex-wrap:wrap; }
.wi-msg .wi-text { white-space:pre-wrap; overflow-wrap:anywhere; }
.wi-in { background:var(--hover-bg); margin-right:auto; }
.wi-out { background:color-mix(in srgb, var(--primary) 11%, var(--card)); margin-left:auto; }
.wi-note { background:#FFF6D6; border-color:#E6CF7A; margin-left:auto; color:#3d3200; }
.wi-note .wi-meta { color:#6b5a14; }
.wi-sys { text-align:center; font-size:var(--fs-xs); color:var(--grey); margin:0 0 10px; }
.wi-fail { color:var(--red); font-size:var(--fs-xs); margin-top:6px; }
.wi-ok { color:var(--success-deep); font-size:var(--fs-xs); margin-top:6px; }
.wi-actions form { display:inline-block; margin:0 4px 6px 0; }
.wi-pane { display:none; }
.wi-pane.active { display:block; }
.wi-composer label { display:block; font-size:var(--fs-sm); margin:8px 0 2px; }
.wi-composer textarea { width:100%; }
.wi-composer input[type=text], .wi-composer select { width:100%; max-width:560px; }
.wi-sel { cursor:pointer; }

/* Website Management: shared bits */
.btn-link, .btn.btn-link { background:none; border:0; padding:0; min-height:0; font:inherit; cursor:pointer; color:var(--accent); text-decoration:none; }
.btn-link:hover { text-decoration:underline; }
.filters { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
.wb-drop { margin-top:6px; display:flex; gap:10px; flex-wrap:wrap; align-items:center; border:2px dashed var(--border-hover); border-radius:var(--r-md); padding:10px; }


/* ---- Menu and tab icons (includes/icons.php): one line-icon set, 16 px in the sidebar, 14 px in tabs. The icon sits in a fixed column so
   labels line up; it is muted until the item is hovered, open or current, and then tints with the label. Decoration only (aria-hidden). */
.sidebar-nav .nav-ic { width: 16px; height: 16px; flex: none; opacity: .6; transition: opacity .12s ease; }
.sidebar-nav a:hover .nav-ic, .sidebar-nav a.active .nav-ic { opacity: 1; }
.sidebar-nav .nav-group-body a, .sidebar-nav .nav-item-soon { display: flex; align-items: center; gap: 10px; padding-left: 24px; }
.sidebar-nav .nav-item-soon { justify-content: flex-start; opacity: 1; }
.sidebar-nav .nav-item-soon .nav-label { flex: 1; }
.sidebar-nav .nav-label { flex: 1; min-width: 0; }
.tab-ic { width: 14px; height: 14px; flex: none; margin-right: 6px; vertical-align: -2px; opacity: .75; }
.btn.btn-primary .tab-ic, a:hover > .tab-ic, a.active > .tab-ic, .detail-tab-btn.active .tab-ic { opacity: 1; }
.cp-item .nav-ic { width: 16px; height: 16px; flex: none; margin-right: 10px; opacity: .7; }
.cp-item { display: flex; align-items: center; }

/* ---------- Redesigned left menu (2.56.0): top links, areas A-Z with module links, icon rail, footer tools ---------- */
/* The logo row carries the collapse arrow; the 64 px icon rail (html[data-rail="1"], set from localStorage in the head) shows icons only. */
.sidebar-logo { justify-content: space-between; padding: 0 10px 0 16px; }
.side-toggle { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: calc(var(--r-sm) * .875); background: transparent; color: rgba(255,255,255,0.55); cursor: pointer; flex: none; }
.side-toggle:hover { background: rgba(255,255,255,0.09); color: #fff; }
.side-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-toggle .ic-rail-expand { display: none; }
.sidebar .mq-home-mark { display: none; }
.sidebar, .topbar, .content, .app-footer-note-shell { transition: width .18s ease, left .18s ease, margin-left .18s ease; }
@media (prefers-reduced-motion: reduce) { .sidebar, .topbar, .content, .app-footer-note-shell { transition: none; } }
/* the expand / collapse-all button sits on the Home row (left of its pop-out arrow) instead of taking a row of its own */
.nav-top { position: relative; }
.nav-top .nav-toggle-all { position: absolute; right: 48px; top: 6px; z-index: 2; }
.sidebar-nav { padding-top: 4px; }
.nav-top { padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.nav-group[data-current="1"] > .nav-group-toggle .nav-group-label { font-weight: 600; }
.nav-pages[hidden] { display: none; }
/* footer: name row, then text size A- / A+, language, About and Sign out */
.sidebar-footer { flex-wrap: wrap; row-gap: 8px; }
.sidebar-footer .sidebar-user { flex: 1 1 100%; min-width: 0; }
.sidebar-footer .sb-tools { display: flex; gap: 4px; flex: none; }
.sidebar-footer .sb-btn { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.34); border-radius: var(--r-sm); padding: 4px 8px; min-height: 28px; font: inherit; font-size: var(--fs-sm); font-weight: 600; line-height: 1; cursor: pointer; }
.sidebar-footer .sb-btn small { font-size: 10px; margin-left: 1px; }
.sidebar-footer .sb-btn:hover:not(:disabled) { background: rgba(255,255,255,.22); }
.sidebar-footer .sb-btn:disabled { opacity: .45; cursor: not-allowed; background: transparent; }
.sidebar-footer .sb-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sidebar-footer .logout-form { margin-left: auto; flex: none; }
.sidebar-footer .logout-form button.sb-signout { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.34); padding: 4px 8px; color: #fff; }
.sidebar-footer .logout-form button.sb-signout:hover { background: rgba(255,255,255,.22); color: #fff; }
.sidebar-footer .about-link { margin: 0; }
.ts-menu { left: 0; }
@media (min-width: 901px) {
  html[data-rail="1"] { --sidebar-w: 64px; }
  html[data-rail="1"] .sidebar .sidebar-logo { justify-content: center; gap: 2px; padding: 0 4px; }
  html[data-rail="1"] .sidebar .mq-home:not(.mq-home-mark) { display: none; }
  html[data-rail="1"] .sidebar .mq-home-mark { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: var(--r-sm); }
  html[data-rail="1"] .sidebar .mq-home-mark .mq-tile { width: 22px; height: 22px; }
  html[data-rail="1"] .sidebar .mq-home-mark .mq-custom-mark { width: 22px; height: 22px; object-fit: contain; }   /* publisher branding (sidebar.php) */
  html[data-rail="1"] .sidebar .mq-home-mark .mq-custom-initial { display: grid; place-items: center; border-radius: var(--r-sm); background: var(--primary); color: #fff; font-weight: 700; font-size: 13px; }
  html[data-rail="1"] .sidebar .side-toggle { width: 22px; height: 24px; }
  html[data-rail="1"] .sidebar .side-toggle .ic-rail-collapse { display: none; }
  html[data-rail="1"] .sidebar .side-toggle .ic-rail-expand { display: inline; }
  html[data-rail="1"] .sidebar .nav-toggle-all,
  html[data-rail="1"] .sidebar .nav-label, html[data-rail="1"] .sidebar .nav-group-label, html[data-rail="1"] .sidebar .chev,
  html[data-rail="1"] .sidebar .nav-pop, html[data-rail="1"] .sidebar .nav-soon-badge, html[data-rail="1"] .sidebar .nav-group-body,
  html[data-rail="1"] .sidebar .sidebar-user-text, html[data-rail="1"] .sidebar .sb-tools, html[data-rail="1"] .sidebar .about-link { display: none !important; }
  html[data-rail="1"] .sidebar .sidebar-nav a, html[data-rail="1"] .sidebar .nav-group-toggle { justify-content: center; gap: 0; margin: 1px 8px; padding: 9px 0; width: auto; }
  html[data-rail="1"] .sidebar .nav-group-toggle { width: calc(100% - 16px); }
  html[data-rail="1"] .sidebar .nav-row > a { padding-right: 0; }
  html[data-rail="1"] .sidebar .sidebar-nav a.active::before { left: -8px; }
  html[data-rail="1"] .sidebar .nav-group[data-current="1"] > .nav-group-toggle { background: rgba(255,255,255,0.13); color: #fff; }
  html[data-rail="1"] .sidebar .nav-top a .nav-count { position: absolute; top: 1px; right: 2px; margin: 0; font-size: 10px; line-height: 14px; padding: 0 4px !important; }
  html[data-rail="1"] .sidebar .sidebar-footer { flex-direction: column; flex-wrap: nowrap; gap: 8px; padding: 12px 6px; }
  html[data-rail="1"] .sidebar .sidebar-footer .sidebar-user { flex: none; }
  html[data-rail="1"] .sidebar .sidebar-footer .logout-form { margin: 0; }
  html[data-rail="1"] .sidebar .sidebar-footer .logout-form button.sb-signout { padding: 6px; }
}
@media (max-width: 900px) { .nav-top .nav-toggle-all { right: 12px; } .side-toggle { display: none; } }
/* compact footer (owner): line 1 = small avatar + name + role, line 2 = A- / A+, language, About and Sign out in one row */
.sidebar-footer { padding: 8px 12px; row-gap: 6px; }
.sidebar-footer .sidebar-avatar { width: 24px; height: 24px; font-size: var(--fs-xs); }
.sidebar-footer .sidebar-user { gap: 8px; }
.sidebar-footer .sidebar-user-text { display: flex; align-items: baseline; gap: 6px; min-width: 0; flex: 1; }
.sidebar-footer .sidebar-user-name { flex: 0 1 auto; min-width: 0; line-height: 1.2; }
.sidebar-footer .sidebar-user-role { flex: 1 1 0; min-width: 0; font-size: var(--fs-xs); }
.sidebar-footer .sb-btn { min-height: 24px; padding: 2px 6px; }
.sidebar-footer .sb-tools { gap: 3px; }
.sidebar-footer .about-link { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin: 0 0 0 2px; }
.sidebar-footer .logout-form { margin-left: auto; }
.sidebar-footer .logout-form button.sb-signout { padding: 2px 8px; min-height: 24px; }
@media (min-width: 901px) {
  html[data-rail="1"] .sidebar .sidebar-footer { padding: 8px 6px; gap: 6px; }
  html[data-rail="1"] .sidebar .sidebar-footer .sidebar-avatar { width: 28px; height: 28px; }
}

/* line 1 of the footer: the profile link (avatar, name, role), then the About icon at its end */
.sidebar-footer .sidebar-line1 { display: flex; align-items: center; gap: 6px; flex: 1 1 100%; min-width: 0; }
.sidebar-footer .sidebar-line1 .sidebar-user { flex: 1 1 auto; min-width: 0; }
.sidebar-footer .sidebar-line1 .about-link { flex: none; margin: 0; }
@media (min-width: 901px) {
  html[data-rail="1"] .sidebar .sidebar-footer .sidebar-line1 { flex: none; }
}
