/* ============================================================================
   Design tokens — reference palette (see dataviz skill: references/palette.md)
   Light mode only. Categorical hues assigned in FIXED order, never cycled:
   1 products=blue  3 industries=aqua  4 technologies=yellow  7 personas=violet
   Sequential ramp (blue) drives the score tiers everywhere (pills + chart).
   ============================================================================ */
:root {
  --page-plane:     #f9f9f7;
  --surface-1:      #fcfcfb;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --border:         rgba(11,11,11,0.10);
  --border-strong:  rgba(11,11,11,0.16);

  --cat-blue:    #2a78d6;
  --cat-orange:  #eb6834;
  --cat-aqua:    #1baf7a;
  --cat-yellow:  #eda100;
  --cat-magenta: #e87ba4;
  --cat-green:   #008300;
  --cat-violet:  #4a3aa7;
  --cat-red:     #e34948;

  /* sequential blue ramp — ordinal steps for the 4 score tiers */
  --seq-250: #86b6ef;
  --seq-350: #5598e7;
  --seq-450: #2a78d6;
  --seq-600: #184f95;

  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(11,11,11,0.05), 0 10px 28px rgba(11,11,11,0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Inter, Arial, sans-serif;
  background: var(--page-plane);
  color: var(--text-primary);
  line-height: 1.5;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 20px 80px; }

/* ---- top nav ---- */
.top-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px 20px; margin-bottom: 8px;
}
.top-nav-right { display: flex; align-items: center; gap: 16px; font-size: 13.5px; }
.top-nav a, .top-nav-right a { color: var(--cat-blue); text-decoration: none; font-weight: 600; }
.top-nav a:hover, .top-nav-right a:hover { text-decoration: underline; }
.user-credits { color: var(--text-secondary); }
.user-credits strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.link-btn-inline {
  background: none; border: none; color: var(--text-secondary); font-size: 13.5px;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 0;
}
.admin-tag {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--cat-violet); color: white; padding: 3px 8px; border-radius: 999px; margin-left: 8px; vertical-align: middle;
}

.app-header { text-align: center; margin-bottom: 28px; }
.brand { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: #1a2b4d; }
.brand-small { font-size: 17px; }
.brand span { color: var(--cat-blue); }
.tagline { color: var(--text-secondary); max-width: 620px; margin: 10px auto 0; font-size: 15px; }

.banner {
  background: #fdf3d9; color: #8a5a00; border: 1px solid #f0dfa8;
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 14px; margin-bottom: 20px;
}
.hidden { display: none !important; }

.input-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; text-align: center;
}
#analyze-form { display: flex; gap: 10px; }
#url-input {
  flex: 1; padding: 13px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  font-size: 15px; outline: none; background: white;
}
#url-input:focus { border-color: var(--cat-blue); box-shadow: 0 0 0 3px rgba(42,120,214,0.15); }
#submit-btn {
  padding: 13px 22px; border: none; border-radius: var(--radius-sm); background: var(--cat-blue);
  color: white; font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap;
}
#submit-btn:hover { background: #1c5cab; }
#submit-btn:disabled { background: #a7c2e8; cursor: not-allowed; }

.link-btn {
  margin-top: 14px; background: none; border: none; color: var(--cat-blue); font-size: 13.5px;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}

.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px; margin-top: 22px;
}

.progress-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.progress-head h3 { margin: 0; font-size: 16px; }
.progress-bar { flex: 1; max-width: 220px; height: 8px; background: var(--gridline); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; width: 4%; background: var(--cat-blue); transition: width 0.4s ease; }
.progress-log {
  list-style: none; margin: 16px 0 0; padding: 0; max-height: 240px; overflow-y: auto;
  font-size: 13px; color: var(--text-secondary); border-top: 1px solid var(--gridline); padding-top: 12px;
}
.progress-log li { padding: 3px 0; }
.progress-log li:last-child { color: var(--text-primary); font-weight: 600; }

