/**
 * GHCP Design System — Futuristic Obsidian & Crisp Light Theme
 * Fully responsive, dark & light mode synchronized with Bootstrap 5.3 ([data-bs-theme] + [data-theme]).
 */

:root,
[data-theme="dark"],
[data-bs-theme="dark"] {
  color-scheme: dark;
  --ghcp-bg-canvas: #06080a;
  --ghcp-bg-elevated: #0d1117;
  --ghcp-bg-sidebar: rgba(11, 15, 21, 0.92);
  --ghcp-bg-topbar: rgba(11, 15, 21, 0.84);
  --ghcp-bg-card: rgba(16, 20, 28, 0.78);
  --ghcp-bg-card-hover: rgba(24, 30, 42, 0.92);
  --ghcp-bg-input: rgba(9, 12, 18, 0.9);
  --ghcp-bg-subtle: rgba(255, 255, 255, 0.04);

  --ghcp-border: rgba(255, 255, 255, 0.09);
  --ghcp-border-strong: rgba(255, 255, 255, 0.16);
  --ghcp-specular: inset 0 1px 0 rgba(255, 255, 255, 0.08);

  --ghcp-text: #f1f5f9;
  --ghcp-text-secondary: #cbd5e1;
  --ghcp-text-muted: #94a3b8;

  --ghcp-accent: #0ea5e9;
  --ghcp-accent-2: #6366f1;
  --ghcp-accent-soft: rgba(14, 165, 233, 0.14);
  --ghcp-success: #22c55e;
  --ghcp-success-soft: rgba(34, 197, 94, 0.14);
  --ghcp-warning: #f59e0b;
  --ghcp-warning-soft: rgba(245, 158, 11, 0.14);
  --ghcp-danger: #ef4444;
  --ghcp-danger-soft: rgba(239, 68, 68, 0.14);

  --ghcp-shadow-card: var(--ghcp-specular), 0 12px 32px rgba(0, 0, 0, 0.45);
  --ghcp-shadow-modal: var(--ghcp-specular), 0 24px 64px rgba(0, 0, 0, 0.7);
}

[data-theme="light"],
[data-bs-theme="light"] {
  color-scheme: light;
  --ghcp-bg-canvas: #edf2f7;
  --ghcp-bg-elevated: #ffffff;
  --ghcp-bg-sidebar: rgba(255, 255, 255, 0.92);
  --ghcp-bg-topbar: rgba(255, 255, 255, 0.88);
  --ghcp-bg-card: rgba(255, 255, 255, 0.94);
  --ghcp-bg-card-hover: #f8fafc;
  --ghcp-bg-input: #ffffff;
  --ghcp-bg-subtle: rgba(15, 23, 42, 0.04);

  --ghcp-border: rgba(15, 23, 42, 0.1);
  --ghcp-border-strong: rgba(15, 23, 42, 0.18);
  --ghcp-specular: inset 0 1px 0 rgba(255, 255, 255, 0.9);

  --ghcp-text: #0f172a;
  --ghcp-text-secondary: #334155;
  --ghcp-text-muted: #64748b;

  --ghcp-accent: #0284c7;
  --ghcp-accent-2: #4f46e5;
  --ghcp-accent-soft: rgba(2, 132, 199, 0.1);
  --ghcp-success: #16a34a;
  --ghcp-success-soft: rgba(22, 163, 74, 0.1);
  --ghcp-warning: #d97706;
  --ghcp-warning-soft: rgba(217, 119, 6, 0.1);
  --ghcp-danger: #dc2626;
  --ghcp-danger-soft: rgba(220, 38, 38, 0.1);

  --ghcp-shadow-card: 0 8px 24px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --ghcp-shadow-modal: 0 24px 60px rgba(15, 23, 42, 0.18);
}

