:root {
  color-scheme: light dark;
  /* 2026-10-03: new CMS design (approved from the mock-up picture): cooler greys, a more vivid indigo accent, softer borders. */
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e4e7ee;
  --text: #161a23;
  --text-2: #4b5365;
  --text-3: #8a92a5;
  --accent: #4a5ee6;
  --accent-hover: #3a4cd0;
  --accent-soft: #eaedff;
  --success: oklch(60% 0.14 150);
  --success-soft: oklch(95% 0.035 150);
  --warning: oklch(78% 0.15 80);
  --warning-soft: oklch(96% 0.045 80);
  --danger: oklch(58% 0.19 25);
  --danger-soft: oklch(96% 0.03 25);
}

/* 2026-09-20: dark theme, the same palette as the provider panel. It follows the computer's setting until someone presses the
   sun/moon button in the top bar; that choice is remembered in the browser (see js/theme.js). Filled buttons keep white text, so the
   accent stays mid-tone in dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1119; --surface: #171b27; --surface-2: #1e2332; --border: #2a3043;
    --text: #f1f3f9; --text-2: #a9b0c5; --text-3: #7a8299;
    --accent: #7c8cf5; --accent-hover: #93a0f8; --accent-soft: #232a55;
    --success: oklch(70% 0.15 150); --success-soft: oklch(28% 0.05 150);
    --warning: oklch(80% 0.13 80); --warning-soft: oklch(30% 0.05 80);
    --danger: oklch(68% 0.18 25); --danger-soft: oklch(29% 0.06 25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1119; --surface: #171b27; --surface-2: #1e2332; --border: #2a3043;
  --text: #f1f3f9; --text-2: #a9b0c5; --text-3: #7a8299;
  --accent: #7c8cf5; --accent-hover: #93a0f8; --accent-soft: #232a55;
  --success: oklch(70% 0.15 150); --success-soft: oklch(28% 0.05 150);
  --warning: oklch(80% 0.13 80); --warning-soft: oklch(30% 0.05 80);
  --danger: oklch(68% 0.18 25); --danger-soft: oklch(29% 0.06 25);
}
/* 2026-10-02: "the dark theme i cant see anything related to branch location" - a <select>/
   <input type=date>'s own native chrome (box fill, dropdown arrow, date-picker icon) follows the
   OS's prefers-color-scheme when only the unconditional `color-scheme: light dark` at :root applies
   - on a machine whose OS theme is light, that can render a select's native background light while
   our own CSS colors its text for dark (var(--text), near-white), making it unreadable. Pinning
   color-scheme explicitly to whichever theme is actually active (here and in the prefers-color-scheme
   block above) makes native controls follow the SITE's own toggle instead of the OS's. */
:root[data-theme="light"] {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
}

input::placeholder {
  color: var(--text-3);
}

