:root {
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --forest: #174c38;
  --forest-2: #1e5dd8;
  --primary-blue: #2563eb;
  --primary-blue-dark: #1d4ed8;
  --orange-accent: #ea580c;
  --orange-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  --blue-header-gradient: linear-gradient(135deg, #1d60db 0%, #2563eb 55%, #3b82f6 100%);
  
  --canvas: #f4f7fb;
  --cream: #fbfcfe;
  --card-bg: rgba(255, 255, 255, 0.92);
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.9);
  
  --line: #e2e8f0;
  --line-light: #f1f5f9;
  
  --success-bg: #d1fae5;
  --success: #059669;
  --bright-green: #10b981;
  --warning-bg: #fef3c7;
  --warning: #d97706;
  --danger-bg: #fee2e2;
  --danger: #dc2626;
  --operator-blue: #164b82;
  --operator-bg: #e0f2fe;

  /* Card distance bounds: Min 0.5cm (19px) - Max 1.2cm (45px) */
  --card-gap: clamp(0.5cm, 2.5vw, 1.2cm);
  --card-space-y: clamp(0.5cm, 2.5vw, 1.2cm);
  --page-padding: clamp(0.5cm, 2.5vw, 1.2cm);

  /* Neumorphic shadow primitives */
  --neu-flat: 8px 12px 28px rgba(160, 175, 195, 0.16), -6px -6px 20px rgba(255, 255, 255, 0.95);
  --neu-hover: 12px 18px 36px rgba(160, 175, 195, 0.22), -8px -8px 24px rgba(255, 255, 255, 0.98);
  --neu-button: 4px 6px 14px rgba(160, 175, 195, 0.14), -3px -3px 10px #ffffff;
  --neu-inset: inset 2px 2px 6px rgba(160, 175, 195, 0.12), inset -2px -2px 6px #ffffff;
  --neu-orange-glow: 4px 6px 18px rgba(249, 115, 22, 0.16), -2px -2px 10px rgba(255, 255, 255, 0.95);
  --neu-blue-glow: 0 12px 32px rgba(37, 99, 235, 0.28);

  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: 
    radial-gradient(circle at 12% 16%, rgba(255, 237, 213, 0.55) 0%, transparent 42%),
    radial-gradient(circle at 92% 12%, rgba(219, 234, 254, 0.75) 0%, transparent 46%),
    radial-gradient(circle at 88% 86%, rgba(254, 215, 170, 0.45) 0%, transparent 50%),
    radial-gradient(circle at 20% 85%, rgba(224, 231, 255, 0.4) 0%, transparent 45%),
    linear-gradient(135deg, #f4f7fb 0%, #edf2f7 50%, #f7f9fa 100%);
  background-attachment: fixed;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  background: #f1f5f9;
  color: var(--ink);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  display: inline-block;
  vertical-align: middle;
  line-height: 1.3;
  white-space: nowrap;
}

/* ========================================================
   LOGIN VIEW (Neumorphic & Frosted Glass)
======================================================== */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: transparent;
}

.login-brand {
  min-height: 100%;
  padding: 64px 60px 56px;
  background: linear-gradient(145deg, #163f31 0%, #0f2d22 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.login-brand::after {
  content: "";
  position: absolute;
  right: -100px;
  bottom: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.22) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  height: 46px;
  width: 46px;
  background: var(--orange-gradient);
  color: #ffffff;
  border-radius: 14px;
  border: 0;
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.35);
  display: grid;
  place-items: center;
  font-family: Manrope, sans-serif;
  font-size: 22px;
  font-weight: 800;
}

