/*
 * ARBE AssetHub v3.2.0 — Enterprise Workspace UI
 * Gaya: aplikasi operasional kantor/pabrik dengan sidebar tree, workspace tabs,
 * filter panel, dan data grid. Mendukung dark dan light mode.
 */

:root {
  --ent-topbar-h: 66px;
  --ent-sidebar-w: 252px;
  --ent-sidebar-collapsed-w: 64px;
  --ent-blue-900: #16345f;
  --ent-blue-800: #1f4b82;
  --ent-blue-700: #2c64a6;
  --ent-blue-600: #3d7fc2;
  --ent-red: #e62435;
  --ent-red-strong: #c91427;
  --ent-success: #218c62;
  --ent-warning: #d89419;
  --ent-danger: #d13e4f;
  --ent-info: #2879bd;

  --ent-bg: #edf3fa;
  --ent-workspace-bg: #dce8f5;
  --ent-surface: #ffffff;
  --ent-surface-2: #f4f8fc;
  --ent-surface-3: #eaf1f8;
  --ent-sidebar-bg: #f5f8fc;
  --ent-topbar-bg: linear-gradient(180deg, #244f84 0%, #1b3e6a 100%);
  --ent-tab-bg: #d9e8f7;
  --ent-tab-active: #ffffff;
  --ent-border: #a9bdd3;
  --ent-border-soft: #cedae7;
  --ent-border-strong: #7f9dbf;
  --ent-text: #1a2a3b;
  --ent-muted: #5f7185;
  --ent-link: #145b9b;
  --ent-table-head: #dce9f6;
  --ent-table-alt: #f6f9fc;
  --ent-table-hover: #e8f2fc;
  --ent-input-bg: #ffffff;
  --ent-shadow: 0 8px 24px rgba(31, 69, 113, .10);
  --ent-shadow-soft: 0 2px 8px rgba(31, 69, 113, .09);

  /* Sinkronkan variabel tema lama agar seluruh template ikut light mode. */
  --app-bg: var(--ent-bg);
  --app-text: var(--ent-text);
  --app-surface: var(--ent-surface);
  --app-surface-solid: var(--ent-surface);
  --app-surface-2: var(--ent-surface-2);
  --app-border: var(--ent-border);
  --app-border-strong: var(--ent-border-strong);
  --app-text-soft: var(--ent-muted);
  --app-shadow: var(--ent-shadow);
  --app-shadow-soft: var(--ent-shadow-soft);
  --brand-1: var(--ent-red);
  --brand-2: var(--ent-blue-600);
  --brand-3: var(--ent-blue-800);
  --accent: var(--ent-warning);
}

[data-bs-theme="dark"] {
  --ent-bg: #07111e;
  --ent-workspace-bg: #091522;
  --ent-surface: #101d2d;
  --ent-surface-2: #142337;
  --ent-surface-3: #172a41;
  --ent-sidebar-bg: #0d1928;
  --ent-topbar-bg: linear-gradient(180deg, #173d6d 0%, #102c50 100%);
  --ent-tab-bg: #12263d;
  --ent-tab-active: #172d47;
  --ent-border: #29445f;
  --ent-border-soft: #203750;
  --ent-border-strong: #3e6285;
  --ent-text: #e9f1fa;
  --ent-muted: #9cb0c4;
  --ent-link: #79b8ef;
  --ent-table-head: #172c45;
  --ent-table-alt: #0d1928;
  --ent-table-hover: #18334f;
  --ent-input-bg: #0d1a2a;
  --ent-shadow: 0 12px 32px rgba(0, 0, 0, .32);
  --ent-shadow-soft: 0 3px 12px rgba(0, 0, 0, .24);

  --app-bg: var(--ent-bg);
  --app-text: var(--ent-text);
  --app-surface: var(--ent-surface);
  --app-surface-solid: var(--ent-surface);
  --app-surface-2: var(--ent-surface-2);
  --app-border: var(--ent-border);
  --app-border-strong: var(--ent-border-strong);
  --app-text-soft: var(--ent-muted);
  --app-shadow: var(--ent-shadow);
  --app-shadow-soft: var(--ent-shadow-soft);
  --brand-1: var(--ent-red);
  --brand-2: var(--ent-blue-600);
  --brand-3: var(--ent-blue-800);
  --accent: var(--ent-warning);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ent-text) !important;
  background: var(--ent-bg) !important;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}
a { color: var(--ent-link); }
a:hover { color: color-mix(in srgb, var(--ent-link) 78%, white); }

/* ===== App shell ===== */
.enterprise-app { min-height: 100vh; background: var(--ent-bg); }
.enterprise-topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1040;
  height: var(--ent-topbar-h);
  display: grid;
  grid-template-columns: minmax(330px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  color: #fff;
  background: var(--ent-topbar-bg);
  border-bottom: 1px solid rgba(255,255,255,.20);
  box-shadow: 0 3px 12px rgba(0,0,0,.22);
}
.enterprise-brand-area { display: flex; align-items: center; gap: 8px; min-width: 0; }
.enterprise-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.enterprise-brand:hover { color: inherit; }
.enterprise-brand-logo {
  width: 94px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 3px 7px;
  overflow: hidden;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.20);
}
.enterprise-brand-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.enterprise-brand-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.enterprise-brand-copy strong { font-size: 1rem; font-weight: 800; white-space: nowrap; }
.enterprise-brand-copy small { margin-top: 4px; color: rgba(255,255,255,.80); font-size: .75rem; font-weight: 600; white-space: nowrap; }
.enterprise-topbar-title {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255,255,255,.90);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.enterprise-account-area { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.enterprise-icon-button,
.workspace-action,
.workspace-menu-button {
  appearance: none;
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.08);
  color: #fff;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  width: 34px;
  height: 34px;
  padding: 0;
  cursor: pointer;
}
.enterprise-icon-button:hover,
.workspace-action:hover,
.workspace-menu-button:hover { background: rgba(255,255,255,.16); }
.enterprise-role {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 4px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: .76rem;
  font-weight: 800;
  white-space: nowrap;
}
.enterprise-role.role-super_admin { color: #ffe19a; border-color: rgba(255,211,102,.58); }
.enterprise-role.role-admin_hrd { color: #b9dcff; border-color: rgba(121,184,239,.55); }
.enterprise-role.role-admin_it { color: #a5efd3; border-color: rgba(78,201,151,.52); }
.enterprise-user {
  max-width: 240px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  color: rgba(255,255,255,.94);
}
.enterprise-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enterprise-logout {
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 5px;
  background: rgba(0,0,0,.12);
  color: #fff;
  min-height: 32px;
  padding: 5px 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}
.enterprise-logout:hover { background: rgba(230,36,53,.78); border-color: rgba(255,255,255,.32); }
.sidebar-mobile-toggle { display: none; }

.enterprise-body { min-height: 100vh; padding-top: var(--ent-topbar-h); display: flex; }
.enterprise-sidebar {
  position: fixed;
  top: var(--ent-topbar-h);
  bottom: 0;
  left: 0;
  z-index: 1030;
  width: var(--ent-sidebar-w);
  display: flex;
  flex-direction: column;
  color: var(--ent-text);
  background: var(--ent-sidebar-bg);
  border-right: 1px solid var(--ent-border);
  box-shadow: 2px 0 9px rgba(0,0,0,.07);
  transition: width .18s ease, transform .18s ease;
}
.enterprise-workspace {
  width: calc(100% - var(--ent-sidebar-w));
  min-width: 0;
  margin-left: var(--ent-sidebar-w);
  min-height: calc(100vh - var(--ent-topbar-h));
  display: flex;
  flex-direction: column;
  background: var(--ent-workspace-bg);
  transition: width .18s ease, margin-left .18s ease;
}
body.sidebar-collapsed .enterprise-sidebar { width: var(--ent-sidebar-collapsed-w); }
body.sidebar-collapsed .enterprise-workspace { width: calc(100% - var(--ent-sidebar-collapsed-w)); margin-left: var(--ent-sidebar-collapsed-w); }
body.sidebar-collapsed .enterprise-sidebar .sidebar-utility span,
body.sidebar-collapsed .enterprise-sidebar .tree-link span,
body.sidebar-collapsed .enterprise-sidebar .tree-group summary > span:not(.tree-chevron),
body.sidebar-collapsed .enterprise-sidebar .tree-group summary > span > *:not(i),
body.sidebar-collapsed .enterprise-sidebar .tree-group summary > span { font-size: 0; }
body.sidebar-collapsed .enterprise-sidebar .tree-group summary > span i { font-size: 1rem; }
body.sidebar-collapsed .enterprise-sidebar .tree-chevron,
body.sidebar-collapsed .enterprise-sidebar .sidebar-footer { display: none; }
body.sidebar-collapsed .enterprise-sidebar .tree-link,
body.sidebar-collapsed .enterprise-sidebar .tree-group summary { justify-content: center; padding-inline: 8px; }
body.sidebar-collapsed .enterprise-sidebar .tree-children { padding-left: 0; }
body.sidebar-collapsed .enterprise-sidebar details:not([open]) .tree-children { display: none; }

/* ===== Sidebar tree ===== */
.sidebar-utility {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--ent-border-soft);
  background: var(--ent-surface-3);
}
.sidebar-utility button {
  border: 0;
  background: transparent;
  color: var(--ent-muted);
  min-width: 0;
  height: 28px;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  white-space: nowrap;
  cursor: pointer;
}
.sidebar-utility button:hover { color: var(--ent-link); background: color-mix(in srgb, var(--ent-link) 8%, transparent); }
.sidebar-desktop-collapse { margin-left: auto; }
.enterprise-tree { flex: 1 1 auto; overflow-y: auto; padding: 8px 6px 14px; scrollbar-width: thin; }
.tree-group { margin: 3px 0; }
.tree-group summary {
  list-style: none;
  min-height: 34px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 4px;
  color: var(--ent-text);
  cursor: pointer;
  font-weight: 800;
  user-select: none;
}
.tree-group summary::-webkit-details-marker { display: none; }
.tree-group summary > span { min-width: 0; display: inline-flex; align-items: center; gap: 8px; }
.tree-group summary:hover { background: var(--ent-surface-3); color: var(--ent-link); }
.tree-chevron { font-size: .72rem; transition: transform .15s ease; }
.tree-group[open] .tree-chevron { transform: rotate(180deg); }
.tree-children { padding: 2px 0 4px 18px; }
.tree-link {
  min-height: 31px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 1px 0;
  padding: 5px 8px;
  color: var(--ent-text);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: .84rem;
  font-weight: 600;
}
.tree-link i { width: 17px; flex: 0 0 17px; text-align: center; color: var(--ent-blue-600); }
[data-bs-theme="dark"] .tree-link i { color: #78afe3; }
.tree-link:hover { color: var(--ent-link); background: var(--ent-surface-3); border-color: var(--ent-border-soft); }
.tree-link.active {
  color: #fff;
  background: linear-gradient(180deg, var(--ent-blue-700), var(--ent-blue-800));
  border-color: var(--ent-blue-900);
  box-shadow: inset 3px 0 0 var(--ent-red);
}
.tree-link.active i { color: #fff; }
.tree-link-root { margin-bottom: 6px; font-weight: 800; }
.sidebar-footer {
  flex: 0 0 auto;
  padding: 10px;
  border-top: 1px solid var(--ent-border-soft);
  background: var(--ent-surface-2);
  color: var(--ent-muted);
  font-size: .72rem;
}
.sidebar-footer > div { display: flex; align-items: center; gap: 6px; font-weight: 800; color: var(--ent-text); }
.sidebar-footer a { display: block; margin: 3px 0; overflow-wrap: anywhere; }
.sidebar-footer small { display: block; }
.sidebar-backdrop { display: none; }

/* ===== Workspace header/tabs ===== */
.workspace-toolbar {
  position: sticky;
  top: var(--ent-topbar-h);
  z-index: 1020;
  height: 42px;
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 4px 6px 0;
  background: var(--ent-surface-3);
  border-bottom: 1px solid var(--ent-border);
  box-shadow: 0 2px 5px rgba(0,0,0,.07);
}
.workspace-menu-button {
  display: none;
  align-self: center;
  width: 31px;
  height: 31px;
  color: var(--ent-text);
  border-color: var(--ent-border);
  background: var(--ent-surface);
}
.workspace-tabs { min-width: 0; flex: 1 1 auto; display: flex; align-items: end; gap: 3px; overflow-x: auto; }
.workspace-tab {
  height: 37px;
  min-width: 0;
  max-width: 280px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  color: var(--ent-text);
  text-decoration: none;
  background: var(--ent-tab-bg);
  border: 1px solid var(--ent-border);
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}
.workspace-tab span { overflow: hidden; text-overflow: ellipsis; }
.workspace-tab:hover { color: var(--ent-link); background: var(--ent-surface); }
.workspace-current-tab { background: var(--ent-tab-active); box-shadow: inset 0 3px 0 var(--ent-blue-700); }
.workspace-home-tab { flex: 0 0 auto; }
.workspace-actions { display: flex; gap: 4px; align-items: center; padding-bottom: 4px; }
.workspace-action { color: var(--ent-text); border-color: var(--ent-border); background: var(--ent-surface); width: 31px; height: 31px; }
.enterprise-content {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 12px;
  background: var(--ent-workspace-bg);
}
.enterprise-footer {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  color: var(--ent-muted);
  background: var(--ent-surface-3);
  border-top: 1px solid var(--ent-border);
  font-size: .72rem;
}

/* ===== Page panels, headers, filter panels ===== */
.enterprise-content .page-header,
.enterprise-content .page-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 78px;
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 1px solid var(--ent-border) !important;
  border-left: 4px solid var(--ent-red) !important;
  border-radius: 4px !important;
  background: var(--ent-surface) !important;
  box-shadow: var(--ent-shadow-soft) !important;
  overflow: visible;
}
.enterprise-content .page-header::before,
.enterprise-content .page-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--ent-blue-700), var(--ent-blue-600), transparent 75%);
}
.enterprise-content .page-header h1,
.enterprise-content .page-hero h1 {
  margin: 0;
  color: var(--ent-text) !important;
  font-size: clamp(1.25rem, 2vw, 1.7rem) !important;
  font-weight: 800;
}
.enterprise-content .page-header p,
.enterprise-content .page-hero p { margin: 4px 0 0; color: var(--ent-muted) !important; }
.enterprise-content .page-eyebrow {
  margin-bottom: 4px;
  color: var(--ent-red) !important;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }

