@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@500;600;700&family=IBM+Plex+Mono:wght@700&display=swap');

:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 35, 54, 0.85);
  --border-card: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-primary: #38bdf8;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --glass-blur: blur(16px);
  --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -ms-overflow-style: none !important;  /* IE and Edge */
  scrollbar-width: none !important;  /* Firefox */
}

/* Hide scrollbars globally across Chrome, Safari, Edge, Opera, and mobile browsers */
*::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar,
div::-webkit-scrollbar,
main::-webkit-scrollbar,
nav::-webkit-scrollbar,
section::-webkit-scrollbar,
table::-webkit-scrollbar,
tbody::-webkit-scrollbar,
textarea::-webkit-scrollbar,
input::-webkit-scrollbar,
select::-webkit-scrollbar,
.table-wrapper::-webkit-scrollbar,
.modal-card::-webkit-scrollbar,
.main-content-container::-webkit-scrollbar,
.user-dropdown-menu::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
}

/* Lucide SVG Outline Icons Styling */
svg[data-lucide], i[data-lucide], [data-lucide] {
  width: 1.15em;
  height: 1.15em;
  stroke-width: 2.2px;
  vertical-align: -0.2em;
  display: inline-block;
  stroke: currentColor;
}

.icon-inline {
  color: var(--accent-primary);
  margin-right: 4px;
}

.kpi-icon svg[data-lucide], .kpi-icon i[data-lucide],
.stat-icon svg[data-lucide], .stat-icon i[data-lucide] {
  width: 22px;
  height: 22px;
  color: var(--accent-primary);
  stroke-width: 2px;
}

.nav-item-icon svg[data-lucide], .nav-item-icon i[data-lucide] {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px 0 20px;
  box-sizing: border-box;
}

/* Header Navbar - Fixed Top Zone */
header, header.app-header {
  flex-shrink: 0;
  position: relative;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-glow);
}

/* Scrollable Main Content Container - Hidden Scrollbar for Perfect Header Alignment */
.main-content-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 24px;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.main-content-container::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

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

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
}

.brand-icon img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 11px;
  filter: drop-shadow(0 4px 14px rgba(56, 189, 248, 0.4));
}

.brand-title h1 {
  font-family: var(--font-family) !important;
  font-size: 1.48rem;
  font-weight: 700 !important;
  letter-spacing: -0.025em;
  color: #ffffff !important;
  background: none !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: #ffffff !important;
  line-height: 1.15;
}

.brand-iq {
  font-family: inherit !important;
  font-weight: inherit !important;
  letter-spacing: inherit !important;
  color: #ffffff !important;
  background: none !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: #ffffff !important;
  display: inline;
}

.brand-title p {
  font-family: var(--font-family);
  font-size: 0.72rem;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin-top: 2px;
}



.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-pill {
  border-radius: 9999px;
  padding: 8px 16px;
}

/* User Menu Wrapper & Dropdown */
.user-menu-wrapper {
  position: relative;
  display: inline-block;
}

.btn-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #f8fafc;
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-user-pill:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.55);
}

.dropdown-caret-icon {
  margin-left: 2px;
  transition: transform 0.2s ease, stroke 0.2s ease;
  vertical-align: middle;
  flex-shrink: 0;
}

.btn-user-pill:hover .dropdown-caret-icon {
  stroke: #818cf8;
}

.user-menu-wrapper.active .dropdown-caret-icon {
  transform: rotate(180deg);
  stroke: #a78bfa;
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  width: 265px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.7);
  padding: 10px;
  z-index: 500;
  animation: authModalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 4px 8px 6px 8px;
}

.dropdown-quick-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 4px;
}

.quick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.quick-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 6px 20px 6px 8px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  text-align: center;
}

.quick-select:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  color: #ffffff;
}

.quick-select option {
  background: #0f172a;
  color: #ffffff;
}

.quick-btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-primary) 100%);
  border: none;
  color: #ffffff;
}

.quick-btn-primary:hover {
  opacity: 0.9;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

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

.dropdown-item-danger {
  color: #f87171;
}

.dropdown-item-danger:hover {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
}

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

/* Unified Button & Control System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  box-sizing: border-box;
  text-decoration: none;
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

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

.btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Button Variants */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-primary) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  color: #ffffff;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
}

.btn-outline:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.28);
  border-color: rgba(244, 63, 94, 0.6);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35);
}