.brand-copy strong {
  font: 800 18px/1 Manrope, sans-serif;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.brand-copy small, .eyebrow {
  display: block;
  margin-top: 4px;
  color: #cbd5e1;
  font-size: 11px;
  letter-spacing: 1.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-pitch {
  margin: auto 0;
  max-width: 620px;
}

.login-pitch h1 {
  margin: 24px 0 26px;
  max-width: 550px;
  font: 800 clamp(38px, 4vw, 56px)/1.08 Manrope, sans-serif;
  letter-spacing: -2px;
}

.login-pitch p {
  color: #cbd5e1;
  font-size: 19px;
  line-height: 1.65;
  max-width: 560px;
}

.login-tagline {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
}

.login-form-wrap {
  display: grid;
  place-items: center;
  padding: 48px;
  background: transparent;
}

.login-form {
  width: min(100%, 540px);
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 44px;
  box-shadow: var(--neu-flat);
}

.login-form h2 {
  margin: 0;
  font: 800 34px/1.15 Manrope, sans-serif;
  letter-spacing: -1.2px;
  color: var(--ink);
}

.login-form > p {
  margin: 8px 0 28px;
  color: var(--muted);
  font-size: 16px;
}

.portal-choice {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  margin: -10px 0 24px;
  background: #edf2f7;
  border-radius: 16px;
  box-shadow: var(--neu-inset);
}

.portal-choice button {
  border: 0;
  border-radius: 12px;
  padding: 11px 8px;
  color: #64748b;
  background: transparent;
  font-weight: 700;
  font-size: 14px;
  transition: all 0.2s ease;
}

.portal-choice button.selected {
  color: #ea580c;
  background: #ffffff;
  box-shadow: 2px 4px 12px rgba(160, 175, 195, 0.15), -2px -2px 8px #ffffff;
}

/* ========================================================
   INPUTS & BUTTONS (Neumorphic Inset & Glowing Elevated)
======================================================== */
label {
  color: #1e293b;
  font-weight: 700;
  font-size: 14px;
  display: block;
  margin: 0 0 8px;
}

.field {
  position: relative;
  margin-bottom: 22px;
}

.field > .field-icon {
  position: absolute;
  left: 18px;
  top: 42px;
  color: #94a3b8;
  font-size: 17px;
  pointer-events: none;
}

/* Precision Input Wrap with Embedded Centered Icons & Toggles */
.input-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.input-wrap .field-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 16px;
  pointer-events: none;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.input-wrap .input {
  width: 100%;
  height: 52px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  color: var(--ink);
  outline: none;
  padding: 0 50px 0 46px;
  background: #fbfcfe;
  font-size: 15px;
  box-shadow: var(--neu-inset);
  transition: border 0.2s, box-shadow 0.2s, background 0.2s;
}

.input-wrap .input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15), inset 1px 1px 3px rgba(160, 175, 195, 0.08);
}

.input-wrap .toggle-pass {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  height: 34px;
  width: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  z-index: 2;
  transition: all 0.15s ease;
}

.input-wrap .toggle-pass:hover {
  color: var(--ink);
  background: #edf2f7;
}

.input {
  width: 100%;
  height: 52px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  color: var(--ink);
  outline: none;
  padding: 0 18px 0 50px;
  background: #fbfcfe;
  font-size: 15px;
  box-shadow: var(--neu-inset);
  transition: border 0.2s, box-shadow 0.2s, background 0.2s;
}

.input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15), inset 1px 1px 3px rgba(160, 175, 195, 0.08);
}

.plain-input {
  padding-left: 16px;
}