:root {
  --sidebar-width: 264px;
  --topbar-height: 66px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--ghcp-bg-canvas);
  background-image:
    radial-gradient(900px 500px at 15% -10%, var(--ghcp-accent-soft), transparent 60%),
    radial-gradient(700px 420px at 90% 0%, rgba(99, 102, 241, 0.08), transparent 60%);
  background-attachment: fixed;
  color: var(--ghcp-text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ghcp-accent);
}

/* ===== SHELL LAYOUT ===== */
.ghcp-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--ghcp-bg-sidebar);
  backdrop-filter: blur(20px) saturate(160%);
  border-right: 1px solid var(--ghcp-border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--ghcp-border);
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ghcp-accent), var(--ghcp-accent-2));
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

.logo-text {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--ghcp-text);
}

.logo-sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ghcp-text-muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 0.75rem 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--ghcp-border-strong) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--ghcp-border-strong);
  border-radius: 999px;
}

.nav-section {
  margin-bottom: 1.15rem;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ghcp-text-muted);
  padding: 0 0.75rem;
  margin-bottom: 0.4rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.56rem 0.78rem;
  border-radius: 10px;
  color: var(--ghcp-text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
  margin-bottom: 2px;
}

.nav-link:hover {
  background: var(--ghcp-bg-subtle);
  color: var(--ghcp-text);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--ghcp-accent-soft), rgba(99, 102, 241, 0.14));
  color: var(--ghcp-accent);
  border: 1px solid rgba(14, 165, 233, 0.25);
  font-weight: 600;
}

.nav-link i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.nav-link-danger {
  color: var(--ghcp-danger);
}

.nav-link-danger:hover {
  background: var(--ghcp-danger-soft);
  color: var(--ghcp-danger);
}

/* ===== MAIN & TOPBAR ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  height: var(--topbar-height);
  padding: 0 1.5rem;
  background: var(--ghcp-bg-topbar);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--ghcp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-title {
  font-size: 1.12rem;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--ghcp-border);
  background: var(--ghcp-bg-subtle);
  color: var(--ghcp-text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.icon-btn:hover {
  border-color: var(--ghcp-border-strong);
  background: var(--ghcp-bg-card-hover);
}

.sidebar-toggle {
  display: none;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--ghcp-bg-subtle);
  border: 1px solid var(--ghcp-border);
  font-size: 0.84rem;
  font-weight: 600;
}

.role-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  background: var(--ghcp-accent-soft);
  color: var(--ghcp-accent);
}

.content-area {
  padding: 1.5rem;
  flex: 1;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

/* ===== CARDS & STATS ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--ghcp-bg-card);
  border: 1px solid var(--ghcp-border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--ghcp-shadow-card);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--ghcp-border-strong);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-icon.accent { background: var(--ghcp-accent-soft); color: var(--ghcp-accent); }
.stat-icon.success { background: var(--ghcp-success-soft); color: var(--ghcp-success); }
.stat-icon.warning { background: var(--ghcp-warning-soft); color: var(--ghcp-warning); }
.stat-icon.indigo { background: rgba(99, 102, 241, 0.16); color: #818cf8; }

.stat-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ghcp-text);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--ghcp-text-muted);
  font-weight: 500;
}

.ghcp-card {
  background: var(--ghcp-bg-card);
  border: 1px solid var(--ghcp-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--ghcp-shadow-card);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.ghcp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ghcp-border);
}

.ghcp-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ghcp-card-body {
  padding: 1.25rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

/* ===== QUICK ACTIONS ===== */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--ghcp-border);
  background: var(--ghcp-bg-subtle);
  color: var(--ghcp-text);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  border-color: var(--ghcp-accent);
  background: var(--ghcp-accent-soft);
  color: var(--ghcp-text);
}

.action-btn i {
  font-size: 1.25rem;
  color: var(--ghcp-accent);
}

