/* ============================================================
   VINASAssets — Global styles
   ============================================================ */

:root {
  --vs-sidebar-bg: #0b1220;
  --vs-sidebar-bg2: #111a2e;
  --vs-accent: #1d4ed8;
  --vs-accent-soft: #1e3a8a;
  --vs-text: #e6ecff;
  --vs-muted: #8ea0c9;
  --vs-page: #f5f7fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--vs-page);
  font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ============ Shell ============ */
.vs-shell {
  display: flex;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  overflow-x: hidden;
}

/* ============ Sidebar ============ */
.vs-sidebar {
  width: 260px;
  background: linear-gradient(
    180deg,
    var(--vs-sidebar-bg),
    var(--vs-sidebar-bg2)
  );
  color: var(--vs-text);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 1040;
}

.vs-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 4px 16px;
  border-bottom: 1px solid #1f2b45;
}
.vs-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--vs-accent);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
}
.vs-brand-name {
  font-weight: 700;
  letter-spacing: 0.3px;
}
.vs-brand-sub {
  font-size: 11px;
  color: var(--vs-muted);
}

.vs-scope {
  margin: 14px 0 4px;
  padding: 10px;
  background: #0f1830;
  border: 1px solid #1f2b45;
  border-radius: 10px;
}
.vs-scope-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--vs-muted);
}
.vs-scope-value {
  font-size: 13px;
  font-weight: 600;
}

.vs-nav {
  flex: 1;
  overflow-y: auto;
  margin-top: 8px;
  padding-right: 4px;
}

.vs-nav-item {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--vs-text);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
  transition: background 0.15s ease;
}
.vs-nav-item:hover {
  background: #152040;
  color: #fff;
}
.vs-nav-item.active {
  background: var(--vs-accent);
  color: #fff;
  font-weight: 600;
}

/* Legacy flat section header (still used in admin/tenant blocks) */
.vs-nav-section {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--vs-muted);
  padding: 14px 8px 6px;
  text-transform: uppercase;
}

/* ============ Super admin business switcher ============ */
.vs-switcher {
  margin: 12px 0 4px;
  padding: 10px 10px 12px;
  background: #0f1830;
  border: 1px solid #1f2b45;
  border-radius: 10px;
}
.vs-switcher-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--vs-muted);
  margin-bottom: 6px;
}
.vs-switcher-select {
  width: 100%;
  background: #0b1220;
  color: var(--vs-text);
  border: 1px solid #1f2b45;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
}
.vs-switcher-select:hover {
  border-color: #3558a8;
}
.vs-switcher-select:focus {
  outline: none;
  border-color: var(--vs-accent);
}
.vs-switcher-hint {
  font-size: 10.5px;
  color: var(--vs-muted);
  margin-top: 6px;
  text-align: right;
}

/* ============ Impersonation banner ============ */
.vs-impersonate-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 4px;
  padding: 10px 12px;
  background: #3b1d0b;
  border: 1px solid #92400e;
  border-radius: 10px;
  color: #fde68a;
  text-decoration: none;
  font-size: 12px;
}
.vs-impersonate-banner:hover {
  background: #4a250e;
  color: #fef3c7;
}
.vs-imp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25);
  flex-shrink: 0;
}
.vs-imp-sub {
  display: block;
  font-size: 11px;
  opacity: 0.75;
  font-weight: 400;
  margin-top: 2px;
}

/* Empty state inside a nav group */
.vs-nav-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--vs-muted);
}

/* ============ Accordion groups ============ */
.vs-group {
  margin-bottom: 2px;
}

.vs-group-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--vs-muted);
  padding: 9px 10px 6px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 8px;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}
.vs-group-btn:hover {
  color: #fff;
  background: #152040;
}
.vs-group-btn .chev {
  transition: transform 0.2s ease;
  font-size: 11px;
  opacity: 0.8;
}
.vs-group.open .vs-group-btn .chev {
  transform: rotate(90deg);
}