.enterprise-content .filter-card,
.enterprise-content .form-section,
.enterprise-content .panel-card,
.enterprise-content .module-section,
.enterprise-content .card,
.enterprise-content .table-card,
.enterprise-content .detail-hero,
.enterprise-content .input-section {
  border: 1px solid var(--ent-border) !important;
  border-radius: 4px !important;
  background: var(--ent-surface) !important;
  box-shadow: var(--ent-shadow-soft) !important;
}
.enterprise-content .filter-card {
  margin: 0 0 10px;
  padding: 32px 10px 10px !important;
  position: relative;
}
.enterprise-content .filter-card::before {
  content: "Filter Data";
  position: absolute;
  inset: 0 0 auto 0;
  height: 25px;
  display: flex;
  align-items: center;
  padding: 0 9px;
  color: var(--ent-text);
  background: var(--ent-table-head);
  border-bottom: 1px solid var(--ent-border);
  font-size: .76rem;
  font-weight: 900;
}
.filter-grid {
  display: grid !important;
  grid-template-columns: minmax(240px, 2fr) repeat(4, minmax(145px, 1fr)) auto !important;
  align-items: end;
  gap: 8px !important;
}
.filter-grid label,
.form-label { margin-bottom: 3px; color: var(--ent-text) !important; font-size: .76rem; font-weight: 800; }