/* ===== TABLES, FORMS, BUTTONS, BADGES ===== */
.table {
  color: var(--ghcp-text);
  margin-bottom: 0;
  --bs-table-bg: transparent;
  --bs-table-color: var(--ghcp-text);
  --bs-table-border-color: var(--ghcp-border);
  --bs-table-hover-bg: var(--ghcp-bg-subtle);
}

.table thead th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ghcp-text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--ghcp-border);
  padding: 0.75rem 0.9rem;
}

.table tbody td {
  padding: 0.78rem 0.9rem;
  vertical-align: middle;
  font-size: 0.88rem;
  border-color: var(--ghcp-border);
}

.form-control,
.form-select,
.form-input {
  background-color: var(--ghcp-bg-input);
  color: var(--ghcp-text);
  border: 1px solid var(--ghcp-border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus,
.form-input:focus {
  background-color: var(--ghcp-bg-input);
  color: var(--ghcp-text);
  border-color: var(--ghcp-accent);
  box-shadow: 0 0 0 3px var(--ghcp-accent-soft);
  outline: none;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ghcp-text-secondary);
  margin-bottom: 0.35rem;
}

.btn-ghcp {
  background: linear-gradient(135deg, var(--ghcp-accent), var(--ghcp-accent-2));
  border: none;
  color: #ffffff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.95rem;
  font-size: 0.86rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.btn-ghcp:hover {
  opacity: 0.92;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--ghcp-bg-subtle);
  border: 1px solid var(--ghcp-border);
  color: var(--ghcp-text);
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.42rem 0.78rem;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-ghost:hover {
  border-color: var(--ghcp-border-strong);
  background: var(--ghcp-bg-card-hover);
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-active { background: var(--ghcp-success-soft); color: var(--ghcp-success); }
.badge-inactive { background: var(--ghcp-warning-soft); color: var(--ghcp-warning); }
.badge-danger { background: var(--ghcp-danger-soft); color: var(--ghcp-danger); }
.badge-info { background: var(--ghcp-accent-soft); color: var(--ghcp-accent); }

/* ===== PROGRESS METERS ===== */
.meter-track {
  height: 8px;
  border-radius: 999px;
  background: var(--ghcp-bg-subtle);
  border: 1px solid var(--ghcp-border);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ghcp-accent), var(--ghcp-accent-2));
}

/* ===== MODAL & TOAST ===== */
.modal-content {
  background: var(--ghcp-bg-elevated);
  color: var(--ghcp-text);
  border: 1px solid var(--ghcp-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--ghcp-shadow-modal);
}

.modal-header,
.modal-footer {
  border-color: var(--ghcp-border);
}

.ghcp-toast-stack {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 380px;
}

.ghcp-toast {
  background: var(--ghcp-bg-elevated);
  color: var(--ghcp-text);
  border: 1px solid var(--ghcp-border-strong);
  border-left: 4px solid var(--ghcp-accent);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  box-shadow: var(--ghcp-shadow-modal);
  font-size: 0.86rem;
}

.ghcp-toast.success { border-left-color: var(--ghcp-success); }
.ghcp-toast.danger { border-left-color: var(--ghcp-danger); }

/* ===== CONSOLE / MONOSPACE ===== */
.mono {
  font-family: var(--font-mono);
}

.console-box {
  background: #05070a;
  color: #e2e8f0;
  border: 1px solid var(--ghcp-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  min-height: 280px;
  max-height: 440px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ===== LOGIN ===== */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--ghcp-bg-card);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--ghcp-border-strong);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--ghcp-shadow-modal);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

/* ===== MOBILE DRAWER & RESPONSIVE ===== */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 1030;
}

.mobile-overlay.active {
  display: block;
}

@media (max-width: 960px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: inline-grid;
  }

  .topbar {
    padding: 0 1rem;
  }

  .content-area {
    padding: 1rem;
  }

  .user-badge .user-name-text {
    display: none;
  }

  .ghcp-toast-stack {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }

  .ghcp-card-header {
    padding: 0.85rem 1rem;
  }

  .ghcp-card-body {
    padding: 1rem;
  }
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--ghcp-accent);
  outline-offset: 2px;
}

