/* ═══════════════════════════════════════════════════════════════════════
   EUREKA DESIGN SYSTEM — loaded after main.css by partials/base.html
   Source of truth: "Eureka Dashboard.html" / "Eureka Login.html" (2026-09).

   Theme switch is still `html.dark` / `html.light` (color-modes.js + the
   anti-flash script in base.html), so every existing page template's
   `html.dark …` overrides keep working. Pages should use the tokens below
   instead of hex values: var(--surface), var(--text-2), var(--accent) …
   ═══════════════════════════════════════════════════════════════════════ */

/* ── 0. Tokens ─────────────────────────────────────────────────────────── */
:root, html.light {
  --font: Inter, 'Noto Sans Bengali', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: Sora, 'Noto Sans Bengali', Inter, system-ui, sans-serif;

  --bg: #F4F5F8;
  --surface: #FFFFFF;
  --surface-2: #F6F7FA;
  --field: #FFFFFF;
  --border: #E4E7EE;
  --border-strong: #CFD5E1;
  --text: #0E0E12;
  --text-2: #525A6B;
  --text-3: #687083;
  --accent: #1D4ED8;
  --accent-soft: rgba(29,78,216,.10);
  --primary: #1D4ED8;
  --primary-hover: #1A44BE;
  --cyan: #0E7C9A;
  --success: #15803D;
  --success-soft: rgba(21,128,61,.10);
  --warning: #A16207;
  --warning-soft: rgba(161,98,7,.12);
  --danger: #B42318;
  --danger-soft: rgba(180,35,24,.08);
  --danger-border: rgba(180,35,24,.3);
  --track: #E9ECF2;
  --row-hover: #F6F7FA;
  --shadow: 0 1px 2px rgba(16,24,40,.05);
  --menu-shadow: 0 12px 32px rgba(16,24,40,.14);
  --focus-ring: 0 0 0 3px var(--accent-soft);

  /* sidebar is dark in both themes (as in the Eureka mock) */
  --sidebar: #060810;
  --sidebar-border: rgba(255,255,255,.06);
  --nav-text: #A3A9B8;
  --nav-hover: rgba(255,255,255,.05);
  --nav-active-bg: rgba(122,166,255,.14);
  --nav-active: #C4D6FF;
  --nav-group: #6B7284;

  /* conversation / order status pills */
  --st-new: #1D4ED8;         --st-new-bg: rgba(29,78,216,.10);
  --st-open: #1D4ED8;        --st-open-bg: rgba(29,78,216,.10);
  --st-qualifying: #1D4ED8;  --st-qualifying-bg: rgba(29,78,216,.10);
  --st-engaging: #0E7C9A;    --st-engaging-bg: rgba(14,124,154,.10);
  --st-negotiating: #6D28D9; --st-negotiating-bg: rgba(109,40,217,.09);
  --st-handover: #A16207;    --st-handover-bg: rgba(161,98,7,.12);
  --st-closed: #525A6B;      --st-closed-bg: #EEF0F4;

  --radius: 10px;
  --radius-lg: 14px;

  /* legacy aliases — old page CSS still references these */
  --ts-primary: var(--primary);
  --ts-primary-dk: var(--primary-hover);
  --ts-primary-lt: var(--accent);
  --ts-sidebar-bg: var(--sidebar);
  --ts-sidebar-w: var(--sidebar);
  --ts-text-muted: var(--text-3);
  --ts-green: var(--success);
  --ts-yellow: #F59E0B;
  --sw-bg: var(--surface); --sw-fg: var(--text); --sw-muted: var(--text-2);
  --sw-field-bg: var(--field); --sw-field-bd: var(--border-strong); --sw-field-fg: var(--text);
  --sw-border: var(--border);
}

html.dark {
  color-scheme: dark;
  /* Navy dark theme (2026-10-29, user-picked base #142B64): page = navy, cards one step
     lighter, fields one step darker, so depth reads without black patches. */
  --bg: #142B64;
  --surface: #1A3473;
  --surface-2: #213D82;
  --field: #10245A;
  --border: rgba(173,196,255,.14);
  --border-strong: rgba(173,196,255,.26);
  --text: #F2F5FF;
  --text-2: #C3CEEA;
  --text-3: #A6B5DC;
  --accent: #8DB4FF;
  --accent-soft: rgba(141,180,255,.18);
  --primary: #2F6BEB;
  --primary-hover: #4A80F0;
  --cyan: #50D6FF;
  --success: #5CD39B;
  --success-soft: rgba(92,211,155,.14);
  --warning: #F3BD5A;
  --warning-soft: rgba(243,189,90,.14);
  --danger: #FF9999;
  --danger-soft: rgba(255,133,133,.12);
  --danger-border: rgba(255,133,133,.35);
  --track: rgba(173,196,255,.14);
  --row-hover: rgba(173,196,255,.07);
  --shadow: 0 1px 2px rgba(3,10,35,.35);
  --menu-shadow: 0 16px 40px rgba(3,10,35,.55);

  /* sidebar: a deeper navy than the page in dark mode */
  --sidebar: #0C1C46;
  --sidebar-border: rgba(173,196,255,.10);
  --nav-text: #B3C1E4;
  --nav-hover: rgba(173,196,255,.08);
  --nav-active-bg: rgba(141,180,255,.20);
  --nav-active: #DCE7FF;
  --nav-group: #8597C4;

  --st-new: #8FB3FF;         --st-new-bg: rgba(122,166,255,.14);
  --st-open: #8FB3FF;        --st-open-bg: rgba(122,166,255,.14);
  --st-qualifying: #8FB3FF;  --st-qualifying-bg: rgba(122,166,255,.14);
  --st-engaging: #5FD8FF;    --st-engaging-bg: rgba(80,214,255,.12);
  --st-negotiating: #C4B5FD; --st-negotiating-bg: rgba(167,139,250,.14);
  --st-handover: #F3BD5A;    --st-handover-bg: rgba(243,189,90,.14);
  --st-closed: #C3CEEA;      --st-closed-bg: rgba(173,196,255,.12);
}