.btn-ghost,
.btn-text {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover,
.btn-text:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Button Sizes */
.btn-lg {
  padding: 10px 20px;
  font-size: 0.92rem;
  border-radius: var(--radius-lg);
  gap: 8px;
}

.btn-md {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  gap: 6px;
}

.btn-sm,
.btn-action-sm {
  padding: 5px 11px;
  font-size: 0.78rem;
  border-radius: 6px;
  gap: 5px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 0.72rem;
  border-radius: 5px;
  gap: 4px;
}

.btn-block {
  width: 100%;
  display: flex;
}

/* Icon-Only Buttons */
.btn-icon {
  padding: 0 !important;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
}

.btn-icon.btn-lg {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 1.15rem;
}

.btn-icon.btn-md {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1rem;
}

.btn-icon.btn-sm,
.btn-action-sm.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 0.85rem;
}

.btn-icon.btn-xs {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  font-size: 0.75rem;
}

/* Filter Toolbar */
.filter-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  padding: 16px;
  border-radius: var(--radius-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.form-select, .form-input {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s ease;
  width: 100%;
}

select,
.form-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
  padding-right: 34px !important;
  cursor: pointer;
}

select:hover,
.form-select:hover {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23818cf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

select:focus,
.form-select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

select option,
.form-select option {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 8px 12px;
}

.form-select:focus, .form-input:focus {
  border-color: var(--accent-primary);
}

/* KPI Cards Grid */
.kpi-section {
  margin-bottom: 24px;
}

.kpi-hero-card {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.95) 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  margin-bottom: 16px;
  padding: 22px 24px;
}

.kpi-hero-card .kpi-header {
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}

.kpi-hero-card .kpi-title {
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: #94a3b8;
}

.kpi-hero-card .kpi-value {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 6px 0;
  background: linear-gradient(135deg, #ffffff 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.kpi-subgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-glow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
}

.kpi-card-clickable {
  cursor: pointer;
}

.kpi-card-clickable:hover {
  border-color: rgba(56, 189, 248, 0.45) !important;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.15) !important;
  transform: translateY(-3px) !important;
}

.kpi-click-hint {
  font-size: 0.72rem;
  color: var(--accent-primary);
  opacity: 0.85;
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.kpi-card-clickable:hover .kpi-click-hint {
  color: #38bdf8;
  opacity: 1;
}

.action-card:hover {
  border-color: rgba(56, 189, 248, 0.4) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.kpi-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.kpi-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Privacy Blur Effect */
.privacy-blurred {
  filter: blur(8px) !important;
  user-select: none !important;
  transition: filter 0.2s ease;
}

/* Charts Grid & Layout */
.charts-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}

.doughnut-charts-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}

.doughnut-charts-row .chart-card {
  min-width: 0;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
}

.doughnut-charts-row .chart-container {
  position: relative;
  width: 100%;
  height: clamp(180px, 20vw, 250px);
  min-height: 170px;
  max-height: 250px;
}

.chart-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-glow);
}

.chart-card-full,
.history-chart-card {
  width: 100%;
  grid-column: 1 / -1;
}

.history-chart-card .chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

.chart-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-card > h3 {
  margin-bottom: 16px;
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.history-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 9999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #34d399;
}

.timeframe-selector {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  padding: 3px;
  gap: 2px;
}

.timeframe-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timeframe-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.timeframe-btn.active {
  background: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.35);
}

.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

.search-box {
  width: 260px;
}

.input-with-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.input-with-icon .search-icon-inside {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  font-size: 0.85rem;
}

.input-with-icon input.form-input {
  padding-left: 34px !important;
}

/* Table Empty State Styling */
.empty-state-row {
  width: 100% !important;
  max-width: 100% !important;
}

.empty-state-cell {
  text-align: center !important;
  padding: 32px 16px !important;
  color: var(--text-muted) !important;
  font-size: 0.875rem !important;
  line-height: 1.6 !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  white-space: normal !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.empty-state-cell strong {
  color: var(--accent-primary) !important;
  cursor: pointer;
  display: inline-block;
  margin-top: 4px;
}

.table-wrapper {
  overflow-x: auto;
}

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

th {
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-card);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-t212 {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-primary);
}