.btn {
  border: 0;
  border-radius: 14px;
  min-height: 48px;
  padding: 0 22px;
  background: var(--orange-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(234, 88, 12, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
}

.btn-block {
  width: 100%;
  height: 52px;
  font-size: 16px;
}

.form-note {
  margin: 16px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.outline-btn {
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  height: 44px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--neu-button);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.outline-btn:hover {
  border-color: #cbd5e1;
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 4px 8px 18px rgba(160, 175, 195, 0.18), -3px -3px 10px #ffffff;
}

.outline-btn.active {
  background: var(--orange-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.3);
}

.outline-btn.success {
  color: var(--success);
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.outline-btn.success:hover {
  background: #dcfce7;
  border-color: #6ee7b7;
}

.outline-btn.danger {
  color: var(--danger);
  border-color: #fecaca;
  background: #fef2f2;
}

.outline-btn.danger:hover {
  background: #fee2e2;
  border-color: #f87171;
}

/* ========================================================
   PORTAL LAYOUT (Glassmorphic Topbar & Neumorphic Sidebar)
======================================================== */
.portal {
  min-height: 100vh;
  background: transparent;
}

.portal.drawer-portal {
  display: block;
}

.portal.drawer-portal .main {
  width: 100%;
  min-width: 0;
}

.portal.drawer-portal .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 320px;
  max-width: 85vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid rgba(255, 255, 255, 0.95);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 12px 0 40px rgba(160, 175, 195, 0.16);
}

.portal.drawer-portal .sidebar.is-open {
  transform: translateX(0);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 993px) {
  .drawer-backdrop,
  .drawer-backdrop.is-visible {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }
}

.side-brand {
  height: 88px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.side-brand .brand-copy strong {
  color: var(--ink);
  font-size: 16px;
}

.side-brand .brand-copy small {
  color: var(--muted);
}

.drawer-close-btn {
  border: 0;
  background: #f1f5f9;
  color: var(--ink);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-left: auto;
  box-shadow: var(--neu-button);
}

.drawer-close-btn:hover {
  background: #e2e8f0;
}

/* ========================================================
   NAVIGATION (Warm Glowing Neumorphic Active Pill)
======================================================== */
.nav {
  padding: 22px 18px;
  display: grid;
  gap: 6px;
  overflow-y: auto;
}

.nav button {
  border: 0;
  background: transparent;
  color: #475569;
  border-radius: 16px;
  height: 52px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav button:hover {
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 4px 6px 14px rgba(160, 175, 195, 0.12), -3px -3px 8px #ffffff;
  color: #0f172a;
  transform: translateX(3px);
}

/* Matches user reference image warm glowing active pill */
.nav button.active {
  background: linear-gradient(135deg, rgba(255, 247, 237, 0.98), rgba(255, 237, 213, 0.88));
  border: 1px solid #fed7aa;
  box-shadow: 5px 8px 18px rgba(249, 115, 22, 0.16), -3px -3px 12px rgba(255, 255, 255, 0.98);
  color: #ea580c;
  font-weight: 700;
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 18px;
  color: currentColor;
}

.nav-badge {
  margin-left: auto;
  background: var(--orange-gradient);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.35);
}

/* Sidebar Accordion Sub-Navigation */
.nav-accordion-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav button.has-submenu {
  width: 100%;
  position: relative;
}

.nav-chevron {
  margin-left: auto;
  font-size: 10px;
  color: #94a3b8;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.nav button.active .nav-chevron {
  color: #ea580c;
}

.nav-chevron.is-open {
  transform: rotate(180deg);
}

.nav-sub-menu {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding-left: 24px;
  padding-top: 4px;
  padding-bottom: 6px;
  position: relative;
}

.nav-sub-menu::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 6px;
  bottom: 10px;
  width: 2px;
  background: #cbd5e1;
  border-radius: 2px;
}

.nav-sub-menu.is-open {
  display: flex;
  animation: submenuSlide 0.2s ease-out;
}

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

.sub-nav-item {
  border: 0;
  background: transparent;
  color: #64748b;
  border-radius: 12px;
  min-height: 42px;
  height: auto;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  transition: all 0.15s ease;
  cursor: pointer;
}

.sub-nav-item:hover {
  background: rgba(255, 255, 255, 0.8);
  color: #0f172a;
}

.sub-nav-item.active {
  background: #ffedd5;
  color: #ea580c;
  font-weight: 700;
}

.sub-bullet {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1;
}

.sub-nav-item.active .sub-bullet {
  color: #ea580c;
}

/* Sidebar Profile Footer (Elevated Soft Neumorphism) */
.sidebar-footer {
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  margin-top: auto;
  padding: 20px 24px 24px;
  background: transparent;
}

.profile {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 4px 6px 16px rgba(160, 175, 195, 0.1), -3px -3px 10px #ffffff;
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fed7aa, #fdba74);
  color: #9a3412;
  font: 700 17px Manrope, sans-serif;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.2);
}

.avatar.operator-avatar {
  background: linear-gradient(135deg, #bfdbfe, #93c5fd);
  color: #1e40af;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.profile-text {
  min-width: 0;
}

.profile-text strong, .profile-text span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-text strong {
  font-size: 14px;
  color: var(--ink);
  font-weight: 700;
}

.profile-text span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.sign-out {
  color: #64748b;
  border: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.7);
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-shadow: 2px 3px 8px rgba(160, 175, 195, 0.08), -2px -2px 6px #ffffff;
  transition: all 0.15s ease;
}

.sign-out:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
  transform: translateY(-1px);
}

/* ========================================================
   TOPBAR HEADER (Matches Reference Image Royal Blue Pill)
======================================================== */
.topbar {
  min-height: 76px;
  margin: var(--card-gap) clamp(0.5cm, 3vw, 1.2cm) 0;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--card-gap);
  background: var(--blue-header-gradient);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(37, 99, 235, 0.28), 0 2px 6px rgba(0, 0, 0, 0.04);
  color: #ffffff;
  position: relative;
  z-index: 10;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-sizing: border-box;
}

.topbar-brand-zone {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.nav-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 14px;
  height: 44px;
  width: 44px;
  padding: 0;
  color: #ffffff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.nav-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.hamburger-icon {
  font-size: 20px;
  line-height: 1;
  color: #ffffff;
}

.nav-btn-text {
  display: none;
}

.topbar-headings {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.console-label {
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 1.2px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.console-title {
  font-size: 19px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  margin-top: 1px;
}

.topbar-right-zone {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vw, 16px);
  flex: 0 0 auto;
}

/* Profile Badge & Clickable Navigation */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  font-weight: 700;
  padding: 8px 18px;
  font-size: 13px;
  flex: 0 0 auto;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.08);
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.role-badge:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), 0 6px 16px rgba(0, 0, 0, 0.12);
}

