/* Import Lexend Deca */
@import url('https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@300;400;500;600&display=swap');

:root {
  --primary:        #1A73E8;
  --primary-dark:   #1557B0;
  --primary-light:  #E8F0FE;
  --surface:        #FFFFFF;
  --background:     #F8F9FA;
  --border:         #DADCE0;
  --text-primary:   #202124;
  --text-secondary: #5F6368;
  --text-muted:     #9AA0A6;
  --success:        #1E8E3E;
  --warning:        #F29900;
  --danger:         #D93025;
  --live:           #34A853;
  --sidebar-w:      240px;
  --topbar-h:       64px;
  --radius:         8px;
  --shadow-card:    0 1px 2px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.08);
  --shadow-hover:   0 2px 6px rgba(0,0,0,.15);
  --shadow-popover: 0 4px 12px rgba(0,0,0,.15);
}

/* --- Dark Mode Colors --- */
[data-theme="dark"] {
  --surface:        #1E1E24;
  --background:     #121216;
  --border:         #2D2E36;
  --text-primary:   #E8EAED;
  --text-secondary: #9AA0A6;
  --text-muted:     #5F6368;
  --primary-light:  rgba(26, 115, 232, 0.15);
  
  /* Additional UI tweaks for dark theme */
  --shadow-card:    0 4px 20px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-hover:   0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-popover: 0 8px 32px rgba(0, 0, 0, 0.4);
  --border-danger: rgba(197, 34, 31, 0.3);
  --bg-danger-light: rgba(197, 34, 31, 0.15);
}

/* Scrollbar adjustment for dark theme */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border: 3px solid var(--background);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* --- Dark Theme Overrides for Components with Hardcoded Styles --- */
[data-theme="dark"] .premium-card-header {
  background: #25262E !important;
  border-bottom-color: var(--border) !important;
}
[data-theme="dark"] .member-list-table th {
  background: #25262E !important;
  border-bottom-color: var(--border) !important;
}
[data-theme="dark"] .card-header-badge {
  background: #2D2E36 !important;
  color: var(--text-secondary) !important;
}
[data-theme="dark"] .nav-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}
[data-theme="dark"] .btn-group {
  background: #2D2E36 !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .btn-group .btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}
[data-theme="dark"] .role-select {
  background-color: #2D2E36 !important;
  color: var(--text-secondary) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] select.form-control {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%239AA0A6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>") !important;
}
[data-theme="dark"] .badge-purple {
  background-color: rgba(63, 81, 181, 0.2) !important;
  color: #8C9EFF !important;
  border-color: rgba(63, 81, 181, 0.25) !important;
}
[data-theme="dark"] .badge-green {
  background-color: rgba(46, 125, 50, 0.2) !important;
  color: #81C784 !important;
  border-color: rgba(46, 125, 50, 0.25) !important;
}
[data-theme="dark"] .badge-red {
  background-color: rgba(197, 34, 31, 0.2) !important;
  color: #E57373 !important;
  border-color: rgba(197, 34, 31, 0.25) !important;
}
[data-theme="dark"] .badge-yellow {
  background-color: rgba(176, 96, 0, 0.2) !important;
  color: #FFE082 !important;
  border-color: rgba(176, 96, 0, 0.25) !important;
}
[data-theme="dark"] .badge-gray {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .btn-action-suspend {
  border-color: var(--border) !important;
  background: var(--surface) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .btn-action-suspend:hover {
  background: rgba(255, 255, 255, 0.05) !important;
}
[data-theme="dark"] .btn-action-unsuspend {
  border-color: rgba(46, 125, 50, 0.3) !important;
  background: rgba(46, 125, 50, 0.15) !important;
  color: #81C784 !important;
}
[data-theme="dark"] .btn-action-unsuspend:hover {
  background: rgba(46, 125, 50, 0.25) !important;
}
[data-theme="dark"] .btn-action-delete {
  color: var(--text-secondary) !important;
}
[data-theme="dark"] .btn-action-delete:hover {
  color: var(--danger) !important;
}
[data-theme="dark"] .status-dot {
  border-color: var(--surface) !important;
}
[data-theme="dark"] thead th {
  background: #25262E !important;
  border-bottom-color: var(--border) !important;
}
[data-theme="dark"] tbody tr:hover {
  background: rgba(255, 255, 255, 0.02) !important;
}

[data-theme="dark"] .copy-chip {
  background-color: #121216 !important;
  border-color: var(--border) !important;
  color: var(--text-secondary) !important;
}
[data-theme="dark"] .copy-chip:hover {
  background-color: var(--primary-light) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}
[data-theme="dark"] .status-pill-active {
  background-color: rgba(46, 125, 50, 0.2) !important;
  color: #81C784 !important;
}
[data-theme="dark"] .status-pill-paused {
  background-color: rgba(176, 96, 0, 0.2) !important;
  color: #FFE082 !important;
}
[data-theme="dark"] .status-pill-archived {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-secondary) !important;
}
[data-theme="dark"] select option {
  background-color: #1E1E24 !important;
  color: var(--text-primary) !important;
}

/* Autofill fixes in dark mode */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover, 
[data-theme="dark"] input:-webkit-autofill:focus, 
[data-theme="dark"] input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-primary) !important;
  transition: background-color 5000s ease-in-out 0s;
  box-shadow: inset 0 0 0 1000px var(--surface) !important;
}