.enterprise-content .module-section { padding: 0 !important; overflow: hidden; }
.enterprise-content .section-heading,
.enterprise-content .panel-header,
.enterprise-content .card-header {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px !important;
  color: var(--ent-text);
  background: var(--ent-table-head) !important;
  border-bottom: 1px solid var(--ent-border) !important;
}
.enterprise-content .section-heading h2,
.enterprise-content .panel-header h3 { margin: 0; font-size: 1rem; font-weight: 800; }
.enterprise-content .section-heading p { margin: 2px 0 0; color: var(--ent-muted); font-size: .73rem; }
.enterprise-content .section-heading > div,
.enterprise-content .panel-header > div { display: flex; align-items: center; gap: 8px; }
.enterprise-content .section-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 3px;
  background: var(--ent-blue-700) !important;
  color: #fff !important;
}
.vehicle-module { border-top: 3px solid var(--ent-red) !important; }
.it-module { border-top: 3px solid var(--ent-blue-600) !important; }

/* ===== Compact metrics ===== */
.metric-grid {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(130px, 1fr)) !important;
  gap: 7px !important;
  padding: 9px !important;
}
.metric-card,
.metric-link-card,
.mini-card {
  min-height: 62px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px !important;
  color: var(--ent-text) !important;
  text-decoration: none !important;
  border: 1px solid var(--ent-border-soft) !important;
  border-radius: 3px !important;
  background: var(--ent-surface-2) !important;
  box-shadow: none !important;
  transform: none !important;
}
.metric-card:hover,
.metric-link-card:hover,
.mini-card:hover { border-color: var(--ent-blue-600) !important; background: var(--ent-table-hover) !important; }
.metric-card strong,
.metric-value,
.mini-card strong { display: block; color: var(--ent-text) !important; font-size: 1.45rem !important; line-height: 1; font-weight: 900; }
.metric-card small,
.metric-label,
.mini-card span { display: block; color: var(--ent-muted) !important; font-size: .72rem !important; font-weight: 700; }
.metric-icon,
.icon-bubble {
  width: 34px !important;
  height: 34px !important;
  flex: 0 0 34px;
  display: inline-grid !important;
  place-items: center !important;
  border-radius: 4px !important;
  color: #fff !important;
  background: var(--ent-blue-700) !important;
  box-shadow: none !important;
}
.metric-icon.warning { background: var(--ent-warning) !important; }
.metric-icon.danger { background: var(--ent-danger) !important; }
.metric-icon.success { background: var(--ent-success) !important; }
.metric-icon.info, .metric-icon.primary { background: var(--ent-info) !important; }
.metric-icon.accent { background: var(--ent-red) !important; }
.mini-metrics { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 7px; }

