:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f3f5f7;
  --brand: #d84a1b;
  --brand-dark: #a93210;
  --ink: #172033;
  --muted: #667085;
}

body {
  margin: 0;
}

.auth-page { min-height: 100vh; background: #162236; }
.auth-shell { display: grid; grid-template-columns: 1fr 430px; gap: 60px; align-items: center; width: min(980px, calc(100% - 36px)); min-height: 100vh; margin: 0 auto; }
.auth-brand { color: #fff; }
.auth-brand h1 { font-size: 38px; margin-bottom: 16px; }
.auth-brand p { max-width: 520px; color: #c7d0dc; line-height: 1.8; }
.auth-card { padding: 28px; }
.error-box { padding: 12px; margin-bottom: 16px; border: 1px solid #fecaca; border-radius: 8px; color: #991b1b; background: #fef2f2; }

a {
  color: var(--brand-dark);
  text-decoration: none;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.container.wide {
  max-width: 1280px;
}

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

.brandbar { padding: 6px 0; }
.nav-actions { display: flex; align-items: center; gap: 14px; font-weight: 700; }
.nav-actions form { margin: 0; }
.user-badge { padding: 5px 9px; border-radius: 999px; color: #475467; background: #e9edf2; font-size: 12px; }
.link-button { padding: 0; color: var(--brand-dark); background: transparent; }
.eyebrow { color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .12em; margin-bottom: 5px; text-transform: uppercase; }

h1 {
  font-size: 28px;
  margin: 0;
}

h2 {
  font-size: 18px;
  margin: 0 0 16px;
}

.panel,
.notice,
.success,
.table-wrap {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 30px;
  margin-bottom: 18px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(120deg, #1c2738, #263a55);
}
.hero h2 { margin: 12px 0 8px; font-size: 26px; max-width: 640px; }
.hero p { color: #d4dbe5; margin: 0; line-height: 1.7; }
.pill { display: inline-block; padding: 5px 9px; border-radius: 999px; color: #ffd8c9; background: rgba(216,74,27,.22); font-size: 12px; font-weight: 800; }
.hero-flow { display: flex; align-items: center; gap: 9px; white-space: nowrap; font-size: 13px; }
.hero-flow span { padding: 9px 10px; background: rgba(255,255,255,.09); border-radius: 8px; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 18px; }
.section-heading { grid-column: 1 / -1; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 4px; }
.section-heading h2 { margin: 0 0 4px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.step-number { display: grid; place-items: center; flex: 0 0 30px; height: 30px; border-radius: 9px; color: #fff; background: var(--brand); font-weight: 900; }
.step-number.muted { background: #344054; }
.full-span { grid-column: 1 / -1; }
small { color: var(--muted); font-weight: 400; line-height: 1.45; }
.primary-action { background: var(--brand); padding: 12px 16px; }
.primary-action:hover { background: var(--brand-dark); }

.route-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 14px; }
.route-list li { display: grid; gap: 3px; padding-left: 14px; border-left: 3px solid #f3b49f; }
.route-list b { font-size: 14px; }
.route-list span { color: var(--muted); font-size: 13px; line-height: 1.5; }
.warning-card { background: #fff5ef; border: 1px solid #ffd5c4; border-radius: 10px; padding: 13px; color: #8e2d0e; font-size: 13px; line-height: 1.6; }
.notice.compact { margin-top: 12px; margin-bottom: 0; padding: 13px; font-size: 13px; line-height: 1.6; }

.notice {
  background: #fefce8;
  border-color: #fde68a;
}

.success {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid h2 {
  grid-column: 1 / -1;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.filters {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr) auto auto auto;
  gap: 10px;
  align-items: end;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

button,
.button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  line-height: 1.35;
}

.secondary {
  background: #334155;
}

.lead-filters { grid-template-columns: 2fr repeat(4, 1fr) auto auto; }
.company-link { color: var(--ink); font-weight: 800; }
.subtext { color: var(--muted); font-size: 12px; margin-top: 5px; }
.map-link { display: inline-block; margin-top: 7px; font-size: 12px; font-weight: 800; }
.tag { display: inline-block; padding: 4px 8px; border-radius: 6px; color: #8e2d0e; background: #fff0ea; font-size: 12px; font-weight: 800; }
.score-copy { max-width: 280px; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.status-chip { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #eef2f6; font-size: 12px; font-weight: 700; white-space: nowrap; }
.text-action { white-space: nowrap; font-weight: 800; }

.table-wrap {
  overflow-x: auto;
  padding: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #f8fafc;
  font-weight: 700;
}

.empty {
  text-align: center;
  color: #64748b;
}

.grade {
  display: inline-block;
  min-width: 28px;
  border-radius: 999px;
  padding: 3px 8px;
  color: #fff;
  text-align: center;
  font-weight: 800;
}

.grade-A { background: #16804a; }
.grade-B { background: #b45309; }
.grade-C { background: #64748b; }

.detail p {
  margin: 10px 0;
  line-height: 1.55;
}

.lead-summary { display: flex; justify-content: space-between; gap: 20px; align-items: center; color: #fff; background: #1d2939; border-radius: 14px; padding: 22px; margin-bottom: 18px; }
.lead-summary h2 { margin: 0; font-size: 23px; }
.lead-summary p { margin: 8px 0 0; color: #cbd3df; }
.summary-title { display: flex; align-items: center; gap: 10px; }
.score-box { display: grid; gap: 4px; max-width: 440px; font-size: 13px; line-height: 1.5; }
.score-box span { color: #d0d5dd; }
.detail-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 18px; }
.info-list { margin: 16px 0 0; }
.info-list > div { padding: 11px 0; border-bottom: 1px solid #edf0f3; }
.info-list dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.info-list dd { margin: 0; line-height: 1.5; }
.map-photo-wrap dd { margin-top: 8px; }
.map-photo { display: block; width: 100%; max-width: 360px; max-height: 240px; object-fit: cover; border-radius: 10px; border: 1px solid #e4e7ec; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { display: grid; gap: 5px; min-height: 112px; padding: 17px; border: 1px solid #e4e7ec; border-radius: 14px; background: #fff; }
.metric-card span { color: var(--muted); font-size: 13px; font-weight: 700; }
.metric-card strong { font-size: 30px; line-height: 1.1; }
.metric-card small { align-self: end; }
.metric-card.accent { border-color: #ffc9b5; background: #fff8f5; }
.metric-card.warn { border-color: #f7d48b; background: #fffbeb; }
.metric-card.success-card { border-color: #a6dfc0; background: #f0fdf4; }
.dashboard-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 18px; }
.funnel-list { display: grid; gap: 14px; margin-top: 18px; }
.funnel-row { display: grid; grid-template-columns: 90px minmax(80px, 1fr) 36px; gap: 12px; align-items: center; font-size: 13px; }
.funnel-track { height: 12px; border-radius: 999px; background: #edf0f3; overflow: hidden; }
.funnel-track i { display: block; height: 100%; min-width: 3px; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #f08b65); }
.rank-list { display: grid; margin-top: 12px; }
.rank-list a { display: flex; justify-content: space-between; gap: 16px; padding: 11px 4px; border-bottom: 1px solid #edf0f3; color: var(--ink); }
.rank-list a:hover { color: var(--brand-dark); }
.queue-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.queue-card h2 { display: flex; justify-content: space-between; }
.queue-card h2 span { color: var(--brand); }
.queue-item { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid #edf0f3; color: var(--ink); }
.queue-item div { min-width: 0; }
.queue-item b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.queue-item small { display: block; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item em { align-self: center; flex: 0 0 auto; padding: 4px 7px; border-radius: 6px; color: #8e2d0e; background: #fff0ea; font-size: 11px; font-style: normal; font-weight: 800; }
.history-grid { grid-template-columns: 1.5fr .7fr; }
.history-list { display: grid; }
.history-row { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid #edf0f3; }
.history-row > div:first-child { min-width: 0; }
.history-row b { display: block; font-size: 13px; }
.history-row small { display: block; margin-top: 5px; color: var(--muted); }
.history-result { flex: 0 0 150px; text-align: right; }
.history-result .status-chip { margin-bottom: 4px; }
.account-list { display: grid; }
.account-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 15px 0; border-bottom: 1px solid #edf0f3; }
.account-row > div:last-child { display: flex; align-items: center; gap: 8px; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.inline-form input { width: 92px; padding: 6px 8px; }
.account-row small { display: block; margin-top: 5px; color: var(--muted); }
.small-button { padding: 6px 10px; font-size: 12px; }
.bulk-actions { display: flex; align-items: end; gap: 10px; margin-top: 12px; }
.bulk-actions label { min-width: 180px; }
.owner-name { color: var(--muted); font-size: 12px; }

@media (max-width: 760px) {
  .topbar,
  .task-grid,
  .workspace-grid,
  .detail-grid,
  .dashboard-grid,
  .queue-grid,
  .metric-grid,
  .two-fields,
  .form-grid,
  .filters {
    grid-template-columns: 1fr;
    display: grid;
  }
  .hero, .lead-summary { align-items: flex-start; flex-direction: column; }
  .hero-flow { white-space: normal; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-actions { align-items: flex-start; flex-wrap: wrap; }
  .auth-shell { grid-template-columns: 1fr; gap: 20px; align-content: center; padding: 30px 0; }
  .auth-brand h1 { font-size: 30px; }
  .account-row { align-items: flex-start; flex-direction: column; }
  .bulk-actions { align-items: stretch; flex-direction: column; }
}
