/* ═══════════════════════════════════════════════
   AgentReadyScore — Design System
   暗色主题 + 琥珀金主色
   ═══════════════════════════════════════════════ */

:root {
  --bg-primary: #0c0f14;
  --bg-card: #161b22;
  --bg-card-hover: #1c2330;
  --border: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #ffb020;
  --accent-glow: rgba(255, 176, 32, 0.15);
  --positive: #2dd4a7;
  --negative: #ff5d5d;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
}

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

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

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 0 20px 24px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.sidebar-nav { list-style: none; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: var(--text-primary);
  background: var(--accent-glow);
  border-left-color: var(--accent);
}

.main-content {
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
}

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px;
}
.topbar h1 { font-size: 24px; font-weight: 700; }
.topbar .shop-badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Card ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Score Gauge ── */
.score-gauge-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.score-gauge { position: relative; width: 180px; height: 180px; }
.score-gauge svg { transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: var(--border); stroke-width: 12; }
.gauge-fill { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-value { font-size: 48px; font-weight: 800; line-height: 1; }
.gauge-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Button ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-primary); transition: all 0.2s; white-space: nowrap;
}
.btn:hover { background: var(--bg-card-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #0c0f14; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-accent { background: var(--accent); color: #0c0f14; border-color: var(--accent); }
.btn-accent:hover:not(:disabled) { filter: brightness(1.1); }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-outline:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; white-space: nowrap;
  background: var(--negative); color: #fff; border-color: var(--negative);
}
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-block { width: 100%; }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; padding: 12px 16px;
  color: var(--text-muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.data-table tr:hover td { background: var(--bg-card-hover); }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
}
.badge-critical { background: rgba(255,93,93,0.2); color: var(--negative); }
.badge-high { background: rgba(245,158,11,0.2); color: var(--warning); }
.badge-medium { background: rgba(255,176,32,0.2); color: var(--accent); }
.badge-low { background: rgba(139,148,158,0.2); color: var(--text-muted); }
.badge-open { background: rgba(45,212,167,0.15); color: var(--positive); }
.badge-fixed { background: rgba(139,148,158,0.15); color: var(--text-muted); }

/* ── Trend Line ── */
.trend-chart { width: 100%; height: 200px; }

/* ── Radar Chart ── */
.radar-wrap { display: flex; justify-content: center; }
.radar-chart { max-width: 320px; }

/* ── Scan Button ── */
.scan-section { text-align: center; margin-bottom: 32px; }
.scan-status { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

/* ── Progress bar ── */
.progress-bar {
  height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%; background: var(--accent); border-radius: 3px;
  transition: width 0.5s ease;
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap;
}
.filter-bar select {
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ── Empty State ── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }

/* ── Settings Form ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input, .form-group select {
  width: 100%; padding: 10px 14px;
  background: var(--bg-primary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px;
}

/* ── Loading ── */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Message Boxes ── */
.msg-box { padding: 12px 20px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.msg-err { background: rgba(255,93,93,.12); border: 1px solid var(--negative); color: var(--negative); }
.msg-ok { background: rgba(45,212,167,.12); border: 1px solid var(--positive); color: var(--positive); }

/* ── Usage Bar ── */
.usage-bar { margin: 8px 0 20px; }
.usage-label { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 4px; color: var(--text-muted); }
.usage-count { font-weight: 600; }
.usage-track { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.usage-fill { height: 100%; border-radius: 2px; transition: width .3s; }
.usage-unlimited { font-size: 12px; color: var(--positive); margin: 8px 0; }

/* ── Trial Badge ── */
.trial-badge { display: inline-block; background: var(--accent); color: #0c0f14; font-size: 11px; padding: 2px 10px; border-radius: 10px; margin-left: 8px; font-weight: 600; }
.trial-urgent { background: var(--negative); color: #fff; }

/* ── Modal ── */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-card { background: var(--bg-card); border-radius: 12px; padding: 28px; max-width: 420px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-card h3 { margin: 0 0 12px; font-size: 18px; }
.modal-card p { color: var(--text-secondary); line-height: 1.6; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; }

/* ── Dimension Card ── */
.dim-card { cursor: pointer; text-align: center; padding: 16px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); transition: all .2s; }
.dim-card:hover { border-color: var(--accent); }
.dim-active { box-shadow: 0 0 12px rgba(255,176,32,0.1); }
.dim-icon { font-size: 20px; margin-bottom: 4px; }
.dim-score { font-size: 28px; font-weight: 700; }
.dim-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.card-sub { font-weight: 400; font-size: 12px; color: var(--text-muted); text-transform: none; }

/* ── Dimension Detail ── */
.dim-detail { border-left: 3px solid var(--accent); }
.dim-detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.dim-detail-header h3 { margin: 0; }
.dim-pass-count { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-left: 8px; }
.check-item { padding: 14px 0; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.check-item:last-child { border-bottom: none; }
.check-icon { font-size: 20px; flex-shrink: 0; }
.check-body { flex: 1; }
.check-name { font-weight: 600; margin-bottom: 4px; }
.check-impact { font-size: 11px; color: var(--text-muted); margin-left: 8px; font-weight: 400; }
.check-detail { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.check-hint { margin-top: 6px; font-size: 12px; color: var(--accent); }

/* ── Benchmark ── */
.bench-row { display: flex; gap: 24px; }
.bench-item { flex: 1; text-align: center; padding: 16px; background: var(--bg-primary); border-radius: var(--radius-sm); }
.bench-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.bench-val { display: block; font-size: 20px; font-weight: 700; color: var(--accent); }
.bench-summary { margin-bottom: 16px; display: flex; gap: 24px; align-items: center; }
.bench-my { font-size: 16px; color: var(--text-secondary); }
.bench-my strong { color: var(--accent); font-size: 24px; }
.bench-cat { font-size: 13px; color: var(--text-muted); }

/* ── Pagination ── */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 16px; align-items: center; }
.page-info { font-size: 13px; color: var(--text-muted); }

/* ── Score Gain ── */
.score-gain { color: var(--positive); font-weight: 600; }

/* ── Settings ── */
.settings-card { max-width: 520px; }
.form-hint { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-check label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"] { width: auto; }

/* ── Pricing Toggle ── */
.pricing-toggle { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; }
.pricing-price { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.pricing-period { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.pricing-feats { list-style: none; padding: 0; margin: 16px 0; }
.pricing-feats li { padding: 4px 0; font-size: 13px; color: var(--text-secondary); }
.pricing-alt { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 13px; }
.pricing-alt a { color: var(--accent); }
.pricing-trial { text-align: center; margin-top: 16px; color: var(--text-muted); font-size: 13px; }

/* ── Empty / Loading ── */
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.nav-icon { font-size: 16px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 20px; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .bench-row { flex-direction: column; }
}
.pricing-price {
  font-size: 28px;
  font-weight: 700;
  margin: 8px 0 4px;
  color: var(--text-primary);
}
.pricing-period {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}
.pricing-features {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}
.pricing-features li {
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.pricing-btn {
  width: 100%;
  margin-top: 8px;
}

/* ── Modal Overlay ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.modal-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}
.modal-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* ── Usage Bar ── */
.usage-bar-wrap {
  margin: 8px 0;
}
.usage-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 4px;
  color: var(--text-muted);
}
.usage-bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
