:root {
  color-scheme: light;
  --btp-brand-950: #061d29;
  --btp-brand-900: #082a3a;
  --btp-brand-800: #0b3d53;
  --btp-brand-700: #075f8a;
  --btp-brand-600: #087bb4;
  --btp-brand-500: #0b87c6;
  --btp-brand-100: #dff2fa;
  --btp-brand-50: #eef8fc;
  --btp-page: #f3f6f8;
  --btp-surface: #fff;
  --btp-surface-2: #f8fafb;
  --btp-surface-3: #eef3f5;
  --btp-text: #162731;
  --btp-text-muted: #607580;
  --btp-border: #d5e0e5;
  --btp-border-strong: #b9c9d1;
  --btp-success: #167a55;
  --btp-success-bg: #e7f5ef;
  --btp-warning: #a76400;
  --btp-warning-bg: #fff2dc;
  --btp-danger: #b8323c;
  --btp-danger-bg: #fdecee;
  --btp-info: #087db7;
  --btp-info-bg: #e6f4fa;
  --btp-radius-sm: 4px;
  --btp-radius: 6px;
  --btp-radius-lg: 8px;
  --btp-control: 40px;
  --btp-shadow-overlay: 0 18px 48px rgb(6 29 41 / 22%);
  --btp-font: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --btp-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

[data-btp-theme="dark"] {
  color-scheme: dark;
  --btp-page: #0e1820;
  --btp-surface: #14232d;
  --btp-surface-2: #192d39;
  --btp-surface-3: #203744;
  --btp-text: #f2f7f9;
  --btp-text-muted: #aac0ca;
  --btp-border: #2c4654;
  --btp-border-strong: #446271;
  --btp-brand-100: #123f54;
  --btp-brand-50: #102f3e;
  --btp-success: #42c38d;
  --btp-success-bg: #123c31;
  --btp-warning: #f0aa3c;
  --btp-warning-bg: #3c2d17;
  --btp-danger: #ff6b74;
  --btp-danger-bg: #44242a;
  --btp-info: #55bce9;
  --btp-info-bg: #153647;
}

html { background: var(--btp-page); }
body.btp-enterprise {
  margin: 0;
  background: var(--btp-page);
  color: var(--btp-text);
  font-family: var(--btp-font);
  font-size: 14px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}
.btp-enterprise *, .btp-enterprise *::before, .btp-enterprise *::after { box-sizing: border-box; }
.btp-enterprise :where(button, input, select, textarea) { font: inherit; }
.btp-enterprise :where(button, a, summary, [role="button"]) { -webkit-tap-highlight-color: transparent; }
.btp-enterprise :where(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--btp-brand-500) 35%, transparent);
  outline-offset: 2px;
}
.btp-skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 10000; transform: translateY(-150%);
  padding: 9px 13px; border-radius: var(--btp-radius); background: var(--btp-brand-900);
  color: #fff; font-weight: 750; text-decoration: none;
}
.btp-skip-link:focus { transform: translateY(0); }
.btp-glyph {
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  width: 18px !important; min-width: 18px !important; max-width: 18px !important;
  height: 18px !important; min-height: 18px !important; max-height: 18px !important;
  overflow: hidden !important; font: 700 15px/18px var(--btp-font) !important; text-align: center;
}
.btp-enterprise svg.btp-icon {
  display: block !important; width: 18px !important; min-width: 18px !important; max-width: 18px !important;
  height: 18px !important; min-height: 18px !important; max-height: 18px !important; flex: 0 0 18px !important;
  overflow: visible !important; fill: none !important; stroke: currentColor !important; stroke-width: 1.8 !important;
  stroke-linecap: round; stroke-linejoin: round;
}
.btp-enterprise :is(.crm-module, .acc-module, .erp-module, .btp-nav-module) .btp-icon-slot {
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  width: 22px !important; min-width: 22px !important; max-width: 22px !important;
  height: 22px !important; min-height: 22px !important; max-height: 22px !important;
  flex: 0 0 22px !important; overflow: hidden !important;
}
.btp-theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border: 1px solid var(--btp-border); border-radius: var(--btp-radius); background: var(--btp-surface);
  color: var(--btp-text); cursor: pointer;
}
.btp-theme-toggle:hover { border-color: var(--btp-brand-500); color: var(--btp-brand-600); }
.btp-breadcrumb {
  display: flex; align-items: center; gap: 7px; min-height: 34px; margin: 0 0 14px;
  color: var(--btp-text-muted); font-size: 12px;
}
.btp-breadcrumb span:last-child { color: var(--btp-text); font-weight: 700; }
.btp-breadcrumb .btp-icon { width: 13px !important; min-width: 13px !important; max-width: 13px !important; height: 13px !important; min-height: 13px !important; max-height: 13px !important; }

