:root {
  --ink: #10233f;
  --muted: #667085;
  --line: #e6eaf0;
  --paper: #ffffff;
  --canvas: #f5f7fb;
  --blue: #1457d9;
  --blue-dark: #0d3f9f;
  --teal: #07847c;
  --red: #c9362b;
  --green: #16794b;
}

html { font-size: 15px; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }

.app-container { width: min(1480px, calc(100% - 40px)); margin-inline: auto; }
.app-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.navbar { min-height: 68px; padding: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 750; margin-right: 34px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: white; background: linear-gradient(145deg, var(--blue), #3c83ff); }
.nav-link { color: #475467; font-weight: 600; padding: 23px 14px !important; border-bottom: 2px solid transparent; }
.nav-link:hover { color: var(--blue); border-bottom-color: var(--blue); }
.account-chip { background: #eef3ff; color: #2a4f9b; padding: 8px 12px; border-radius: 999px; font-size: .84rem; font-weight: 650; }
.main-content { padding-block: 38px 70px; }

.page-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-header h1 { font-size: clamp(1.75rem, 2.5vw, 2.5rem); margin: 4px 0 8px; letter-spacing: -.035em; font-weight: 760; }
.page-header p { color: var(--muted); margin: 0; }
.eyebrow { color: var(--blue); font-size: .74rem; letter-spacing: .14em; font-weight: 800; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric-grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.metric-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: 0 8px 30px rgba(16, 35, 63, .035); }
.metric-label { color: var(--muted); font-size: .82rem; font-weight: 650; }
.metric-value { font-size: 1.9rem; line-height: 1.15; font-weight: 770; letter-spacing: -.035em; margin: 9px 0; }
.metric-context { display: flex; gap: 7px; color: var(--muted); font-size: .78rem; }
.delta { font-weight: 750; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px rgba(16, 35, 63, .035); margin-bottom: 20px; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 21px 22px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { font-size: 1.05rem; margin: 0 0 5px; font-weight: 750; }
.panel-heading p { margin: 0; color: var(--muted); font-size: .84rem; }
.form-panel form { padding: 22px; }
.content-layout { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: 20px; align-items: start; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

.data-table { margin: 0; font-size: .88rem; }
.data-table th { color: #667085; background: #fafbfc; font-size: .73rem; letter-spacing: .04em; text-transform: uppercase; border-bottom-color: var(--line); padding: 12px 16px; white-space: nowrap; }
.data-table td { padding: 14px 16px; border-color: #edf0f4; }
.table-title { color: var(--ink); font-weight: 700; }
.url-text { color: var(--muted); font-size: .76rem; margin-top: 3px; overflow-wrap: anywhere; }
.query-text { color: var(--ink); font-weight: 650; overflow-wrap: anywhere; }
.table-scroll { max-height: 520px; overflow: auto; }
.muted-row { opacity: .58; }
.message-cell { white-space: pre-line; max-width: 460px; font-size: .78rem; }
.sync-progress-cell { min-width: 170px; }
.sync-stage { font-size: .78rem; font-weight: 700; margin-bottom: 6px; }
.sync-progress-cell .progress { height: 16px; min-width: 150px; }
.sync-progress-cell small { display: block; color: var(--muted); margin-top: 4px; }

.badge-soft { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: #edf3ff; color: #2856a7; font-size: .72rem; font-weight: 750; }
.status { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: .72rem; font-weight: 750; }
.status-succeeded { background: #eaf8f0; color: var(--green); }
.status-failed { background: #fff0ef; color: var(--red); }
.status-partial { background: #fff7e6; color: #96640b; }
.status-running { background: #edf3ff; color: var(--blue); }
.status-queued { background: #f1edff; color: #6046a8; }

.empty-state { text-align: center; padding: 50px 24px; color: var(--muted); }
.empty-state h1, .empty-state h3 { color: var(--ink); }
.settings-list { margin: 0; padding: 10px 22px 22px; }
.settings-list > div { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.settings-list dt { color: var(--muted); font-weight: 550; }
.settings-list dd { text-align: right; font-weight: 650; margin: 0; overflow-wrap: anywhere; }
.cannibal-list { padding: 18px; display: grid; gap: 16px; }
.cannibal-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cannibal-summary { display: flex; justify-content: space-between; padding: 16px; background: #fbfcfe; }
.pre-line { white-space: pre-line; }
.code-block { background: #0e1b31; color: #dbe7ff; border-radius: 9px; padding: 12px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.analysis-body { padding: 22px; }
.analysis-decision { display: flex; justify-content: space-between; align-items: center; gap: 20px; border: 1px solid var(--line); border-left-width: 5px; border-radius: 12px; padding: 18px 20px; background: #fafcff; }
.analysis-decision h3 { margin: 4px 0 0; font-size: 1.55rem; }
.decision-keep { border-left-color: var(--green); }
.decision-update { border-left-color: #d89010; }
.decision-rewrite { border-left-color: var(--red); }
.analysis-summary { font-size: 1.02rem; line-height: 1.65; margin: 18px 0 10px; }
.analysis-score-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 22px 0; }
.analysis-heading { font-size: 1rem; font-weight: 750; margin: 22px 0 12px; }
.analysis-findings td { vertical-align: top; min-width: 110px; }
.analysis-findings td:nth-child(4) { min-width: 360px; }
.analysis-findings td:nth-child(5) { min-width: 260px; }
.analysis-lists { margin-top: 8px; }
.analysis-lists li { margin-bottom: 8px; }
.analysis-meta { color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; font-size: .78rem; }
.finding-critical { background: #fff0ef; color: var(--red); }
.finding-warning { background: #fff7e6; color: #96640b; }
.finding-pass { background: #eaf8f0; color: var(--green); }
.finding-info { background: #edf3ff; color: var(--blue); }

.auth-shell { min-height: calc(100vh - 100px); display: grid; place-items: center; }
.auth-card { width: min(540px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 34px; box-shadow: 0 24px 70px rgba(16, 35, 63, .09); }
.auth-card h1 { font-size: 2rem; margin: 7px 0 14px; letter-spacing: -.035em; }

.btn-primary { background: var(--blue); border-color: var(--blue); font-weight: 650; }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.form-control, .form-select { min-height: 44px; border-color: #d6dce5; }
.form-control:focus, .form-select:focus { border-color: #78a1f4; box-shadow: 0 0 0 .2rem rgba(20, 87, 217, .12); }

@media (max-width: 1100px) {
  .metric-grid, .metric-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analysis-score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .app-container { width: min(100% - 24px, 1480px); }
  .main-content { padding-top: 26px; }
  .page-header { align-items: start; flex-direction: column; }
  .content-layout { grid-template-columns: 1fr; }
  .nav-link { padding: 10px 0 !important; }
  .account-chip { margin: 12px 0; display: inline-flex; }
}
@media (max-width: 540px) {
  .metric-grid, .metric-grid-6 { grid-template-columns: 1fr; }
  .analysis-score-grid { grid-template-columns: 1fr; }
  .metric-value { font-size: 1.65rem; }
  .auth-card { padding: 25px; }
}
