/* ============================================================
   TELEGRAM STORE BOT - FIXED VIEWPORT & INTERNAL LOG SCROLL
   No outer page scrolling: 100vh single-screen application with
   smooth internal log & table scrolling.
   ============================================================ */

/* DARK MODE (PITCH BLACK & SLATE GLOW) */
body.dark-theme {
  --bg-main: #000000;
  --bg-sidebar: #080808;
  --bg-card: #0d0d10;
  --bg-card-hover: #141418;
  --bg-input: #0a0a0d;
  --border-color: #222228;
  --border-color-hover: #363640;
  --border-color-glow: rgba(0, 112, 243, 0.4);

  --text-main: #ffffff;
  --text-body: #e4e4e7;
  --text-muted: #94949e;
  --text-dim: #5e5e68;

  --accent-primary: #0070f3;
  --accent-cyan: #00dfd8;
  --accent-purple: #7928ca;
  --accent-pink: #ff0080;
  --accent-green: #50e3c2;
  --accent-orange: #f5a623;
  --accent-red: #ff4d4f;

  --active-nav-bg: #15151a;
  --active-nav-text: #ffffff;
  --active-nav-border: #0070f3;

  --shadow-card: 0 0 0 1px #222228, 0 8px 26px rgba(0, 0, 0, 0.5);
}

/* LIGHT MODE (ULTRA CLEAN MINIMALIST SLATE & PEARL) */
body.light-theme {
  --bg-main: #f6f8fb;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #f1f5f9;
  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;
  --border-color-glow: rgba(0, 112, 243, 0.2);

  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --accent-primary: #0070f3;
  --accent-cyan: #0284c7;
  --accent-purple: #7928ca;
  --accent-pink: #ec4899;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;

  --active-nav-bg: #eff6ff;
  --active-nav-text: #0070f3;
  --active-nav-border: #0070f3;

  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
}

:root {
  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  --transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html, body {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

body {
  background-color: var(--bg-main);
  color: var(--text-body);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.011em;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* ============================================================
   AMBIENT GLOWING BACKGROUND (DARK & LIGHT THEMES)
   ============================================================ */
.ambient-glow-wrapper {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background: 
    radial-gradient(1000px circle at 50% -10%, rgba(0, 112, 243, 0.10), transparent 60%),
    radial-gradient(800px circle at 90% 90%, rgba(121, 40, 202, 0.08), transparent 60%),
    #08080a;
}

body.light-theme .ambient-glow-wrapper {
  background: 
    radial-gradient(1100px circle at 50% -10%, rgba(0, 112, 243, 0.05), transparent 60%),
    radial-gradient(900px circle at 90% 90%, rgba(121, 40, 202, 0.03), transparent 60%),
    #f6f8fb;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.16;
  animation: floatAmbient 22s ease-in-out infinite alternate;
  will-change: transform;
  pointer-events: none;
}

body.light-theme .ambient-orb {
  display: none;
}

.ambient-orb-1 {
  width: 600px;
  height: 600px;
  top: -100px;
  right: 5%;
  background: radial-gradient(circle, #0070f3 0%, #7928ca 60%, transparent 80%);
  animation-duration: 24s;
}

.ambient-orb-2 {
  width: 650px;
  height: 650px;
  bottom: -150px;
  left: 5%;
  background: radial-gradient(circle, #0070f3 0%, #00dfd8 50%, transparent 80%);
  animation-duration: 28s;
  animation-delay: -6s;
}

.ambient-orb-3 {
  display: none;
}

@keyframes floatAmbient {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(30px, -20px, 0) scale(1.04); }
  100% { transform: translate3d(-20px, 20px, 0) scale(0.96); }
}

.app-layout {
  display: flex;
  height: 100vh;
  max-height: 100vh;
  width: 100%;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* Tab Panes Animation */
.tab-pane {
  display: none;
  height: 100%;
}

.tab-pane.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  animation: tabEntrance 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tabEntrance {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.995);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Interactive Nav Item Hover & Active Animation */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-color);
  transform: translateX(3px);
}

.nav-item:hover i {
  color: var(--accent-cyan);
  transform: scale(1.15) rotate(3deg);
  transition: transform 0.2s ease;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(0, 112, 243, 0.14) 0%, rgba(0, 223, 216, 0.06) 100%);
  color: #ffffff;
  font-weight: 600;
  border-color: rgba(0, 112, 243, 0.35);
  box-shadow: inset 3px 0 0 var(--accent-cyan), 0 4px 14px rgba(0, 112, 243, 0.12);
}

.nav-item.active i {
  color: var(--accent-cyan);
  animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); filter: drop-shadow(0 0 6px rgba(0, 223, 216, 0.6)); }
}

