:root {
  --bg-background: #08080b;
  --bg-surface: #0f0f14;
  --bg-surface-glass: rgba(15, 15, 20, 0.75);
  --bg-surface-raised: #15151c;
  --bg-surface-hover: #1b1b24;
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text-primary: #f4f4f7;
  --text-secondary: #c4c4cc;
  --text-muted: #787885;
  --accent-astra: #6366f1;
  --accent-astra-light: #818cf8;
  --accent-astra-dim: rgba(99, 102, 241, 0.15);
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.2);
  --danger: #f43f5e;
  --danger-glow: rgba(244, 63, 94, 0.2);
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Menlo, Consolas, monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-background);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.07) 0%, transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(168, 85, 247, 0.04) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
}

#root {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ASCII Canvas Container */
.ascii-card {
  background: rgba(12, 12, 16, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.ascii-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.ascii-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.terminal-dots {
  display: flex;
  gap: 5px;
}
.terminal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0.7;
}
.terminal-dot.red { background: #ef4444; }
.terminal-dot.yellow { background: #f59e0b; }
.terminal-dot.green { background: #10b981; }

.ascii-art-container {
  font-family: var(--font-mono);
  white-space: pre;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--accent-astra-light);
  background: transparent;
  user-select: none;
  overflow: hidden;
  font-size: 11px;
  opacity: 0.85;
}

/* Sidebar Navigation */
.sidebar {
  width: 260px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 20px 6px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: var(--accent-grad);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 0 16px var(--accent-glow);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-text span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-raised);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.05) 100%);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: inset 0 0 12px rgba(99, 102, 241, 0.1);
}

.nav-item.active svg {
  color: var(--accent-astra-light);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.user-profile {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  font-size: 11px;
  color: var(--accent-astra-light);
  font-family: var(--font-mono);
}

.btn-logout {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 7px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-logout:hover {
  color: var(--danger);
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.2);
}

/* Main Content Area */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  position: relative;
}

.top-bar {
  padding: 18px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(8, 8, 11, 0.85);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-title h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.top-title p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.main-view {
  padding: 28px 36px 48px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1320px;
}

/* Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.metric-card {
  background: var(--bg-surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-medium);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-grad);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* Heatmap Grid */
.heatmap-container {
  background: var(--bg-surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  backdrop-filter: blur(12px);
}

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

.heatmap-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.heatmap-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 12px);
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2.5px;
  background-color: var(--bg-surface-raised);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.heatmap-cell:hover {
  transform: scale(1.3);
  filter: brightness(1.2);
  z-index: 5;
}

.heatmap-cell.level-0 { background-color: #17171d; }
.heatmap-cell.level-1 { background-color: #3730a3; }
.heatmap-cell.level-2 { background-color: #4f46e5; }
.heatmap-cell.level-3 { background-color: #6366f1; }
.heatmap-cell.level-4 { background-color: #a855f7; }

/* Panels and Cards */
.panel-card {
  background: var(--bg-surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.4);
}

.panel-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  padding: 12px 22px;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.015);
}

.data-table td {
  padding: 14px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 0.12s ease;
}

.data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.025);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.25);
}

.badge-danger {
  background: rgba(244, 63, 94, 0.12);
  color: #f87171;
  border-color: rgba(244, 63, 94, 0.25);
}

.badge-indigo {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.25);
}

.badge-cooldown {
  background: rgba(244, 63, 94, 0.14);
  color: #fca5a5;
  border: 1px solid rgba(244, 63, 94, 0.35);
  font-family: var(--font-mono);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7175f3 0%, #5850eb 100%);
  box-shadow: 0 0 12px var(--accent-glow);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-medium);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: var(--border-strong);
}

/* Icon Buttons (Eye, Copy, Action) */
.btn-icon {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-subtle);
}

.btn-icon.copied {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.1);
}

/* Email Display & Masking UI */
.account-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #a5b4fc;
  font-size: 13px;
  flex-shrink: 0;
}

.account-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.email-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.email-text {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.account-id {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Quota Bar UI */
.quota-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 145px;
}

.quota-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.quota-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.quota-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1 0%, #818cf8 100%);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.quota-bar-fill.warning {
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.quota-bar-fill.danger {
  background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* LimitSwitch Banner */
.limitswitch-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px -2px rgba(99, 102, 241, 0.1);
  gap: 20px;
}

.status-pulse-dot {
  position: relative;
  display: inline-flex;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.status-pulse-dot .pulse-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.4);
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-pulse-dot .pulse-dot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.6); opacity: 0; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: #111116;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

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

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  background: #09090c;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
  border-color: var(--accent-astra);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