/* Brand images must never inherit dimensions from data/media image rules. */
img[src*="btpoint-logo-white.png"] {
  display: block !important; width: auto !important; max-width: 230px !important;
  height: auto !important; max-height: 72px !important; object-fit: contain !important;
}
.brand img[src*="btpoint-logo-white.png"] {
  width: 190px !important; max-width: 190px !important; height: 64px !important; max-height: 64px !important;
}
.top img[src*="btpoint-logo-white.png"],
.head img[src*="btpoint-logo-white.png"],
.bar img[src*="btpoint-logo-white.png"] {
  width: auto !important; max-width: 180px !important; height: 48px !important; max-height: 48px !important;
}

/* Shared application shell */
.btp-enterprise :is(.crm-shell, .acc-shell, .erp-shell, .producer-layout, .layout) { min-height: 100vh; background: var(--btp-page); }
.btp-enterprise :is(.crm-side, .acc-side, .erp-sidebar, .producer-side, .sidebar) {
  background: var(--btp-brand-950) !important; color: #e8f1f5; border-right: 1px solid #183b4d;
}
.btp-enterprise :is(.crm-main, .acc-main, .erp-main, .producer-main, .main) {
  min-width: 0; background: var(--btp-page); color: var(--btp-text);
}
.btp-enterprise :is(.crm-top, .acc-top, .erp-top, .producer-main > .top, .topbar) {
  min-height: 62px; border-bottom: 1px solid var(--btp-border); background: var(--btp-surface);
}
.btp-enterprise :is(.crm-brand-row, .acc-brand-row, .erp-brand-row) { border-bottom: 1px solid rgb(255 255 255 / 10%); }
.btp-enterprise :is(.crm-brand, .erp-brand) img,
.btp-enterprise :is(.acc-brand-row, .producer-side) img { object-fit: contain; }