/* Metric Cards with Floating 3D Hover & Glow */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  transition: left 0.6s ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 112, 243, 0.45);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4), 0 0 18px rgba(0, 112, 243, 0.18);
}

.metric-card:hover::before {
  left: 100%;
}

.metric-card .icon-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  transition: transform 0.25s ease;
}

.metric-card:hover .icon-badge {
  transform: scale(1.12) rotate(4deg);
}

/* Button Shimmer Wave */
.btn-primary {
  background: linear-gradient(135deg, #0070f3 0%, #00a8ff 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0058ca 0%, #0090e0 100%);
  box-shadow: 0 6px 18px rgba(0, 112, 243, 0.35);
  transform: translateY(-1.5px);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: rotate(25deg);
  transition: left 0.6s ease;
}

.btn-primary:hover::after {
  left: 140%;
}

/* Live Status Radar Pulse - Ultra Sleek Glass Pill */
.live-status-ping {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.06);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #a7f3d0;
  transition: all 0.2s ease;
}

.live-status-ping:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
  position: relative;
  flex-shrink: 0;
}

.live-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid #10b981;
  animation: radarPing 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes radarPing {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* ============================================================
   MINIMALIST LUXURY DARK LOGIN SCREEN
   ============================================================ */
.login-container {
  height: 100vh;
  max-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: transparent;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

/* Luxury Dark Login Card */
.login-card {
  width: 100%;
  max-width: 410px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 38px 34px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
  position: relative;
  z-index: 2;
  animation: modalScaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Cinematic Login Exit Animation */
.login-card.anim-exit {
  animation: loginCardExit 0.16s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.login-container.anim-fade-out {
  animation: loginViewFadeOut 0.16s ease forwards;
}

@keyframes loginViewFadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Dashboard Entrance Animation */
.app-layout.anim-entrance {
  animation: dashboardEntrance 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dashboardEntrance {
  0% { opacity: 0; transform: scale(0.995); }
  100% { opacity: 1; transform: scale(1); }
}

.app-layout.anim-entrance .sidebar {
  animation: sidebarSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes sidebarSlideIn {
  0% { opacity: 0; transform: translateX(-12px); }
  100% { opacity: 1; transform: translateX(0); }
}

.app-layout.anim-entrance .main-content {
  animation: mainContentFadeUp 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes mainContentFadeUp {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Header & Clean Icon Badge */
.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-icon-badge {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px auto;
  border-radius: 14px;
  background: rgba(0, 112, 243, 0.12);
  border: 1px solid rgba(0, 112, 243, 0.30);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 14px rgba(0, 112, 243, 0.18);
}

.login-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 4px;
}

.login-header p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Form Groups & Inputs */
.login-form .form-group {
  margin-bottom: 16px;
}

.login-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.input-wrapper .field-icon {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  font-size: 17px;
  pointer-events: none;
  z-index: 3;
}

.input-wrapper input {
  width: 100% !important;
  height: 44px !important;
  padding: 0 42px 0 42px !important;
  background-color: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-main) !important;
  font-family: var(--font-main) !important;
  font-size: 13.5px !important;
  outline: none !important;
  transition: var(--transition) !important;
}

.input-wrapper input::placeholder {
  color: var(--text-dim) !important;
}

.input-wrapper input:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 2px rgba(0, 112, 243, 0.2) !important;
}

.btn-toggle-pw {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 17px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.btn-toggle-pw:hover {
  color: var(--text-main);
}

/* Clean High-End Button */
.btn-submit-auth {
  width: 100%;
  height: 44px;
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 12px;
  box-shadow: 0 4px 14px rgba(0, 112, 243, 0.3);
}

.btn-submit-auth i {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.btn-submit-auth:hover {
  background: #0060df;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 112, 243, 0.45);
}

.btn-submit-auth:hover i {
  transform: translateX(3px);
}

.btn-submit-auth:active {
  transform: translateY(0);
}

.login-error {
  background: rgba(255, 77, 79, 0.12);
  border: 1px solid rgba(255, 77, 79, 0.35);
  color: var(--accent-red);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 14px;
  text-align: center;
}

/* Footer Security Chip */
.login-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
}

.security-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ============================================================
   SIDEBAR NAVIGATION
   ============================================================ */
.sidebar {
  width: 250px;
  min-width: 250px;
  height: 100vh;
  max-height: 100vh;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 50;
  overflow: hidden;
}

.sidebar-scroll {
  overflow-y: auto;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
}

.nav-group-header .chevron {
  font-size: 14px;
  transition: transform 0.2s ease;
}

.nav-group.collapsed .nav-group-items {
  display: none;
}

.nav-group.collapsed .chevron {
  transform: rotate(180deg);
}

.nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 11px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.nav-item i {
  font-size: 17px;
  color: var(--text-dim);
}

.nav-item:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
  border-color: var(--border-color);
}

.nav-item:hover i {
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--active-nav-bg);
  color: var(--active-nav-text);
  font-weight: 600;
  border-color: var(--border-color);
  box-shadow: inset 3px 0 0 var(--active-nav-border);
}

.nav-item.active i {
  color: var(--accent-cyan);
}

/* ============================================================
   MAIN CONTENT AREA (FIXED HEIGHT 100VH)
   ============================================================ */
.main-content {
  flex: 1;
  height: 100vh;
  max-height: 100vh;
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

/* Top Header */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.top-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

.top-header p {
  font-size: 13px;
  color: var(--text-muted);
}

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

/* Live Digital Clock Pill */
.live-clock-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-main);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.live-clock-pill:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
}

body.light-theme .live-clock-pill {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.btn-theme-toggle i {
  font-size: 15px;
  color: var(--accent-orange);
}

/* Tab Panes (Fill Space) */
.tab-pane {
  display: none;
  height: 100%;
}

.tab-pane.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Quick Action Toolbar (Compact 1-Line) */
.quick-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 12px;
  gap: 14px;
  flex-shrink: 0;
  box-shadow: var(--shadow-card);
}

.quick-action-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-action-title i {
  font-size: 20px;
  color: var(--accent-cyan);
}

.quick-action-title h4 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
}

.quick-action-title p {
  font-size: 12px;
  color: var(--text-muted);
}

.quick-action-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Metrics Grid (Clean Horizontal Balanced Cards) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

@media (max-width: 1366px) {
  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.metric-card:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.metric-icon.cyan { background: rgba(0, 223, 216, 0.12); color: var(--accent-cyan); box-shadow: 0 0 16px rgba(0, 223, 216, 0.14); }
.metric-icon.blue { background: rgba(59, 130, 246, 0.14); color: #3b82f6; box-shadow: 0 0 16px rgba(59, 130, 246, 0.16); }
.metric-icon.purple { background: rgba(168, 85, 247, 0.14); color: #c084fc; box-shadow: 0 0 16px rgba(168, 85, 247, 0.14); }
.metric-icon.orange { background: rgba(245, 166, 35, 0.14); color: var(--accent-orange); box-shadow: 0 0 16px rgba(245, 166, 35, 0.14); }

/* Center Stretched Graph filling the empty space continuously */
.metric-graph-stretch {
  flex: 1;
  height: 38px;
  min-width: 60px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: visible;
  opacity: 0.88;
  transition: all 0.3s ease;
  margin: 0 4px;
}

.metric-card:hover .metric-graph-stretch {
  opacity: 1;
  transform: scaleY(1.08);
}

.sparkline-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Right-aligned clean text information */
.metric-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  flex-shrink: 0;
  min-width: fit-content;
}

.metric-info .label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.metric-val-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 1px 0;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1.5px 6px;
  border-radius: 20px;
  font-size: 9.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.metric-badge.cyan { background: rgba(0, 223, 216, 0.12); color: var(--accent-cyan); border: 1px solid rgba(0, 223, 216, 0.25); }
.metric-badge.blue { background: rgba(59, 130, 246, 0.14); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.metric-badge.purple { background: rgba(168, 85, 247, 0.14); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.25); }
.metric-badge.orange { background: rgba(245, 166, 35, 0.12); color: var(--accent-orange); border: 1px solid rgba(245, 166, 35, 0.25); }

.metric-info h3 {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-main);
  letter-spacing: -0.025em;
  color: var(--text-main);
  white-space: nowrap;
}

.metric-info .sub {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* 2-Column Dashboard Grid (Wider Orders Table & Compact Low Stock Alert) */
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 2.35fr 1fr;
  gap: 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.dashboard-right-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

/* Panel Card with Internal Scroll */
.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.tab-pane > .panel-card {
  flex: 1;
  height: 100%;
}

.panel-header {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.panel-header h3 {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.panel-header h3 i {
  color: var(--accent-cyan);
  font-size: 16px;
}

.panel-body {
  padding: 14px 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Scrollable Table Container */
.table-responsive {
  width: 100%;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: auto;
}

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

.data-table th {
  padding: 9px 12px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--bg-card-hover);
}

.data-table tr.empty-row td,
.data-table tr.empty-row:hover td,
.data-table td.no-hover,
.data-table td.no-hover:hover {
  background: transparent !important;
}

/* Table Pagination Navigation Bar */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.pagination-info {
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-info b {
  color: var(--text-main);
  font-weight: 600;
}

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

.page-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
  color: var(--accent-primary);
}

.page-btn.active {
  background: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 112, 243, 0.4);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
}

/* Low Stock Alert List */
.stats-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.stats-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.stats-item:hover {
  border-color: rgba(0, 112, 243, 0.35);
  background: var(--bg-card-hover);
  transform: translateX(2px);
}

.stats-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.stats-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

.stats-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* System Status Mini Widget Grid */
.system-widget-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.system-widget-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.2s ease;
}

.system-widget-item:hover {
  border-color: var(--border-color-hover);
}

.system-widget-item .title {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.system-widget-item .val {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-mono);
}

/* Search Bar on Tables */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
  flex-shrink: 0;
}

.table-search {
  position: relative;
  max-width: 300px;
  width: 100%;
}

.table-search input {
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.table-search i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 14px;
}

/* Bulk Action Toolbar */
.bulk-action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 112, 243, 0.08);
  border: 1px solid rgba(0, 112, 243, 0.25);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  animation: fadeIn 0.2s ease;
}

.bulk-count-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #0070f3;
  border-radius: 4px;
  vertical-align: middle;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--text-main);
  color: var(--bg-main);
  font-weight: 600;
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 10px 18px;
  font-size: 13.5px;
}