.badge-t212-isa {
  background: rgba(14, 165, 233, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-weight: 600;
}

.badge-zerodha {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.badge-jpm-pi {
  background: rgba(30, 64, 175, 0.25);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  font-weight: 600;
}

.badge-jpm-lisa {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  font-weight: 600;
}

.badge-hdfc-fd {
  background: rgba(225, 29, 72, 0.18);
  border: 1px solid rgba(225, 29, 72, 0.4);
  color: #fb7185;
  font-weight: 600;
}

.cash-isa-live-preview-banner,
.cash-isa-live-preview-banner * {
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.badge-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

/* Modals Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #0f172a;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

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

.section-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 8px;
}

/* Mobile Navigation Bar */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
  padding: 6px 4px;
  z-index: 200;
  justify-content: space-around;
  align-items: center;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 500;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  flex: 1;
  max-width: 72px;
}

.nav-item:hover {
  color: #e2e8f0;
}

.nav-item.active {
  color: #38bdf8;
  font-weight: 600;
}

.nav-item.active .nav-item-icon {
  transform: translateY(-1px);
  color: #38bdf8;
  filter: drop-shadow(0 2px 8px rgba(56, 189, 248, 0.45));
}

.nav-item-icon {
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, color 0.2s ease, filter 0.2s ease;
}

.nav-item-icon svg {
  width: 20px;
  height: 20px;
}

.nav-item:active {
  transform: scale(0.92);
}

/* --- App Footer & Status Pill --- */
.app-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 40px;
  margin-bottom: 20px;
  text-align: center;
}

.footer-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-card);
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 0.78rem;
  color: var(--text-muted);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
  flex-shrink: 0;
}

.footer-dot-divider {
  color: rgba(255, 255, 255, 0.2);
}

.footer-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.75;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.modal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.modal-toolbar-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 280px;
}

.modal-toolbar-inputs .search-box-wrapper {
  flex: 1;
  max-width: 320px;
}

.modal-toolbar-inputs .form-select {
  width: auto;
  min-width: 140px;
  font-size: 0.85rem;
}

.modal-toolbar-kpis {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Mobile & iPad Touch safe area & responsive polish */
@media (max-width: 834px) {
  .modal-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .modal-toolbar-inputs {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    gap: 8px;
  }

  .modal-toolbar-inputs .search-box-wrapper {
    max-width: 100%;
    width: 100%;
  }

  .modal-toolbar-inputs .form-select {
    width: 100%;
    min-width: 0;
  }

  .modal-toolbar-kpis {
    width: 100%;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
  }

  .modal-kpi-divider {
    border-left: none !important;
    padding-left: 0 !important;
  }
  .app-container {
    height: 100vh;
    height: 100dvh;
    padding: max(12px, env(safe-area-inset-top)) 12px 0 12px;
  }
  
  .modal-card-xl {
    width: 100% !important;
    max-width: 100% !important;
    height: 92vh !important;
    max-height: 92vh !important;
    padding: 16px 12px !important;
    border-radius: 16px !important;
  }

  .admin-nav-tabs {
    gap: 6px;
    padding-bottom: 8px;
    margin-bottom: 12px;
  }

  .admin-tab-btn {
    padding: 0 12px !important;
    height: 32px !important;
    font-size: 0.78rem !important;
    border-radius: 16px !important;
    flex: 0 0 auto !important;
  }

  header.app-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: 16px;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-glow);
  }

  .main-content-container {
    padding-bottom: max(90px, env(safe-area-inset-bottom));
    padding-right: 0;
  }

  .brand {
    gap: 10px;
  }

  .brand-icon img {
    width: 38px;
    height: 38px;
    border-radius: 9px;
  }

  .brand-title h1 {
    font-size: 1.05rem;
  }

  .brand-title p {
    font-size: 0.68rem;
  }

  .header-controls {
    display: flex;
    align-items: center;
    width: auto;
  }

  #userNameDisplay .user-full-name {
    display: none !important;
  }

  #userNameDisplay .user-initials {
    display: inline !important;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #f8fafc;
  }

  .user-dropdown-menu {
    right: 0;
    left: auto;
    width: 250px;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 75px);
    overflow-y: auto;
  }

  /* Filter toolbar 2-column layout */
  .filter-toolbar {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
  }

  .form-group label {
    font-size: 0.7rem;
  }

  .form-select, .form-input {
    padding: 8px 10px;
    font-size: 0.8125rem;
  }

  /* iOS Finance App Style KPI Grid */
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .kpi-card {
    padding: 14px 16px;
    border-radius: var(--radius-md);
  }

  .kpi-click-hint {
    display: none !important;
  }

  /* First KPI (Total Net Worth) Spans Full Width */
  .kpi-grid .kpi-card:first-child {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.9) 100%);
    border: 1px solid rgba(56, 189, 248, 0.25);
  }

  .kpi-title {
    font-size: 0.75rem;
  }

  .kpi-icon {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .kpi-value {
    font-size: 1.4rem;
  }

  .kpi-grid .kpi-card:first-child .kpi-value {
    font-size: 1.85rem;
    background: linear-gradient(135deg, #ffffff 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .kpi-subtitle {
    font-size: 0.7rem;
  }

  /* Responsive Charts Grid */
  .charts-grid {
    gap: 14px;
    margin-bottom: 16px;
  }

  .doughnut-charts-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .chart-card {
    padding: 14px;
    border-radius: var(--radius-md);
  }

  .chart-card h3 {
    font-size: 0.9375rem;
    margin-bottom: 12px;
  }

  .chart-container {
    height: 320px;
  }

  /* Table Section */
  .table-card {
    padding: 14px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
  }

  .table-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .search-box {
    width: 100%;
  }

  th, td {
    padding: 10px 10px;
    font-size: 0.8125rem;
    white-space: nowrap;
  }

  /* iOS Bottom Touch Navigation Bar */
  .mobile-nav {
    display: flex;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  /* Touch Feedback Scale */
  .btn:active, .kpi-card:active, .nav-item:active {
    transform: scale(0.96);
    transition: transform 0.1s ease;
  }
}

/* --- Authentication Overlay & Glassmorphism Card --- */
.hidden {
  display: none !important;
}

.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 10, 19, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 10000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(18, 24, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  animation: authModalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authModalFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-brand-icon img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 12px;
  filter: drop-shadow(0 4px 14px rgba(56, 189, 248, 0.4));
  margin-bottom: 12px;
}

.auth-header h2 {
  font-family: var(--font-family) !important;
  font-size: 1.55rem;
  font-weight: 700 !important;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 40%, #e2e8f0 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  margin-bottom: 4px;
}

.auth-header p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: var(--accent-indigo);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.auth-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: 16px;
  line-height: 1.4;
}

.auth-alert.error {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fca5a5;
}

.auth-alert.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.auth-form .form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 0.9375rem;
  margin-top: 8px;
}