.service-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ghcp-border);
  background: var(--ghcp-bg-subtle);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Customer portal visual system */
body.portal-ui,
body.portal-auth {
  --ghcp-bg-canvas: #0b111a;
  --ghcp-bg-elevated: #111b27;
  --ghcp-bg-sidebar: rgba(13, 21, 32, 0.97);
  --ghcp-bg-topbar: rgba(13, 21, 32, 0.94);
  --ghcp-bg-card: #111b27;
  --ghcp-bg-card-hover: #192635;
  --ghcp-bg-input: #0d1722;
  --ghcp-bg-subtle: rgba(178, 205, 225, 0.06);
  --ghcp-border: rgba(173, 202, 222, 0.13);
  --ghcp-border-strong: rgba(173, 202, 222, 0.24);
  --ghcp-text: #f2f7fb;
  --ghcp-text-secondary: #d0dce7;
  --ghcp-text-muted: #a4b4c4;
  --ghcp-accent: #65cde0;
  --ghcp-accent-2: #3baec8;
  --ghcp-accent-soft: rgba(75, 190, 214, 0.14);
  --ghcp-shadow-card: 0 12px 30px rgba(0, 0, 0, 0.22);
  --ghcp-shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.48);
  --bs-body-color: #f2f7fb;
  --bs-secondary-color: #a4b4c4;
  --bs-info-rgb: 101, 205, 224;
  --bs-dark-bg-subtle: #192635;
  --bs-primary: #168ba5;
  --bs-primary-rgb: 22, 139, 165;
  background-color: var(--ghcp-bg-canvas);
  background-image:
    radial-gradient(800px 400px at 5% -12%, rgba(52, 148, 174, 0.14), transparent 62%),
    radial-gradient(700px 360px at 96% 0%, rgba(57, 91, 128, 0.12), transparent 65%);
  color: var(--ghcp-text);
  overflow-x: clip;
}

html[data-theme="light"] body.portal-ui,
html[data-bs-theme="light"] body.portal-ui,
html[data-theme="light"] body.portal-auth,
html[data-bs-theme="light"] body.portal-auth {
  --ghcp-bg-canvas: #f2f6fa;
  --ghcp-bg-elevated: #ffffff;
  --ghcp-bg-sidebar: rgba(255, 255, 255, 0.98);
  --ghcp-bg-topbar: rgba(255, 255, 255, 0.96);
  --ghcp-bg-card: #ffffff;
  --ghcp-bg-card-hover: #f5f9fc;
  --ghcp-bg-input: #ffffff;
  --ghcp-bg-subtle: rgba(22, 47, 68, 0.045);
  --ghcp-border: rgba(28, 54, 75, 0.12);
  --ghcp-border-strong: rgba(28, 54, 75, 0.21);
  --ghcp-text: #152534;
  --ghcp-text-secondary: #344a5c;
  --ghcp-text-muted: #52697c;
  --ghcp-accent: #087c97;
  --ghcp-accent-2: #116d89;
  --ghcp-accent-soft: rgba(8, 124, 151, 0.1);
  --ghcp-shadow-card: 0 10px 28px rgba(27, 52, 72, 0.07);
  --ghcp-shadow-modal: 0 24px 60px rgba(27, 52, 72, 0.16);
  --bs-body-color: #152534;
  --bs-secondary-color: #52697c;
  --bs-info-rgb: 8, 124, 151;
  --bs-dark-bg-subtle: #e8f0f5;
  --bs-primary: #087c97;
  --bs-primary-rgb: 8, 124, 151;
  background-image:
    radial-gradient(800px 400px at 5% -12%, rgba(8, 124, 151, 0.08), transparent 62%),
    radial-gradient(700px 360px at 96% 0%, rgba(57, 91, 128, 0.06), transparent 65%);
}