.role-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

.role-badge-name {
  display: inline-block;
  line-height: 1;
  font-weight: 700;
}

.role-badge-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  opacity: 0.85;
  margin-left: 2px;
  transform: translateY(0.5px);
  line-height: 1;
  transition: transform 0.2s ease;
}

.role-badge.admin,
.role-badge.operator,
.role-badge.agent {
  background: rgba(255, 255, 255, 0.22);
}

.topbar-bell-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: grid;
  place-items: center;
  font-size: 16px;
  color: #fff;
  cursor: pointer;
  position: relative;
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.topbar-bell-btn .bell-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 3px;
  border: 2px solid #2563eb;
}

/* ========================================================
   MAIN CONTENT AREA & CARDS (Min 0.5cm - Max 1.2cm Distance)
======================================================== */
.content {
  padding: var(--card-space-y) clamp(0.5cm, 3vw, 1.2cm) clamp(0.5cm, 4vw, 1.2cm);
  max-width: 1640px;
  margin: 0 auto;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--card-gap);
  margin-bottom: var(--card-space-y);
}

.page-heading h1 {
  margin: 0;
  font: 800 34px/1.15 Manrope, sans-serif;
  letter-spacing: -1.5px;
  color: var(--ink);
}

.page-heading p {
  color: var(--muted);
  margin: 6px 0 0;
  font-size: 16px;
  font-weight: 500;
}

/* Metric Cards (Matches Reference Image with colored accent bars & precise gap) */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--card-gap);
  margin-bottom: var(--card-space-y);
}

.metrics.metrics-5 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--card-gap);
}

.metric {
  min-height: 140px;
  padding: 24px 26px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 22px;
  box-shadow: var(--neu-flat);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric:hover {
  transform: translateY(-3px);
  box-shadow: var(--neu-hover);
}

.metric h3 {
  color: var(--muted);
  margin: 0;
  font-size: 11px;
  letter-spacing: 1.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric p {
  margin: 16px 0 0;
  font: 800 32px/1 Manrope, sans-serif;
  letter-spacing: -0.8px;
  color: var(--ink);
}

.metric.earnings p {
  color: var(--orange-accent);
}

.metric.highlight p {
  color: var(--primary-blue);
}

/* Colored accent bar indicator at card bottom (as in reference image) */
.metric::after {
  content: "";
  position: absolute;
  left: 26px;
  bottom: 18px;
  width: 34px;
  height: 3px;
  border-radius: 2px;
  background: #2563eb;
}

.metric.earnings::after {
  background: #ea580c;
}

.metric.highlight::after {
  background: #0284c7;
}

/* Soft Neumorphic Standard Card & Dynamic Table Container */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--neu-flat);
  margin-bottom: var(--card-space-y);
  transition: padding-bottom 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.table-wrap,
.table-wrap {
  overflow-x: auto;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;
  min-height: auto;
  padding-bottom: 0;
  position: relative;
  transition: padding-bottom 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.table-wrap.dropdown-active {
  padding-bottom: 280px !important;
}

.data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  text-align: left;
}

.data-table td {
  border-top: 1px solid #f1f5f9;
  padding: 16px 20px;
  font-size: 14px;
  vertical-align: middle;
  text-align: left;
  line-height: 1.4;
  position: relative;
}

.data-table td:last-child {
  overflow: visible;
  position: relative;
}

.data-table th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.8px;
  font-weight: 800;
  text-transform: uppercase;
  text-align: left;
  padding: 16px 20px;
  white-space: nowrap;
  background: rgba(248, 250, 252, 0.85);
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

.data-table td {
  border-top: 1px solid #f1f5f9;
  padding: 16px 20px;
  font-size: 14px;
  vertical-align: middle;
  text-align: left;
  line-height: 1.4;
}

.data-table tr:hover td {
  background: rgba(241, 245, 249, 0.6);
}

.agent-name {
  max-width: 220px;
  line-height: 1.35;
}

.money {
  white-space: nowrap;
}

.total {
  font-weight: 800;
}

/* Status Badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  font-weight: 700;
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.status.approved, .status.completed, .status.active {
  background: var(--success-bg);
  color: var(--success);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.12);
}

.status.pending {
  background: var(--warning-bg);
  color: var(--warning);
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.12);
}

.status.frozen, .status.rejected {
  background: var(--danger-bg);
  color: var(--danger);
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.12);
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ========================================================
   CONSOLIDATED & COMPANY ANALYTICS (Fixed Alignment & Layout)
======================================================== */
.consolidated-analytics-card {
  border-radius: 26px;
  overflow: hidden;
  box-shadow: var(--neu-flat);
  border: 1px solid rgba(255, 255, 255, 0.95);
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  margin-bottom: var(--card-space-y);
}

.consolidated-header {
  padding: 24px 28px;
  background: var(--blue-header-gradient);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.consolidated-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.consolidated-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
}

.consolidated-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #e2e8f0;
}

