/* ==========================================================================
   DESIGN SYSTEM & VARIABLES (Light Vibrant Glassmorphism Theme)
   ========================================================================== */
:root {
  /* Color Palette */
  --bg-app: #f4f6fb;
  --bg-sidebar: rgba(255, 255, 255, 0.45);
  --bg-glass: rgba(255, 255, 255, 0.6);
  --bg-glass-hover: rgba(255, 255, 255, 0.85);
  --bg-card: rgba(255, 255, 255, 0.65);
  --border-glass: rgba(255, 255, 255, 0.6);
  --border-glass-focus: rgba(139, 92, 246, 0.35);

  /* Colorful Neon Accents (炫彩点缀) */
  --color-primary: #8b5cf6; /* Violet */
  --color-primary-glow: rgba(139, 92, 246, 0.08);
  --color-accent: #ec4899;  /* Pink */
  --color-accent-grad: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
  
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.08);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.08);
  --color-danger: #f43f5e;
  --color-danger-bg: rgba(244, 63, 94, 0.08);
  --color-info: #3b82f6;
  --color-info-bg: rgba(59, 130, 246, 0.08);

  /* Typography / Text */
  --text-main: #0f172a;    /* Deep slate (slate-900) */
  --text-muted: #475569;   /* Medium slate (slate-600) */
  --text-dimmed: #64748b;  /* Light slate (slate-500) */

  /* Font System */
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  
  /* Shadow & Transitions */
  --shadow-neon: 0 10px 30px 0 rgba(31, 38, 135, 0.04), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 20px; /* Highly rounded corners */
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  
  /* Vibrant colorful background blur spots */
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(236, 72, 153, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(0, 242, 254, 0.06) 0%, transparent 40%);
  position: relative;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* ==========================================================================
   APP LAYOUT
   ========================================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 24px 16px;
  z-index: 10;
}

.sidebar-header {
  padding-bottom: 32px;
  padding-left: 8px;
}

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

.logo-svg {
  width: 32px;
  height: 32px;
  color: var(--color-primary);
  filter: drop-shadow(0 4px 12px rgba(139, 92, 246, 0.3));
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: var(--color-accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: 14px; /* More rounded */
  transition: var(--transition-smooth);
}

.nav-item i {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  color: var(--text-main);
  background-color: rgba(0, 0, 0, 0.02);
}

.nav-item.active {
  color: var(--color-primary);
  background-color: rgba(139, 92, 246, 0.08);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 14px 14px 0;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.04);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-glass);
}

.status-indicator-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

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

/* Main Content Layout */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

.header {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-glass);
  background-color: rgba(244, 246, 251, 0.4);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.time-widget {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: var(--text-main);
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
  white-space: nowrap;
}

.time-part {
  display: inline-flex;
  align-items: center;
}

.time-part.lunar-label {
  color: var(--text-muted);
  font-weight: 500;
}

.time-part.lunar-ganzhi {
  color: #e63946; /* Premium Cinnabar Red */
  font-weight: 600;
}

.time-part.date-lunar {
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 2px;
}

.time-part.date-gregorian {
  color: var(--text-muted);
  font-weight: 500;
}

.time-part.week {
  color: var(--text-muted);
  font-weight: 500;
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.time-part.clock-time {
  font-family: 'SF Mono', 'Courier New', Courier, monospace;
  font-weight: 700;
  color: var(--color-primary);
  font-size: 16px;
}

.time-divider {
  color: rgba(0, 0, 0, 0.15);
  font-weight: 300;
  margin: 0 4px;
}

.time-part.term-festival {
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.15);
}

.content-container {
  padding: 32px;
  flex-grow: 1;
  overflow-y: auto;
}

/* ==========================================================================
   BUTTONS & CONTROLS (Vibrant & Round)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--border-radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: var(--color-accent-grad);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
}

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

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-main);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.btn-secondary:hover {
  background-color: #ffffff;
  border-color: rgba(0, 0, 0, 0.15);
}

.btn-icon {
  width: 44px; /* More rounded size */
  height: 44px;
  padding: 0;
  border-radius: 50%;
}

.btn-icon i {
  width: 18px;
  height: 18px;
}

.btn-icon-xs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-icon-xs:hover {
  color: var(--color-primary);
  background-color: #ffffff;
  border-color: var(--color-primary);
  transform: scale(1.05);
}

.btn svg,
.btn-icon svg,
.btn-icon-xs svg,
.nav-item svg,
.time-widget svg,
.icon-container svg,
.btn-close-modal svg {
  flex-shrink: 0;
  width: 1em;
  height: 1em;
  pointer-events: none;
}

.btn-icon-xs svg {
  width: 16px;
  height: 16px;
}

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

/* ==========================================================================
   TAB CONTAINER & CONTENT
   ========================================================================== */