[data-theme="dark"] .cron-intro-card {
  background: linear-gradient(135deg, var(--primary-light), rgba(255, 255, 255, 0.02)) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}
[data-theme="dark"] .cron-intro-title {
  color: var(--primary) !important;
}
[data-theme="dark"] .cron-intro-desc {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .sidebar-logo-inner svg rect,
[data-theme="dark"] .auth-logo svg rect {
  fill: transparent !important;
}

[data-theme="dark"] .cron-command-box {
  background-color: #121216 !important;
  border-color: var(--border) !important;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: 'Lexend Deca', sans-serif;
  background: var(--background);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

/* --- App Shell --- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow: hidden;
}
.sidebar-logo {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  gap: 10px;
  flex-shrink: 0;
}
.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
/* Hide scrollbar for sidebar nav */
.sidebar-nav::-webkit-scrollbar {
  display: none;
}

/* Custom global scrollbar for the rest of the application */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  border: 3px solid var(--background);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 20px 24px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  margin: 4px 12px;
  height: 40px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: background .15s ease, color .15s ease;
  position: relative;
}
.nav-item:hover {
  background: #f1f3f4;
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.nav-item .material-symbols-outlined {
  font-size: 20px;
  color: var(--text-secondary);
  transition: color .15s ease;
}
.nav-item:hover .material-symbols-outlined {
  color: var(--text-primary);
}
.nav-item.active .material-symbols-outlined {
  color: var(--primary);
}


/* --- Topbar --- */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 500; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
}

/* --- Main Content --- */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.page-content { padding: 24px; }

/* --- Page Headers --- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.page-title { font-size: 20px; font-weight: 500; color: var(--text-primary); }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  border-color: #DADCE0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}
.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text-primary);
}
.card-body { padding: 20px; }

/* --- Metric Cards --- */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card { padding: 22px 20px; }
.metric-label { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.metric-label .material-symbols-outlined { font-size: 16px; color: var(--primary); }
.metric-value { font-size: 32px; font-weight: 600; color: var(--text-primary); line-height: 1; margin-bottom: 8px; letter-spacing: -0.02em; }
.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 100px;
  width: fit-content;
}
.metric-delta .material-symbols-outlined { font-size: 14px !important; }
.delta-up   { background: #E6F4EA; color: var(--success); }
.delta-down { background: #FCE8E6; color: var(--danger); }
.delta-neutral { background: var(--background); color: var(--text-secondary); }


/* --- Live Dot --- */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--live);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(52, 168, 83, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 168, 83, 0); }
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 36px;
  border-radius: 4px;
  font-family: 'Lexend Deca', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s, box-shadow .15s;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--background); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c5221f; }