.user-avatar {
  font-size: 0.9rem;
}

#userNameDisplay {
  font-weight: 600;
  color: #f8fafc;
}

.user-full-name {
  display: inline;
}

.user-initials {
  display: none;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.75rem;
}

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

.btn-outline:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

/* Side-by-side Form Inputs */
.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* Modal Overlay & Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 10, 19, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  animation: authModalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fb7185;
  transform: rotate(90deg);
}

.form-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Wider Modal for Broker Settings */
.modal-card-wide {
  max-width: 640px;
}

.broker-settings-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Switch Toggle Styling */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
}

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

input:focus + .slider {
  box-shadow: 0 0 1px var(--accent-emerald);
}

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

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Unconfigured Setup Banner */
.setup-banner {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12) 0%, rgba(99, 102, 241, 0.12) 100%);
  border: 1px dashed rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  animation: authModalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.setup-banner-content {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.setup-banner-text {
  flex: 1;
  min-width: 260px;
}

.setup-banner-text h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.setup-banner-title-icon {
  font-size: 1.3rem;
}

.setup-banner-text p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.setup-banner-btn {
  padding: 12px 20px;
  font-size: 0.875rem;
  white-space: nowrap;
}

/* Chart Container Placeholder */
.chart-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.08);
}

.broker-fields {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease-in-out;
}

.account-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
}

.toggle-status-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-main);
  min-width: 52px;
}

.remove-account-btn {
  height: 38px;
  padding: 0 14px;
  color: #f43f5e !important;
  border: 1px solid rgba(244, 63, 94, 0.3) !important;
  background: rgba(244, 63, 94, 0.1) !important;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-account-btn:hover {
  background: rgba(244, 63, 94, 0.25) !important;
  color: #fb7185 !important;
  border-color: rgba(244, 63, 94, 0.5) !important;
}

.remove-account-btn svg, .remove-account-btn [data-lucide] {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2.2px;
  display: inline-block;
  vertical-align: -0.15em;
}

/* --- Toast Notification Pop Modals --- */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 2000000 !important;
  pointer-events: none;
}