.consolidated-stat {
  background: #ffffff;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.consolidated-stat label,
.consolidated-stat .stat-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0;
}

.consolidated-stat .val,
.consolidated-stat .stat-num {
  font: 800 26px/1.2 Manrope, sans-serif;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.consolidated-stat small {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* Clean, fully visible distribution rail section */
.consolidated-rail-section,
.rail-distribution-bar {
  padding: 22px 28px !important;
  background: #f8fafc !important;
  border-top: 1px solid #e2e8f0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  height: auto !important;
  min-height: 80px !important;
  overflow: visible !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.rail-distribution-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.rail-bar-track {
  height: 12px;
  width: 100%;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  display: flex;
  box-shadow: var(--neu-inset);
}

.rail-segment {
  height: 100%;
  transition: width 0.3s ease;
}

.rail-segment.comp-1 { background: #10b981; }
.rail-segment.comp-2 { background: #2563eb; }
.rail-segment.comp-3 { background: #ea580c; }
.rail-segment.comp-4 { background: #8b5cf6; }
.rail-segment.comp-5 { background: #ec4899; }

.rail-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink);
}

.rail-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-secondary);
}

.rail-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.rail-dot.comp-1 { background: #10b981; }
.rail-dot.comp-2 { background: #2563eb; }
.rail-dot.comp-3 { background: #ea580c; }
.rail-dot.comp-4 { background: #8b5cf6; }
.rail-dot.comp-5 { background: #ec4899; }

.company-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--card-gap);
  margin-bottom: var(--card-space-y);
}

.company-analytics-card {
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--neu-flat);
  border: 1px solid rgba(255, 255, 255, 0.95);
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.company-analytics-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--neu-hover);
}

.comp-analytics-header {
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.analytics-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 20px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}

.analytics-stat-box {
  background: #ffffff;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #edf2f7;
  box-shadow: var(--neu-button);
}

.analytics-stat-box .stat-lbl {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.analytics-stat-box .stat-val {
  font: 800 20px/1.2 Manrope, sans-serif;
  color: var(--ink);
}

.analytics-stat-box .stat-val.earnings {
  color: #ea580c;
}

.comp-analytics-footer {
  padding: 16px 24px;
  background: rgba(248, 250, 252, 0.8);
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

/* ========================================================
   ACTIVITY LEDGER CARDS & PAGINATION (Glassmorphism + Neumorphism)
======================================================== */
.activity-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: var(--card-space-y);
  flex-wrap: wrap;
}

.date-filter {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.date-filter label {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--muted);
}

.date-filter input {
  height: 44px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  background: #fbfcfe;
  box-shadow: var(--neu-inset);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  padding: 10px;
  cursor: pointer;
}

.text-button:hover {
  color: var(--ink);
}

.activity-kind {
  font-size: 11px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.recharge-kind {
  background: #e0f2fe;
  color: #0369a1;
}

.bill-kind {
  background: #ffedd5;
  color: #c2410c;
}

.activity-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--card-gap);
  margin-top: 16px;
  margin-bottom: var(--card-space-y);
}

.activity-card {
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 22px;
  padding: 22px 24px;
  box-shadow: var(--neu-flat);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.activity-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--neu-hover);
  border-color: #cbd5e1;
}

.activity-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.activity-card-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.activity-card-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-card-agent-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #e2e8f0;
}

.activity-card-financials {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--neu-inset);
}

.activity-fin-item label {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.8px;
  display: block;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.activity-fin-item .fin-val {
  font: 800 16px/1.2 Manrope, sans-serif;
  color: var(--ink);
}

.activity-fin-item .fin-val.green {
  color: #10b981;
}

.activity-fin-item .fin-val.orange {
  color: #ea580c;
}

.activity-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 8px;
}

/* Glassmorphic & Neumorphic Pagination Bar */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: var(--card-space-y);
  padding: 18px 24px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: var(--neu-flat);
}

.pagination-info {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--neu-button);
  transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--orange-gradient);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
  transform: translateY(-1px);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.pagination-page-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--neu-button);
  transition: all 0.15s ease;
}

.pagination-page-btn:hover:not(.active-page) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.pagination-page-btn.active-page {
  background: var(--orange-gradient);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
}