.dashboard-grid { display: grid !important; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr) !important; gap: 9px !important; padding: 0 9px 9px !important; }
.request-stack { display: flex; flex-direction: column; }
.request-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  color: var(--ent-text);
  text-decoration: none;
  border-bottom: 1px solid var(--ent-border-soft);
}
.request-row:hover { background: var(--ent-table-hover); }
.request-row small { display: block; color: var(--ent-muted); }
.request-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 3px; color: #fff; background: var(--ent-blue-700); }
.request-icon.vehicle { background: var(--ent-red); }
.count-chip { min-width: 24px; min-height: 22px; display: inline-grid; place-items: center; border-radius: 3px; background: var(--ent-red); color: #fff; font-weight: 900; }

/* ===== Forms ===== */
.form-control,
.form-select,
.input-group-text,
.form-check-input {
  color: var(--ent-text) !important;
  background: var(--ent-input-bg) !important;
  border-color: var(--ent-border) !important;
  border-radius: 3px !important;
  min-height: 34px !important;
  font-size: .82rem;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--ent-blue-600) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ent-blue-600) 20%, transparent) !important;
}
.form-control::placeholder { color: color-mix(in srgb, var(--ent-muted) 82%, transparent); }
.form-select option { color: var(--ent-text); background: var(--ent-input-bg); }
.form-text { color: var(--ent-muted) !important; font-size: .71rem; }
.form-section { margin-bottom: 10px; padding: 34px 10px 10px !important; position: relative; }
.form-section::before {
  content: "Data Formulir";
  position: absolute;
  inset: 0 0 auto 0;
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 9px;
  background: var(--ent-table-head);
  border-bottom: 1px solid var(--ent-border);
  color: var(--ent-text);
  font-size: .76rem;
  font-weight: 900;
}
.form-grid { gap: 9px !important; }
.form-actions { display: flex; justify-content: flex-end; gap: 7px; padding: 8px 0; }
.input-group > .form-control,
.input-group > .form-select { border-radius: 0 3px 3px 0 !important; }
.input-group-text { border-radius: 3px 0 0 3px !important; }