/* Navigation */
.btp-enterprise :is(.crm-module-nav, .acc-module-nav, .erp-module-nav, .btp-main-nav) { gap: 3px !important; }
.btp-enterprise :is(.crm-module, .acc-module, .erp-module, .btp-nav-module) {
  border: 0 !important; border-radius: var(--btp-radius) !important; background: transparent !important;
}
.btp-enterprise :is(.crm-module, .acc-module, .erp-module, .btp-nav-module) > summary {
  min-height: 42px; padding: 9px 10px !important; border-radius: var(--btp-radius) !important;
  color: #c8d8e0 !important; font-size: 12px !important; letter-spacing: .01em; font-weight: 750 !important;
}
.btp-enterprise :is(.crm-module, .acc-module, .erp-module, .btp-nav-module)[open] > summary {
  background: rgb(255 255 255 / 6%) !important; color: #fff !important;
}
.btp-enterprise :is(.crm-module, .acc-module, .erp-module, .btp-nav-module) a,
.btp-enterprise .btp-nav-module button {
  min-height: 38px !important; border-radius: var(--btp-radius-sm) !important; color: #b7c9d2 !important;
  font-size: 13px !important; font-weight: 600 !important;
}
.btp-enterprise :is(.crm-module, .acc-module, .erp-module, .btp-nav-module) a:hover,
.btp-enterprise .btp-nav-module button:hover { background: rgb(255 255 255 / 7%) !important; color: #fff !important; }
.btp-enterprise :is(.crm-module, .acc-module, .erp-module, .btp-nav-module) a.active,
.btp-enterprise .btp-nav-module button.active {
  background: #0b78a9 !important; color: #fff !important; box-shadow: inset 3px 0 #56c5ef;
}

/* Operational surfaces */
.btp-enterprise :is(.crm-panel, .acc-panel, .erp-card, .panel, .card, .metric, .login-card) {
  border: 1px solid var(--btp-border) !important; border-radius: var(--btp-radius-lg) !important;
  background: var(--btp-surface) !important; color: var(--btp-text); box-shadow: none !important;
}
.btp-enterprise :is(.crm-panel-head, .pos-products-head, .pos-cart-head) { border-bottom-color: var(--btp-border) !important; }
.btp-enterprise :is(.crm-metrics, .acc-metrics, .erp-metrics, .metrics) { gap: 10px !important; }
.btp-enterprise :is(.crm-metrics, .acc-metrics, .erp-metrics, .metrics) > * {
  min-height: 92px; border: 1px solid var(--btp-border) !important; border-radius: var(--btp-radius) !important;
  background: var(--btp-surface) !important; box-shadow: none !important;
}
.btp-enterprise :is(.crm-metrics, .acc-metrics, .erp-metrics, .metrics) b { font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.btp-enterprise :is(.crm-muted, .muted, small) { color: var(--btp-text-muted); }

/* Forms */
.btp-enterprise :where(label) { color: var(--btp-text); font-size: 12px; font-weight: 700; }
.btp-enterprise :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  min-height: var(--btp-control); border: 1px solid var(--btp-border-strong) !important;
  border-radius: var(--btp-radius) !important; background: var(--btp-surface) !important;
  color: var(--btp-text) !important; box-shadow: none !important;
}
.btp-enterprise :where(input, select, textarea)::placeholder { color: color-mix(in srgb, var(--btp-text-muted) 75%, transparent); }
.btp-enterprise :where(input, select, textarea):hover { border-color: var(--btp-brand-500) !important; }
.btp-enterprise :where(input, select, textarea)[aria-invalid="true"] { border-color: var(--btp-danger) !important; }
.btp-enterprise :is(.crm-btn, .acc-btn, .erp-btn, .btn) {
  min-height: 38px; border-radius: var(--btp-radius) !important; box-shadow: none !important; font-weight: 750 !important;
}
.btp-enterprise :is(.crm-btn, .acc-btn, .erp-btn.primary, .btn):not(.secondary):not(.danger) {
  background: var(--btp-brand-600) !important; color: #fff !important;
}
.btp-enterprise :is(.crm-btn, .acc-btn, .erp-btn.primary, .btn):hover { filter: brightness(.94); }
.btp-enterprise .btp-submit-loading { cursor: progress !important; opacity: .72; }

/* Dense data tables */
.btp-table-region, .btp-enterprise :is(.crm-table, .acc-table, .erp-table, .table) {
  max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; border: 1px solid var(--btp-border);
  border-radius: var(--btp-radius); background: var(--btp-surface);
}
.btp-enterprise table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.btp-enterprise thead th {
  position: sticky; top: 0; z-index: 2; min-height: 38px; padding: 9px 10px !important;
  border-bottom: 1px solid var(--btp-border-strong) !important; background: var(--btp-surface-2) !important;
  color: var(--btp-text-muted) !important; font-size: 11px !important; font-weight: 800 !important;
  letter-spacing: .035em; text-transform: uppercase; white-space: nowrap;
}
.btp-enterprise tbody td { padding: 9px 10px !important; border-bottom: 1px solid var(--btp-border) !important; color: var(--btp-text); }
.btp-enterprise tbody tr:hover td { background: var(--btp-brand-50) !important; }
.btp-enterprise tbody tr:last-child td { border-bottom: 0 !important; }
.btp-enterprise .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Status and feedback */
.btp-enterprise :is(.crm-notice, .acc-notice, .erp-alert, .notice) {
  border-radius: var(--btp-radius) !important; border: 1px solid var(--btp-border) !important;
}
.btp-enterprise :is(.crm-notice, .acc-notice, .erp-alert.success, .notice):not(.error) { background: var(--btp-success-bg) !important; color: var(--btp-success) !important; }
.btp-enterprise :is(.crm-notice.error, .acc-notice.error, .erp-alert.error, .notice.error) { background: var(--btp-danger-bg) !important; color: var(--btp-danger) !important; }
.btp-enterprise :is(.crm-pill, .tag) { border-radius: 999px; font-size: 11px; font-weight: 750; }
.btp-enterprise :is(.crm-empty, .acc-empty, .erp-empty) { color: var(--btp-text-muted); background: var(--btp-surface-2); }

/* Producer license workspace */
.btp-enterprise .producer-main { padding: 24px 28px !important; }
.btp-enterprise .producer-main > .top { margin: -24px -28px 20px; padding: 14px 28px; }
.btp-enterprise .producer-side { width: auto; }
.btp-enterprise .producer-side h1 { color: #5bc5ef !important; }
.btp-enterprise .producer-side a { min-height: 40px; padding: 9px 10px; border-radius: var(--btp-radius); }
.btp-enterprise .producer-side a:hover { background: rgb(255 255 255 / 8%); }
.btp-enterprise .producer-main details { border-top: 1px solid var(--btp-border); }
.btp-enterprise .producer-main details > summary { min-height: 38px; cursor: pointer; font-weight: 700; }
.btp-license-tree { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 8px; margin: 12px 0; }
.btp-license-product { min-height: 96px; padding: 11px; border: 1px solid var(--btp-border); border-left: 3px solid var(--btp-brand-500); border-radius: var(--btp-radius); background: var(--btp-surface-2); }
.btp-license-product[data-state="off"] { border-left-color: var(--btp-text-muted); opacity: .72; }
.btp-license-product[data-state="pending"] { border-left-color: var(--btp-warning); }
.btp-license-product strong { display: block; margin-bottom: 5px; color: var(--btp-text); }
.btp-license-product span { color: var(--btp-text-muted); font-size: 11px; line-height: 1.45; }

@media (max-width: 1024px) {
  .btp-enterprise :is(.crm-main, .acc-main, .erp-main, .producer-main, .main) { padding: 18px !important; }
  .btp-enterprise .producer-main > .top { margin: -18px -18px 18px; padding-inline: 18px; }
}
@media (max-width: 768px) {
  .btp-enterprise { font-size: 14px; }
  .btp-enterprise :is(.crm-top, .acc-top, .erp-top, .topbar) { min-height: 56px; }
  .btp-breadcrumb { margin-bottom: 10px; }
  .btp-enterprise :is(.crm-metrics, .acc-metrics, .erp-metrics, .metrics) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .btp-enterprise :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { min-height: 44px; font-size: 16px; }
  .btp-enterprise :is(.crm-btn, .acc-btn, .erp-btn, .btn) { min-height: 44px; }
  .btp-enterprise thead th, .btp-enterprise tbody td { padding: 10px 9px !important; }
  .btp-license-tree { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .btp-enterprise :is(.crm-main, .acc-main, .erp-main, .producer-main, .main) { padding: 12px !important; }
  .btp-enterprise .producer-main > .top { margin: -12px -12px 14px; padding-inline: 12px; }
  .btp-enterprise :is(.crm-metrics, .acc-metrics, .erp-metrics, .metrics) { grid-template-columns: 1fr !important; }
  .btp-license-tree { grid-template-columns: 1fr; }
  .btp-enterprise .brand img[src*="btpoint-logo-white.png"] { width: 120px !important; max-width: 120px !important; height: 48px !important; max-height: 48px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .btp-enterprise *, .btp-enterprise *::before, .btp-enterprise *::after {
    scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