/* App shell */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.app-sidebar {
  width: 248px;
  flex: 0 0 248px;
  /* 2026-10-03: the sidebar is always the dark navy of the new design, in light and dark mode: the tokens are redefined for everything
     inside it, so the existing inline styles (var(--text), var(--border), ...) pick up the sidebar palette by themselves. */
  --surface: #14172a;
  --bg: #1d2140;
  --surface-2: #1d2140;
  --border: #262b52;
  --text: #ffffff;
  --text-2: #c3c8e6;
  --text-3: #7e86b0;
  --accent: #8a98ff;
  --accent-hover: #a3aeff;
  --accent-soft: #2b3166;
  background: #14172a;
  color: var(--text);
  border-right: none;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  height: 64px;
  flex: 0 0 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  position: relative;
}
.topbar-left { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; min-width: 0; }
.topbar-crumb { font-size: 12px; color: var(--text-3); line-height: 1.2; }
.topbar-crumb b { display: block; color: var(--text); font-size: 15px; font-weight: 700; }
.topbar-search {
  position: relative;
  flex: 1 1 auto;
  max-width: 430px;
  margin-left: 26px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 13px;
  height: 40px;
  color: var(--text-3);
}
.topbar-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 13px; }
.topbar-search kbd { font-family: inherit; font-size: 10.5px; border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: var(--surface); color: var(--text-3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.ai-btn {
  display: flex; align-items: center; gap: 7px; border: none; cursor: pointer; font-family: inherit;
  background: linear-gradient(135deg, #4a5ee6, #8d5cf0); color: #fff; border-radius: 10px; padding: 9px 14px; font-weight: 700; font-size: 12.5px; white-space: nowrap;
}
.nav-heading { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--text-3); text-transform: uppercase; padding: 14px 10px 4px; }
.aih-fab { display: none; }
@media (max-width: 1100px) { .topbar-search kbd { display: none; } .ai-btn-text { display: none; } .ai-btn { padding: 9px 11px; } }
@media (max-width: 760px) { .topbar-search { display: none; } .topbar-crumb { display: none; } }

.app-content {
  flex: 1;
  padding: 28px 32px;
  /* 2026-09-24: "keep everything working on mobile" - a page whose own content is wider than the
     screen (a wide table, a fixed-width grid) scrolls INSIDE this box instead of breaking the whole
     layout (pushing the sidebar off-screen, forcing the page itself to scroll sideways). This is a
     safety net on top of the page-by-page responsive work below, not a substitute for it. */
  overflow-x: auto;
}

.sidebar-toggle {
  display: none;
}
.sidebar-backdrop {
  display: none;
}

/* 2026-09-24: "consider doing the design mobile or tablet friendly while everything keep working" -
   below 900px (phone and most tablets in portrait) the sidebar becomes an off-canvas drawer instead
   of a permanent 240px column: it starts off-screen (transform, not display:none, so it keeps its
   own scroll position and open sub-menus) and slides in over the content when the hamburger button
   (top left of the bar, see MainLayout.razor) is pressed. A translucent backdrop behind it closes it
   on tap, and it also closes itself on every real navigation (MainLayout's own LocationChanged
   handler) so picking a page doesn't leave the drawer open over it. */
@media (max-width: 900px) {
  .app-shell {
    display: block;
  }
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 210;
    width: 260px;
    flex: none;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 28px rgba(0, 0, 0, 0.25);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    width: 100%;
  }
  .sidebar-toggle {
    display: flex;
  }
  .sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 21, 0.4);
    z-index: 205;
  }
  .app-topbar {
    padding: 0 14px;
    gap: 10px;
  }
  .app-content {
    padding: 16px;
  }
}

/* Phones specifically: the brand-name middle column and the username text next to the gear menu
   are the first things to give up space so the logo, hamburger and gear stay tappable. */
@media (max-width: 520px) {
  .app-topbar .topbar-username-text {
    display: none;
  }
}

/* 2026-09-24: "I want it like the picture as rectangular but the width is more than the length" -
   flex-wrap with a min-width floor (the previous attempt) still collapsed to one column wide once
   the columns hit that floor, which is exactly the tall single-column list the owner was rejecting.
   A fixed 2-column CSS grid guarantees the panel is always at least 2 columns wide - never a single
   vertical list - regardless of how narrow the actual screen is; only the column contents get
   narrower, never the column count. */
.gear-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
  width: min(520px, calc(100vw - 32px));
  max-height: min(70vh, 520px);
  overflow-y: auto;
}