.btn-danger {
  background: rgba(255, 77, 79, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(255, 77, 79, 0.3);
}

.btn-danger:hover {
  background: var(--accent-red);
  color: #fff;
}

/* Badges */
.badge-status {
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-status.paid, .badge-status.instock, .badge-status.active {
  background: rgba(80, 227, 194, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(80, 227, 194, 0.3);
}

.badge-status.warning {
  background: rgba(245, 166, 35, 0.14);
  color: var(--accent-orange);
  border: 1px solid rgba(245, 166, 35, 0.35);
}

.badge-status.sold, .badge-status.expired, .badge-status.blocked {
  background: rgba(255, 77, 79, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(255, 77, 79, 0.3);
}

/* Forms */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

input[type="text"],
input[type="number"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 13.5px;
  font-weight: 400;
  outline: none;
  transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--border-color-glow);
}

/* ============================================================
   PAYMENT GATEWAY MANAGER (LOYISA STYLE)
   ============================================================ */
.alert-notice {
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 16px;
  flex-shrink: 0;
}

.alert-notice i {
  font-size: 20px;
  color: var(--accent-orange);
  flex-shrink: 0;
}

.alert-notice code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  color: var(--accent-orange);
  font-family: var(--font-mono);
  font-weight: 600;
}

.input-copy-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-copy-box input {
  flex: 1;
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.project-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: var(--transition);
}

.project-card:hover {
  border-color: var(--border-color-hover);
}

.project-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: #3b82f6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.project-avatar.dana { background: #0086e0; }
.project-avatar.gopay { background: #00aa13; }
.project-avatar.orkut { background: #6366f1; }

.project-meta {
  flex: 1;
}

.project-meta h4 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

.project-code {
  font-size: 11px;
  color: var(--text-dim);
}

.project-code code {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Modern iOS Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  transition: .2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 34px;
}

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

input:checked + .slider {
  background-color: var(--accent-primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  position: relative;
  z-index: 101;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.65);
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  color: var(--text-main);
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-body {
  padding: 22px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 22px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

.toast.success { border-color: var(--accent-green); }
.toast.error { border-color: var(--accent-red); }
.toast.info { border-color: var(--accent-primary); }

/* ============================================================
   LIGHT THEME ENHANCEMENT SUITE (APPLE / LINEAR MINIMALIST STYLE)
   ============================================================ */
body.light-theme {
  background-color: #f6f8fb;
}

body.light-theme .sidebar {
  background-color: #ffffff;
  border-right: 1px solid #e2e8f0;
}

body.light-theme .nav-group-header {
  color: #94a3b8;
}

body.light-theme .nav-item {
  color: #475569;
}

body.light-theme .nav-item:hover {
  background-color: #f1f5f9;
  color: #0f172a;
  border-color: #e2e8f0;
}

body.light-theme .nav-item.active {
  background-color: #eff6ff;
  color: #0070f3;
  border-color: #bfdbfe;
  box-shadow: inset 3px 0 0 #0070f3;
}

body.light-theme .nav-item.active i {
  color: #0070f3;
}

body.light-theme .top-header {
  border-bottom: 1px solid #e2e8f0;
}

body.light-theme .owner-header-pill {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .live-status-ping {
  background: #ecfdf5 !important;
  border: 1px solid #a7f3d0 !important;
  color: #047857 !important;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.1) !important;
}

body.light-theme .btn-theme-toggle {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.light-theme .btn-theme-toggle:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

body.light-theme .btn-outline {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #334155;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.light-theme .btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

body.light-theme .quick-action-bar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .metric-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .metric-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

body.light-theme .metric-icon.cyan { background: #e0f2fe; color: #0284c7; }
body.light-theme .metric-icon.green { background: #ecfdf5; color: #059669; }
body.light-theme .metric-icon.purple { background: #f3e8ff; color: #7c3aed; }
body.light-theme .metric-icon.orange { background: #fff7ed; color: #ea580c; }
body.light-theme .metric-icon.blue { background: #eff6ff; color: #0070f3; }

body.light-theme .panel-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .panel-header {
  border-bottom: 1px solid #e2e8f0;
}

body.light-theme .stats-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

body.light-theme .stats-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

body.light-theme .stats-badge.warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
}

body.light-theme .btn-icon-xs {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #475569;
}

body.light-theme .btn-icon-xs:hover {
  background: #0070f3;
  border-color: #0070f3;
  color: #ffffff;
}

body.light-theme .data-table th {
  background: #f8fafc;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}

body.light-theme .data-table td {
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

body.light-theme .data-table tr:hover td {
  background: #f8fafc;
}

body.light-theme .modal-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}

body.light-theme .modal-header,
body.light-theme .modal-footer {
  border-color: #e2e8f0;
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme input:focus,
body.light-theme select:focus,
body.light-theme textarea:focus {
  background-color: #ffffff !important;
  border-color: #0070f3 !important;
  box-shadow: 0 0 0 2px rgba(0, 112, 243, 0.15) !important;
}

body.light-theme .table-pagination {
  background: #ffffff !important;
  border-top-color: #e2e8f0 !important;
}

body.light-theme .page-btn {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #334155 !important;
}

body.light-theme .page-btn:hover:not(:disabled) {
  background: #eff6ff !important;
  border-color: #cbd5e1 !important;
  color: var(--accent-primary) !important;
}

body.light-theme .page-btn.active {
  background: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: #ffffff !important;
}