/* ========================================================
   3-COMPANY AGENT CARDS GRID & DIRECT QR CARD VIEWS
======================================================== */
.company-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--card-gap);
  margin-bottom: var(--card-space-y);
  align-items: start;
}

.company-card {
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--neu-flat);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  max-width: 100%;
}

.company-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--neu-hover);
  border-color: #cbd5e1;
}

.comp-header {
  padding: 24px 26px 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.comp-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.comp-badge.comp-1 {
  background: #dcfce7;
  color: #15803d;
}

.comp-badge.comp-2 {
  background: #dbeafe;
  color: #1d4ed8;
}

.comp-badge.comp-3 {
  background: #ffedd5;
  color: #c2410c;
}

.comp-title {
  font: 800 20px/1.2 Manrope, sans-serif;
  margin: 6px 0 0;
  color: var(--ink);
}

.comp-tagline {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.comp-balance-row {
  padding: 18px 26px;
  background: rgba(248, 250, 252, 0.8);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
}

.comp-balance-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.comp-balance-val {
  font: 800 24px/1 Manrope, sans-serif;
  color: var(--bright-green);
  margin: 4px 0 0;
}

/* Live direct image box */
.card-image-box {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image-element {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

/* Expansion Section for Company-Specific Transactions */
.card-expansion {
  display: block;
  padding: 24px 26px;
  border-top: 1px solid #f1f5f9;
  background: #ffffff;
}

.comp-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 12px;
}

.comp-tab-btn {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 12px;
  box-shadow: var(--neu-button);
  transition: all 0.15s ease;
}

.comp-tab-btn.active {
  background: var(--orange-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.3);
}

/* Dashboard Filter Bar (Neumorphic Floating Pill) */
.dashboard-filter-bar {
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 16px 24px;
  margin-bottom: var(--card-space-y);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--neu-flat);
}

.filter-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-bar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.filter-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.preset-chip {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #475569;
  box-shadow: var(--neu-button);
}

.preset-chip:hover {
  border-color: #cbd5e1;
  color: #0f172a;
  transform: translateY(-1px);
}

.preset-chip.active-chip {
  background: var(--orange-gradient);
  color: #fff;
  border-color: transparent;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.35);
}

/* Toggle Switch Component for Manage Relation */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.22s ease;
  border-radius: 999px;
  box-shadow: var(--neu-inset);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--orange-gradient);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

.toggle-status-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  transition: color 0.2s ease;
}

.toggle-status-label.is-on {
  color: #059669;
}

.toggle-status-label.is-off {
  color: var(--muted);
}

/* Form Cards & Two-Column Security Layout */
.form-card {
  padding: 34px 36px;
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  box-shadow: var(--neu-flat);
}

.account-card {
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  padding: 34px 32px;
  box-shadow: var(--neu-flat);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-card h3 {
  margin: 4px 0 0;
  font: 800 22px/1.2 Manrope, sans-serif;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.account-card .email {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.account-card .rules {
  margin: 18px 0 0;
  padding-left: 20px;
  color: var(--ink-secondary);
  font-size: 13.5px;
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr);
  align-items: start;
  gap: var(--card-gap);
  margin-bottom: var(--card-space-y);
}

.form-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--card-gap);
}

.recharge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--card-gap);
  margin-bottom: var(--card-space-y);
}

.bill-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.75fr);
  align-items: start;
  gap: var(--card-gap);
  margin-bottom: var(--card-space-y);
}

.agent-balance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(290px, 0.75fr);
  gap: var(--card-gap);
  margin-bottom: var(--card-space-y);
}

/* ========================================================
   ADMIN QR MANAGEMENT / COMPANY CARDS GRID (Contained & Clean)
======================================================== */
.admin-company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--card-gap);
  margin-bottom: var(--card-space-y);
  align-items: start;
}

.admin-company-card {
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  overflow: hidden;
  padding: 26px;
  box-shadow: var(--neu-flat);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  max-width: 100%;
}

.admin-company-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--neu-hover);
}

.admin-image-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 360px;
  border-radius: 18px;
  overflow: hidden;
  margin: 12px 0 16px;
  border: 1px solid #e2e8f0;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--neu-inset);
  position: relative;
}

.admin-image-preview img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.upload-btn-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-blue);
  cursor: pointer;
  background: rgba(248, 250, 252, 0.8);
  transition: all 0.15s ease;
}

.upload-btn-label:hover {
  background: #eff6ff;
  border-color: var(--primary-blue);
}

.upload-btn-label input {
  display: none;
}