.btn-sm { height: 28px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn .material-symbols-outlined { font-size: 18px; }
.btn-icon-only { width: 32px; height: 32px; padding: 0; justify-content: center; }
.btn-icon-only.btn-sm { width: 28px; height: 28px; }
.btn-icon-only .material-symbols-outlined { margin: 0; font-size: 16px; }

/* --- Segmented Button Group --- */
.btn-group {
  display: inline-flex;
  border-radius: 6px;
  background: #F1F3F4;
  padding: 3px;
  border: 1px solid #DADCE0;
  gap: 2px;
}
.btn-group .btn {
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}
.btn-group .btn:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.04);
}
.btn-group .btn.btn-primary {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-weight: 600;
}
.btn-group .btn.btn-primary:hover {
  background: var(--surface);
  color: var(--primary);
}



/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #E6F4EA; color: var(--success); }
.badge-warning { background: #FEF3E2; color: var(--warning); }
.badge-danger  { background: #FCE8E6; color: var(--danger); }
.badge-neutral { background: var(--background); color: var(--text-secondary); border: 1px solid var(--border); }

/* --- Tables --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead th {
  background: #F8F9FA;
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 14px 16px; font-size: 13.5px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-primary); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(0, 0, 0, 0.015); }


/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-control {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Lexend Deca', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%235F6368' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 36px; }

/* --- Tabs --- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 12px 16px;
  font-family: 'Lexend Deca', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  text-decoration: none;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* --- Grid Systems --- */
.chart-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 24px; margin-bottom: 24px; }
.chart-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; margin-bottom: 24px; }
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }

/* --- Site Card --- */
.site-card {
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s;
}
.site-card:hover { box-shadow: var(--shadow-hover); }
.site-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.site-card-name { font-weight: 500; font-size: 15px; color: var(--text-primary); }
.site-card-domain { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.site-card-sparkline { height: 40px; margin-bottom: 16px; }
.site-card-stats { display: flex; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 12px; }
.site-stat { display: flex; flex-direction: column; }
.site-stat-value { font-weight: 600; font-size: 15px; }
.site-stat-label { font-size: 11px; color: var(--text-muted); }

/* --- Date Range Picker --- */
.date-range-picker { display: flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; background: var(--surface); }
.date-range-picker .btn { height: 30px; border-radius: 0; border: none; font-size: 12px; font-weight: 500; }
.date-range-picker .btn:not(:last-child) { border-right: 1px solid var(--border); }
.date-range-picker .btn.btn-primary { background: var(--primary); color: #fff; }
.date-range-picker .btn.btn-secondary { background: var(--surface); color: var(--text-secondary); }
.date-range-picker .btn.btn-secondary:hover { background: var(--background); }

/* --- Code Block --- */
.code-block {
  position: relative;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-top: 8px;
}
.code-block pre { margin: 0; font-family: Courier, monospace; font-size: 12px; overflow-x: auto; line-height: 1.5; color: var(--text-primary); }
.copy-btn {
  position: absolute;
  top: 12px; right: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background .15s;
}
.copy-btn:hover { background: var(--background); }
.code-inline { background: var(--primary-light); color: var(--primary); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 12px; }

/* --- Guide Cards --- */
.guide-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 12px; }
.guide-card { background: var(--background); border: 1px solid var(--border); border-radius: 6px; padding: 12px; }
.guide-card strong { font-size: 12px; text-transform: uppercase; color: var(--text-primary); display: block; margin-bottom: 4px; }
.guide-card p { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

/* --- Donut Chart Custom Legend --- */
.chart-legend { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.legend-item { display: flex; align-items: center; font-size: 12px; color: var(--text-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; flex-shrink: 0; }
.legend-label { flex: 1; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.legend-value { font-weight: 500; color: var(--text-primary); margin-left: 8px; }

/* --- Mini Progress Bars --- */
.progress-bar-mini { width: 60px; height: 6px; background: var(--border); border-radius: 100px; overflow: hidden; flex-shrink: 0; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 100px; }

/* --- Funnel Visualization --- */
.funnel-visualization { display: flex; flex-direction: column; gap: 16px; }
.funnel-step-row { display: flex; align-items: center; gap: 16px; }
.funnel-step-info { width: 160px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.funnel-step-num { width: 24px; height: 24px; background: var(--primary-light); color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.funnel-bar-wrap { flex: 1; height: 24px; background: var(--background); border-radius: 4px; overflow: hidden; }
.funnel-bar { height: 100%; background: var(--primary-light); border-right: 3px solid var(--primary); transition: width .5s ease-out; }
.funnel-step-stats { width: 140px; display: flex; flex-direction: column; font-size: 13px; text-align: right; flex-shrink: 0; }

/* --- Alerts --- */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}
.alert-error { background: #FCE8E6; color: #C5221F; border: 1px solid #FAD2CF; }
.alert-success { background: #E6F4EA; color: #137333; border: 1px solid #CEEAD6; }

/* --- Realtime Feed Row --- */
.recent-event {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.recent-event:last-child { border-bottom: none; }

/* --- Profile Settings Avatar --- */
.avatar-circle { width: 32px; height: 32px; background: var(--primary-light); color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.avatar-large { width: 80px; height: 80px; background: var(--primary-light); color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 600; overflow: hidden; border: 1px solid var(--border); }

/* --- Auth layout --- */
.auth-body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: var(--background); }
.auth-wrapper { width: 420px; padding: 24px 16px; }
.auth-card {
  background: var(--surface);
  border: 1px solid #E8EAED;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 16px -6px rgba(0,0,0,0.05);
  padding: 40px 32px;
}
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 28px; }
.auth-logo-text { font-size: 22px; font-weight: 600; color: var(--primary); }
.auth-title { font-size: 22px; font-weight: 600; color: var(--text-primary); text-align: center; margin-bottom: 8px; letter-spacing: -0.02em; }
.auth-subtitle { font-size: 13.5px; color: var(--text-secondary); text-align: center; margin-bottom: 28px; line-height: 1.4; }
.auth-form .form-group { margin-bottom: 20px; }
.auth-card .form-control { height: 44px; border-radius: 6px; font-size: 14px; border-color: #DADCE0; }
.auth-card .btn { height: 44px; border-radius: 6px; font-size: 14.5px; transition: background 0.15s, box-shadow 0.15s; }
.auth-card .btn:hover { box-shadow: 0 4px 12px rgba(26, 115, 232, 0.2); }

.form-link { font-size: 12px; color: var(--primary); text-decoration: none; float: right; font-weight: 500; }
.form-link:hover { text-decoration: underline; }
.auth-alt { text-align: center; margin-top: 24px; font-size: 13.5px; color: var(--text-secondary); border-top: 1px solid var(--border); padding-top: 20px; }
.auth-alt a { color: var(--primary); text-decoration: none; font-weight: 500; }
.auth-alt a:hover { text-decoration: underline; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 12px; color: var(--text-muted); }


/* --- Billing plan table highlighted row --- */
.billing-active-row { background: var(--primary-light) !important; }

/* --- Text Truncate Helper --- */
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { width: 240px; transform: translateX(-240px); transition: transform .3s ease-in-out; }
  .sidebar.sidebar-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .public-header { flex-direction: column; align-items: flex-start; gap: 16px; }
}

/* --- New Topbar & Breadcrumbs Design --- */
.topbar-main {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  height: var(--topbar-h);
}

.topbar.topbar-analytics {
  height: auto;
  min-height: 104px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.topbar.topbar-analytics .topbar-main {
  padding: 0 24px;
  height: 58px;
}

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  flex: 1;
}
.breadcrumb-item {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 400;
  transition: color 0.15s ease;
}
.breadcrumb-item:hover {
  color: var(--primary);
}
.breadcrumb-separator {
  color: var(--text-muted);
  font-size: 11px;
}
.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

/* Live Status Pill */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #E6F4EA;
  color: #1E8E3E;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 100px;
  text-decoration: none;
  transition: background 0.15s ease;
  border: 1px solid rgba(30, 142, 62, 0.1);
}
.live-pill:hover {
  background: #D2EBD4;
}
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #1E8E3E;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

/* Bell Icon */
.notification-bell {
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s ease;
}
.notification-bell:hover {
  color: var(--text-primary);
}

/* Sub-Navigation Container */
.subnav-container {
  border-top: 1px solid var(--border);
  padding: 0 24px;
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar */
}
.subnav-container::-webkit-scrollbar {
  display: none;
}

/* Horizontal Sub-Navigation Tab Items */
.topbar-subnav {
  display: flex;
  gap: 20px;
}
.subnav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 10px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.subnav-item .material-symbols-outlined {
  font-size: 18px;
  color: var(--text-muted);
  transition: color 0.15s ease;
}
.subnav-item:hover {
  color: var(--text-primary);
}
.subnav-item:hover .material-symbols-outlined {
  color: var(--text-secondary);
}
.subnav-item.active {
  color: var(--primary);
  font-weight: 500;
  border-bottom-color: var(--primary);
}
.subnav-item.active .material-symbols-outlined {
  color: var(--primary);
}

/* Hide Default Views Page-Header on Analytics Pages */
.topbar-analytics + .page-content .page-header {
  display: none !important;
}

/* --- New Unified Analytics Page Headers --- */
.analytics-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.analytics-page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.analytics-page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Date Range Dropdown */
.date-dropdown {
  position: relative;
  display: inline-block;
}
.date-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 38px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Lexend Deca', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.date-dropdown-btn:hover {
  background: var(--background);
  border-color: #C0C4C9;
}
.date-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-popover);
  min-width: 140px;
  z-index: 100;
  padding: 6px 0;
}
.date-dropdown-menu.show {
  display: block;
}
.date-dropdown-item {
  display: block;
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  transition: background 0.15s ease, color 0.15s ease;
}
.date-dropdown-item:hover {
  background: var(--background);
  color: var(--text-primary);
}
.date-dropdown-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

@media (max-width: 768px) {
  .topbar.topbar-analytics .topbar-main {
    padding: 0 16px;
  }
  .subnav-container {
    padding: 0 16px;
  }
}

@media (max-width: 576px) {
  .analytics-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

.sidebar-logo-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
}

/* --- Premium Date Range Picker Popover --- */
.date-picker-popover {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  width: 328px;
  z-index: 100;
  padding: 16px;
  font-family: 'Lexend Deca', sans-serif;
  animation: popoverFadeIn 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.date-picker-popover.show {
  display: block;
}

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

/* Quick Presets Grid */
.presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.preset-btn {
  background: var(--background);
  color: var(--text-secondary);
  border: none;
  font-family: 'Lexend Deca', sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-btn:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text-primary);
}
.preset-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Calendar Month Navigation Header */
.calendar-layout {
  margin-bottom: 16px;
}
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.month-year-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.cal-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: background 0.15s ease;
}
.cal-nav-btn:hover {
  background: var(--background);
  color: var(--text-primary);
}
.cal-nav-btn .material-symbols-outlined {
  font-size: 18px;
}

/* Calendar Weekdays Header Row */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 6px;
}
.calendar-weekdays span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Calendar Days Grid */
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 2px;
}
.calendar-day {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-primary);
  cursor: pointer;
  position: relative;
  transition: all 0.1s ease;
}
.calendar-day.empty {
  cursor: default;
}

