/* ==========================================================================
   PGBox Cloud — Supabase & Google Cloud Console Design System
   Emerald, Cyan & Cyber Slate Architecture
   ========================================================================== */

:root {
  --sidebar-w: 250px;
  --sidebar-collapsed-w: 60px;
  --header-h: 56px;
  
  /* Deep Space Matrix Backgrounds */
  --bg-dark: #070a11;
  --bg-surface: #0b0f19;
  --bg-surface-elevated: #0f172a;
  --bg-card: #0d1322;
  --bg-radial: radial-gradient(circle at 50% 0%, #111a2e 0%, #070a11 60%);
  --bg-mesh: radial-gradient(at 100% 0%, rgba(52, 211, 153, 0.05) 0px, transparent 50%),
             radial-gradient(at 0% 100%, rgba(45, 212, 191, 0.04) 0px, transparent 50%);

  /* Glassmorphic Surfaces */
  --glass-header: rgba(7, 10, 17, 0.92);
  --glass-sidebar: rgba(9, 13, 23, 0.94);
  --glass-panel: rgba(13, 19, 34, 0.85);
  --glass-card: rgba(15, 23, 42, 0.75);
  --glass-card-hover: rgba(22, 33, 54, 0.85);
  --glass-input: #060910;
  
  /* Glass Borders & Highlights */
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(52, 211, 153, 0.2);
  --glass-border-glow: rgba(52, 211, 153, 0.45);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --glass-highlight-glow: inset 0 1px 0 rgba(52, 211, 153, 0.25);
  
  /* Luminescent Emerald & Teal Palette */
  --accent-emerald: #10b981;
  --accent-neon: #34d399;
  --accent-teal: #2dd4bf;
  --accent-cyan: #38bdf8;
  --accent-gradient: linear-gradient(135deg, #10b981 0%, #0d9488 60%, #06b6d4 100%);
  --accent-gradient-glow: linear-gradient(135deg, #34d399 0%, #2dd4bf 100%);
  
  /* Semantic Colors */
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.35);
  --success-bg: rgba(52, 211, 153, 0.12);
  --success-border: rgba(52, 211, 153, 0.35);
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.35);
  
  /* Typography & Contrast */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Shadows & Atmospheric Glows */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 0 0 20px -5px rgba(52, 211, 153, 0.08);
  --shadow-glow: 0 0 20px rgba(52, 211, 153, 0.25);
}

[data-theme="light"], body.light-theme {
  --bg-dark: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-card: #ffffff;
  --bg-radial: radial-gradient(circle at 50% 0%, #e2e8f0 0%, #f8fafc 60%);
  --bg-mesh: radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.04) 0px, transparent 50%),
             radial-gradient(at 0% 100%, rgba(14, 165, 233, 0.03) 0px, transparent 50%);

  --glass-header: rgba(255, 255, 255, 0.95);
  --glass-sidebar: rgba(248, 250, 252, 0.98);
  --glass-panel: rgba(255, 255, 255, 0.98);
  --glass-card: rgba(255, 255, 255, 0.95);
  --glass-card-hover: rgba(241, 245, 249, 0.95);
  --glass-input: #ffffff;

  --border: rgba(0, 0, 0, 0.1);
  --border-subtle: rgba(0, 0, 0, 0.06);
  --glass-border: rgba(16, 185, 129, 0.3);
  --glass-border-glow: rgba(16, 185, 129, 0.45);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.9);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
}

/* Comprehensive Light Theme Component & Typography Overrides */
[data-theme="light"] h1, body.light-theme h1,
[data-theme="light"] h2, body.light-theme h2,
[data-theme="light"] h3, body.light-theme h3,
[data-theme="light"] h4, body.light-theme h4,
[data-theme="light"] .brand-title, body.light-theme .brand-title,
[data-theme="light"] .sidebar-title, body.light-theme .sidebar-title,
[data-theme="light"] .metric-card .val, body.light-theme .metric-card .val,
[data-theme="light"] .card h2, body.light-theme .card h2,
[data-theme="light"] .card-panel h2, body.light-theme .card-panel h2 {
  color: #0f172a !important;
}

