:root {
  --bg-main: #f8fafc;
  --glass-bg: rgba(255, 255, 255, 0.80);
  --glass-bg-hover: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(255, 255, 255, 0.90);
  --glass-border-subtle: rgba(226, 232, 240, 0.8);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  --shadow-lg: 0 16px 48px 0 rgba(31, 38, 135, 0.10);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-blue: #2563eb;
  --accent-blue-light: #eff6ff;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
}

.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}
.glow-sky { width: 450px; height: 450px; top: -100px; left: -100px; background: rgba(186, 230, 253, 0.5); }
.glow-emerald { width: 400px; height: 400px; top: 30%; right: -100px; background: rgba(209, 250, 229, 0.5); }
.glow-indigo { width: 500px; height: 500px; bottom: -150px; left: 20%; background: rgba(224, 231, 255, 0.4); }

.app-shell { position: relative; z-index: 1; display: flex; flex-direction: column; min-height: 100vh; }

.glass-header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border-subtle);
  box-shadow: var(--shadow-sm);
  padding: 14px 24px;
}
.header-inner { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.brand-group { display: flex; align-items: center; gap: 12px; }
.brand-title { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.brand-subtitle { font-size: 0.8rem; color: var(--text-secondary); }
.badge-capsule { font-size: 0.7rem; background: var(--accent-blue-light); color: var(--accent-blue); padding: 2px 8px; border-radius: 12px; font-weight: 600; margin-left: 6px; }

.header-controls { display: flex; align-items: center; gap: 12px; }
.status-pill { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 500; padding: 6px 12px; border-radius: 20px; background: rgba(255,255,255,0.7); border: 1px solid var(--glass-border-subtle); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-emerald); }
.status-ready .status-dot { background: var(--accent-emerald); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.2s ease;
}
.btn-primary { background: var(--accent-blue); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #fff; color: var(--text-secondary); border: 1px solid var(--glass-border-subtle); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: #f1f5f9; color: var(--text-primary); }

.content-wrapper { max-width: 1200px; margin: 0 auto; padding: 28px 24px; flex: 1; width: 100%; }

.glass-card {
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { padding: 18px 20px; }
.kpi-title { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.kpi-value-row { margin-top: 8px; display: flex; align-items: baseline; gap: 6px; }
.kpi-value { font-size: 1.8rem; font-weight: 800; }
.kpi-unit { font-size: 0.8rem; color: var(--text-muted); }

.toolbar-section { padding: 14px 20px; margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.filter-group { display: flex; gap: 8px; }
.filter-tab {
  padding: 6px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); cursor: pointer;
  transition: all 0.2s;
}
.filter-tab.active { background: #fff; color: var(--accent-blue); border-color: var(--glass-border-subtle); box-shadow: var(--shadow-sm); }

.search-input {
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--glass-border-subtle);
  background: rgba(255,255,255,0.8); font-size: 0.875rem; width: 240px; outline: none;
}
.search-input:focus { border-color: var(--accent-blue); background: #fff; }

.models-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.model-card { padding: 22px; display: flex; flex-direction: column; justify-content: space-between; min-height: 190px; }
.model-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); background: var(--glass-bg-hover); }

.model-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.model-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.model-id-tag { font-size: 0.75rem; color: var(--text-muted); font-family: monospace; }
.model-badge { font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 6px; letter-spacing: 0.5px; }
.badge-gemini { background: #e0f2fe; color: #0284c7; }
.badge-claude { background: #ffedd5; color: #ea580c; }
.badge-gpt { background: #dcfce7; color: #16a34a; }
.badge-other { background: #f1f5f9; color: #64748b; }

.quota-progress-section { margin-top: 10px; }
.gauge-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 0.85rem; }
.gauge-label { color: var(--text-secondary); }
.gauge-value { font-weight: 700; font-size: 1rem; }
.progress-track { width: 100%; height: 8px; background: rgba(226, 232, 240, 0.6); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.fill-healthy { background: linear-gradient(90deg, #34d399, #10b981); }
.fill-warning { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.fill-critical, .fill-exhausted { background: linear-gradient(90deg, #fb7185, #f43f5e); }

.model-meta-row { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-secondary); margin-top: 18px; padding-top: 12px; border-top: 1px solid rgba(226, 232, 240, 0.6); }
.meta-item { display: flex; align-items: center; gap: 4px; }

.text-emerald { color: var(--accent-emerald) !important; }
.text-amber { color: var(--accent-amber) !important; }
.text-rose { color: var(--accent-rose) !important; }
.text-muted { color: var(--text-muted) !important; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.3); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal-window { width: 90%; max-width: 520px; border-radius: var(--radius-lg); background: #ffffff; padding: 24px; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; }
.glass-textarea, .glass-input { width: 100%; padding: 10px 14px; border: 1px solid var(--glass-border-subtle); border-radius: var(--radius-sm); font-size: 0.875rem; margin-top: 6px; outline: none; }
.modal-footer { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }
.modal-msg { margin-top: 12px; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 0.85rem; }
.modal-msg.success { background: #dcfce7; color: #166534; }
.modal-msg.error { background: #ffe4e6; color: #9f1239; }

.hidden { display: none !important; }
.loading-state, .empty-state { grid-column: 1 / -1; padding: 48px; text-align: center; color: var(--text-secondary); }

.app-footer { border-top: 1px solid var(--glass-border-subtle); padding: 16px 24px; font-size: 0.8rem; color: var(--text-muted); background: var(--glass-bg); text-align: center; }