/* ===== Buttons ===== */
.btn {
  min-height: 32px;
  border-radius: 4px !important;
  font-size: .79rem;
  font-weight: 800;
  box-shadow: none !important;
}
.btn-primary {
  color: #fff !important;
  background: linear-gradient(180deg, var(--ent-red), var(--ent-red-strong)) !important;
  border-color: var(--ent-red-strong) !important;
}
.btn-primary:hover { filter: brightness(1.05); transform: none !important; }
.btn-outline-info { color: var(--ent-link) !important; border-color: var(--ent-blue-600) !important; background: transparent !important; }
.btn-outline-info:hover { color: #fff !important; background: var(--ent-blue-700) !important; }
.btn-ghost,
.btn-outline-secondary,
.btn-outline-light { color: var(--ent-text) !important; border-color: var(--ent-border) !important; background: var(--ent-surface-2) !important; }
.btn-ghost:hover,
.btn-outline-secondary:hover,
.btn-outline-light:hover { background: var(--ent-table-hover) !important; }

/* ===== Data grids ===== */
.table-responsive { width: 100%; overflow: auto; }
.enterprise-content .panel-card { overflow: hidden; }
.table,
.app-table { margin: 0; color: var(--ent-text) !important; --bs-table-bg: transparent; --bs-table-color: var(--ent-text); }
.table thead th,
.app-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 8px !important;
  color: var(--ent-text) !important;
  background: var(--ent-table-head) !important;
  border: 1px solid var(--ent-border) !important;
  font-size: .69rem !important;
  font-weight: 900 !important;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.table tbody td,
.app-table tbody td {
  padding: 7px 8px !important;
  color: var(--ent-text) !important;
  background: var(--ent-surface) !important;
  border: 1px solid var(--ent-border-soft) !important;
  font-size: .78rem;
  vertical-align: middle;
}
.table tbody tr:nth-child(even) td,
.app-table tbody tr:nth-child(even) td { background: var(--ent-table-alt) !important; }
.table tbody tr:hover td,
.app-table tbody tr:hover td { background: var(--ent-table-hover) !important; }
.table a, .app-table a { font-weight: 700; }
.table small, .app-table small { display: block; color: var(--ent-muted); font-size: .69rem; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.table-actions a,
.table-actions button,
.table-link {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid var(--ent-border);
  border-radius: 3px;
  background: var(--ent-surface-2);
  color: var(--ent-link);
  text-decoration: none;
  font-size: .72rem;
}
.table-actions a:hover,
.table-actions button:hover,
.table-link:hover { color: #fff; background: var(--ent-blue-700); }
.enterprise-grid-toolbar,
.enterprise-grid-footer {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  color: var(--ent-muted);
  background: var(--ent-surface-3);
  border-bottom: 1px solid var(--ent-border);
  font-size: .72rem;
}
.enterprise-grid-footer { border-top: 1px solid var(--ent-border); border-bottom: 0; }
.enterprise-grid-page-size { display: inline-flex; align-items: center; gap: 5px; }
.enterprise-grid-page-size select { min-height: 26px !important; height: 26px; padding: 2px 24px 2px 6px; font-size: .72rem; }
.enterprise-grid-pager { display: inline-flex; align-items: center; gap: 4px; }
.enterprise-grid-pager button {
  min-width: 28px;
  height: 26px;
  border: 1px solid var(--ent-border);
  border-radius: 3px;
  color: var(--ent-text);
  background: var(--ent-surface);
}
.enterprise-grid-pager button:disabled { opacity: .42; cursor: not-allowed; }
.enterprise-grid-pager input { width: 44px; height: 26px; border: 1px solid var(--ent-border); border-radius: 3px; text-align: center; color: var(--ent-text); background: var(--ent-input-bg); }
.enterprise-grid-scroll { max-height: 58vh; overflow: auto; }

/* ===== Status and detail helpers ===== */
.status-badge,
.requirement-chip,
.role-pill,
.badge {
  border-radius: 3px !important;
  font-size: .68rem;
  font-weight: 800;
}
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border: 1px solid transparent; white-space: nowrap; }
.status-badge.success { color: #fff; background: var(--ent-success); }
.status-badge.info,
.status-badge.primary { color: #fff; background: var(--ent-info); }
.status-badge.warning { color: #1f1704; background: #e9b949; }
.status-badge.danger { color: #fff; background: var(--ent-danger); }
.status-badge.secondary { color: var(--ent-text); background: var(--ent-surface-3); border-color: var(--ent-border); }
.requirement-chip.required { color: #fff; background: var(--ent-warning); border-color: color-mix(in srgb, var(--ent-warning) 75%, black); }
.empty-state { padding: 28px 12px !important; color: var(--ent-muted) !important; text-align: center; }
.empty-state.compact { padding: 20px 10px !important; }
.empty-state i { color: var(--ent-blue-600) !important; }
.info-grid,
.description-grid { gap: 7px !important; }
.info-item,
.description-grid > div { border: 1px solid var(--ent-border-soft) !important; border-radius: 3px !important; background: var(--ent-surface-2) !important; }

/* Legacy card lists become compact enterprise cards if still used. */
.asset-card-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)) !important; gap: 8px !important; }
.asset-card { border: 1px solid var(--ent-border) !important; border-radius: 4px !important; background: var(--ent-surface) !important; box-shadow: var(--ent-shadow-soft) !important; }
.asset-card-top,
.asset-card-footer { border-color: var(--ent-border-soft) !important; }
.asset-symbol { border-radius: 4px !important; box-shadow: none !important; }

/* ===== Guest/login pages ===== */
.enterprise-guest {
  min-height: 100vh;
  background:
    linear-gradient(rgba(7,17,30,.90), rgba(7,17,30,.93)),
    radial-gradient(circle at 15% 10%, rgba(44,100,166,.45), transparent 32rem),
    radial-gradient(circle at 85% 0%, rgba(230,36,53,.23), transparent 28rem) !important;
}
[data-bs-theme="light"] .enterprise-guest {
  background:
    linear-gradient(rgba(237,243,250,.90), rgba(237,243,250,.94)),
    radial-gradient(circle at 15% 10%, rgba(44,100,166,.24), transparent 32rem),
    radial-gradient(circle at 85% 0%, rgba(230,36,53,.15), transparent 28rem) !important;
}
.guest-topbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  color: #fff;
  background: var(--ent-topbar-bg);
  border-bottom: 1px solid rgba(255,255,255,.20);
}
.guest-actions { display: flex; align-items: center; gap: 7px; }
.guest-content { width: min(1180px, calc(100% - 24px)); margin: 0 auto; padding: 24px 0; }
.guest-content .auth-card,
.guest-content .register-shell { margin-inline: auto; }
.guest-content .card { border-radius: 5px !important; background: var(--ent-surface) !important; border-color: var(--ent-border) !important; box-shadow: var(--ent-shadow) !important; }

/* ===== Alerts ===== */
.alert { border-radius: 4px !important; border-width: 1px; box-shadow: var(--ent-shadow-soft); }

/* ===== Responsive ===== */
@media (max-width: 1399.98px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)) !important; }
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .filter-grow { grid-column: span 2; }
}

