/* Broker Rate design system - Reddit-style community with light/dark theming. */

:root {
  color-scheme: light;
  /* Accent is scheme-driven (see [data-accent] blocks); red is the default. */
  --accent: #d83a2f;
  --accent-dark: #b21d15;
  --up: var(--accent);
  --down: #5d7290;
  /* Softer, slightly tinted light surfaces - dimmer than pure white, with a
     gentle cool cast so the page feels more dynamic and less stark. */
  --bg: #e4e8ef;
  --bg-2: #d6dde7;
  --surface: #f7f9fc;
  --surface-2: #eef2f7;
  --surface-3: #e3e9f1;
  --border: #d3dae4;
  --border-strong: #bcc6d3;
  --text: #1a2230;
  --muted: #54616f;
  --muted-2: #82909e;
  --rail: #edf1f6;
  --success: #1a7f3c;
  --success-soft: #e7f6ec;
  --danger: #c0331f;
  --danger-soft: #fcecea;
  --warning: #9a6a00;
  --gold: #d99a00;
  --accent-soft: color-mix(in srgb, var(--accent) 13%, var(--surface));
  --highlight: rgba(255, 255, 255, 0.7);
  --shadow: 0 1px 1px rgba(16, 24, 40, 0.04), 0 4px 10px rgba(16, 24, 40, 0.06), 0 16px 32px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 18px 50px rgba(16, 24, 40, 0.16);
  --shadow-3d: 0 1px 0 var(--highlight) inset, 0 1px 2px rgba(16, 24, 40, 0.05), 0 10px 24px rgba(16, 24, 40, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --accent: #f0584b;
  --accent-dark: #ff7468;
  --up: var(--accent);
  --down: #8aa0bd;
  /* Deeper, slightly blue-tinted charcoal with a touch more contrast between
     layers so dark mode has character while staying clean and professional. */
  --bg: #181b21;
  --bg-2: #1f242c;
  --surface: #262c34;
  --surface-2: #2f353e;
  --surface-3: #3a414b;
  --border: #3c434e;
  --border-strong: #4d5560;
  --text: #eceff3;
  --muted: #b3bcc6;
  --muted-2: #8b96a3;
  --rail: #2f353e;
  --success: #5cd083;
  --success-soft: #21372a;
  --danger: #ff7d72;
  --danger-soft: #3a221f;
  --warning: #e6bd58;
  --gold: #ecc14d;
  --accent-soft: color-mix(in srgb, var(--accent) 26%, var(--surface));
  --highlight: rgba(255, 255, 255, 0.06);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 22px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
  --shadow-3d: 0 1px 0 var(--highlight) inset, 0 2px 4px rgba(0, 0, 0, 0.32), 0 12px 28px rgba(0, 0, 0, 0.4);
}

/* ---------- Color schemes (admin-selectable accent) ----------
   Each scheme overrides only the accent trio; --accent-soft and --up derive
   from it automatically so both light and dark stay coherent. */
[data-accent="red"] { --accent: #d83a2f; --accent-dark: #b21d15; }
[data-theme="dark"][data-accent="red"] { --accent: #f0584b; --accent-dark: #ff7468; }

[data-accent="turquoise"] { --accent: #0c95a8; --accent-dark: #0a7787; }
[data-theme="dark"][data-accent="turquoise"] { --accent: #2fc6d8; --accent-dark: #61dced; }

[data-accent="ocean"] { --accent: #1f6fe0; --accent-dark: #1657c4; }
[data-theme="dark"][data-accent="ocean"] { --accent: #4f94ff; --accent-dark: #7eb1ff; }

[data-accent="violet"] { --accent: #6d44e6; --accent-dark: #5631c2; }
[data-theme="dark"][data-accent="violet"] { --accent: #9d7bff; --accent-dark: #bba2ff; }

[data-accent="forest"] { --accent: #1f9d57; --accent-dark: #167a43; }
[data-theme="dark"][data-accent="forest"] { --accent: #3fce82; --accent-dark: #67dd9c; }

[data-accent="sunset"] { --accent: #e0791f; --accent-dark: #c06016; }
[data-theme="dark"][data-accent="sunset"] { --accent: #f6a64b; --accent-dark: #ffc078; }

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, color-mix(in srgb, var(--down) 10%, transparent), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* Subtle paper texture overlay for depth (very faint). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

body > * {
  position: relative;
  z-index: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand .logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.nav a,
.nav button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav a:hover,
.nav button:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav .nav-cta {
  color: #fff;
  background: var(--accent);
}

.nav .nav-cta:hover {
  background: var(--accent-dark);
  color: #fff;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
}

.avatar-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.85rem;
  font-weight: 600;
}

.avatar-chip img,
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--surface-3);
}

.avatar {
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--accent);
}

/* ---------- Layout ---------- */
.shell {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 36px) clamp(14px, 4vw, 24px) 80px;
}

.shell-wide {
  max-width: 1200px;
}

/* ---------- Hero / search ---------- */
.hero {
  text-align: center;
  padding: clamp(28px, 6vw, 56px) 0 22px;
}

.hero h1 {
  font-size: clamp(1.9rem, 5vw, 3rem);
  font-weight: 850;
  max-width: 18ch;
  margin: 0 auto 10px;
}

.hero p {
  margin: 0 auto;
  max-width: 56ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.searchbox {
  position: relative;
  max-width: 640px;
  margin: 22px auto 0;
}

.searchbox form {
  display: flex;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 7px 7px 18px;
  box-shadow: var(--shadow);
}

.searchbox form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.searchbox input {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  outline: none;
}

.searchbox button[type="submit"] {
  border: 0;
  border-radius: 999px;
  padding: 11px 22px;
  font: inherit;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.searchbox button[type="submit"]:hover {
  background: var(--accent-dark);
}

.form-label {
  display: grid;
  gap: 8px;
}

.toggle-group {
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.toggle-group legend {
  color: var(--muted);
  flex: 0 0 100%;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.toggle-group label {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  gap: 7px;
  padding: 8px 12px;
}

.toggle-group label:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.suggestions {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  text-align: left;
}

.suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text);
}

.suggestions button:last-child {
  border-bottom: 0;
}

.suggestions button:hover {
  background: var(--surface-2);
}

.suggestions strong {
  display: block;
  font-size: 0.95rem;
}

.suggestion-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.suggestion-main b {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 0.82rem;
}

.suggestions span:not(.suggestion-main),
.suggestions small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.vote-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.comment-signin {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 12px;
}

@media (max-width: 560px) {
  .comment-signin {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .suggestion-main {
    display: block;
  }
}

/* ---------- Section heading ---------- */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 34px 0 14px;
}

.section-head h2 {
  font-size: 1.3rem;
}

.select {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

select,
input,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Cards / threads ---------- */
.card {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 100%, transparent), color-mix(in srgb, var(--surface) 92%, var(--bg-2)));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3d);
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thread {
  display: grid;
  grid-template-columns: 48px 1fr;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 100%, transparent), color-mix(in srgb, var(--surface) 94%, var(--bg-2)));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-3d);
  transition: border-color 0.15s, box-shadow 0.18s, transform 0.12s;
}

.thread:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 4px;
  background: var(--rail);
  border-right: 1px solid var(--border);
}

.vote-btn {
  border: 0;
  background: transparent;
  color: var(--muted-2);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  width: 30px;
  height: 28px;
  display: grid;
  place-items: center;
  transition: background 0.12s, color 0.12s;
}

.vote-btn:hover {
  background: var(--surface-3);
}

.vote-btn.is-up:hover {
  color: var(--up);
}

.vote-btn.is-down:hover {
  color: var(--down);
}

.vote-btn.is-up.is-active {
  color: #fff;
  background: var(--up);
}

.vote-btn.is-down.is-active {
  color: #fff;
  background: var(--down);
}

.vote-score {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--text);
}

.thread-body {
  padding: 14px 16px 16px;
  min-width: 0;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.post-meta .dot::before {
  content: "·";
  margin: 0 4px;
  color: var(--muted-2);
}

.thread-title {
  font-size: 1.08rem;
  font-weight: 750;
  margin: 2px 0 6px;
}

.thread-body p {
  margin: 6px 0;
  color: var(--text);
}

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px 18px;
  margin: 12px 0;
}

.kv div {
  display: flex;
  flex-direction: column;
}

.kv dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  font-weight: 700;
}

.kv dd {
  margin: 2px 0 0;
  font-weight: 600;
}

.kv .map-link {
  color: var(--accent-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.kv .map-link:hover {
  color: var(--accent);
}

.thread-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

.btn:hover {
  background: var(--surface-3);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  border-color: var(--accent-dark);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 4px 12px color-mix(in srgb, var(--accent) 40%, transparent);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px 10px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-broker {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.badge-carrier {
  background: var(--success-soft);
  color: var(--success);
}

.badge-both {
  background: color-mix(in srgb, var(--down) 16%, transparent);
  color: var(--down);
}

.badge-unknown {
  background: var(--surface-3);
  color: var(--muted);
}

[data-theme="dark"] .badge-broker {
  color: var(--accent-dark);
}

/* ---------- Star rating ---------- */
.stars {
  color: var(--accent);
  letter-spacing: 1px;
  font-size: 0.95rem;
}

.stars .off {
  color: var(--border-strong);
}

/* ---------- Profile (broker) ---------- */
.profile {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}

.profile-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.profile-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 78px;
}

.hero-card {
  padding: 20px;
}

.hero-card .hero-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.hero-card h2 {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  margin: 8px 0 4px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.stat {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
}

.stat span {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  font-weight: 700;
}

.stat strong {
  display: block;
  font-size: 1.15rem;
  margin-top: 2px;
}

.panel {
  padding: 18px 20px;
}

.panel > h2,
.panel > h3 {
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.side-card {
  padding: 16px 18px;
}

.side-card h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.sync-note {
  font-size: 0.78rem;
  color: var(--muted-2);
  margin-top: 8px;
}

/* ---------- Reviews + comments ---------- */
.review {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 4px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.review:first-of-type {
  border-top: 0;
}

.review .vote {
  background: transparent;
  border: 0;
  padding: 0;
}

.review-body {
  min-width: 0;
}

.author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.author .avatar,
.author img {
  width: 32px;
  height: 32px;
}

.author .who strong {
  font-size: 0.9rem;
}

.author .who span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
}

.review-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.comment-thread {
  margin-top: 12px;
  border-left: 2px solid var(--border);
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment {
  font-size: 0.9rem;
}

.comment .c-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.comment .c-head strong {
  color: var(--text);
  font-size: 0.84rem;
}

.comment p {
  margin: 3px 0 0;
}

.comment-replies {
  margin-top: 8px;
  border-left: 2px solid var(--border);
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-reply-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
}

.comment-reply-btn:hover {
  color: var(--accent);
}

.comment-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.comment-form input {
  flex: 1;
}

.comment-empty {
  font-size: 0.85rem;
  color: var(--muted-2);
}

/* ---------- Forms ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.context-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.88rem;
}

.context-box strong {
  display: block;
}

.context-box span {
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- Messages / empty ---------- */
.msg {
  font-size: 0.88rem;
  color: var(--muted);
  min-height: 1.2em;
}

.msg[data-tone="success"] {
  color: var(--success);
}

.msg[data-tone="error"] {
  color: var(--danger);
}

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty strong {
  display: block;
  color: var(--text);
  font-size: 1.05rem;
  margin-bottom: 4px;
}

/* ---------- Auth / centered cards ---------- */
.auth-shell {
  display: grid;
  place-items: center;
  padding: clamp(30px, 8vw, 80px) 16px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 30px;
  text-align: center;
}

.auth-card h1 {
  font-size: 1.5rem;
  margin: 12px 0 6px;
}

.auth-card p.lead {
  color: var(--muted);
  margin: 0 0 18px;
}

.auth-card p.lead.small {
  font-size: 0.9rem;
  margin-top: 0;
}

.auth-form {
  display: grid;
  gap: 12px;
  margin: 18px 0;
  text-align: left;
}

.auth-form input {
  width: 100%;
}

.auth-form .btn {
  justify-content: center;
  width: 100%;
}

.recaptcha-box {
  display: flex;
  justify-content: center;
  min-height: 78px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-2);
  font-size: 0.78rem;
  margin: 18px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.google-mark {
  width: 46px;
  height: 46px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.google-mark svg,
.btn-google svg {
  width: 22px;
  height: 22px;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.field {
  text-align: left;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-2);
  font-size: 0.78rem;
  margin: 8px 0;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

/* ---------- Onboarding / profile manager ---------- */
.steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.company-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.company-result:hover {
  border-color: var(--accent);
}

.company-result .who strong {
  display: block;
}

.company-result .who small {
  color: var(--muted);
  font-size: 0.8rem;
}

.profile-photo-edit {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-photo-edit img,
.profile-photo-edit .avatar {
  width: 64px;
  height: 64px;
  font-size: 1.4rem;
}

.pill-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.pill-status.approved {
  background: var(--success-soft);
  color: var(--success);
}

.pill-status.pending {
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: var(--warning);
}

/* ---------- Admin ---------- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metric-card {
  padding: 16px 18px;
}

.metric-card span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.metric-card strong {
  display: block;
  font-size: 1.9rem;
  font-weight: 800;
  margin-top: 4px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.warning {
  background: var(--danger-soft);
  color: var(--danger);
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.list-row:first-child {
  border-top: 0;
}

.list-row .info strong {
  display: block;
  font-size: 0.95rem;
}

.list-row .info span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- Leaderboards ---------- */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.board {
  padding: 16px 18px;
}

.board h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  margin-bottom: 12px;
}

.board-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.board-row:first-of-type {
  border-top: 0;
}

.board-row .rank {
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--muted-2);
  text-align: center;
}

.board-row.top-1 .rank {
  color: var(--gold);
}

.board-row .name {
  min-width: 0;
}

.board-row .name strong {
  display: block;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-row .name span {
  font-size: 0.76rem;
  color: var(--muted);
}

.board-row .metric {
  font-weight: 800;
  font-size: 0.9rem;
  white-space: nowrap;
}

.metric.good {
  color: var(--success);
}

.metric.bad {
  color: var(--danger);
}

/* ---------- Rank / reviewer badges ---------- */
.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 18%, transparent);
  color: var(--gold);
  text-transform: uppercase;
}

.rank-badge.tier-pro {
  background: color-mix(in srgb, var(--down) 16%, transparent);
  color: var(--down);
}

.rank-badge.tier-new {
  background: var(--surface-3);
  color: var(--muted);
}

/* ---------- Star summary with expandable reviewers ---------- */
.rating-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.rating-big {
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
}

.reviewers-toggle {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.reviewers-toggle:hover {
  border-color: var(--border-strong);
}

.reviewers-panel {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.reviewers-panel .r-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  cursor: pointer;
}

.reviewers-panel .r-row:first-child {
  border-top: 0;
}

.reviewers-panel .r-row:hover {
  background: var(--surface-3);
}

.reviewers-panel .r-row .who {
  flex: 1;
  min-width: 0;
}

.reviewers-panel .r-row .who strong {
  font-size: 0.88rem;
}

.reviewers-panel .r-row .who span {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
}

/* ---------- Quick review form ---------- */
.star-input {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 4px;
}

.star-input input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.star-input label {
  font-size: 1.9rem;
  line-height: 1;
  color: var(--border-strong);
  cursor: pointer;
  transition: color 0.1s, transform 0.1s;
}

.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label {
  color: var(--accent);
}

.star-input label:hover {
  transform: scale(1.12);
}

.more-details {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin-top: 4px;
}

.more-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
  list-style: none;
}

.more-details summary::-webkit-details-marker {
  display: none;
}

.more-details summary::before {
  content: "+ ";
}

.more-details[open] summary::before {
  content: "– ";
}

.more-details .form-grid {
  margin-top: 12px;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 60px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.site-footer .inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 26px clamp(14px, 4vw, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--muted);
  font-weight: 600;
}

.site-footer a:hover {
  color: var(--accent);
}

.footer-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

/* ---------- Announcement banner (admin-controlled) ---------- */
.announcement {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  padding: 9px clamp(16px, 4vw, 40px);
}

[data-theme="dark"] .announcement {
  color: color-mix(in srgb, var(--accent) 70%, #fff);
}

/* ---------- Home section separation ---------- */
.section-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
}

.section-label h2 {
  font-size: 1.25rem;
}

.section-label .count {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

#results:not(:empty) {
  margin: 8px 0 10px;
}

/* Visible divider + breathing room between search results and the rankings. */
.home-divider {
  height: 1px;
  border: 0;
  margin: 34px 0;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}

#boards {
  scroll-margin-top: 80px;
}

#boards .boards-head {
  margin: 0 0 16px;
}

/* ---------- Broker identity card (address + owner + DOT on top) ---------- */
.identity-card {
  padding: 20px;
}

.identity-card .identity-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.identity-card h2 {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  margin: 6px 0 2px;
}

.identity-lines {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.identity-line {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  align-items: baseline;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.identity-line:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.identity-line dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  font-weight: 700;
}

.identity-line dd {
  margin: 0;
  font-weight: 650;
  min-width: 0;
}

.gl {
  color: var(--accent-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.gl:hover {
  color: var(--accent);
}

[data-theme="dark"] .gl {
  color: color-mix(in srgb, var(--accent) 78%, #fff);
}

.addr-actions {
  display: inline-flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.addr-actions a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.addr-actions a:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* ---------- Onboarding confirm step ---------- */
.confirm-box {
  margin-top: 12px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.confirm-box strong {
  display: block;
  margin-bottom: 6px;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ---------- Broker profile (searchcarriers-inspired) ---------- */
.profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 14px;
}

.profile-hero {
  padding: 22px;
  margin-bottom: 16px;
}

.ph-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.ph-id {
  min-width: 0;
}

.profile-hero h2 {
  font-size: clamp(1.35rem, 3.5vw, 2rem);
  margin: 6px 0 4px;
}

.ph-sub {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.ph-legal {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

.ph-rating {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.ph-rating .rating-big {
  font-size: 2.2rem;
  line-height: 1;
}

.ph-rating .muted {
  font-size: 0.78rem;
}

.ph-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.ph-stat {
  font-size: 0.88rem;
  color: var(--muted);
}

.ph-stat strong {
  color: var(--text);
  font-size: 1rem;
}

.snapshot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 12px;
  text-align: center;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.stat-tile-value {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.stat-tile-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  font-weight: 700;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.tab-panel.is-active {
  display: flex;
}

/* Reviews overview (score + distribution bars) */
.reviews-overview {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
}

.ro-score {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 88px;
}

.ro-score .rating-big {
  font-size: 2.8rem;
  line-height: 1;
}

.ro-score .muted {
  font-size: 0.78rem;
}

.ro-bars {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.rbar {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.rbar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.rbar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.rbar-count {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 520px) {
  .reviews-overview {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ---------- How it works + join CTA ---------- */
.how-section {
  margin-top: 40px;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.how-step {
  padding: 20px;
}

.how-step .how-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

[data-theme="dark"] .how-step .how-num {
  color: color-mix(in srgb, var(--accent) 78%, #fff);
}

.how-step strong {
  display: block;
  font-size: 1.02rem;
  margin-bottom: 4px;
}

.how-step p {
  margin: 0;
  font-size: 0.9rem;
}

.join-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 22px;
  margin-top: 14px;
}

.join-cta strong {
  font-size: 1.02rem;
}

/* ---------- Carrier profile setup ---------- */
.profile-wrap {
  display: grid;
  gap: 14px;
  max-width: 620px;
  margin: 0 auto;
}

.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-sub {
  margin: 6px 0 18px;
}

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.photo-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.field-hint {
  margin: 5px 0 0;
  font-size: 0.78rem;
  color: var(--muted-2);
}

.setup-label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--text);
}

.setup-label-text {
  font-size: 0.85rem;
  font-weight: 650;
}

.setup-label input,
.setup-label textarea {
  font-weight: 400;
}

.combo {
  position: relative;
}

.combo-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.combo-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text);
}

.combo-item:last-child {
  border-bottom: 0;
}

.combo-item:hover {
  background: var(--surface-2);
}

.combo-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 0.92rem;
}

.combo-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.combo-empty {
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

.selected-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.selected-chip .who strong {
  display: block;
  font-size: 0.92rem;
}

.selected-chip .who small {
  color: var(--muted);
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* Grouped quick yes/no questions on the review form. */
.quick-questions {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.quick-questions .toggle-group {
  margin: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 880px) {
  .profile {
    grid-template-columns: 1fr;
  }
  .profile-side {
    position: static;
  }
}

@media (max-width: 560px) {
  .nav a span.label,
  .nav .hide-sm {
    display: none;
  }
}