/* Day State Classes */
.calendar-day:not(.empty):hover {
  background: var(--background);
  border-radius: 50%;
}
.calendar-day.is-today {
  font-weight: 600;
  color: var(--primary);
}
.calendar-day.is-today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
}

/* Range Start Selection style */
.calendar-day.range-start {
  background: var(--primary) !important;
  color: #fff !important;
  border-radius: 50% 0 0 50% !important;
  font-weight: 500;
}
.calendar-day.range-start.is-today::after {
  background: #fff;
}

/* Range End Selection style */
.calendar-day.range-end {
  background: var(--primary) !important;
  color: #fff !important;
  border-radius: 0 50% 50% 0 !important;
  font-weight: 500;
}
.calendar-day.range-end.is-today::after {
  background: #fff;
}

/* Single Day selection: if range start and end is same day */
.calendar-day.range-start.range-end {
  border-radius: 50% !important;
}

/* Range in between highlight background */
.calendar-day.range-between {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
  border-radius: 0 !important;
}

/* Footer Section */
.date-picker-footer {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.selected-range-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.footer-actions {
  display: flex;
  gap: 8px;
}
.footer-actions .btn {
  height: 32px;
  font-size: 12px;
  padding: 0 12px;
  border-radius: 6px;
}
.footer-actions .cancel-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}
.footer-actions .cancel-btn:hover {
  background: var(--background);
  color: var(--text-primary);
}
.footer-actions .apply-btn {
  background: var(--primary);
  color: #fff;
}
.footer-actions .apply-btn:hover {
  background: var(--primary-dark);
}