body.portal-ui .ghcp-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

body.portal-ui .sidebar {
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--ghcp-bg-sidebar);
  border-color: var(--ghcp-border);
}

body.portal-ui .sidebar-header {
  padding-top: max(1rem, env(safe-area-inset-top));
  height: auto;
  min-height: var(--topbar-height);
}

body.portal-ui .sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: var(--ghcp-border-strong) transparent;
}

body.portal-ui .nav-section-title {
  color: var(--ghcp-text-muted);
}

body.portal-ui .nav-link {
  min-height: 44px;
  color: var(--ghcp-text-secondary);
}

body.portal-ui .nav-link.active {
  color: var(--ghcp-accent);
  background: var(--ghcp-accent-soft);
  border-color: var(--ghcp-border-strong);
}

body.portal-ui .main-content,
body.portal-ui .page-body {
  min-width: 0;
  max-width: 100%;
}

body.portal-ui .main-content {
  background: transparent;
}

body.portal-ui .topbar {
  min-height: var(--topbar-height);
  height: auto;
  padding: 0.7rem 1.5rem;
  background: var(--ghcp-bg-topbar);
  border-color: var(--ghcp-border);
  padding-top: max(0.7rem, env(safe-area-inset-top));
}

body.portal-ui .topbar > .d-flex {
  min-width: 0;
}

body.portal-ui .topbar-page-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

body.portal-ui .page-body {
  width: 100%;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom)) !important;
}

body.portal-ui .card,
body.portal-ui .modal-content {
  color: var(--ghcp-text);
  background-color: var(--ghcp-bg-card);
  border-color: var(--ghcp-border) !important;
  border-radius: var(--radius-md);
  box-shadow: var(--ghcp-shadow-card);
}

body.portal-ui .card-header,
body.portal-ui .card-footer {
  background-color: transparent;
  border-color: var(--ghcp-border);
  padding: 0.95rem 1.15rem;
}

body.portal-ui .card-body {
  min-width: 0;
}

body.portal-ui .btn,
body.portal-ui .btn-ghost {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  white-space: normal;
}

body.portal-ui .btn-sm {
  min-height: 44px;
}

body.portal-ui .btn-primary {
  --bs-btn-bg: #147f98;
  --bs-btn-border-color: #147f98;
  --bs-btn-hover-bg: #116b81;
  --bs-btn-hover-border-color: #116b81;
  --bs-btn-active-bg: #0f6074;
  --bs-btn-active-border-color: #0f6074;
  --bs-btn-color: #ffffff;
  --bs-btn-hover-color: #ffffff;
}

html[data-theme="light"] body.portal-ui .btn-primary,
html[data-bs-theme="light"] body.portal-ui .btn-primary {
  --bs-btn-bg: #087c97;
  --bs-btn-border-color: #087c97;
  --bs-btn-hover-bg: #06677e;
  --bs-btn-hover-border-color: #06677e;
  --bs-btn-active-bg: #05596d;
  --bs-btn-active-border-color: #05596d;
}

body.portal-ui .btn-outline-info {
  --bs-btn-color: var(--ghcp-accent);
  --bs-btn-border-color: var(--ghcp-accent);
  --bs-btn-hover-bg: var(--ghcp-accent);
  --bs-btn-hover-border-color: var(--ghcp-accent);
  --bs-btn-hover-color: #07131b;
}

body.portal-ui .form-control,
body.portal-ui .form-select,
body.portal-ui .form-control:focus,
body.portal-ui .form-select:focus {
  min-height: 44px;
  color: var(--ghcp-text);
  background-color: var(--ghcp-bg-input);
  border-color: var(--ghcp-border-strong);
}

body.portal-ui .form-control::placeholder {
  color: var(--ghcp-text-muted);
  opacity: 0.85;
}