/* ── 1. Base ───────────────────────────────────────────────────────────── */
html, html.dark { background: var(--bg); }
html.dark body, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-display);
  color: var(--text);
  letter-spacing: -.01em;
}
html.dark h1, html.dark h2, html.dark h3, html.dark h4, html.dark h5, html.dark h6 { color: var(--text); }
a { color: var(--accent); }
a:hover { color: var(--primary-hover); }
html.dark a:hover { color: #A6C2FF; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
hr, html.dark hr { border-color: var(--border) !important; color: var(--border) !important; opacity: 1; }
.ek-ico { flex: none; display: block; }
[hidden] { display: none !important; }
.num, .tabular { font-variant-numeric: tabular-nums; }

/* ── 2. Sidebar ────────────────────────────────────────────────────────── */
.navbar-aside, html.dark .navbar-aside {
  max-width: 240px;
  background: var(--sidebar) !important;
  border-right: 1px solid var(--sidebar-border) !important;
  box-shadow: none !important;
  display: flex; flex-direction: column;
  transition: max-width .2s ease, transform .2s ease;
}
.navbar-aside .aside-top, html.dark .navbar-aside .aside-top {
  height: 64px; min-height: 64px; flex: none;
  padding: 0 12px 0 20px !important;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: transparent !important;
  border-bottom: 0 !important;
}
.ek-brand { display: flex; align-items: center; min-width: 0; text-decoration: none; }
.ek-brand-full { height: 30px; width: auto; display: block; }
.ek-brand-mark { display: none; width: 32px; height: 32px; border-radius: 9px; }
.ek-aside-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 0; padding: 0;
  background: transparent; color: var(--nav-text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.ek-aside-btn:hover { background: rgba(255,255,255,.06); color: #EEF0F6; }

.navbar-aside nav { flex: 1 0 auto; }
.ek-aside-close { display: none !important; }
.menu-aside { margin: 0; padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.menu-aside .menu-item { margin: 0; position: relative; }
.menu-aside a { font-family: var(--font); }
.menu-aside .menu-header, html.dark .menu-aside .menu-header {
  margin: 0; padding: 18px 12px 6px;
  font-family: var(--font);
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--nav-group);
  list-style: none;
}
.menu-aside .menu-header:first-child { padding-top: 6px; }

.menu-aside .menu-link, html.dark .menu-aside .menu-link,
.ek-aside-foot .menu-link, html.dark .ek-aside-foot .menu-link {
  display: flex; align-items: center; gap: 12px;
  height: 38px; padding: 0 12px !important; margin: 0 !important;
  border-radius: var(--radius) !important;
  color: var(--nav-text) !important;
  background: transparent !important;
  border-left: 0 !important;
  font-size: 14px; font-weight: 500; line-height: 1;
  text-decoration: none;
  transition: background .15s ease, color .15s ease !important;
}
.menu-aside .menu-link .text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.menu-aside .menu-link:hover, html.dark .menu-aside .menu-link:hover,
.ek-aside-foot .menu-link:hover, html.dark .ek-aside-foot .menu-link:hover { background: var(--nav-hover) !important; color: #EEF0F6 !important; }
.menu-aside .menu-item.active > .menu-link,
html.dark .menu-aside .menu-item.active > .menu-link { background: var(--nav-active-bg) !important; color: var(--nav-active) !important; }

/* submenu caret → rotating chevron */
.menu-aside .menu-item.has-submenu > .menu-link:after { display: none !important; }
.menu-aside .ek-caret { transition: transform .2s ease; opacity: .7; }
.menu-aside .menu-item.has-submenu.open > .menu-link .ek-caret { transform: rotate(180deg); }

.menu-aside .submenu, html.dark .menu-aside .submenu {
  margin: 2px 0 6px 21px !important;
  padding: 2px 0 2px 12px !important;
  border-left: 1px solid rgba(255,255,255,.08) !important;
  background: transparent !important;
  border-radius: 0 !important;
}
.menu-aside .submenu a, html.dark .menu-aside .submenu a {
  display: flex !important; align-items: center;
  height: 32px; padding: 0 10px !important; margin: 1px 0 !important;
  border-radius: 8px;
  font-size: 13px !important; font-weight: 500 !important;
  color: var(--nav-text) !important;
  background: transparent !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .15s ease, color .15s ease;
}
.menu-aside .submenu a::before { display: none !important; }
.menu-aside .submenu a:hover { background: var(--nav-hover) !important; color: #EEF0F6 !important; }
.menu-aside .submenu a.active,
.menu-aside .menu-item.active .submenu a.active { color: var(--nav-active) !important; background: var(--nav-active-bg) !important; }

.ek-aside-foot { flex: none; padding: 12px; border-top: 1px solid var(--sidebar-border); }
.ek-aside-foot .menu-link { width: 100%; border: 0; cursor: pointer; font-family: var(--font); }
.ek-aside-foot .menu-link .text { white-space: nowrap; text-align: left; flex: 1; }

/* collapsed (mini) sidebar — 72px rail */
.main-wrap, html.dark .main-wrap { margin-left: 240px; background: var(--bg) !important; min-height: 100vh; display: flex !important; flex-direction: column; }
html.dark main { background: var(--bg) !important; }
body.aside-mini .main-wrap { margin-left: 72px; }
body.aside-mini .navbar-aside { max-width: 72px; }
body.aside-mini .navbar-aside .aside-top { padding: 0 !important; justify-content: center; flex-direction: column; height: auto; min-height: 64px; gap: 6px; padding-top: 14px !important; }
body.aside-mini .navbar-aside .aside-top > div { flex-grow: 0; }
body.aside-mini .ek-brand { display: flex !important; }
body.aside-mini .ek-brand-full { display: none; }
body.aside-mini .ek-brand-mark { display: block; }
body.aside-mini .navbar-aside .ek-aside-top-btn { display: none; }
body.aside-mini .menu-aside { padding: 4px 12px 16px; }
body.aside-mini .menu-aside .menu-header, html.dark body.aside-mini .menu-aside .menu-header {
  height: 1px; padding: 0; margin: 12px 8px; font-size: 0; text-indent: 0;
  background: var(--sidebar-border); border: 0; overflow: hidden;
}
body.aside-mini .menu-aside .menu-link,
body.aside-mini .ek-aside-foot .menu-link { justify-content: center; padding: 0 !important; }
body.aside-mini .menu-aside .menu-link .text,
body.aside-mini .menu-aside .menu-link .ek-caret,
body.aside-mini .ek-aside-foot .text { display: none; }
body.aside-mini .ek-aside-foot .ek-ico { transform: rotate(180deg); }
body.aside-mini .menu-aside .submenu, html.dark body.aside-mini .menu-aside .submenu {
  position: absolute; left: calc(100% + 10px); top: 0; z-index: 50;
  min-width: 200px; margin: 0 !important; padding: 6px !important;
  background: var(--sidebar) !important;
  border: 1px solid var(--sidebar-border) !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
}
body.aside-mini .menu-aside .menu-item.active .submenu { display: none; }

/* tablet: theme shrinks to 220px — keep one width */
@media (max-width: 1200px) {
  .main-wrap { margin-left: 240px; }
  .navbar-aside { max-width: 240px; }
  body.aside-mini .main-wrap { margin-left: 72px; }
}
/* phone: off-canvas drawer (theme JS toggles .show) */
@media (max-width: 768px) {
  .navbar-aside, body.aside-mini .navbar-aside { max-width: 264px; position: fixed; z-index: 900; }
  .navbar-aside.show { box-shadow: 0 24px 64px rgba(0,0,0,.5) !important; }
  .main-wrap, body.aside-mini .main-wrap { margin-left: 0 !important; }
  .ek-aside-foot { display: none; }
  .ek-aside-close { display: inline-flex !important; }
}
.screen-overlay.show { background: rgba(3,5,10,.6) !important; }

/* ── 3. Top bar ────────────────────────────────────────────────────────── */
.ek-topbar, html.dark .ek-topbar {
  height: 56px; min-height: 56px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.ek-crumbs { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-3); min-width: 0; }
.ek-crumbs [data-crumb-root] { white-space: nowrap; }
.ek-crumbs .ek-crumb-cur { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ek-crumbs .ek-crumb-sep { opacity: .7; }
.ek-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.ek-menu-btn { display: none !important; margin-left: -6px; border: 1px solid var(--border) !important; background: var(--surface) !important; }

.ek-icon-btn {
  position: relative;
  width: 36px; height: 36px; border-radius: var(--radius);
  border: 0; padding: 0; background: transparent;
  color: var(--text-2); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.ek-icon-btn:hover, .ek-icon-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.ek-icon-btn:focus:not(:focus-visible) { outline: none; box-shadow: none; }
.ek-badge {
  position: absolute; top: 3px; right: 1px;
  min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  border-radius: 999px; border: 2px solid var(--bg);
  background: var(--primary); color: #fff;
  font-size: 10.5px; font-weight: 600; line-height: 14px; text-align: center;
  font-variant-numeric: tabular-nums;
}
/* theme toggle shows the icon of the *other* mode */
.ek-theme .ek-when-dark { display: none; }
html.dark .ek-theme .ek-when-dark { display: block; }
html.dark .ek-theme .ek-when-light { display: none; }

/* EN / বাং segmented control */
.ek-seg { display: inline-flex; padding: 2px; margin: 0 6px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.ek-seg form { margin: 0; display: contents; }
.ek-seg button {
  height: 26px; padding: 0 10px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-3);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.ek-seg button:hover { color: var(--text); }
.ek-seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* AI master switch */
.ai-switch { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; height: 32px; padding: 0 10px 0 6px; margin-right: 6px; border-radius: 999px; color: var(--text-2);
  font: inherit; transition: border-color .15s ease; }
.ai-switch:hover { border-color: var(--border-strong); }
.ai-switch-track { position: relative; width: 32px; height: 18px; border-radius: 999px; background: var(--track); transition: background .2s; flex: none; }
.ai-switch-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: left .2s; }
.ai-switch.on .ai-switch-track { background: var(--success); }
html.dark .ai-switch.on .ai-switch-track { background: #22A06B; }
.ai-switch.on .ai-switch-thumb { left: 16px; }
.ai-switch-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.ai-txt { color: var(--text); }
.ai-switch.off .ai-txt { color: var(--text-3); }
.ai-dot { display: none; }
.ai-switch[disabled] { opacity: .5; cursor: wait; }

/* account + notification menus */
.ek-avatar-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 6px 0 2px; margin-left: 6px;
  border: 0; border-radius: 999px; background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s ease; }
.ek-avatar-btn:hover, .ek-avatar-btn[aria-expanded="true"] { background: var(--surface-2); }
.ek-avatar-btn::after { display: none !important; }
.ek-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
}
.ek-menu.dropdown-menu, html.dark .ek-menu.dropdown-menu {
  min-width: 232px; padding: 6px; margin-top: 8px !important;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border) !important; border-radius: 12px !important;
  box-shadow: var(--menu-shadow) !important;
}
.ek-menu-head { padding: 10px 12px 10px; display: grid; gap: 1px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ek-menu-head strong { font-size: 14px; font-weight: 600; color: var(--text); }
.ek-menu-head span { font-size: 12.5px; color: var(--text-3); }
.ek-menu .dropdown-item, html.dark .ek-menu .dropdown-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px !important;
  border-radius: 8px !important; background: transparent; border: 0; width: 100%;
  color: var(--text) !important; font-size: 14px; text-decoration: none;
}
.ek-menu .dropdown-item .ek-ico { color: var(--text-3); }
.ek-menu .dropdown-item:hover, .ek-menu .dropdown-item:focus,
html.dark .ek-menu .dropdown-item:hover, html.dark .ek-menu .dropdown-item:focus { background: var(--surface-2) !important; color: var(--text) !important; }
.ek-menu .dropdown-item.ek-danger, html.dark .ek-menu .dropdown-item.ek-danger { color: var(--danger) !important; }
.ek-menu .dropdown-item.ek-danger .ek-ico { color: var(--danger); }

.ek-notif.dropdown-menu { width: 340px; max-height: 64vh; overflow-y: auto; padding: 6px; }
.ek-notif .notif-head { padding: 8px 10px 10px; font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--text); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ek-notif .notif-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
.ek-notif .notif-item:hover { background: var(--surface-2); color: var(--text); }
.ek-notif .notif-item.unread .notif-title { font-weight: 600; }
.ek-notif .notif-item.unread::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: none; }
.ek-notif .notif-ico { width: 30px; height: 30px; border-radius: 8px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.ek-notif .notif-pinned .notif-ico { background: var(--warning-soft); color: var(--warning); }
.ek-notif .notif-body { display: grid; gap: 2px; flex: 1; min-width: 0; }
.ek-notif .notif-title { font-size: 13.5px; line-height: 1.4; }
.ek-notif .notif-time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ek-notif .notif-empty { padding: 28px 12px; text-align: center; color: var(--text-3); font-size: 13px; }

@media (max-width: 768px) {
  .ek-topbar { padding: 0 16px; }
  .ek-menu-btn { display: inline-flex !important; }
  .ek-crumbs [data-crumb-root] { display: none; }
  .ek-hide-sm { display: none !important; }
}

/* view-as-shop banner + flash messages */
.ek-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 16px 32px 0; padding: 10px 12px 10px 16px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--accent-soft); color: var(--text); font-size: 13.5px;
}
.ek-banner b { font-weight: 600; }
.rbd-messages { padding: 16px 32px 0 !important; max-width: 1464px; width: 100%; margin: 0 auto; box-sizing: border-box; }
@media (max-width: 768px) { .ek-banner { margin: 12px 14px 0; } .rbd-messages { padding: 12px 14px 0 !important; } }

/* ── 4. Page shell ─────────────────────────────────────────────────────── */
.content-main, html.dark .content-main {
  width: 100%; max-width: 1464px; margin: 0 auto; box-sizing: border-box;
  padding: 28px 32px 56px;
  background: transparent !important;
  color: var(--text);
  min-height: 0; flex: 1;
}
.main-wrap .content-main { min-height: 0; }
.content-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.content-header .content-title, .content-title, .content-title.card-title, html.dark .content-title.card-title {
  margin: 0; font-family: var(--font-display) !important;
  font-size: 24px; font-weight: 600; letter-spacing: -.015em; line-height: 1.2;
  color: var(--text) !important;
}
.content-header p { color: var(--text-2); }
@media (max-width: 768px) {
  .content-main, html.dark .content-main { padding: 16px 14px 40px; }
  .content-header { align-items: flex-start; }
  .content-header .content-title { font-size: 22px; margin-bottom: 0; }
  .content-header, .content-header > div, .content-header form { width: 100% !important; max-width: none !important; }
  .content-header form .form-control, .content-header form .form-select { flex: 1 1 100% !important; min-width: 0 !important; }
  .content-header form .btn { flex: 1 1 auto !important; }
}

/* ── 5. Cards ──────────────────────────────────────────────────────────── */
.card, html.dark .card {
  background: var(--surface) !important;
  color: var(--text);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow) !important;
}
.card-header, html.dark .card-header {
  background: transparent !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  padding: 16px 20px;
}
.card-footer, html.dark .card-footer { background: transparent !important; border-top: 1px solid var(--border) !important; }
.card-body, html.dark .card-body { color: var(--text) !important; }
.card-title, html.dark .card-title { color: var(--text) !important; font-family: var(--font-display); font-weight: 600; }
.card-header .card-title, .card-header h4, .card-header h5, .card-header h6 { font-size: 15px; margin: 0; }

/* ── 6. Tables ─────────────────────────────────────────────────────────── */
.table, html.dark .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-hover-bg: var(--row-hover);
  --bs-table-hover-color: var(--text);
  --bs-table-striped-bg: var(--row-hover);
  color: var(--text) !important;
  border-color: var(--border);
  font-size: 14px;
}
.table > :not(caption) > * > *, html.dark .table > :not(caption) > * > * {
  background-color: transparent !important;
  color: inherit;
  border-bottom-color: var(--border) !important;
  padding: 10px 12px;
}
.table > thead > tr > th, .table > thead th, .table-light, .table-light > th, thead.table-light th,
html.dark .table > thead th, html.dark .table-light, html.dark thead.table-light th, html.dark table thead {
  background: var(--surface-2) !important;
  color: var(--text-3) !important;
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap;
  border-color: var(--border) !important;
  padding-top: 9px; padding-bottom: 9px;
}
.table > thead > tr > th:first-child, .table > tbody > tr > td:first-child { padding-left: 20px; }
.table > thead > tr > th:last-child, .table > tbody > tr > td:last-child { padding-right: 20px; }
.table-hover > tbody > tr:hover > *, html.dark .table-hover > tbody > tr:hover > * { background-color: var(--row-hover) !important; color: var(--text); }
html.dark table { color: var(--text) !important; }
.card > .table-responsive:last-child .table tr:last-child > *,
.card-body.p-0 > .table-responsive:last-child .table tbody tr:last-child > * { border-bottom: 0 !important; }
.table-responsive { border-radius: inherit; }

/* ── 7. Buttons ────────────────────────────────────────────────────────── */
.btn:not(.btn-icon):not(.btn-mobile):not(.btn-close):not(.btn-link) {
  --btn-h: 38px;
  height: var(--btn-h); min-height: var(--btn-h);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px !important;
  border-radius: var(--radius) !important;
  font-family: var(--font);
  font-size: 14px !important; font-weight: 600 !important; line-height: 1 !important;
  box-shadow: none !important;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease !important;
}
.btn:focus-visible { box-shadow: var(--focus-ring) !important; outline: 2px solid var(--accent) !important; outline-offset: 2px; }
.btn-sm:not(.btn-icon), .btn-xs:not(.btn-icon) { --btn-h: 32px; padding: 0 12px !important; font-size: 13px !important; border-radius: 8px !important; }
.btn-lg { --btn-h: 46px; padding: 0 22px !important; font-size: 15px !important; }
.btn:not(.btn-icon):not(.btn-mobile) .material-icons { font-size: 17px !important; }
.btn:disabled, .btn.disabled { opacity: .55; }

.btn-primary, .btn-brand, html.dark .btn-dark, .btn-dark {
  background: var(--primary) !important; border: 1px solid var(--primary) !important; color: #fff !important;
}
.btn-primary:hover, .btn-brand:hover, .btn-dark:hover { background: var(--primary-hover) !important; border-color: var(--primary-hover) !important; color: #fff !important; }
.btn-success { background: #15803D !important; border: 1px solid #15803D !important; color: #fff !important; }
.btn-success:hover { background: #166534 !important; border-color: #166534 !important; }
html.dark .btn-success { background: #1F8A55 !important; border-color: #1F8A55 !important; }
.btn-danger { background: #D92D20 !important; border: 1px solid #D92D20 !important; color: #fff !important; }
.btn-danger:hover { background: #B42318 !important; border-color: #B42318 !important; }
.btn-warning { background: #F3BD5A !important; border: 1px solid #F3BD5A !important; color: #3B2A05 !important; }
.btn-info { background: var(--cyan) !important; border: 1px solid var(--cyan) !important; color: #fff !important; }
html.dark .btn-info { color: #05232C !important; }

.btn-light, .btn-secondary, html.dark .btn-light, html.dark .btn-secondary {
  background: var(--surface) !important; border: 1px solid var(--border-strong) !important; color: var(--text) !important;
}
.btn-light:hover, .btn-secondary:hover, html.dark .btn-light:hover, html.dark .btn-secondary:hover { background: var(--surface-2) !important; color: var(--text) !important; }
html.dark .btn-light i { color: inherit; }

.btn-outline-primary, html.dark .btn-outline-primary { background: transparent !important; border: 1px solid var(--accent) !important; color: var(--accent) !important; }
.btn-outline-primary:hover, html.dark .btn-outline-primary:hover { background: var(--accent-soft) !important; color: var(--accent) !important; }
.btn-outline-secondary, .btn-outline-dark, html.dark .btn-outline-secondary, html.dark .btn-outline-dark {
  background: transparent !important; border: 1px solid var(--border-strong) !important; color: var(--text-2) !important;
}
.btn-outline-secondary:hover, .btn-outline-dark:hover, html.dark .btn-outline-secondary:hover, html.dark .btn-outline-dark:hover { background: var(--surface-2) !important; color: var(--text) !important; }
.btn-outline-danger { background: transparent !important; border: 1px solid var(--danger-border) !important; color: var(--danger) !important; }
.btn-outline-danger:hover { background: var(--danger-soft) !important; color: var(--danger) !important; }
.btn-outline-success { background: transparent !important; border: 1px solid var(--success) !important; color: var(--success) !important; }
.btn-outline-success:hover { background: var(--success-soft) !important; }
.btn-outline-warning { background: transparent !important; border: 1px solid var(--warning) !important; color: var(--warning) !important; }
.btn-outline-warning:hover { background: var(--warning-soft) !important; }
/* fraud-check action (contacts + orders) — soft amber in both themes */
.btn-fraud { background: var(--warning-soft) !important; color: var(--warning) !important; border: 1px solid transparent !important; }
.btn-fraud:hover, .btn-fraud:focus { border-color: var(--warning) !important; color: var(--warning) !important; }
.btn-link { height: auto; min-height: 0; padding: 0 !important; color: var(--accent) !important; font-weight: 500 !important; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
html.dark .btn { color: inherit; }

.btn-icon, .btn-mobile {
  width: 36px; height: 36px; min-height: 36px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 !important; border-radius: var(--radius) !important;
  background: transparent; border: 0; color: var(--text-2);
  transition: background .15s ease, color .15s ease;
}
.btn-icon:hover, .btn-mobile:hover { background: var(--surface-2); color: var(--text); }
.btn-icon .material-icons, .btn-mobile .material-icons { font-size: 20px !important; line-height: 1; }
.btn-close { height: auto; min-height: 0; padding: .5em !important; }
html.dark .btn-close, html.dark .modal .btn-close, html.dark .alert .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }

/* ── 8. Forms ──────────────────────────────────────────────────────────── */
.form-control, .form-select, textarea.form-control,
html.dark .form-control, html.dark .form-select, html.dark textarea.form-control {
  background-color: var(--field) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius) !important;
  color: var(--text) !important;
  font-family: var(--font);
  font-size: 14px !important;
  box-shadow: none !important;
  transition: border-color .15s ease, box-shadow .15s ease !important;
}
.form-control:not(textarea), .form-select { height: 40px; padding: 0 12px !important; }
.form-control-sm:not(textarea), .form-select-sm { height: 34px; font-size: 13px !important; border-radius: 8px !important; }
textarea.form-control { padding: 10px 12px !important; line-height: 1.5; }
.form-control::placeholder, html.dark .form-control::placeholder { color: var(--text-3) !important; opacity: .8; }
.form-control:focus, .form-select:focus, textarea.form-control:focus,
html.dark .form-control:focus, html.dark .form-select:focus, html.dark textarea.form-control:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft) !important;
}
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: var(--surface-2) !important; color: var(--text-2) !important; }
.form-label, label.form-label, html.dark .form-label, html.dark label.form-label { font-size: 13.5px !important; font-weight: 500 !important; color: var(--text) !important; margin-bottom: 6px; }
.form-text, html.dark .form-text { color: var(--text-3) !important; font-size: 12.5px; }
.invalid-feedback { color: var(--danger); font-size: 12.5px; }
.is-invalid, .form-control.is-invalid { border-color: var(--danger) !important; }

.form-select, html.dark .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237B8396' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 15px 15px !important;
  padding-right: 36px !important;
  -webkit-appearance: none; appearance: none;
}
.form-select option { background: var(--surface); color: var(--text); }

.form-control[type="file"] { padding: 0 12px 0 0 !important; line-height: 38px; }
.form-control[type="file"]::file-selector-button {
  height: 38px; margin: 0 12px 0 0; padding: 0 16px;
  border: 0; border-right: 1px solid var(--border-strong); border-radius: 9px 0 0 9px;
  background: var(--surface-2); color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s ease;
}
.form-control[type="file"]:hover::file-selector-button { background: var(--track); }

/* date/time: our own calendar glyph so Safari + Chromium match */
.form-control[type="date"], .form-control[type="datetime-local"], .form-control[type="time"] {
  position: relative;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237B8396' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='17' rx='3'/%3E%3Cpath d='M3 9.5h18'/%3E%3Cpath d='M8 2.5v4'/%3E%3Cpath d='M16 2.5v4'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 11px center !important;
  background-size: 16px 16px !important;
  padding-right: 38px !important;
  -webkit-appearance: none; appearance: none;
}
.form-control[type="date"]::-webkit-calendar-picker-indicator,
.form-control[type="datetime-local"]::-webkit-calendar-picker-indicator,
.form-control[type="time"]::-webkit-calendar-picker-indicator { position: absolute; right: 6px; width: 26px; height: 26px; opacity: 0; cursor: pointer; }
.form-control::-webkit-datetime-edit, .form-control::-webkit-datetime-edit-fields-wrapper,
.form-control::-webkit-datetime-edit-text, .form-control::-webkit-datetime-edit-month-field,
.form-control::-webkit-datetime-edit-day-field, .form-control::-webkit-datetime-edit-year-field,
.form-control::-webkit-datetime-edit-hour-field, .form-control::-webkit-datetime-edit-minute-field { color: inherit; padding: 0; }

.input-group .btn { border-radius: 0 var(--radius) var(--radius) 0 !important; }
.input-group .form-control:not(:last-child) { border-radius: var(--radius) 0 0 var(--radius) !important; }
.input-group-text, html.dark .input-group-text { background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-2); border-radius: var(--radius); }

.form-check-input, html.dark .form-check-input { background-color: var(--field); border: 1px solid var(--border-strong); }
.form-check-input:checked, html.dark .form-check-input:checked { background-color: var(--primary) !important; border-color: var(--primary) !important; }
.form-check-input:focus { box-shadow: var(--focus-ring) !important; border-color: var(--accent) !important; }
.form-check-label { color: var(--text); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }

/* select2 (product/category pickers) */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple,
html.dark .custom_select .select2-container--default .select2-selection--single {
  background: var(--field) !important; border: 1px solid var(--border-strong) !important; border-radius: var(--radius) !important; min-height: 40px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--text) !important; line-height: 38px !important; }
.select2-dropdown { background: var(--surface) !important; border-color: var(--border) !important; color: var(--text); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--accent-soft) !important; color: var(--text) !important; }
.select2-search__field { background: var(--field) !important; color: var(--text) !important; border-color: var(--border-strong) !important; }

/* ── 9. Badges, alerts, pagination, misc ───────────────────────────────── */
.badge { font-family: var(--font); font-weight: 600; font-size: 11.5px; letter-spacing: .01em; padding: .38em .7em; border-radius: 999px; }
.badge.bg-primary { background: var(--accent-soft) !important; color: var(--accent) !important; }
.badge.bg-success { background: var(--success-soft) !important; color: var(--success) !important; }
.badge.bg-warning, .badge.bg-warning.text-dark { background: var(--warning-soft) !important; color: var(--warning) !important; }
.badge.bg-danger { background: var(--danger-soft) !important; color: var(--danger) !important; }
.badge.bg-info, .badge.bg-info.text-dark { background: rgba(14,124,154,.10) !important; color: var(--cyan) !important; }
html.dark .badge.bg-info, html.dark .badge.bg-info.text-dark { background: rgba(80,214,255,.12) !important; }
.badge.bg-secondary, .badge.bg-light, .badge.bg-light.text-dark, .badge.bg-dark,
html.dark .badge.bg-secondary, html.dark .badge.bg-light, html.dark .badge.bg-light.text-dark, html.dark .badge.bg-dark {
  background: var(--st-closed-bg) !important; color: var(--text-2) !important; border: 0 !important;
}

.alert { border-radius: var(--radius) !important; border: 1px solid var(--border); font-size: 13.5px; padding: 12px 44px 12px 14px; box-shadow: none !important; }
.alert-success { background: var(--success-soft) !important; border-color: rgba(21,128,61,.25) !important; color: var(--text) !important; }
.alert-info, .alert-primary { background: var(--accent-soft) !important; border-color: rgba(29,78,216,.22) !important; color: var(--text) !important; }
.alert-warning { background: var(--warning-soft) !important; border-color: rgba(161,98,7,.28) !important; color: var(--text) !important; }
.alert-danger, .alert-error { background: var(--danger-soft) !important; border-color: var(--danger-border) !important; color: var(--text) !important; }
html.dark .alert-success { border-color: rgba(92,211,155,.3) !important; }
html.dark .alert-info, html.dark .alert-primary { border-color: rgba(122,166,255,.3) !important; }
html.dark .alert-warning { border-color: rgba(243,189,90,.3) !important; }
.alert .alert-link { color: inherit; }

.pagination { gap: 6px; }
.page-link, html.dark .page-link, html.dark .pagination-area .page-link {
  min-width: 32px; height: 32px; padding: 0 12px !important;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong) !important; border-radius: 8px !important;
  background: transparent !important; color: var(--text) !important;
  font-size: 13px !important; font-weight: 500 !important; line-height: 1 !important;
  box-shadow: none !important; transition: background .15s ease;
}
.page-link:hover, html.dark .page-link:hover { background: var(--surface-2) !important; color: var(--text) !important; }
.page-item.active .page-link, html.dark .page-item.active .page-link { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; }
.page-item.disabled .page-link { opacity: .5; }
.page-link:focus { box-shadow: var(--focus-ring) !important; }

.dropdown-menu, html.dark .dropdown-menu {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--menu-shadow); padding: 6px;
}
.dropdown-item, html.dark .dropdown-menu a, html.dark .dropdown-item { color: var(--text); border-radius: 8px; font-size: 14px; }
.dropdown-item:hover, .dropdown-item:focus, html.dark .dropdown-menu .dropdown-item:hover, html.dark .dropdown-menu .dropdown-item:focus { background: var(--surface-2); color: var(--text); }
.dropdown-divider, html.dark .dropdown-divider { border-color: var(--border) !important; }