.tab-content {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

.tab-content.active {
  display: block;
}

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

/* ==========================================================================
   MONITORING OVERVIEW TAB
   ========================================================================== */

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stats-card {
  background-color: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius);
  padding: 24px;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-neon);
}

.stats-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.2);
  box-shadow: 0 12px 36px 0 rgba(31, 38, 135, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

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

.stats-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.icon-container {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-container i {
  width: 16px;
  height: 16px;
}

.icon-container.primary { background-color: var(--color-primary-glow); color: var(--color-primary); }
.icon-container.success { background-color: var(--color-success-bg); color: var(--color-success); }
.icon-container.warning { background-color: var(--color-warning-bg); color: var(--color-warning); }
.icon-container.info { background-color: var(--color-info-bg); color: var(--color-info); }

.stats-card-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  font-feature-settings: "tnum";
  background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stats-card-desc {
  font-size: 12px;
  color: var(--text-dimmed);
}

/* Charts Section */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

@media (max-width: 1024px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  background-color: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-neon);
}

.chart-header {
  margin-bottom: 24px;
}

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

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 300px;
}

.chart-wrapper.doughnut {
  height: 250px;
}

.chart-fallback {
  width: 100%;
  height: 100%;
  color: var(--text-muted);
}

.chart-fallback-title {
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

.mini-bars {
  display: grid;
  grid-template-columns: repeat(12, minmax(18px, 1fr));
  gap: 8px;
  height: 220px;
  align-items: end;
}

.mini-bar-item {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
  min-width: 0;
}

.mini-bar-fill {
  display: block;
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--color-info), var(--color-success));
}

.mini-bar-label {
  color: var(--text-dimmed);
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
}

.compact-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
}

.distribution-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
}

.distribution-value {
  color: var(--text-main);
  font-size: 12px;
  font-weight: 700;
  font-feature-settings: "tnum";
}

.distribution-bar {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background-color: rgba(15, 23, 42, 0.06);
}

.distribution-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-accent-grad);
}

.chart-fallback-note {
  color: var(--text-dimmed);
  font-size: 11px;
  margin-top: 10px;
}

/* ==========================================================================
   KEYS MANAGEMENT & LOGS TAB (CARDS / TABLES)
   ========================================================================== */
.section-card {
  background-color: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-neon);
}

.table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.table-actions.grid {
  display: flex;
  flex-flow: row wrap;
}

.search-box {
  position: relative;
  width: 320px;
  max-width: 100%;
}

.search-box i,
.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-dimmed);
}

.search-box input {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 10px 14px 10px 42px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
}

.search-box input:focus {
  border-color: var(--color-primary);
  background-color: #ffffff;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.15);
}

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

.form-select {
  background-color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 10px 16px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.form-select:focus {
  border-color: var(--color-primary);
  background-color: #ffffff;
}

.form-select option {
  background-color: #ffffff;
  color: var(--text-main);
}

/* Data Table */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
}

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

.data-table th, 
.data-table td {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.data-table th {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  font-size: 14px;
}

.data-table tbody tr {
  transition: var(--transition-smooth);
}

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

/* Key display block */
.api-key-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Courier New', Courier, monospace;
  font-weight: 600;
  color: var(--color-primary);
  background-color: rgba(139, 92, 246, 0.06);
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.api-key-display:hover {
  background-color: rgba(139, 92, 246, 0.12);
  transform: scale(1.02);
}

/* Quota progress indicators */
.quota-progress-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 220px;
  max-width: 100%;
}

.quota-progress-text {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.quota-progress-bar-bg {
  width: 100%;
  height: 6px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  overflow: hidden;
}

.quota-progress-bar-fill {
  height: 100%;
  background: var(--color-accent-grad);
  border-radius: 10px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.1, 0.8, 0.2, 1);
}

.quota-progress-bar-fill.warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.quota-progress-bar-fill.danger {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
}

/* Status switch toggles */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.08);
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

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

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

/* Action button items */
.action-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.badge.success { background-color: var(--color-success-bg); color: var(--color-success); }
.badge.danger { background-color: var(--color-danger-bg); color: var(--color-danger); }
.badge.warning { background-color: var(--color-warning-bg); color: var(--color-warning); }
.badge.info { background-color: var(--color-info-bg); color: var(--color-info); }

/* Pagination Footer */
.pagination-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

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

.pagination-buttons {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   MODAL WINDOWS STYLES
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.15);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 500px;
  max-width: 90%;
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  transform: translateY(20px);
  transition: var(--transition-smooth);
}

.modal-backdrop.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  transition: var(--transition-smooth);
}

.btn-close-modal:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
}

.form-control:focus {
  border-color: var(--color-primary);
  background-color: #ffffff;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.15);
}

.quota-input-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
}

.form-help {
  font-size: 12px;
  color: var(--text-dimmed);
  margin-top: 6px;
}

.info-box-value {
  padding: 12px 16px;
  background-color: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   TOAST NOTIFICATION STYLES
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 110;
}

