/* ==========================================================================
   Exalit OneApp — Design System tokens + shell theme
   UI-only global theme. Wired in Components/App.razor after MudBlazor css.
   Token source: exalit_erp_design.html (:root scale).
   ========================================================================== */

:root {
  --bg: #f2f5f5;
  --surface: #ffffff;
  --surface-2: #f8fafa;
  --surface-3: #eef3f3;
  --line: #e3e9e9;
  --line-strong: #cfd9d9;
  --text: #0d2b31;
  --text-2: #4e6a6f;
  --text-3: #84999c;
  --accent: #0f9e91;
  --accent-2: #0a6f66;
  --accent-soft: #e6f5f3;
  --danger: #cf4444;
  --danger-soft: #fbecec;
  --warn: #b5811a;
  --warn-soft: #fbf2e2;
  --ok: #2f8256;
  --ok-soft: #e8f4ec;
  --card-radius: 12px;
  --card-border: 1px solid var(--line);
  --card-shadow: 0 1px 2px rgba(13, 43, 49, .05), 0 12px 28px -18px rgba(13, 43, 49, .28);
  --rowh: 46px;
  --pad: 18px;
  --fs: 13.5px;
  --fs-sm: 12px;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
}

[data-look="lined"] {
  --card-radius: 3px;
  --card-shadow: none;
  --card-border: 1px solid var(--line-strong);
  --surface-2: #fff;
}

[data-density="compact"] {
  --rowh: 34px;
  --pad: 13px;
  --fs: 12.5px;
  --fs-sm: 11px;
}

[data-theme="dark"] {
  --bg: #091416;
  --surface: #0f2023;
  --surface-2: #13282c;
  --surface-3: #183036;
  --line: #1e383d;
  --line-strong: #2b4d53;
  --text: #e9f3f2;
  --text-2: #9cb5b7;
  --text-3: #6e888c;
  --accent: #2fc4b2;
  --accent-2: #8ce4d7;
  --accent-soft: #11302e;
  --danger: #f07575;
  --danger-soft: #331b1b;
  --warn: #e0b464;
  --warn-soft: #33280f;
  --ok: #61c58e;
  --ok-soft: #12301f;
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .02);
}

/* -------- Global typography: force IBM Plex Sans across MudBlazor -------- */
html, body {
  font-family: var(--font-sans);
}

body {
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

.mud-typography-h1, .mud-typography-h2, .mud-typography-h3,
.mud-typography-h4, .mud-typography-h5, .mud-typography-h6,
.mud-typography-subtitle1, .mud-typography-subtitle2,
.mud-typography-body1, .mud-typography-body2,
.mud-typography-button, .mud-typography-caption, .mud-typography-overline,
.mud-input, .mud-input-root, .mud-input-slot,
.mud-button-root, .mud-nav-link, .mud-nav-group,
.mud-table, .mud-table-cell, .mud-select, .mud-chip,
.mud-tabs, .mud-tab, .mud-menu,
input, textarea, button, select {
  font-family: var(--font-sans) !important;
}

/* Utility: monospace for document ids / numbers (opt-in) */
.mono, .exalit-mono {
  font-family: var(--font-mono) !important;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   App shell — sidebar (MudDrawer) + header (MudAppBar) + nav (MudNavMenu)
   ========================================================================== */

.exalit-root {
  background: var(--bg);
  color: var(--text);
}

/* ---- Header / AppBar ---- */
.exalit-appbar.mud-appbar {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--line);
  box-shadow: none !important;
}

.exalit-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-3);
}

.exalit-breadcrumb .crumb-sep {
  opacity: .5;
}

.exalit-breadcrumb .crumb-current {
  color: var(--text-2);
  font-weight: 500;
}

/* ---- Sidebar / Drawer ---- */
.exalit-drawer.mud-drawer {
  background: var(--surface) !important;
  border-right: 1px solid var(--line);
}

.exalit-brand {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.exalit-brand__tile {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  color: #fff;
}

.exalit-brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.exalit-brand__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.exalit-brand__sub {
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ---- User footer in drawer ---- */
.exalit-userfoot {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.exalit-userfoot__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-2);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  flex: 0 0 28px;
}

.exalit-userfoot__meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}