/* Primary nav */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.app-sidebar .nav-item.active {
  background: linear-gradient(90deg, #4a5ee6, #5d6df0);
  color: #fff;
}
.app-sidebar .nav-item:hover:not(.active) {
  background: #1d2140;
}
.app-sidebar .settings-item.active {
  background: #2b3166;
  color: #fff;
}
.app-sidebar input::placeholder { color: #7e86b0; }
.app-sidebar { overflow: hidden; }
.app-sidebar > nav { overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: #2b3166 transparent; }
.app-sidebar > nav::-webkit-scrollbar { width: 6px; }
.app-sidebar > nav::-webkit-scrollbar-thumb { background: #2b3166; border-radius: 6px; }

/* New design: cards a little rounder, the page title bigger, the brand switcher a pill. */
.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 12px;
  background: var(--surface);
}
.brand-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.top-date {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.topbar-logo-spacer { display: none; }
@media (min-width: 901px) {
  .topbar-logo { display: none !important; }
  .topbar-logo-spacer { display: block; }
}

/* Settings sub-nav */
.settings-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.settings-item:hover {
  background: var(--bg);
}
.settings-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Forms */
.field-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field-value {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  background: var(--surface);
}

/* Tables */
.row:hover {
  background: var(--bg);
}

/* Toggles */
.toggle-on {
  width: 32px;
  height: 18px;
  border-radius: 10px;
  background: var(--accent);
  position: relative;
  flex: 0 0 32px;
  border: none;
  padding: 0;
  cursor: pointer;
}
.toggle-on div {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  right: 2px;
}
.toggle-off {
  width: 32px;
  height: 18px;
  border-radius: 10px;
  background: var(--border);
  position: relative;
  flex: 0 0 32px;
  border: none;
  padding: 0;
  cursor: pointer;
}
.toggle-off div {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
}

/* Toolbar */
.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.btn-accent {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border: none;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* 2026-09-24: color-coded action buttons (Omega Software walkthrough reference: green=commit, orange/
   accent=save a draft, red=delete). .btn-accent above is the "save" color; these two round out the set
   for any form that also needs a positive-commit and a destructive action next to it. */
.btn-success {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border: none;
  border-radius: 9px;
  background: var(--success);
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn-danger {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border: none;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* Sales item tabs */
.tab-1 {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
}
.tab-1.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-1 .badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex: 0 0 24px;
}
.tab-1.active .badge {
  background: var(--accent-soft);
  color: var(--accent);
}
.tab-2 {
  padding: 10px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
}
.tab-2.active {
  color: var(--text);
  font-weight: 800;
  border-bottom-color: var(--accent);
}
.tab-3 {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  border-radius: 20px;
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
  background: none;
  border: none;
}
.tab-3.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
/* 2026-09-24: horizontally-scrolling tab row (Omega Software walkthrough reference) - a tab row that
   doesn't fit the screen scrolls sideways in one line instead of wrapping to a second line or relying
   on the page-wide overflow-x safety net to shift the whole page. Wrap any row of .tab-1/.tab-2/.ci-tab
   buttons in a div with this class. */
.tab-row-scroll {
  display: flex;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.tab-row-scroll::-webkit-scrollbar {
  height: 5px;
}
.tab-row-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex: 0 0 22px;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* Blazor connection banner */
#blazor-error-ui {
  background: var(--danger);
  color: #fff;
  bottom: 0;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
  display: none;
  left: 0;
  padding: 0.75rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
  font-size: 13.5px;
}
#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}
#blazor-error-ui .reload {
  color: #fff;
  text-decoration: underline;
}

.blazor-error-boundary {
  background: var(--danger);
  padding: 1rem;
  color: white;
  border-radius: 8px;
}
.blazor-error-boundary::after {
  content: "An error has occurred.";
}

/* Customer page tabs (2026-10-03) */
.cust-tabs { display:flex; gap:4px; border-bottom:1px solid var(--border); margin-bottom:16px; overflow-x:auto; }
.cust-tabs button { font-family:inherit; font-size:13px; font-weight:700; padding:9px 16px; border:none; background:none; cursor:pointer; white-space:nowrap; border-bottom:2px solid transparent; margin-bottom:-1px; }
.cust-tabs .tab-off { color:var(--text-3); }
.cust-tabs .tab-off:hover { color:var(--text); }
.cust-tabs .tab-on { color:var(--accent); border-bottom-color:var(--accent); }

[hidden] { display: none !important; }