.error-card { border-color: #f0c9c0; background: #fff7f5; }
.error-card p { color: var(--status-critical); margin: 0; font-size: 14px; }

/* ---- login page ---- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap { width: 100%; max-width: 380px; padding: 20px; }
.login-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 32px 28px;
}
.login-sub { color: var(--text-secondary); text-align: center; font-size: 14px; margin: 10px 0 22px; }
.login-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin: 14px 0 5px; }
#login-form input {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  font-size: 14.5px; outline: none;
}
#login-form input:focus { border-color: var(--cat-blue); box-shadow: 0 0 0 3px rgba(42,120,214,0.15); }
#login-btn {
  width: 100%; margin-top: 20px; padding: 12px; border: none; border-radius: var(--radius-sm);
  background: var(--cat-blue); color: white; font-weight: 600; font-size: 14.5px; cursor: pointer;
}
#login-btn:hover { background: #1c5cab; }
#login-btn:disabled { background: #a7c2e8; }
.login-error { color: var(--status-critical); font-size: 13.5px; text-align: center; margin-top: 14px; }

/* ---- admin page ---- */
.admin-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.admin-form input[type="email"] { flex: 2; min-width: 200px; }
.admin-form input[type="password"] { flex: 2; min-width: 180px; }
.admin-form input[type="number"] { width: 90px; }
.admin-form input {
  padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); font-size: 14px;
}
.admin-form button {
  padding: 10px 18px; border: none; border-radius: var(--radius-sm); background: var(--cat-blue);
  color: white; font-weight: 600; cursor: pointer;
}
.admin-checkbox { font-size: 13.5px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
#users-table .credits-input { font-variant-numeric: tabular-nums; }
#users-table button:not(.save-credits) { background: none; border: 1px solid var(--border-strong); border-radius: 7px; padding: 6px 10px; cursor: pointer; font-size: 12.5px; margin-left: 6px; }
#users-table .save-credits { background: var(--cat-blue); color: white; border: none; border-radius: 7px; padding: 6px 12px; cursor: pointer; font-size: 12.5px; }

/* ============================================================================
   Report
   ============================================================================ */
.report-head {
  display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 14px;
  padding-bottom: 20px; border-bottom: 1px solid var(--gridline); margin-bottom: 22px;
}
.report-head h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -0.01em; }
.report-head .meta { color: var(--text-muted); font-size: 13px; }
.report-head .meta a { color: var(--text-muted); }
.downloads { display: flex; gap: 8px; flex-wrap: wrap; }
.downloads a {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-strong); background: white; padding: 9px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; color: #1a2b4d; text-decoration: none;
}
.downloads a:hover { border-color: var(--cat-blue); color: var(--cat-blue); }
.dl-icon { font-size: 13px; }