.vs-group-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s ease;
}
.vs-group.open .vs-group-body {
  max-height: 1000px; /* generous — groups have max 5 links */
  overflow-y: auto;
}

/* ============ User box ============ */
.vs-userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #1f2b45;
  padding-top: 12px;
  margin-top: 8px;
}
.vs-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1f2b45;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}
.vs-user-name {
  font-size: 13px;
  font-weight: 600;
}
.vs-user-role {
  font-size: 11px;
  color: var(--vs-muted);
}
.vs-logout {
  margin-left: auto;
  font-size: 12px;
  color: #ffd7d7;
  text-decoration: none;
  border: 1px solid #7a2a2a;
  padding: 4px 8px;
  border-radius: 8px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.vs-logout:hover {
  background: #7a2a2a;
  color: #fff;
}

/* ============ Main column ============ */
.vs-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

.vs-topbar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: #fff;
  border-bottom: 1px solid #e5e9f2;
}
.vs-topbar-title {
  font-weight: 700;
  font-size: 18px;
}
.vs-topbar-meta {
  color: #6b7a9b;
  font-size: 13px;
}

.vs-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px;
  min-height: 0;
  background: var(--vs-page);
}

/* ============ Footer ============ */
.vs-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 22px;
  color: #01091a;
  font-size: 12px;
  border-top: 1px solid #e5e9f2;
  background: #eef2fa;
  position: sticky;
  bottom: 0;
  z-index: 5;
}
.vs-footer a {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 600;
}
.vs-footer a:hover {
  text-decoration: underline;
}

/* ============ KPI cards ============ */
.kpi {
  background: #fff;
  border-radius: 14px;
  padding: 16px 18px;
  border-left: 4px solid var(--vs-accent);
  box-shadow: 0 1px 3px rgba(15, 30, 70, 0.06);
}
.kpi-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #7b8aa8;
  text-transform: uppercase;
}
.kpi-value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
}
.kpi-sub {
  font-size: 12px;
  color: #8595b6;
}

.card-flat {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 30, 70, 0.06);
  border: none;
}

/* ============ Mobile hamburger ============ */
.vs-hamburger {
  display: none;
  background: #0b1220;
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
  margin-right: 12px;
}
.vs-hamburger:hover {
  background: #1d4ed8;
}

/* ============ Backdrop ============ */
.vs-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.55);
  z-index: 1035;
}
.vs-backdrop.show {
  display: block;
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .vs-shell {
    display: block;
    height: auto;
    overflow: auto;
  }

  .vs-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 270px;
    height: 100vh;
  }
  .vs-sidebar.open {
    transform: none;
  }

  .vs-main {
    height: auto;
  }

  /* Leave room for the fixed footer so the last card isn't hidden */
  .vs-content {
    overflow: visible;
    padding-bottom: 80px;
  }

  /* ---- Fixed bottom footer on phones ---- */
  .vs-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    padding: 10px 16px;
    background: #eef2fa;
    border-top: 1px solid #e5e9f2;
    box-shadow: 0 -6px 18px rgba(15, 30, 70, 0.08);
    font-size: 11.5px;
  }

  /* Hide the middle tagline on phones — too long */
  .vs-footer .footer-mid {
    display: none;
  }

  .vs-hamburger {
    display: inline-grid;
    place-items: center;
  }
}

/* ============ Responsive tables ============ */
.card-flat .table-responsive,
.card-flat table {
  width: 100%;
}
.card-flat .table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.card-flat .table-responsive > table {
  margin-bottom: 0;
  min-width: 560px;  /* force horizontal scroll instead of squashing columns */
}
.card-flat table th,
.card-flat table td {
  white-space: nowrap;
}
.card-flat table td.wrap-cell {
  white-space: normal;
  min-width: 180px;
}

@media (max-width: 640px){
  .card-flat .table-responsive > table { min-width: 520px; }
}