/* ========================================================
   MODALS & TOASTS (Glassmorphic & Soft Floating)
======================================================== */
.modal-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: min(100%, 540px);
  border-radius: 28px;
  padding: 36px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.98);
  box-shadow: 0 25px 80px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.8);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.modal h2 {
  margin: 0;
  font: 800 26px/1.2 Manrope, sans-serif;
  letter-spacing: -0.8px;
  color: var(--ink);
}

.modal p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.icon-btn {
  border: 0;
  border-radius: 12px;
  height: 36px;
  width: 36px;
  background: #f1f5f9;
  color: var(--ink);
  font-size: 20px;
  box-shadow: var(--neu-button);
}

.icon-btn:hover {
  background: #e2e8f0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}

.secondary-btn {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  min-height: 48px;
  padding: 0 20px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--neu-button);
}

.secondary-btn:hover {
  background: #f8fafc;
}

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 1100;
  max-width: min(440px, calc(100vw - 40px));
  padding: 16px 20px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  font-weight: 600;
  font-size: 14px;
  backdrop-filter: blur(12px);
  animation: slidein 0.25s ease-out;
}

.toast.error {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

@keyframes slidein {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: none; }
}


/* ========================================================
   COMPREHENSIVE MOBILE RESPONSIVE ENGINE (Phones & Tablets)
======================================================== */

/* Prevent mobile horizontal overflow & enable smooth touch scroll */
html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