.toast {
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-left: 4px solid var(--color-primary);
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  transform: translateX(120%);
  animation: slideIn 0.3s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
  max-width: 320px;
}

@keyframes slideIn {
  to {
    transform: translateX(0);
  }
}

.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-danger); }
.toast.info { border-left-color: var(--color-info); }

.toast-message {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

/* ==========================================================================
   16:9 LARGE MODAL STYLES
   ========================================================================== */
@media (min-width: 768px) {
  .modal-card.large {
    width: 1080px;
    max-width: 95%;
    height: 610px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .modal-card.large form {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100% - 60px);
    overflow: hidden;
  }

  .modal-card.large .modal-header {
    padding: 16px 24px;
  }

  .modal-card.large .modal-footer {
    padding: 14px 24px;
  }

  .modal-card.large .modal-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    gap: 32px;
    padding: 18px 32px;
  }

  .modal-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  .modal-col .form-group {
    margin-bottom: 0;
  }

  .modal-card.large label {
    font-size: 13px;
    margin-bottom: 5px;
  }

  .modal-card.large .form-control,
  .modal-card.large .form-select {
    padding: 10px 14px;
    height: 40px;
  }

  .modal-card.large .form-help {
    margin-top: 4px;
    font-size: 11px;
  }

  .modal-card.large .form-grid-2,
  .modal-card.large .form-grid-3 {
    gap: 10px;
  }
}

@media (max-width: 767px) {
  .modal-card.large .modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
}

/* ==========================================================================
   GENERAL LLM DISTRIBUTION UI ADDITIONS
   ========================================================================== */
.scope-panel {
  margin-bottom: 24px;
}

.scope-panel-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.scope-panel h3 {
  font-size: 20px;
  line-height: 1.3;
  margin: 4px 0;
}

.scope-panel p {
  color: var(--text-dimmed);
  font-size: 13px;
}

.section-kicker {
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.scope-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 420px;
}

.scope-controls .form-select {
  width: 100%;
  min-width: 180px;
}

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

.chart-header.compact h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-header.compact i,
.chart-header.compact svg {
  width: 18px;
  height: 18px;
  color: var(--color-primary);
}

.panel-subtitle {
  color: var(--text-dimmed);
  font-size: 12px;
}

.balance-panel {
  margin-bottom: 32px;
}

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

.balance-account-card {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 12px;
  padding: 18px;
  min-height: 150px;
}

.balance-account-card.selected {
  grid-column: 1 / -1;
}

.balance-card-head,
.balance-card-foot,
.balance-kpi-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.balance-card-foot {
  align-items: center;
  color: var(--text-dimmed);
  font-size: 12px;
  margin-top: 14px;
}

.balance-kpi-row {
  margin: 18px 0;
}

.balance-kpi-row > div {
  min-width: 0;
  flex: 1;
}

.balance-amount {
  color: var(--text-main);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 12px 0 10px;
  font-feature-settings: "tnum";
}

.kpi-label,
.field-caption {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.kpi-caption {
  color: var(--text-dimmed);
  font-size: 12px;
}

.success-text { color: var(--color-success); }
.warning-text { color: var(--color-warning); }
.danger-text { color: var(--color-danger); }
.muted { color: var(--text-dimmed); }

.item-title {
  color: var(--text-main);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.item-subtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dimmed);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 4px;
  max-width: 320px;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.table-url {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-main);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  gap: 4px 10px;
  color: var(--text-muted);
  font-size: 12px;
  min-width: 160px;
}

.form-grid-2,
.form-grid-3 {
  display: grid;
  gap: 12px;
}

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

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.filter-input {
  width: 180px;
}

.quota-input-wrapper.wrap {
  flex-wrap: wrap;
}

.quota-progress-container.full {
  width: 100%;
}

.status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.empty-state {
  width: 100%;
  color: var(--text-dimmed);
  text-align: center;
  padding: 30px 16px;
}

.text-copy {
  border: none;
  background: transparent;
  color: var(--color-primary);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  padding: 0;
}

.danger-action {
  color: var(--color-danger);
}

.api-key-display i,
.api-key-display svg,
.toast i,
.toast svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

@keyframes slideOut {
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

@media (max-width: 900px) {
  .scope-panel-main,
  .chart-header.compact,
  .balance-card-head,
  .balance-kpi-row {
    flex-direction: column;
    align-items: stretch;
  }

  .scope-controls {
    min-width: 0;
    width: 100%;
    flex-direction: column;
  }

  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .filter-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .filter-input,
  .filter-group .form-select,
  .filter-group .form-control {
    width: 100%;
  }
}

/* ==========================================================================
   SUB-TABS FILTER STYLES
   ========================================================================== */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  align-self: flex-start;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.filter-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.filter-tab:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.03);
}

.filter-tab.active {
  color: var(--color-primary);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
}