[data-theme="light"] input[type="text"], body.light-theme input[type="text"],
[data-theme="light"] input[type="password"], body.light-theme input[type="password"],
[data-theme="light"] input[type="email"], body.light-theme input[type="email"],
[data-theme="light"] input[type="number"], body.light-theme input[type="number"],
[data-theme="light"] input[type="tel"], body.light-theme input[type="tel"],
[data-theme="light"] input[type="file"], body.light-theme input[type="file"],
[data-theme="light"] select, body.light-theme select,
[data-theme="light"] textarea, body.light-theme textarea,
[data-theme="light"] .custom-card-input, body.light-theme .custom-card-input {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] input::placeholder, body.light-theme input::placeholder,
[data-theme="light"] textarea::placeholder, body.light-theme textarea::placeholder {
  color: #94a3b8 !important;
}

[data-theme="light"] .top-bar-generic, body.light-theme .top-bar-generic {
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .top-generic-link, body.light-theme .top-generic-link {
  color: #475569;
}

[data-theme="light"] .top-generic-link:hover, body.light-theme .top-generic-link:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .top-generic-link.active, body.light-theme .top-generic-link.active {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .app-sidebar, body.light-theme .app-sidebar {
  border-right-color: #e2e8f0;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .sidebar-header, body.light-theme .sidebar-header {
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .nav-item, body.light-theme .nav-item {
  color: #475569;
}

[data-theme="light"] .nav-item:hover, body.light-theme .nav-item:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .nav-item.active, body.light-theme .nav-item.active {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="light"] .table-nav-item, body.light-theme .table-nav-item {
  color: #475569;
}

[data-theme="light"] .table-nav-item:hover, body.light-theme .table-nav-item:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .table-nav-item.active, body.light-theme .table-nav-item.active {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

[data-theme="light"] .header-profile-trigger, body.light-theme .header-profile-trigger {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .header-profile-email, body.light-theme .header-profile-email {
  color: #0f172a;
}

[data-theme="light"] .profile-dropdown-card, body.light-theme .profile-dropdown-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .dropdown-user-email, body.light-theme .dropdown-user-email {
  color: #0f172a;
}

[data-theme="light"] .dropdown-divider, body.light-theme .dropdown-divider {
  background: #e2e8f0;
}

[data-theme="light"] .dropdown-menu-link, body.light-theme .dropdown-menu-link {
  color: #475569;
}

[data-theme="light"] .dropdown-menu-link:hover, body.light-theme .dropdown-menu-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .data-scroll, body.light-theme .data-scroll {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

[data-theme="light"] .data-table th, body.light-theme .data-table th {
  background: #f8fafc;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .data-table td, body.light-theme .data-table td {
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
}

[data-theme="light"] .data-table tr:hover td, body.light-theme .data-table tr:hover td {
  background: rgba(16, 185, 129, 0.04);
}

[data-theme="light"] .data-table td code, body.light-theme .data-table td code {
  color: #0f172a !important;
}

[data-theme="light"] .btn.secondary, body.light-theme .btn.secondary {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

[data-theme="light"] .btn.secondary:hover:not(:disabled), body.light-theme .btn.secondary:hover:not(:disabled) {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

[data-theme="light"] .entity-toggle-label, body.light-theme .entity-toggle-label {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #cbd5e1;
}

[data-theme="light"] .entity-toggle-label.active, body.light-theme .entity-toggle-label.active {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
}

[data-theme="light"] .tier-select-card, body.light-theme .tier-select-card {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .tier-select-card strong, body.light-theme .tier-select-card strong {
  color: #0f172a !important;
}

[data-theme="light"] .tier-select-card.active, body.light-theme .tier-select-card.active {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.06);
}

[data-theme="light"] select.db-select-pill, body.light-theme select.db-select-pill {
  background-color: #ffffff;
  color: #047857;
  border-color: #cbd5e1;
}

[data-theme="light"] select.db-select-pill option, body.light-theme select.db-select-pill option {
  background: #ffffff;
  color: #0f172a;
}

[data-theme="light"] .sidebar-footer, body.light-theme .sidebar-footer {
  background: #f8fafc;
  border-top-color: #e2e8f0;
}

[data-theme="light"] .sidebar-collapse-btn, body.light-theme .sidebar-collapse-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #475569;
}

[data-theme="light"] .login-card, body.light-theme .login-card {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .crumb-trail strong, body.light-theme .crumb-trail strong {
  color: #0f172a !important;
}

[data-theme="light"] .modal, body.light-theme .modal,
[data-theme="light"] .modal-content, body.light-theme .modal-content {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--glass-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.theme-toggle-btn:hover {
  color: var(--accent-neon);
  border-color: var(--glass-border-glow);
  background: var(--glass-card-hover);
  transform: translateY(-1px);
}

.theme-toggle-btn .sun-icon {
  display: none;
}

.theme-toggle-btn .moon-icon {
  display: block;
}

[data-theme="light"] .theme-toggle-btn .sun-icon,
body.light-theme .theme-toggle-btn .sun-icon {
  display: block;
  color: #d97706;
}

[data-theme="light"] .theme-toggle-btn .moon-icon,
body.light-theme .theme-toggle-btn .moon-icon {
  display: none;
}

.text-emerald { color: #34d399 !important; }
.text-amber { color: #fbbf24 !important; }
.text-sky { color: #38bdf8 !important; }
.text-purple { color: #c084fc !important; }
.text-rose, .text-danger { color: #f87171 !important; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.flex-row { display: flex !important; }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  background-color: var(--bg-dark);
  background-image: var(--bg-mesh), var(--bg-radial);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.has-sidebar {
  display: flex;
}

a {
  color: var(--accent-neon);
  text-decoration: none;
  transition: color 0.15s ease, text-shadow 0.15s ease;
}

a:hover {
  color: #6ee7b7;
}

/* ==========================================================================
   Page Layout & Containers
   ========================================================================== */

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.wrap-wide {
  max-width: 1360px;
}

/* ==========================================================================
   Top Header Bar & Generic Menu (Home, Pricing, Docs)
   ========================================================================== */

.top-bar-generic {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--glass-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.top-generic-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.top-generic-link {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.38rem 0.85rem;
  border-radius: 7px;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.top-generic-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

.top-generic-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

/* Header Right Profile Dropdown Menu */
.top-header-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.header-profile-menu-container {
  position: relative;
}

.header-profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.65rem 0.3rem 0.3rem;
  background: rgba(16, 24, 40, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.header-profile-trigger:hover,
.header-profile-trigger[aria-expanded="true"] {
  background: rgba(22, 33, 54, 0.9);
  border-color: rgba(52, 211, 153, 0.4);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.2);
}

.user-avatar-initial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.header-profile-email {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: #e2e8f0;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-profile-trigger .chevron-icon {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.header-profile-trigger[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

.profile-dropdown-card {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: #0d1322;
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 14px;
  padding: 0.5rem;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8), 0 0 20px rgba(52, 211, 153, 0.1);
  display: none;
  flex-direction: column;
  z-index: 200;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: dropdownFadeIn 0.15s ease-out;
}

.profile-dropdown-card.show {
  display: flex;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
  padding: 0.65rem 0.75rem 0.5rem;
}

.dropdown-user-email {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: #ffffff;
  word-break: break-all;
  margin-bottom: 0.35rem;
}

.dropdown-user-role {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.role-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.25);
  text-transform: uppercase;
}

.engine-badge {
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--text-dim);
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0.4rem 0;
}

.dropdown-menu-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
}

.dropdown-menu-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.dropdown-logout-form {
  margin: 0;
  padding: 0;
}

.dropdown-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #f87171;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.dropdown-logout-btn:hover {
  background: rgba(248, 113, 113, 0.12);
  color: #ef4444;
}

/* ==========================================================================
   Brand Group & Logo Mark
   ========================================================================== */

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-text-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.logo-box, .sidebar-logo {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0 !important;
  position: relative;
}

.logo-box svg, .sidebar-logo svg {
  width: 34px;
  height: 34px;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(52, 211, 153, 0.45));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
}

.logo-box:hover svg, .sidebar-logo:hover svg {
  transform: scale(1.08) translateY(-1px);
  filter: drop-shadow(0 0 16px rgba(52, 211, 153, 0.75));
}

.brand-title, .sidebar-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-accent {
  color: #34d399;
}

@supports (-webkit-background-clip: text) or (background-clip: text) {
  .brand-accent {
    background: linear-gradient(135deg, #34d399 0%, #2dd4bf 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
  }
}

.brand-cloud-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 0.25rem;
}

/* ==========================================================================
   Supabase / Google Cloud Universal Collapsible Sidebar
   ========================================================================== */

.app-sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--glass-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 50;
  user-select: none;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--header-h);
  flex-shrink: 0;
}

.sidebar-subtitle {
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--text-dim);
}

.db-selector-box {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

select.db-select-pill {
  width: 100%;
  background: rgba(16, 24, 40, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  padding: 0.55rem 0.85rem;
  color: var(--accent-neon);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2334d399' stroke-width='2.2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2rem;
  box-shadow: var(--glass-highlight);
  transition: all 0.15s ease;
}

select.db-select-pill:hover, select.db-select-pill:focus {
  border-color: var(--glass-border-glow);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.2);
}

select.db-select-pill option {
  background: #0d131f;
  color: #ffffff;
  font-family: var(--mono);
  padding: 0.6rem;
}

.nav-section-title {
  padding: 0.85rem 0.85rem 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.sidebar-scroll-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.5rem 0.65rem;
}

.sidebar-scroll-area::-webkit-scrollbar {
  width: 4px;
}

.sidebar-scroll-area::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-scroll-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
  position: relative;
  white-space: nowrap;
}

.nav-item svg {
  flex-shrink: 0;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  background: rgba(52, 211, 153, 0.12);
  color: var(--accent-neon);
  border: 1px solid rgba(52, 211, 153, 0.3);
  font-weight: 600;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.1);
}

.table-list-box {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.25rem 0.25rem 0.5rem;
}

.table-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: var(--mono);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.table-nav-item.active {
  background: rgba(52, 211, 153, 0.12);
  color: var(--accent-neon);
  font-weight: 600;
}

.sidebar-footer {
  padding: 0.65rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 10, 17, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

/* Sidebar Collapse Toggle Button */
.sidebar-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-collapse-btn:hover {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
  color: #34d399;
}

.sidebar-collapse-btn svg {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Collapsed Sidebar State (64px Rail)
   ========================================================================== */

body.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed-w) !important;
  overflow-x: hidden !important;
}

body.sidebar-collapsed .sidebar-header {
  padding: 0.75rem 0 !important;
  justify-content: center !important;
  align-items: center !important;
  display: flex !important;
  overflow: hidden !important;
}

body.sidebar-collapsed .sidebar-header > div {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  margin: 0 auto !important;
  overflow: hidden !important;
}

body.sidebar-collapsed .sidebar-header .sidebar-collapse-btn {
  display: none !important;
}

body.sidebar-collapsed .sidebar-header .brand-text-col,
body.sidebar-collapsed .sidebar-subtitle {
  display: none !important;
}

body.sidebar-collapsed .sidebar-logo {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto !important;
  width: 36px !important;
  height: 36px !important;
  cursor: pointer !important;
}

body.sidebar-collapsed .sidebar-logo svg {
  display: block !important;
  width: 32px !important;
  height: 32px !important;
  filter: drop-shadow(0 0 10px rgba(52, 211, 153, 0.6)) !important;
}

body.sidebar-collapsed .sidebar-logo:hover svg {
  transform: scale(1.12) !important;
  filter: drop-shadow(0 0 16px rgba(52, 211, 153, 0.95)) !important;
}

body.sidebar-collapsed .sidebar-header .brand-text-col,
body.sidebar-collapsed .db-selector-box,
body.sidebar-collapsed .db-selector-container,
body.sidebar-collapsed .project-selector-container,
body.sidebar-collapsed .sidebar-project-header-row,
body.sidebar-collapsed .project-select-shell,
body.sidebar-collapsed .sidebar-db-subnav,
body.sidebar-collapsed .nav-section-title,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .table-list-box,
body.sidebar-collapsed .sidebar-table-search-box,
body.sidebar-collapsed .sidebar-footer-links {
  display: none !important;
}

body.sidebar-collapsed .sidebar-scroll-area {
  padding: 0.5rem 0.35rem !important;
  overflow-x: hidden !important;
  max-width: 100% !important;
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 0.65rem 0;
  width: 100%;
}

body.sidebar-collapsed .sidebar-footer {
  justify-content: center;
  padding: 0.65rem 0.4rem;
}

body.sidebar-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

/* Floating tooltip when sidebar is collapsed */
body.sidebar-collapsed .nav-item[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(52, 211, 153, 0.4);
  padding: 0.35rem 0.75rem;
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 1000;
}

body.sidebar-collapsed .nav-item:hover::after {
  opacity: 1;
}

/* Minimalist info tooltip & popover components */
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-family: var(--mono);
  font-weight: 700;
  cursor: help;
  transition: all 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
}
.info-tip:hover {
  background: var(--accent-neon);
  color: #03060c;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.4);
}
.info-tip[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0b1120;
  color: #e2e8f0;
  font-size: 0.74rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  white-space: normal;
  width: max-content;
  max-width: 280px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  text-align: left;
}
.info-tip:hover[data-tip]::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.minimal-details {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  transition: all 0.2s ease;
}
.minimal-details summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  outline: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}
.minimal-details summary:hover {
  color: #ffffff;
}
.minimal-details[open] {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

/* Main Workspace with Sidebar */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}

body.sidebar-collapsed .app-main {
  margin-left: var(--sidebar-collapsed-w);
}

.workspace-content {
  padding: 1.75rem 1.5rem 3rem;
  flex: 1;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   Cards, Grids & Glass Panels (Supabase Style)
   ========================================================================== */

.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.metric-card {
  background: var(--glass-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm), var(--glass-highlight);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient-glow);
  opacity: 0.7;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--glass-border-glow);
  box-shadow: var(--shadow-lg), 0 0 16px rgba(52, 211, 153, 0.12);
}

.metric-card .label {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.metric-card .val {
  font-size: 1.55rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.grid {
  display: grid;
  gap: 1.25rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card, .card-panel {
  background: var(--glass-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg), var(--glass-highlight);
  margin-bottom: 1.5rem;
  position: relative;
}

.card h2, .card-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card .sub, .card-panel .sub {
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   Buttons, Inputs & Form Controls (Consistent Supabase Polish)
   ========================================================================== */

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.login-form button[type="submit"],
.btn.full-width {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: 1px solid #10b981;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.login-form button[type="submit"]:hover:not(:disabled),
.btn.full-width:hover:not(:disabled) {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 6px 20px rgba(52, 211, 153, 0.45);
  transform: translateY(-1px);
}

.login-form button[type="submit"]:active:not(:disabled),
.btn.full-width:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.login-form button[type="submit"]:disabled,
.btn.full-width:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
}

.pwd-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pwd-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-color: rgba(52, 211, 153, 0.4);
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: #060910 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 9px !important;
  color: #ffffff !important;
  padding: 0.65rem 0.85rem !important;
  font-size: 0.88rem !important;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
  outline: none !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4) !important;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2), inset 0 1px 2px rgba(0, 0, 0, 0.4) !important;
}

input::placeholder, textarea::placeholder {
  color: var(--text-dim);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.6rem 1.15rem;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn.primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: #10b981;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 6px 20px rgba(52, 211, 153, 0.45);
  transform: translateY(-1px);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.12);
}

.btn.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn.danger {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
}

.btn.danger:hover:not(:disabled) {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn.mini {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  border-radius: 7px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ==========================================================================
   Data Tables & Badges
   ========================================================================== */

.data-scroll {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #090d16;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.data-table th {
  background: #0d1424;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
}

.data-table tr:hover td {
  background: rgba(52, 211, 153, 0.03);
}

.kind-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(52, 211, 153, 0.12);
  color: var(--accent-neon);
  border: 1px solid rgba(52, 211, 153, 0.3);
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.db-size-pill {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.plan-flex {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--accent-neon);
}

.plan-pro {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.plan-business {
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #c084fc;
}

.flash {
  padding: 0.85rem 1.15rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.flash.error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #fca5a5;
}

.flash.ok {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: #6ee7b7;
}

/* ==========================================================================
   Modals & Popups
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(4, 7, 13, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.modal-card {
  width: 100%;
  max-width: 580px;
  background: #0d1322;
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 30px rgba(52, 211, 153, 0.15);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   Auth / Login Pages
   ========================================================================== */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(13, 19, 34, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 20px;
  padding: 2.5rem 2.25rem;
  box-shadow: var(--shadow-lg), 0 0 30px rgba(52, 211, 153, 0.12);
  position: relative;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent-gradient-glow);
  box-shadow: 0 0 10px var(--accent-neon);
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand h1 {
  margin: 0.75rem 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-brand p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-hint {
  margin-top: 1.75rem;
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Responsive Rules
   ========================================================================== */

@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .top-bar-generic {
    padding: 0 1rem;
  }
}

body.sidebar-collapsed .sidebar-logo {
  cursor: pointer;
  margin: 0 auto;
}
body.sidebar-collapsed .sidebar-logo:hover svg {
  transform: scale(1.15);
  filter: drop-shadow(0 0 18px rgba(52, 211, 153, 0.9));
}

/* Question mark help trigger and collapsible guides */
.icon-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.icon-help-btn:hover {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
  color: #34d399;
}

.help-drawer-box {
  background: rgba(16, 185, 129, 0.04);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
  line-height: 1.5;
  animation: dropdownFadeIn 0.15s ease-out;
}

.entity-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.65rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  color: #ffffff;
  transition: border-color 0.15s ease;
}

.entity-toggle-label.active {
  border-color: var(--accent-neon);
}

.field-hidden {
  display: none !important;
}

/* ==========================================================================
   Official PGBox Tax Invoice & Printable Statement Design
   ========================================================================== */

.receipt-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}

.receipt-modal-card {
  max-width: 580px;
  width: 100%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  color: #0f172a;
  overflow: hidden;
  position: relative;
  margin: auto;
}

.receipt-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 1rem;
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.invoice-sheet {
  padding: 1.5rem 1.75rem;
  background: #ffffff;
  color: #0f172a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.invoice-brand-col {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.invoice-logo-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.invoice-brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.invoice-brand-sub {
  font-size: 0.74rem;
  font-weight: 400;
  color: #64748b;
}

.invoice-meta-col {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: flex-end;
}

.invoice-title-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #475569;
  text-transform: uppercase;
  background: #f8fafc;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  margin-bottom: 0.1rem;
}

.invoice-meta-item {
  font-size: 0.76rem;
  color: #475569;
}

.invoice-meta-item .meta-label {
  color: #64748b;
  margin-right: 0.3rem;
}

.paid-pill {
  display: inline-block;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-weight: 600;
  font-size: 0.68rem;
  padding: 0.12rem 0.5rem;
  border-radius: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.invoice-account-box {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 1fr;
  gap: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  margin: 0.9rem 0;
}

.account-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.account-item .acc-label {
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.account-item .acc-val {
  font-size: 0.78rem;
  color: #0f172a;
}

.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.75rem;
}

.invoice-items-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.5rem;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
}

.invoice-items-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.72rem;
  color: #334155;
  vertical-align: middle;
}

.tier-pill {
  display: inline-block;
  padding: 0.08rem 0.35rem;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
}

.invoice-summary-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
  padding-top: 0.4rem;
  border-top: 1px solid #e2e8f0;
  margin-top: 0.35rem;
}

.invoice-totals-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: #475569;
}

.total-row.grand-total {
  border-top: 1px solid #0f172a;
  padding-top: 0.35rem;
  margin-top: 0.2rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
}

.invoice-footer {
  margin-top: 1rem;
  padding-top: 0.65rem;
  border-top: 1px solid #f1f5f9;
  text-align: center;
  font-size: 0.72rem;
  color: #64748b;
}

/* ==========================================================================
   Print Optimization (@media print) - Strict 1-Page Layout
   ========================================================================== */

@page {
  size: A4 portrait;
  margin: 12mm 15mm;
}

@media print {
  /* Hide the entire dashboard shell */
  .dashboard-container,
  .topbar,
  .dashboard-main,
  .receipt-action-bar,
  .no-print {
    display: none !important;
  }

  html, body {
    background: #ffffff !important;
    color: #0f172a !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .receipt-modal-overlay {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: visible !important;
    z-index: 1 !important;
  }

  .receipt-modal-card {
    display: block !important;
    position: static !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #0f172a !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .invoice-sheet {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 1.5rem 1.75rem !important;
    margin: 0 !important;
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .invoice-header {
    padding-bottom: 1.1rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }

  .invoice-brand-title {
    font-size: 1.4rem !important;
    color: #0f172a !important;
  }

  .invoice-account-box {
    margin: 1rem 0 !important;
    padding: 0.65rem 0.85rem !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .invoice-items-table {
    width: 100% !important;
    margin-bottom: 0.85rem !important;
    border-collapse: collapse !important;
  }

  .invoice-items-table th {
    background: #f8fafc !important;
    color: #475569 !important;
    padding: 0.45rem 0.6rem !important;
    font-size: 0.68rem !important;
    border-top: 1px solid #e2e8f0 !important;
    border-bottom: 1px solid #cbd5e1 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .invoice-items-table td {
    padding: 0.5rem 0.6rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
    font-size: 0.74rem !important;
    color: #334155 !important;
  }

  .invoice-summary-grid {
    margin-top: 0.4rem !important;
    padding-top: 0.5rem !important;
    border-top: 1px solid #e2e8f0 !important;
  }

  .total-row.grand-total {
    border-top: 1.5px solid #0f172a !important;
    padding-top: 0.4rem !important;
    margin-top: 0.2rem !important;
    font-size: 0.95rem !important;
  }

  .paid-pill {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .invoice-footer {
    margin-top: 1.2rem !important;
    padding-top: 0.75rem !important;
    border-top: 1px solid #f1f5f9 !important;
  }
}

/* ==========================================================================
   Connection Cards, URL Blocks & Scrollbars (Polished Console UI)
   ========================================================================== */

.data-scroll {
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.data-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.data-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

.data-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}

.data-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(52, 211, 153, 0.45);
}

.url-block {
  background: #070b14;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.url-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.url-header label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.35rem 0.45rem 0.35rem 0.85rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.copy-row:focus-within {
  border-color: rgba(52, 211, 153, 0.5);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.15);
}

.copy-row input {
  flex: 1;
  background: transparent;
  border: none;
  color: #34d399;
  font-family: var(--mono);
  font-size: 0.82rem;
  outline: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag.public {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.db-selector-container,
.project-selector-container {
  padding: 0.55rem 0.85rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 0.5rem;
}

.sidebar-project-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  padding: 0 0.15rem;
}

.sidebar-project-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.sidebar-new-project-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: #34d399;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-new-project-btn:hover {
  background: rgba(52, 211, 153, 0.2);
  border-color: #34d399;
  color: #ffffff;
}

.project-select-shell {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.project-select-shell .project-box-icon,
.project-box-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 3;
  color: #34d399;
  display: flex;
  align-items: center;
}

.project-select-shell .project-chevron-icon,
.project-chevron-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 3;
  color: #94a3b8;
}

select.project-select-pill,
.project-select-shell select,
.project-select-shell select.db-select-pill {
  width: 100%;
  background: #060910 !important;
  background-image: none !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
  font-family: var(--font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif) !important;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 1.9rem 0.5rem 2.35rem !important;
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none !important;
  line-height: 1.25;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select.project-select-pill:hover,
select.project-select-pill:focus,
.project-select-shell select:hover,
.project-select-shell select:focus {
  border-color: #34d399 !important;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.15) !important;
}

select.project-select-pill option,
.project-select-shell select option {
  background: #0b1120;
  color: #ffffff;
  padding: 0.55rem;
  font-family: var(--font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

/* Light theme overrides */
[data-theme="light"] .project-selector-container {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sidebar-project-label {
  color: #64748b;
}

[data-theme="light"] select.project-select-pill,
[data-theme="light"] .project-select-shell select {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] select.project-select-pill option,
[data-theme="light"] .project-select-shell select option {
  background: #ffffff;
  color: #0f172a;
}


/* ==========================================================================
   Mobile Responsiveness & Adaptive Viewport Architecture (Desktop-First)
   ========================================================================== */

/* Mobile Sidebar Backdrop */
.mobile-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 990;
  opacity: 0;
  transition: opacity 0.25s ease;
}

body.mobile-nav-open .mobile-sidebar-backdrop {
  display: block;
  opacity: 1;
}

/* Mobile Hamburger Toggle Button */
.mobile-menu-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s ease;
  margin-right: 0.35rem;
}

.mobile-menu-toggle-btn:hover {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--accent-neon);
}

/* Desktop-Optimized Screen Banner Notice */
.mobile-desktop-notice {
  display: none;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  align-items: flex-start;
  gap: 0.75rem;
}

.mobile-desktop-notice-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.mobile-desktop-notice-content {
  flex: 1;
}

.mobile-desktop-notice-title {
  margin: 0 0 0.2rem;
  font-size: 0.84rem;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mobile-desktop-notice-desc {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Mobile Media Queries (<= 900px) */
@media (max-width: 900px) {
  .mobile-menu-toggle-btn {
    display: inline-flex;
  }

  .mobile-desktop-notice {
    display: flex;
  }

  /* Off-canvas sidebar */
  body.has-sidebar .app-sidebar {
    width: 280px !important;
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    transform: translateX(-100%) !important;
    z-index: 1000 !important;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.9) !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  body.mobile-nav-open .app-sidebar {
    transform: translateX(0) !important;
  }

  /* Full width main workspace */
  body.has-sidebar .app-main,
  body.sidebar-collapsed .app-main {
    margin-left: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .workspace-content {
    padding: 1rem 0.85rem 2.5rem !important;
    max-width: 100% !important;
  }

  .top-bar-generic {
    padding: 0 0.75rem !important;
    height: 52px !important;
    gap: 0.4rem !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
  }

  .top-header-right {
    gap: 0.35rem !important;
    flex-shrink: 0 !important;
  }

  /* Hide verbose navigation and badges on mobile */
  .top-generic-nav,
  .top-bar-generic .db-size-pill,
  .top-bar-generic .top-header-right > .mono,
  .header-profile-email {
    display: none !important;
  }

  /* Compact breadcrumb */
  .top-generic-link span {
    display: none !important;
  }

  .header-profile-trigger {
    padding: 2px 4px !important;
    background: transparent !important;
    border-color: transparent !important;
    gap: 2px !important;
  }

  .header-profile-trigger .chevron-icon {
    display: none !important;
  }

  .user-avatar-initial {
    width: 30px !important;
    height: 30px !important;
    font-size: 0.85rem !important;
  }

  .project-overview-hero {
    padding: 1.2rem 1rem !important;
    border-radius: 12px !important;
  }

  .hero-top-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
  }

  .hero-actions-col {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  .hero-actions-col .btn,
  .hero-actions-col button,
  .hero-actions-col a {
    flex: 1 1 auto !important;
    justify-content: center !important;
  }

  .metrics-row,
  .metrics-grid,
  .subsystems-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  /* Tables & Horizontal Containers */
  .table-responsive,
  .data-scroll,
  .sql-results-table-wrap,
  .data-table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    max-width: 100% !important;
  }

  /* Modals */
  .modal,
  .modal-dialog,
  .modal-content,
  .dialog-box {
    width: calc(100vw - 20px) !important;
    max-width: 100% !important;
    margin: 10px auto !important;
    max-height: calc(100vh - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    overflow-y: auto !important;
  }

  /* Forms & Grid layout stacking */
  .form-row,
  .form-grid {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
  }
}