.modal-content, html.dark .modal-content { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border) !important; border-radius: 16px !important; box-shadow: var(--menu-shadow); }
.modal-header, .modal-footer, html.dark .modal-header, html.dark .modal-footer { border-color: var(--border) !important; }
.modal-title, html.dark .modal-title { color: var(--text) !important; font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.modal-backdrop.show { opacity: .6; background: #03050A; }

.nav-tabs { border-bottom: 1px solid var(--border); gap: 4px; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 500; border-radius: 0; padding: 10px 14px; }
.nav-tabs .nav-link:hover { color: var(--text); border-bottom-color: var(--border-strong); }
.nav-tabs .nav-link.active, html.dark .nav-tabs .nav-link.active { background: transparent; color: var(--text); border-bottom-color: var(--accent); }
.nav-pills .nav-link, html.dark .nav-pills .nav-link { color: var(--text-2); border-radius: 8px; font-weight: 500; }
.nav-pills .nav-link.active, html.dark .nav-pills .nav-link.active { background: var(--accent-soft); color: var(--accent); }

.progress, html.dark .progress { height: 6px; border-radius: 3px; background: var(--track); }
.progress-bar { background: var(--accent); border-radius: 3px; }

.list-group-item, html.dark .list-group-item { background: transparent; color: var(--text); border-color: var(--border); }

/* muted text + light surfaces that went invisible in one theme or the other */
.text-muted, html.dark .text-muted, small.text-muted, html.dark small.text-muted { color: var(--text-3) !important; }
.text-body, html.dark .text-body { color: var(--text) !important; }
.text-dark, html.dark .text-dark:not(.badge) { color: var(--text) !important; }
.text-primary { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--cyan) !important; }
.bg-white, html.dark .bg-white { background-color: var(--surface) !important; }
.bg-light, html.dark .bg-light { background-color: var(--surface-2) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end,
html.dark .border-bottom, html.dark .border-end { border-color: var(--border) !important; }
html.dark .border-dark { border-color: var(--border-strong) !important; }
pre, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
pre.bg-light, html.dark pre.bg-light { background: var(--surface-2) !important; color: var(--text) !important; border: 1px solid var(--border); border-radius: var(--radius); }
code { color: var(--accent); }

/* legacy on/off toggle used by list pages */
.toggle_active .input { visibility: hidden; }
.toggle_active .label { background-color: var(--track); height: 22px; width: 40px; position: absolute; border-radius: 999px; cursor: pointer; left: -28px; top: -6px; transition: background .2s; }
.toggle_active .circle { width: 16px; height: 16px; background-color: #fff; position: absolute; top: 3px; left: 3px; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); animation: toggleOff .2s ease forwards; }
.toggle_active .input:checked + .label { background-color: var(--success); }
html.dark .toggle_active .input:checked + .label { background-color: #22A06B; }
.toggle_active .input:checked + .label .circle { animation: toggleOn .2s ease forwards; }
@keyframes toggleOn { from { transform: translateX(0); } to { transform: translateX(18px); } }
@keyframes toggleOff { from { transform: translateX(18px); } to { transform: translateX(0); } }

/* ── 10. SweetAlert2 ───────────────────────────────────────────────────── */
.swal2-popup { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border); border-radius: 16px !important; padding: 1.5rem 1.6rem 1.3rem !important; box-shadow: var(--menu-shadow) !important; width: 34em !important; font-family: var(--font); }
.swal2-toast.swal2-popup { width: auto !important; padding: .75rem 1rem !important; }
.swal2-title { color: var(--text) !important; font-family: var(--font-display); font-size: 1.15rem !important; font-weight: 600 !important; padding: .2rem 0 .3rem !important; text-align: left !important; width: 100%; }
.swal2-html-container { color: var(--text-2) !important; text-align: left !important; margin: .4rem 0 0 !important; font-size: .92rem; }
.swal2-icon { margin: .6rem auto .4rem !important; }
.rbd-field { text-align: left; margin: .85rem 0 0; }
.rbd-field > label { display: block; font-size: 13.5px; font-weight: 500; color: var(--text) !important; margin-bottom: 6px; }
.rbd-field .hint { font-weight: 400; color: var(--text-3); font-size: 12.5px; }
.rbd-input, .swal2-input, .swal2-textarea, .swal2-select {
  width: 100%; box-sizing: border-box; height: 42px; padding: 0 12px;
  background: var(--field) !important; color: var(--text) !important;
  border: 1px solid var(--border-strong) !important; border-radius: var(--radius) !important;
  font: inherit; font-size: 14px; outline: none; box-shadow: none !important;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.rbd-input { padding: 10px 12px; }
.rbd-input::placeholder { color: var(--text-3); opacity: .8; }
.rbd-input:focus, .swal2-input:focus, .swal2-textarea:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft) !important; }
.swal2-validation-message { background: transparent !important; color: var(--danger) !important; font-size: .82rem; padding-top: .5rem; }
.swal2-actions { gap: .5rem !important; margin-top: 1.3rem !important; }
.swal2-styled { border-radius: var(--radius) !important; padding: 0 1.3rem !important; height: 40px; font-size: 14px !important; font-weight: 600 !important; box-shadow: none !important; margin: 0 !important; min-width: 104px; }
.swal2-styled.swal2-confirm { background: var(--primary) !important; color: #fff !important; }
.swal2-styled.swal2-confirm:hover { background: var(--primary-hover) !important; }
.swal2-styled.swal2-cancel { background: transparent !important; color: var(--text) !important; border: 1px solid var(--border-strong) !important; }
.swal2-styled.swal2-cancel:hover { background: var(--surface-2) !important; }
.swal2-styled.swal2-deny { background: #D92D20 !important; color: #fff !important; }
.swal2-styled:focus { box-shadow: var(--focus-ring) !important; }
.swal2-close { color: var(--text-3) !important; }
.swal2-close:hover { color: var(--text) !important; }
.swal2-container { backdrop-filter: blur(2px); }
.swal2-container.swal2-backdrop-show { background: rgba(3,5,10,.55) !important; }

/* ── 11. Footer ────────────────────────────────────────────────────────── */
footer.main-footer, .ek-footer {
  position: static; height: auto; width: 100%;
  max-width: 1464px; margin: 0 auto; box-sizing: border-box;
  padding: 16px 32px 24px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-3);
  border-top: 1px solid var(--border);
}
@media (max-width: 768px) { footer.main-footer, .ek-footer { padding: 14px; } }

/* ═══════════════════════════════════════════════════════════════════════
   12. Eureka components (.ek-*) — use these on new pages
   ═══════════════════════════════════════════════════════════════════════ */
.ek-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; }
.ek-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ek-page-head > div { min-width: 0; display: grid; gap: 6px; }
.ek-page-title { margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -.015em; line-height: 1.2; color: var(--text); }
.ek-page-sub { margin: 0; font-size: 14px; color: var(--text-2); text-wrap: pretty; }

.ek-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); min-width: 0; }
.ek-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; flex-wrap: wrap; }
.ek-card-head > div { display: grid; gap: 2px; min-width: 0; }
.ek-card-title { margin: 0; font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--text); }
.ek-card-sub { font-size: 12.5px; color: var(--text-3); }
.ek-link { font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; color: var(--accent); }
.ek-link:hover { text-decoration: underline; color: var(--accent); }
.ek-eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.ek-divider { height: 1px; background: var(--border); }