@media (max-width: 1199.98px) {
  .enterprise-topbar { grid-template-columns: minmax(280px, auto) 1fr auto; }
  .enterprise-topbar-title { display: none; }
  .enterprise-user { max-width: 180px; }
  .dashboard-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 991.98px) {
  .enterprise-topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .sidebar-mobile-toggle { display: inline-grid; }
  .enterprise-account-area .enterprise-user,
  .enterprise-account-area .enterprise-role { display: none; }
  .enterprise-sidebar {
    width: min(86vw, 290px);
    transform: translateX(-102%);
    box-shadow: 8px 0 26px rgba(0,0,0,.28);
  }
  .enterprise-workspace,
  body.sidebar-collapsed .enterprise-workspace { width: 100%; margin-left: 0; }
  body.sidebar-open .enterprise-sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    inset: var(--ent-topbar-h) 0 0 0;
    z-index: 1025;
    display: block;
    border: 0;
    background: rgba(0,0,0,.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }
  body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .workspace-menu-button { display: inline-grid; }
  .sidebar-desktop-collapse { display: none; }
  body.sidebar-collapsed .enterprise-sidebar { width: min(86vw, 290px); }
  body.sidebar-collapsed .enterprise-sidebar .sidebar-utility span,
  body.sidebar-collapsed .enterprise-sidebar .tree-link span,
  body.sidebar-collapsed .enterprise-sidebar .tree-group summary > span { font-size: inherit; }
  body.sidebar-collapsed .enterprise-sidebar .tree-group summary > span i { font-size: inherit; }
  body.sidebar-collapsed .enterprise-sidebar .tree-chevron,
  body.sidebar-collapsed .enterprise-sidebar .sidebar-footer { display: initial; }
  body.sidebar-collapsed .enterprise-sidebar .tree-link,
  body.sidebar-collapsed .enterprise-sidebar .tree-group summary { justify-content: initial; padding-inline: 8px; }
  body.sidebar-collapsed .enterprise-sidebar .tree-children { padding-left: 18px; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .filter-grow { grid-column: 1 / -1; }
}

@media (max-width: 767.98px) {
  :root { --ent-topbar-h: 60px; }
  .enterprise-topbar { padding: 0 8px; }
  .enterprise-brand-logo { width: 76px; height: 39px; }
  .enterprise-brand-copy strong { font-size: .86rem; }
  .enterprise-brand-copy small { font-size: .66rem; }
  .enterprise-account-area .enterprise-logout span { display: none; }
  .enterprise-content { padding: 8px; }
  .enterprise-content .page-header,
  .enterprise-content .page-hero { align-items: flex-start; flex-direction: column; padding: 11px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .filter-grid { grid-template-columns: 1fr !important; }
  .filter-grow { grid-column: auto; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .mini-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-card-grid { grid-template-columns: 1fr !important; }
  .workspace-home-tab span { display: none; }
  .workspace-tab { max-width: 220px; padding-inline: 8px; }
  .enterprise-footer { align-items: flex-start; flex-direction: column; }
  .guest-topbar .enterprise-brand-copy small { display: none; }
}

@media (max-width: 479.98px) {
  .metric-grid { grid-template-columns: 1fr !important; }
  .enterprise-brand-copy { display: none; }
  .enterprise-account-area { gap: 4px; }
  .workspace-actions [data-theme-toggle] { display: none; }
}