/* Base Mobile Overrides (< 992px) */
@media (max-width: 992px) {
  :root {
    --card-gap: 16px;
    --card-space-y: 20px;
  }

  .login {
    grid-template-columns: 1fr;
    min-height: 100vh;
    padding: 20px 16px;
  }

  .login-brand {
    display: none;
  }

  .login-form-wrap {
    padding: 28px 20px;
    border-radius: 24px;
    margin: 0 auto;
    width: 100%;
    max-width: 480px;
  }

  .topbar {
    margin: 12px 14px 0;
    padding: 10px 16px;
    border-radius: 18px;
  }

  .content {
    padding: 16px 14px 28px;
    max-width: 100%;
  }

  .company-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .admin-company-grid {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .company-analytics-grid {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .two-column,
  .recharge-grid,
  .bill-grid,
  .agent-balance-grid {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .consolidated-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet & Mobile Breakpoint (< 768px) */
@media (max-width: 768px) {
  /* Prevent iOS zoom on input focus */
  input, select, textarea, .input {
    font-size: 16px !important;
  }

  .page-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-heading h1 {
    font-size: 26px;
    letter-spacing: -0.8px;
  }

  .page-heading p {
    font-size: 14px;
  }

  .topbar {
    margin: 10px 10px 0;
    padding: 8px 12px;
    min-height: 56px;
  }

  .topbar-brand-zone {
    gap: 10px;
  }

  .topbar-headings .console-label {
    font-size: 9px;
    letter-spacing: 1px;
  }

  .topbar-headings .console-title {
    font-size: 15px;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }

  .role-badge {
    padding: 6px 12px;
    font-size: 12px;
    gap: 5px;
  }

  .role-badge-name {
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Navigation Drawer on Mobile */
  .portal.drawer-portal .sidebar {
    width: min(85vw, 320px);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.35);
  }

  .side-brand {
    padding: 18px 16px 14px;
  }

  .nav {
    padding: 10px 12px;
    gap: 6px;
  }

  .nav-btn {
    min-height: 46px;
    padding: 10px 14px;
    font-size: 14px;
  }

  .drawer-portal .profile-footer {
    padding: 14px 16px;
  }

  /* Filter Bars Responsive Flex Wrap */
  .filter-bar,
  [style*="display:flex"][style*="justify-content:space-between"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .preset-group,
  .timeframe-presets {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    gap: 6px;
    width: 100%;
    scrollbar-width: none;
  }

  .preset-group::-webkit-scrollbar,
  .timeframe-presets::-webkit-scrollbar {
    display: none;
  }

  .preset-chip {
    flex-shrink: 0;
    min-height: 38px;
    padding: 0 14px;
    font-size: 12px;
  }

  /* Table Containers with Touch Scroll Hints */
  .table-wrap {
    border-radius: 18px;
    box-shadow: var(--neu-flat);
    position: relative;
  }

  .data-table {
    min-width: 900px;
  }

  .data-table th,
  .data-table td {
    padding: 12px 14px;
    font-size: 13px;
  }

  /* Form & Card Elements */
  .card {
    border-radius: 20px;
  }

  .company-card {
    border-radius: 22px;
  }

  .company-card-header {
    padding: 18px 18px 14px;
  }

  .company-card-body {
    padding: 18px;
  }

  .tab-group,
  .portal-choice {
    gap: 6px;
  }

  .tab-btn,
  .portal-choice button {
    min-height: 44px;
    font-size: 13px;
  }

  /* Modals on Mobile */
  .modal-backdrop {
    padding: 12px;
    align-items: flex-end;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    padding: 22px 18px !important;
    border-radius: 24px 24px 18px 18px !important;
    max-height: 90vh !important;
  }

  .modal-top h2 {
    font-size: 20px;
  }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 10px;
    margin-top: 20px;
  }

  .modal-actions button {
    width: 100% !important;
    min-height: 46px;
  }

  /* Toast Notification on Mobile */
  .toast {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    bottom: 16px !important;
    width: min(92vw, 420px) !important;
    text-align: center;
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 13px;
  }
}

/* Small Smartphone Breakpoint (< 480px) */
@media (max-width: 480px) {
  .content {
    padding: 12px 8px 24px;
  }

  .topbar {
    margin: 8px 8px 0;
    padding: 8px 10px;
  }

  .topbar-headings .console-title {
    font-size: 14px;
    max-width: 140px;
  }

  .metrics {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .metric {
    min-height: 115px;
    padding: 18px 18px;
    border-radius: 18px;
  }

  .metric p {
    font-size: 26px;
    margin-top: 10px;
  }

  .consolidated-grid {
    grid-template-columns: 1fr;
  }

  .consolidated-header {
    padding: 16px 18px;
  }

  .consolidated-stat {
    padding: 16px 18px;
  }

  .consolidated-stat .val {
    font-size: 22px;
  }

  .activity-card-financials {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .activity-fin-item {
    padding: 10px 12px;
  }

  .activity-fin-item .fin-val {
    font-size: 16px;
  }

  .form-pair {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .btn, .secondary-btn, .outline-btn {
    min-height: 44px;
  }

  .login-form-wrap {
    padding: 22px 16px;
    border-radius: 20px;
  }

  .login-form h2 {
    font-size: 22px;
  }
}

/* ========================================================
   MODAL ALERTS, INPUT HINTS, BADGES & TABLE UTILITIES
======================================================== */
.alert-box,
.modal-alert {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 14px;
}

.alert-box.error,
.modal-alert.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.alert-box.success,
.modal-alert.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #16a34a;
}

.alert-box.info,
.modal-alert.info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
}

.input-hint {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  line-height: 1.3;
}

.input-hint.info {
  color: #64748b;
}

.input-hint.error {
  color: #dc2626;
}

.input-hint.valid {
  color: #16a34a;
}

.no-image-badge {
  color: var(--muted, #94a3b8);
  font-size: 12px;
  font-weight: 500;
}

.image-preview-thumbnail-btn {
  border: 1px solid #cbd5e1;
  padding: 3px 6px;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.image-preview-thumbnail-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.table-empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted, #64748b);
  font-size: 14px;
  font-weight: 600;
}

/* ========================================================
   AGENT ROW UNIFIED ACTION DROPDOWN MENU
======================================================== */
.action-dropdown {
  position: relative;
  display: inline-block;
  text-align: right;
}

.action-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #174c38 0%, #0e3325 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 10px rgba(23, 76, 56, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.25);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.action-dropdown-btn:hover,
.action-dropdown-btn.is-active {
  background: linear-gradient(135deg, #1f634a 0%, #174c38 100%);
  box-shadow: 0 6px 18px rgba(23, 76, 56, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.action-dropdown-btn .dropdown-caret {
  font-size: 10px;
  transition: transform 0.2s ease;
  display: inline-block;
}

.action-dropdown-btn.is-active .dropdown-caret {
  transform: rotate(180deg);
}

.action-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18), 0 6px 14px rgba(15, 23, 42, 0.08);
  padding: 8px 0;
  z-index: 1050;
  display: none;
  flex-direction: column;
  text-align: left;
}

.action-dropdown-menu.is-open {
  display: flex !important;
  animation: dropdownPop 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownPop {
  0% {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.action-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 18px;
  border: 0;
  background: transparent;
  color: var(--ink, #0f172a);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.action-menu-item:hover {
  background: #f8fafc;
  color: #0f172a;
}

.action-menu-item .menu-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  font-size: 15px;
  flex-shrink: 0;
}

.action-menu-item.success {
  color: #059669;
}

.action-menu-item.success:hover {
  background: #ecfdf5;
  color: #047857;
}

.action-menu-item.warning {
  color: #d97706;
}

.action-menu-item.warning:hover {
  background: #fffbeb;
  color: #b45309;
}

.action-menu-item.danger {
  color: #dc2626;
}

.action-menu-item.danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.action-menu-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 6px 0;
}