/* Spinner Animation */
.spin {
  animation: cf-spin 1.2s linear infinite;
}
@keyframes cf-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 360px;
  width: 90%;
  pointer-events: none;
}

.toast-popup {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  padding: 14px 16px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
}

.toast-success {
  border-left: 4px solid #137333;
}
.toast-success .toast-icon {
  color: #137333;
}

.toast-error {
  border-left: 4px solid #C5221F;
}
.toast-error .toast-icon {
  color: #C5221F;
}

.toast-content {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.4;
  flex-grow: 1;
  padding-right: 12px;
}

.toast-close {
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}
.toast-close:hover {
  color: var(--text-primary);
}

/* Custom Confirmation Modal */
.custom-confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.custom-confirm-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.custom-confirm-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.custom-confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  padding: 24px;
  position: relative;
  z-index: 1;
  transform: scale(0.92);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-confirm-modal.show .custom-confirm-box {
  transform: scale(1);
}

.custom-confirm-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.confirm-warning-icon {
  color: #C5221F;
  font-size: 28px;
}

.custom-confirm-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.custom-confirm-body {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
  padding-left: 40px;
}

.custom-confirm-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-left: 40px;
}

.confirm-cancel-btn {
  background: #F1F3F4 !important;
  color: #3C4043 !important;
  border: 1px solid #DADCE0 !important;
}
.confirm-cancel-btn:hover {
  background: #E8EAED !important;
}

.confirm-ok-btn {
  background: #C5221F !important;
  border-color: #C5221F !important;
  color: #fff !important;
}
.confirm-ok-btn:hover {
  background: #B01E1A !important;
}

@keyframes slideInRight {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* --- Profile Dropdown --- */
.profile-dropdown-container {
  position: relative;
  display: inline-block;
}

.profile-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  min-width: 220px;
  z-index: 1000;
  padding: 8px 0;
  animation: popoverFadeIn 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-dropdown-menu.show {
  display: block;
}

.profile-dropdown-header {
  padding: 12px 16px;
  user-select: none;
  font-family: 'Lexend Deca', sans-serif;
}

.profile-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

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

.profile-dropdown-divider {
  height: 1px;
  background-color: var(--border);
  margin: 6px 0;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
  font-family: 'Lexend Deca', sans-serif;
}

.profile-dropdown-item:hover {
  background: var(--background);
}

.profile-dropdown-item .material-symbols-outlined {
  font-size: 20px;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.profile-dropdown-item:hover .material-symbols-outlined {
  color: var(--text-primary);
}

.profile-dropdown-item.signout {
  color: var(--danger);
}

.profile-dropdown-item.signout .material-symbols-outlined {
  color: var(--danger);
}

.profile-dropdown-item.signout:hover {
  background: #FCE8E6;
}