.toast-card {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-card);
  animation: toastSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-card.toast-fade-out {
  opacity: 0;
  transform: translateY(-16px);
}

.toast-icon {
  font-size: 1.1rem;
}

.toast-message {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s ease;
}

.toast-close:hover {
  color: #ffffff;
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.25);
}

.toast-info {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.25);
}

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

/* --- Holdings Table Mobile Touch Cards Styling --- */
.mobile-only {
  display: none !important;
}

.desktop-only {
  display: table-cell;
}

.holding-symbol-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

.holding-name {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
}

.holding-account-tag {
  font-size: 0.75rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Tablet & iPad Landscape Optimization */
@media (max-width: 1024px) {
  .modal-card-xl {
    width: 96% !important;
    max-width: 100% !important;
    padding: 18px 16px !important;
  }

  .modal-card .table-wrapper,
  .modal-card-xl .table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 834px) {
  .mobile-only {
    display: block !important;
  }

  .desktop-only {
    display: none !important;
  }

  #userNameDisplay .user-full-name {
    display: none !important;
  }

  #userNameDisplay .user-initials {
    display: inline !important;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #f8fafc;
  }

  .table-card .table-wrapper,
  .modal-card .table-wrapper,
  .modal-card-xl .table-wrapper,
  .admin-tab-content .table-wrapper,
  .table-wrapper {
    overflow-x: hidden !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .table-card table,
  .table-card tbody,
  .table-card tr,
  .table-card td.holding-card-cell,
  .modal-card table,
  .modal-card tbody,
  .modal-card tr,
  .modal-card td.holding-card-cell,
  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td.holding-card-cell,
  .admin-table td.mobile-only,
  td.holding-card-cell,
  td.mobile-only {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .empty-state-row {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }

  .empty-state-cell {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 24px 12px !important;
    text-align: center !important;
    font-size: 0.82rem !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }

  .table-card thead,
  .modal-card thead,
  .admin-table thead {
    display: none !important;
  }

  .table-card tbody,
  .modal-card tbody,
  .admin-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  .holding-row {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--border-card) !important;
    border-radius: var(--radius-md) !important;
    padding: 14px 16px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .holding-row:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(56, 189, 248, 0.35) !important;
  }

  .holding-card-cell {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    width: 100% !important;
    max-width: 100% !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    white-space: normal !important;
  }

  .holding-card-top {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    flex-wrap: nowrap !important;
  }

  .holding-card-info {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .holding-symbol-title {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
  }

  .holding-name {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    font-size: 0.78rem !important;
    color: #94a3b8 !important;
    margin-top: 2px !important;
    max-width: 100% !important;
    line-height: 1.35 !important;
  }

  .holding-card-value {
    flex: 0 0 auto !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    text-align: right !important;
    white-space: nowrap !important;
  }

  .holding-card-bottom {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 10px !important;
    padding-top: 10px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
  }

  .holding-card-meta {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .mobile-qty-price {
    font-size: 0.72rem !important;
    color: #94a3b8 !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }

  .holding-card-pnl,
  .holding-card-bottom > .badge {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }
}

/* --- Admin Console & Breakdown Modals Full-Width Desktop Styling --- */
.modal-card-xl {
  width: calc(100vw - 64px) !important;
  max-width: 1720px !important;
  height: 90vh !important;
  max-height: 90vh !important;
  padding: 24px 28px !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.modal-card-xl .modal-header {
  flex-shrink: 0 !important;
}

.modal-card-xl .modal-toolbar {
  flex-shrink: 0 !important;
}

.modal-card-xl .table-wrapper {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  margin-bottom: 12px !important;
  -webkit-overflow-scrolling: touch;
}

.modal-card-xl .pagination-container {
  flex-shrink: 0 !important;
}

.modal-card .table-wrapper {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: auto;
  max-height: 58vh;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

.admin-nav-tabs {
  flex-shrink: 0 !important;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 10px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.admin-nav-tabs::-webkit-scrollbar {
  display: none;
}

.admin-tab-btn {
  flex: 0 0 auto !important;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  padding: 0 16px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1;
}

.admin-tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.admin-tab-btn.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35) 0%, rgba(168, 85, 247, 0.35) 100%);
  border-color: #818cf8;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.admin-tab-content:not(.hidden) {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
  padding-right: 4px;
}

.admin-tab-content.hidden {
  display: none !important;
}

#adminTabOverview.admin-tab-content:not(.hidden) {
  display: block !important;
  overflow-y: auto !important;
}

.admin-tab-content .admin-tab-toolbar {
  flex-shrink: 0 !important;
  margin-bottom: 12px !important;
}

.admin-tab-content .table-wrapper {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin-bottom: 12px !important;
}

.admin-tab-content .pagination-container {
  flex-shrink: 0 !important;
  margin-top: auto !important;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.admin-stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  backdrop-filter: var(--glass-blur);
}

.admin-stat-card .stat-icon {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.05);
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.admin-stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-tab-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table th {
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  padding: 10px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-card);
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.admin-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.role-badge {
  display: inline-block;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.col-role {
  white-space: nowrap;
}

.action-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: stretch;
  min-width: 115px;
}

.action-buttons-stack .btn {
  width: 100%;
  justify-content: flex-start;
}

.role-badge-admin {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.role-badge-user {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}


/* Live Terminal Log Console */
.admin-log-console {
  background: #070a13;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  max-height: 280px;
  overflow-y: auto;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-all;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.log-line {
  margin-bottom: 2px;
  padding: 2px 4px;
  border-radius: 4px;
}

.log-line.log-info { color: #38bdf8; }
.log-line.log-warning { color: #fbbf24; background: rgba(251, 191, 36, 0.08); }
.log-line.log-error { color: #f43f5e; background: rgba(244, 63, 94, 0.12); font-weight: 600; }
.log-line.log-debug { color: #c084fc; }

#adminAddUserModal,
#adminResetPwdModal,
#adminConfirmModal {
  z-index: 200000 !important;
}

/* --- Pagination Container Styling --- */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  color: var(--text-muted);
  gap: 12px;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  width: 100%;
  box-sizing: border-box;
}

.pagination-info {
  color: var(--text-muted);
  text-align: left;
  flex: 0 0 auto;
}

.pagination-info span {
  color: #ffffff;
  font-weight: 600;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
}

@media (max-width: 640px) {
  .pagination-container {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 10px !important;
    padding: 12px 10px !important;
  }

  .pagination-info {
    margin-right: 0 !important;
    text-align: center !important;
    width: 100% !important;
  }

  .pagination-controls {
    margin-left: 0 !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
  }
}

.pagination-page-size {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.06);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 5px 24px 5px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-page-size:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
}

.pagination-page-size option {
  background: #0f172a;
  color: #ffffff;
}

.pagination-page-num {
  font-weight: 500;
  color: var(--text-muted);
  margin: 0 4px;
}

/* Global Glassmorphic Loading Overlay Backdrop */
.global-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 10, 19, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: all;
  user-select: none;
  animation: loadingOverlayFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.icon-inline.spin {
  animation: spinRing 0.85s linear infinite;
}

.global-loading-overlay.hidden {
  display: none !important;
}

@keyframes loadingOverlayFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.loading-glass-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(18, 24, 38, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 40px rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  text-align: center;
  max-width: 380px;
  width: 90%;
}

.loading-spinner-wrapper {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.spinner-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 3px solid rgba(56, 189, 248, 0.15);
  border-top: 3px solid var(--accent-primary);
  border-right: 3px solid var(--accent-secondary);
  border-radius: 50%;
  animation: spinRing 0.85s linear infinite;
}

@keyframes spinRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-logo-pulse {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 11px;
  animation: logoPulse 1.5s ease-in-out infinite alternate;
}

@keyframes logoPulse {
  0% { transform: scale(0.92); opacity: 0.8; }
  100% { transform: scale(1.08); opacity: 1; filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.8)); }
}

.loading-overlay-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.loading-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Mobile Pull-to-Refresh Glassmorphism Indicator
   ========================================================================== */
.pull-to-refresh-container {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translate(-50%, -100%);
  z-index: 999;
  width: auto;
  max-width: 92%;
  pointer-events: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  opacity: 0;
}

.pull-to-refresh-container.active,
.pull-to-refresh-container.refreshing {
  opacity: 1;
}

.pull-to-refresh-content {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 30px;
  padding: 8px 18px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.2);
}

.pull-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-primary);
  transition: transform 0.15s ease, background 0.2s ease;
}

.pull-icon-wrapper.ready {
  background: var(--accent-primary);
  color: #0f172a;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

.pull-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
  transition: transform 0.15s ease;
}

.pull-text {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.01em;
  white-space: nowrap;
}