.exalit-userfoot__name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exalit-userfoot__role {
  font-size: 10.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exalit-version {
  padding: 6px 16px 10px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

/* ---- Nav links: design-style icon+label rows with teal active state ---- */
.exalit-drawer .mud-nav-link {
  border-radius: 8px;
  margin: 1px 8px;
  min-height: 38px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.exalit-drawer .mud-nav-link:hover {
  background: var(--surface-3);
  color: var(--text);
}

.exalit-drawer .mud-nav-link .mud-nav-link-icon {
  color: var(--text-2);
  min-width: 34px;
}

.exalit-drawer .mud-nav-link.active,
.exalit-drawer .mud-nav-link.mud-nav-link-active {
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 600;
}

.exalit-drawer .mud-nav-link.active .mud-nav-link-icon,
.exalit-drawer .mud-nav-link.mud-nav-link-active .mud-nav-link-icon {
  color: var(--accent);
}

/* Content area background */
.exalit-main.mud-main-content {
  background: var(--bg);
}

/* ============================================================
   Global MudTabs — flat, consistent across every page.
   Kills the solid teal tab-bar; thin bottom rule + teal active
   underline, matching the Exalit design. Overrides any per-tab
   Color="Primary"/Rounded defaults so all pages look the same.
   ============================================================ */
.mud-tabs-tabbar {
  background: transparent !important;
  box-shadow: none !important;
  border-bottom: 1px solid var(--line);
  border-radius: 0 !important;
}
.mud-tabs-tabbar .mud-tabs-tabbar-inner { background: transparent !important; }
.mud-tabs-tabbar .mud-tab {
  color: var(--text-2) !important;
  text-transform: none;
  font-weight: 500;
  min-height: 44px;
  opacity: 1;
}
.mud-tabs-tabbar .mud-tab:hover { color: var(--text) !important; background: transparent !important; }
.mud-tabs-tabbar .mud-tab.mud-tab-active,
.mud-tabs-tabbar .mud-tab.mud-tab-active .mud-icon-root { color: var(--accent) !important; }
.mud-tabs-tabbar .mud-tab-slider,
.mud-tab-slider.mud-tab-slider-horizontal { background: var(--accent) !important; height: 2px; }
/* tab bars that were rendered on a colored surface */
.mud-tabs-tabbar.mud-tabs-rounded { border-radius: 0 !important; }

/* ============================================================
   Dark-mode fix for .exd-scoped editor pages.
   InvoiceEditor/SalesQuoteEditor hardcode LIGHT tokens inside a
   local `.exd { ... }` block, which win over the global
   [data-theme=dark] set — so in dark mode their cards stayed light
   with mismatched text. This flips the .exd tokens under dark.
   ============================================================ */
[data-theme="dark"] .exd {
  --bg:#091416; --surface:#0f2023; --surface-2:#13282c; --surface-3:#183036;
  --line:#1e383d; --line-strong:#2b4d53;
  --text:#e9f3f2; --text-2:#9cb5b7; --text-3:#6e888c;
  --accent:#2fc4b2; --accent-2:#8ce4d7; --accent-soft:#11302e;
  --danger:#f07575; --danger-soft:#331b1b; --ok:#61c58e; --ok-soft:#12301f;
  --warn:#e0b464; --warn-soft:#33280f;
}
/* MudBlazor inputs inside dark .exd cards — ensure readable label/value/placeholder */
[data-theme="dark"] .exd .mud-input-slot,
[data-theme="dark"] .exd .mud-input-label,
[data-theme="dark"] .exd input,
[data-theme="dark"] .exd .mud-select-input { color: var(--text) !important; }
[data-theme="dark"] .exd input::placeholder { color: var(--text-3) !important; }
[data-theme="dark"] .exd .mud-input-outlined-border { border-color: var(--line) !important; }


/* ============================================================
   Brand in the TOP BAR (moved out of the drawer, 2026-07-25).
   ============================================================ */
.exalit-brand--top {
  height: auto;
  padding: 0 14px 0 2px;
  border-bottom: 0;
  cursor: pointer;
  flex: 0 0 auto;
}
.exalit-brand--top:hover .exalit-brand__name { color: var(--accent); }
.exalit-appbar .exalit-breadcrumb { padding-left: 0; }
