* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%;
  overflow-x: hidden;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0a;
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.header {
  background: #141414;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #222;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.logo { font-weight: 600; font-size: 1rem; }
.header-links { display: flex; gap: 1rem; align-items: center; }
.header-links a { color: #888; text-decoration: none; font-size: 0.875rem; transition: color 0.2s; }
.header-links a:hover { color: #fff; }
button {
  padding: 8px 16px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}
button:hover { background: #444; }

.container {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}
.card {
  background: #141414;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 1.25rem;
}
h2 {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

/* API Key Card */
.key-box {
  font-family: monospace;
  background: #1a1a1a;
  padding: 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  word-break: break-all;
}
.key-box span { font-size: 0.875rem; }
.copy-btn {
  padding: 6px 12px;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.copy-btn:hover { background: #5558e3; }
.info { color: #888; font-size: 0.75rem; margin-top: 8px; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.stat-card {
  background: #1a1a1a;
  border-radius: 10px;
  padding: 1rem;
}
.stat-label {
  color: #888;
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: monospace;
  color: #22c55e;
}
.stat-subtext {
  color: #666;
  font-size: 0.65rem;
  margin-top: 0.25rem;
}

/* Progress Bar */
.progress-section { margin-top: 0.75rem; }
.progress-bar {
  height: 8px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.progress-fill {
  height: 100%;
  background: #22c55e;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.progress-fill.warning { background: #f59e0b; }
.progress-fill.danger { background: #dc2626; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #888;
  margin-top: 0.25rem;
}

/* Timer Section */
.timer-section {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.timer-main {
  text-align: center;
  min-width: 150px;
}
.timer-value {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: monospace;
  color: #22c55e;
}
.timer-value.warning { color: #f59e0b; }
.timer-value.danger { color: #dc2626; }
.timer-subtext { color: #666; font-size: 0.7rem; margin-top: 0.25rem; }
.timer-info {
  flex: 1;
  min-width: 150px;
}
.timer-info-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #222;
  font-size: 0.8rem;
}
.timer-info-item:last-child { border-bottom: none; }
.timer-info-item span:first-child { color: #888; }
.timer-info-item span:last-child { color: #fff; }

/* Model Stats */
.model-grid {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.model-badge {
  background: #1a1a1a;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.model-count {
  background: #6366f1;
  color: #fff;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
}

/* Usage Graph */
.graph-container {
  height: 200px;
  margin-top: 1rem;
  position: relative;
}
.graph-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 160px;
  gap: 4px;
  padding: 0 10px;
}
.graph-bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.graph-bar {
  width: 100%;
  max-width: 30px;
  background: #6366f1;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
  position: relative;
}
.graph-bar:hover {
  background: #818cf8;
}
.graph-bar-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.graph-bar:hover .graph-bar-tooltip {
  opacity: 1;
}
.graph-label {
  font-size: 0.6rem;
  color: #666;
  margin-top: 6px;
  text-align: center;
}
.graph-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #666;
  font-size: 0.875rem;
}

/* Usage Table */
.table-wrapper {
  max-height: 250px;
  overflow-y: auto;
  border-radius: 8px;
}
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #222;
  font-size: 0.875rem;
}
th {
  color: #888;
  font-size: 0.75rem;
  position: sticky;
  top: 0;
  background: #141414;
  z-index: 1;
}
.status {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
}
.status.ok { background: #166534; color: #4ade80; }
.status.error { background: #991b1b; color: #f87171; }
.model-tag {
  background: #1e293b;
  color: #94a3b8;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
}
.no-logs {
  color: #888;
  text-align: center;
  padding: 2rem;
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 600px) {
  .header { padding: 0.75rem 1rem; }
  .container { padding: 1rem; gap: 0.75rem; }
  .card { padding: 1rem; }
  .timer-value { font-size: 2rem; }
  .stat-value { font-size: 1.25rem; }
  .timer-section { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr; }
}