/* stat tiles */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
@media (max-width: 700px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat-tile {
  background: var(--page-plane); border: 1px solid var(--gridline); border-radius: var(--radius-sm);
  padding: 16px 18px;
}
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; color: #1a2b4d; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; }

.section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  margin: 30px 0 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px;
}
.section-title:first-child { margin-top: 0; }
.exec-summary {
  background: linear-gradient(180deg, #f4f8ff 0%, #f9f9f7 100%);
  border-left: 3px solid var(--cat-blue); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
}
.exec-summary p { color: var(--text-primary); font-size: 14.5px; white-space: pre-wrap; margin: 0; }
.exec-summary p + p { margin-top: 12px; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; color: var(--text-primary);
  border: 1px solid transparent;
}
.tag-products    { background: rgba(42,120,214,0.10); border-color: rgba(42,120,214,0.22); }
.tag-industries  { background: rgba(27,175,122,0.12); border-color: rgba(27,175,122,0.24); }
.tag-personas    { background: rgba(74,58,167,0.10);  border-color: rgba(74,58,167,0.22); }
.tag-tech        { background: rgba(237,161,0,0.14);  border-color: rgba(237,161,0,0.28); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

.plain-list { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.plain-list li { padding: 7px 0; border-bottom: 1px solid var(--gridline); display: flex; align-items: baseline; gap: 8px; }
.plain-list li:last-child { border-bottom: none; }
.plain-list .bullet { color: var(--cat-blue); flex-shrink: 0; }
.plain-list a { color: var(--text-primary); text-decoration: none; }
.plain-list a:hover { color: var(--cat-blue); text-decoration: underline; }
.empty-note { color: var(--text-muted); font-size: 13px; font-style: italic; }

/* score distribution — sequential (single hue, light -> dark by tier) */
.dist-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; margin: 7px 0; }
.dist-label { width: 56px; color: var(--text-secondary); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.dist-bar-track { flex: 1; background: var(--gridline); border-radius: 5px; height: 12px; overflow: hidden; }
.dist-bar-fill { height: 100%; border-radius: 5px; min-width: 3px; }
.dist-count { width: 34px; text-align: right; color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* ranked table */
.table-scroll { overflow-x: auto; border: 1px solid var(--gridline); border-radius: var(--radius-sm); }
table.companies { width: 100%; border-collapse: collapse; font-size: 13px; }
table.companies thead th {
  position: sticky; top: 0; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); background: var(--page-plane); border-bottom: 1px solid var(--gridline); padding: 10px 12px;
}
table.companies td { padding: 10px 12px; border-bottom: 1px solid var(--gridline); vertical-align: top; }
table.companies tbody tr:nth-child(odd) { background: rgba(11,11,11,0.014); }
table.companies tbody tr:hover td { background: rgba(42,120,214,0.05); }
table.companies td:first-child, table.companies th:first-child { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.company-name { font-weight: 600; }
.industry-tag {
  display: inline-block; font-size: 11.5px; padding: 2px 9px; border-radius: 999px;
  background: rgba(27,175,122,0.12); color: #0d5c3f; white-space: nowrap;
}
.score-pill {
  display: inline-block; min-width: 28px; text-align: center; font-weight: 700; border-radius: 7px;
  padding: 3px 8px; font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.score-t4 { background: rgba(24,79,149,0.14); color: var(--seq-600); }
.score-t3 { background: rgba(42,120,214,0.13); color: #1c5cab; }
.score-t2 { background: rgba(85,152,231,0.13); color: #2a5f9e; }
.score-t1 { background: rgba(134,182,239,0.14); color: #52698a; }
.evidence-cell { color: var(--text-secondary); font-size: 12px; max-width: 380px; }
.evidence-cell em { color: var(--text-muted); font-style: normal; }

.warnings {
  font-size: 12.5px; color: var(--text-secondary); background: var(--page-plane);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 28px;
}
.warnings ul { margin: 6px 0 0; padding-left: 18px; }
.warnings li { margin: 3px 0; }

/* ---- outreach pitch profile (Summary / Services / Value props / Proof) ---- */
.pitch-card { margin-top: 8px; }
.pitch-note { color: var(--text-muted); font-size: 12.5px; margin: -6px 0 16px; }
.pitch-field { margin-bottom: 18px; }
.pitch-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-secondary); margin-bottom: 7px;
}
.pitch-box {
  background: white; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 14px 16px; font-size: 13.5px; color: var(--text-primary); line-height: 1.55;
}
.pitch-box p { margin: 0; white-space: pre-wrap; }
.pitch-box ul { margin: 0; padding-left: 20px; }
.pitch-box li { margin: 5px 0; }
.pitch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 800px) { .pitch-grid { grid-template-columns: 1fr; } }

.show-more {
  margin-top: 14px; background: white; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 16px; cursor: pointer; font-size: 13px; font-weight: 600; color: #1a2b4d;
}
.show-more:hover { border-color: var(--cat-blue); color: var(--cat-blue); }
