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

:root {
  --bg: #0a0a0f;
  --card: #12121a;
  --border: #1e1e2e;
  --text: #e0e0e8;
  --text-dim: #8888a0;
  --accent: #f6821f;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --bar-bg: #1e1e2e;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 24px;
}

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

.header h1 {
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header h1 .cf-logo {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: white;
}

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

.billing-period {
  color: var(--text-dim);
  font-size: 14px;
}

.refresh-btn {
  background: var(--border);
  border: 1px solid #2a2a3a;
  color: var(--text);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.refresh-btn:hover { background: #2a2a3a; }
.refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.cost-banner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.cost-item {
  text-align: center;
}

.cost-item .label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.cost-item .value {
  font-size: 28px;
  font-weight: 700;
}

.cost-item .value.green { color: var(--green); }
.cost-item .value.yellow { color: var(--yellow); }
.cost-item .value.red { color: var(--red); }

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.metric-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.metric-pct {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.metric-pct.green { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.metric-pct.yellow { background: rgba(251, 191, 36, 0.15); color: var(--yellow); }
.metric-pct.red { background: rgba(248, 113, 113, 0.15); color: var(--red); }

.bar-container {
  width: 100%;
  height: 8px;
  background: var(--bar-bg);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.bar-fill.green { background: var(--green); }
.bar-fill.yellow { background: var(--yellow); }
.bar-fill.red { background: var(--red); }

.metric-detail {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.metric-detail .current { color: var(--text); font-weight: 500; }
.metric-detail .limit { color: var(--text-dim); }

.metric-overage {
  margin-top: 6px;
  font-size: 12px;
  color: var(--red);
}

.workers-table {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 32px;
}

.workers-table table {
  width: 100%;
  border-collapse: collapse;
}

.workers-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.workers-table td {
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.workers-table tr:last-child td { border-bottom: none; }
.workers-table tr:hover td { background: rgba(255,255,255,0.02); }

.workers-table .worker-name {
  font-weight: 500;
  color: var(--accent);
}

.error-state, .loading-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.error-state { color: var(--red); }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.timestamp {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}