body.portal-ui .form-control:focus,
body.portal-ui .form-select:focus {
  border-color: var(--ghcp-accent);
  box-shadow: 0 0 0 3px var(--ghcp-accent-soft);
}

body.portal-ui .form-select option {
  color: var(--ghcp-text);
  background: var(--ghcp-bg-elevated);
}

body.portal-ui .table-responsive {
  max-width: 100%;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

body.portal-ui .table {
  --bs-table-color: var(--ghcp-text);
  --bs-table-border-color: var(--ghcp-border);
  --bs-table-hover-color: var(--ghcp-text);
  --bs-table-hover-bg: var(--ghcp-bg-subtle);
}

body.portal-ui .table th,
body.portal-ui .table td {
  overflow-wrap: anywhere;
  word-break: normal;
}

body.portal-ui code,
body.portal-ui pre,
body.portal-ui .font-monospace {
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.portal-ui .alert {
  overflow-wrap: anywhere;
}

body.portal-ui :focus-visible,
body.portal-auth :focus-visible {
  outline: 3px solid var(--ghcp-accent);
  outline-offset: 3px;
}

body.portal-ui .mobile-overlay.active {
  display: block;
}

body.portal-auth {
  min-height: 100vh;
  min-height: 100dvh;
}

body.portal-auth .login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(1.25rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1.25rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

body.portal-auth .login-card {
  max-width: 480px;
  padding: clamp(1.35rem, 5vw, 2.25rem);
  color: var(--ghcp-text);
  background: var(--ghcp-bg-card);
  border-color: var(--ghcp-border-strong);
  border-radius: 20px;
  box-shadow: var(--ghcp-shadow-modal);
}

body.portal-auth .login-brand {
  justify-content: flex-start;
  margin-bottom: 1.75rem;
}

body.portal-auth .form-control {
  min-height: 48px;
}

body.portal-auth .btn-ghost {
  min-width: 44px;
  min-height: 44px;
}

body.portal-auth .btn-ghcp {
  min-height: 48px;
  background: #147f98;
}

html[data-theme="light"] body.portal-auth .btn-ghcp,
html[data-bs-theme="light"] body.portal-auth .btn-ghcp {
  background: #087c97;
}

@media (max-width: 991.98px) {
  body.portal-ui .sidebar {
    width: min(var(--sidebar-width), 86vw);
    transform: translateX(-105%);
    z-index: 1040;
    box-shadow: 18px 0 45px rgba(0, 0, 0, 0.24);
  }

  body.portal-ui .sidebar.open {
    transform: translateX(0);
  }

  body.portal-ui .main-content {
    margin-left: 0;
  }

  body.portal-ui .topbar {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }
}

@media (max-width: 575.98px) {
  body.portal-ui .topbar {
    gap: 0.55rem;
    padding-top: max(0.55rem, env(safe-area-inset-top));
    padding-bottom: 0.55rem;
  }

  body.portal-ui .topbar-page-title {
    font-size: 1rem;
  }

  body.portal-ui .topbar-agent-link {
    width: 42px;
    min-width: 42px;
    padding-inline: 0.55rem;
    overflow: hidden;
    white-space: nowrap;
  }

  body.portal-ui .topbar-agent-link span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  body.portal-ui .page-body {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  body.portal-ui .card-header,
  body.portal-ui .card-footer {
    padding: 0.8rem 0.9rem;
  }

  body.portal-ui .card-body {
    padding: 1rem;
  }

  body.portal-ui .table {
    font-size: 0.82rem;
  }

  body.portal-ui .table thead th,
  body.portal-ui .table tbody td {
    padding: 0.7rem 0.65rem;
  }

  body.portal-ui .table-responsive {
    margin-inline: -1rem;
    width: calc(100% + 2rem);
  }

  body.portal-auth .login-shell {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  body.portal-auth .login-card {
    padding: 1.35rem 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.portal-ui *,
  body.portal-auth * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