.ek-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 600;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.ek-btn-primary { background: var(--primary); color: #fff; }
.ek-btn-primary:hover { background: var(--primary-hover); color: #fff; }
.ek-btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.ek-btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* KPI tiles */
.ek-kpis { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1100px) { .ek-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 520px)  { .ek-kpis { grid-template-columns: minmax(0,1fr); } }
.ek-kpi { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; text-decoration: none; color: inherit; transition: border-color .15s ease; }
a.ek-kpi:hover { border-color: var(--border-strong); color: inherit; }
.ek-kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ek-kpi-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.ek-kpi-ico { width: 30px; height: 30px; border-radius: 8px; flex: none; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.ek-kpi-value { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ek-kpi-value small { font-size: .6em; font-weight: 500; color: var(--text-2); margin-right: 2px; letter-spacing: 0; }
.ek-kpi-meta { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ek-kpi-meta .up { color: var(--success); font-weight: 500; }

/* "Needs attention" queue tiles */
.ek-attn { display: grid; gap: 10px; padding: 0 12px 12px; grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1199px) { .ek-attn { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 560px)  { .ek-attn { grid-template-columns: minmax(0,1fr); } }
.ek-attn-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 12px 14px 16px;
  border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border);
  text-decoration: none; color: inherit; transition: border-color .15s ease;
}
a.ek-attn-item:hover { border-color: var(--border-strong); color: inherit; }
.ek-attn-num { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; min-width: 36px; line-height: 1; color: var(--text-3); }
.ek-attn-item.is-hot .ek-attn-num { color: var(--warning); }
.ek-attn-body { min-width: 0; flex: 1; display: grid; gap: 3px; }
.ek-attn-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 600; color: var(--text); }
.ek-attn-sub { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ek-attn-chev { color: var(--text-3); flex: none; }
.ek-flag { font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); white-space: nowrap; }
.ek-clear { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; color: var(--text-3); }

.ek-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.ek-row > .ek-grow-2 { flex: 2 1 560px; }
.ek-row > .ek-grow-1 { flex: 1 1 300px; }
.ek-row-top { align-items: flex-start; }

/* CSS bar chart */
.ek-bars { padding: 36px 20px 16px; display: grid; grid-template-columns: 32px minmax(0,1fr); column-gap: 12px; grid-template-rows: 216px 28px; flex: 1; }
.ek-bars-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; text-align: right; line-height: 1; transform: translateY(-5px); }
.ek-bars-plot { position: relative; min-width: 0; }
.ek-bars-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; }
.ek-bars-grid > div { height: 1px; background: var(--border); }
.ek-bars-grid > div:last-child { background: var(--border-strong); }
.ek-bars-cols { position: absolute; inset: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); align-items: end; }
.ek-bar { justify-self: center; width: min(56px, 52%); min-height: 2px; background: var(--accent); border-radius: 6px 6px 2px 2px; position: relative; transition: opacity .15s ease; }
.ek-bar:hover, .ek-bar:focus { opacity: .85; }
.ek-bar span { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); line-height: 1; }
.ek-bars-labels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); padding-top: 8px; }
.ek-bars-labels span { text-align: center; font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }

/* meters */
.ek-meter { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.ek-meter > div { height: 100%; background: var(--accent); border-radius: 3px; min-width: 4px; }
.ek-meter.thin { height: 4px; border-radius: 2px; }
.ek-meter.alt > div { background: var(--cyan); }
.ek-stat-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 14px; }
.ek-stat-line .lbl { font-weight: 500; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ek-stat-line .val { font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.ek-stat-line .val b { font-weight: 600; }
.ek-stat-line .val span { color: var(--text-3); }
.ek-big { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }

.ek-trio { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.ek-trio > div { padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); display: grid; gap: 2px; }
.ek-trio b { font-family: var(--font-display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ek-trio span { font-size: 12px; color: var(--text-3); }

/* data table */
.ek-table-wrap { overflow-x: auto; }
.ek-table { width: 100%; border-collapse: collapse; min-width: 520px; font-size: 14px; }
.ek-table th { text-align: left; padding: 9px 16px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.ek-table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ek-table th:first-child, .ek-table td:first-child { padding-left: 20px; }
.ek-table th:last-child, .ek-table td:last-child { padding-right: 20px; }
.ek-table tbody tr { transition: background .15s ease; }
.ek-table tbody tr:hover { background: var(--row-hover); }
.ek-table tbody tr:last-child td { border-bottom: 0; }
.ek-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ek-person .ek-avatar { width: 32px; height: 32px; font-size: 12px; border: 0; }
.ek-person-name { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; display: block; }
.ek-person-sub { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; display: block; }
.ek-chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; text-transform: capitalize; }
.ek-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; color: var(--st-closed); background: var(--st-closed-bg); text-transform: capitalize; }
.ek-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ek-status.st-new { color: var(--st-new); background: var(--st-new-bg); }
.ek-status.st-open { color: var(--st-open); background: var(--st-open-bg); }
.ek-status.st-qualifying { color: var(--st-qualifying); background: var(--st-qualifying-bg); }
.ek-status.st-engaging { color: var(--st-engaging); background: var(--st-engaging-bg); }
.ek-status.st-negotiating { color: var(--st-negotiating); background: var(--st-negotiating-bg); }
.ek-status.st-handover { color: var(--st-handover); background: var(--st-handover-bg); }
.ek-muted { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

.ek-empty { padding: 40px 20px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.ek-empty-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.ek-empty strong { font-size: 14px; font-weight: 600; color: var(--text); }
.ek-empty span { font-size: 13px; color: var(--text-3); max-width: 320px; text-wrap: pretty; }

.ek-list { list-style: none; margin: 0; padding: 8px 20px 18px; display: grid; gap: 14px; }
.ek-list li { display: grid; gap: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ── 13. On/off switches (role="switch" checkboxes, Bootstrap .form-switch) ───── */
input[type="checkbox"][role="switch"].form-check-input,
.form-switch .form-check-input {
  -webkit-appearance: none; appearance: none;
  width: 36px !important; height: 20px !important; flex: none;
  border: 0 !important; border-radius: 999px !important;
  background-color: var(--track) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%23fff'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-size: 16px 16px !important;
  background-position: left 2px center !important;
  box-shadow: inset 0 0 0 1px var(--border-strong) !important;
  cursor: pointer;
  transition: background-position .15s ease, background-color .15s ease !important;
}
input[type="checkbox"][role="switch"].form-check-input:checked,
.form-switch .form-check-input:checked {
  background-color: var(--success) !important;
  background-position: right 2px center !important;
  box-shadow: none !important;
}
html.dark input[type="checkbox"][role="switch"].form-check-input:checked,
html.dark .form-switch .form-check-input:checked { background-color: #22A06B !important; }
input[type="checkbox"][role="switch"].form-check-input:focus-visible,
.form-switch .form-check-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"][role="switch"].form-check-input:disabled { opacity: .5; cursor: not-allowed; }

/* ── 14. Row-level destructive buttons stay quiet (ecom tables + popups) ── */
.ecom .btn-danger, .ecom-overlay .btn-danger,
.table .btn-sm.btn-danger {
  background: var(--danger-soft) !important; color: var(--danger) !important; border: 1px solid transparent !important;
}
.ecom .btn-danger:hover, .ecom-overlay .btn-danger:hover,
.table .btn-sm.btn-danger:hover { border-color: var(--danger-border) !important; color: var(--danger) !important; }

/* ═══════════════════════════════════════════════════════════════════════
   15. Polish pass (2026-10-06) — calmer tables, steady cards, mobile rows
   ═══════════════════════════════════════════════════════════════════════ */

/* cards don't jump on hover (main.css legacy lift); link-cards just firm their border */
.card:hover, html.dark .card:hover { transform: none !important; }
a.card { transition: border-color .15s ease !important; }
a.card:hover { border-color: var(--border-strong) !important; }

/* numbers line up in columns */
.table td, .ek-table td, .badge, .ek-kpi-value { font-variant-numeric: tabular-nums; }
.table > tbody > tr > td { vertical-align: middle; }

/* row actions: one quiet weight — the row is the content, not the buttons */
.table td .btn-sm:not(.btn-icon), .table td .btn-xs:not(.btn-icon) { --btn-h: 30px; padding: 0 11px !important; font-size: 12.5px !important; font-weight: 600 !important; }
.table td .btn-primary, .table td .btn-brand, .table td .btn-dark, .table td .btn-info {
  background: var(--accent-soft) !important; color: var(--accent) !important; border: 1px solid transparent !important;
}
.table td .btn-primary:hover, .table td .btn-brand:hover, .table td .btn-dark:hover, .table td .btn-info:hover { border-color: var(--accent) !important; color: var(--accent) !important; }
.table td .btn-success { background: var(--success-soft) !important; color: var(--success) !important; border: 1px solid transparent !important; }
.table td .btn-success:hover { border-color: var(--success) !important; }
.table td .btn-danger { background: transparent !important; color: var(--danger) !important; border: 1px solid transparent !important; }
.table td .btn-danger:hover { background: var(--danger-soft) !important; border-color: transparent !important; }
.table td .btn-light, .table td .btn-secondary, .table td .btn-outline-secondary, .table td .btn-outline-dark {
  background: transparent !important; border-color: var(--border) !important; color: var(--text-2) !important;
}
.table td .btn + .btn, .table td .btn + form, .table td form + .btn, .table td form + form { margin-left: 4px; }
.table td form { display: inline-flex; }
html.dark .table td .btn-primary, html.dark .table td .btn-brand, html.dark .table td .btn-dark, html.dark .table td .btn-info { color: #9DB8FF !important; }

/* pagination — one consistent pill row (legacy .pagination-area padding broke centering) */
.pagination-area .pagination { margin: 4px 0 0; }
.pagination-area .page-item { margin: 0; }
.pagination-area .page-item .page-link, .pagination .page-link {
  display: inline-flex !important; width: auto; min-width: 34px; height: 34px; padding: 0 12px !important;
  border-radius: 8px !important; line-height: 1 !important;
}
.pagination-area .page-item:not(.active) .page-link { background: transparent !important; color: var(--text) !important; }
.pagination-area .page-item:not(.active):hover .page-link { background: var(--surface-2) !important; }

/* row overflow menu (⋯) — secondary row actions live here instead of a wall of buttons */
.ek-row-menu { display: inline-flex; }
.ek-row-menu > .btn-icon { width: 30px; height: 30px; min-height: 30px; border: 1px solid var(--border) !important; color: var(--text-2); }
.ek-row-menu .dropdown-menu { min-width: 180px; }
.ek-row-menu .dropdown-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 13.5px; background: transparent; border: 0; width: 100%; text-align: left; }
.ek-row-menu .dropdown-item.is-danger { color: var(--danger); }
.ek-row-menu .dropdown-item.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.ek-row-menu .dropdown-item:disabled { opacity: .5; }
.ek-row-menu form { display: block !important; margin: 0 !important; }

/* page titles: display face, no stray emoji spacing */
.content-header .content-title { display: flex; align-items: center; gap: 10px; }

/* section labels inside cards (the `<b class="d-block mb-2">` pattern) read as card titles */
.card-body > b.d-block:first-child, .card-body > div > b:first-child:not(.badge) {
  font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--text);
}

/* empty-state rows */
.table td[colspan] { padding: 36px 20px !important; color: var(--text-3); text-align: center; }

/* ── mobile: table rows become labelled cards (labels filled from <th> by base.html) ── */
@media (max-width: 576px) {
  .table-responsive table, .table-responsive .table { min-width: 0 !important; }
  .table-responsive table thead { display: none; }
  .table-responsive table, .table-responsive table tbody { display: block; width: 100%; }
  .table-responsive table tbody tr {
    display: block; margin: 0 0 12px; padding: 6px 14px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  }
  .table-responsive table tbody tr:last-child { margin-bottom: 0; }
  .table-responsive table td,
  .table > tbody > tr > td:first-child, .table > tbody > tr > td:last-child {
    display: flex !important; align-items: center; justify-content: space-between; gap: 14px;
    width: 100%; text-align: right !important; white-space: normal;
    padding: 9px 0 !important; border-bottom: 1px solid var(--border) !important;
  }
  .table-responsive table td:last-child { border-bottom: 0 !important; }
  .table-responsive table td::before {
    content: attr(data-title); float: none; margin: 0; flex: none; max-width: 45%;
    text-align: left; text-transform: none;
    font-size: 12.5px; font-weight: 500; color: var(--text-3);
  }
  .table-responsive table td:not([data-title])::before, .table-responsive table td[data-title=""]::before { content: none; }
  .table-responsive table td:not([data-title]), .table-responsive table td[data-title=""] { justify-content: flex-end; }
  /* action cell: buttons wrap left-to-right across the full card width */
  .table-responsive table td.text-end:last-child, .table-responsive table td[data-actions] {
    flex-wrap: wrap; justify-content: flex-start; gap: 6px; padding-top: 12px !important;
  }
  .table-responsive table td.text-end:last-child::before, .table-responsive table td[data-actions]::before { content: none; }
  .table-responsive table td .btn + .btn, .table-responsive table td .btn + form,
  .table-responsive table td form + .btn, .table-responsive table td form + form { margin-left: 0; }
  .table-responsive table td[colspan] { display: block !important; text-align: center !important; border: 0 !important; }
  .table-responsive table td[colspan]::before { content: none; }
  .card-body:has(> .table-responsive), .card:has(> .table-responsive) { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; }
}

/* page-header toolbars: secondary actions share one neutral weight; only the primary CTA is filled */
.content-header .btn-outline-success, .content-header .btn-outline-primary, .content-header .btn-outline-secondary,
.content-header .btn-outline-info, .content-header .btn-outline-dark, .content-header .btn-light,
html.dark .content-header .btn-outline-primary, html.dark .content-header .btn-outline-secondary, html.dark .content-header .btn-light {
  background: var(--surface) !important; border: 1px solid var(--border-strong) !important; color: var(--text) !important;
}
.content-header .btn-outline-success:hover, .content-header .btn-outline-primary:hover, .content-header .btn-outline-secondary:hover,
.content-header .btn-outline-info:hover, .content-header .btn-outline-dark:hover, .content-header .btn-light:hover,
html.dark .content-header .btn-outline-primary:hover, html.dark .content-header .btn-outline-secondary:hover, html.dark .content-header .btn-light:hover {
  background: var(--surface-2) !important; color: var(--text) !important;
}
@media (max-width: 576px) {
  .table-responsive table td[data-actions] .ek-row-menu { margin-left: auto !important; }
}

/* outline buttons inside table rows: one neutral ghost; only delete keeps its red text */
.table td .btn-outline-primary, .table td .btn-outline-info, .table td .btn-outline-warning,
.table td .btn-outline-success, .table td .btn-outline-secondary, .table td .btn-outline-dark {
  background: transparent !important; border: 1px solid var(--border) !important; color: var(--text-2) !important;
}
.table td .btn-outline-primary:hover, .table td .btn-outline-info:hover, .table td .btn-outline-warning:hover,
.table td .btn-outline-success:hover, .table td .btn-outline-secondary:hover, .table td .btn-outline-dark:hover {
  background: var(--surface-2) !important; color: var(--text) !important; border-color: var(--border-strong) !important;
}
.table td .btn-outline-danger { background: transparent !important; border: 1px solid var(--border) !important; color: var(--danger) !important; }
.table td .btn-outline-danger:hover { background: var(--danger-soft) !important; border-color: transparent !important; }
.btn .ek-ico { flex: none; }
.table td .btn-sm.btn-danger { background: transparent !important; border: 1px solid var(--border) !important; color: var(--danger) !important; }
.table td .btn-sm.btn-danger:hover { background: var(--danger-soft) !important; border-color: transparent !important; }
