:root {
  --sa-bg: #eef3f7;
  --sa-ink: #182230;
  --sa-muted: #667085;
  --sa-line: #d8e0ea;
  --sa-panel: #ffffff;
  --sa-panel-soft: #f7fafc;
  --sa-deep: #101828;
  --sa-blue: #2563eb;
  --sa-teal: #0f766e;
  --sa-green: #15803d;
  --sa-amber: #b45309;
  --sa-red: #b42318;
  --sa-violet: #6d28d9;
  --sa-shadow: 0 18px 48px rgba(16, 24, 40, .10);
  --sa-sidebar: 292px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--sa-ink);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .08), transparent 34%),
    linear-gradient(225deg, rgba(15, 118, 110, .08), transparent 36%),
    var(--sa-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.sa-shell { display: flex; min-height: 100vh; }
.sa-sidebar {
  position: sticky;
  top: 0;
  width: var(--sa-sidebar);
  min-width: var(--sa-sidebar);
  height: 100vh;
  padding: 18px 14px;
  color: #ffffff;
  background: #111827;
  display: flex;
  flex-direction: column;
}
.sa-brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 8px 18px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.sa-brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--sa-blue), var(--sa-teal));
  font-weight: 900;
}
.sa-brand strong { display: block; font-size: 16px; }
.sa-brand span { display: block; margin-top: 2px; color: #b7c0cf; font-size: 12px; }
.sa-nav {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 7px;
  padding: 16px 0;
}
.sa-nav a {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr);
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #d5dbea;
  font-weight: 800;
  font-size: 13px;
}
.sa-nav a span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255,255,255,.08);
  color: #ffffff;
  font-size: 10px;
}
.sa-nav a:hover,
.sa-nav a.is-active {
  background: #2563eb;
  color: #ffffff;
  border-color: rgba(255,255,255,.18);
}
.sa-nav a.sa-danger { color: #ffd1d1; }
.sa-version { color: #98a2b3; font-size: 11px; padding: 10px 8px; }
.sa-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 24px;
}
.sa-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px 22px;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(216,224,234,.85);
  border-radius: 8px;
  box-shadow: var(--sa-shadow);
  backdrop-filter: blur(12px);
}
.sa-topbar h1 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: 0; }
.sa-topbar p { margin: 5px 0 0; color: var(--sa-muted); font-size: 13px; }
.sa-user-pill {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--sa-line);
  border-radius: 999px;
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
}
.sa-grid { display: grid; gap: 16px; }
.sa-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sa-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sa-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sa-panel {
  background: var(--sa-panel);
  border: 1px solid var(--sa-line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .06);
}
.sa-panel-pad { padding: 18px; }
.sa-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.sa-section-head h2,
.sa-section-head h3 { margin: 0; font-size: 18px; letter-spacing: 0; }
.sa-section-head p { margin: 4px 0 0; color: var(--sa-muted); font-size: 13px; }
.sa-stat {
  min-height: 122px;
  padding: 17px;
  border-left: 5px solid var(--sa-blue);
}
.sa-stat:nth-child(2) { border-left-color: var(--sa-teal); }
.sa-stat:nth-child(3) { border-left-color: var(--sa-violet); }
.sa-stat:nth-child(4) { border-left-color: var(--sa-amber); }
.sa-stat span { color: var(--sa-muted); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.sa-stat strong { display: block; margin-top: 12px; font-size: 34px; line-height: 1; }
.sa-stat small { display: block; margin-top: 10px; color: var(--sa-muted); }
.sa-table-wrap { overflow: auto; }
.sa-table { width: 100%; border-collapse: collapse; min-width: 780px; }
.sa-table th,
.sa-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--sa-line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}
.sa-table th {
  color: #344054;
  background: var(--sa-panel-soft);
  font-size: 11px;
  text-transform: uppercase;
}
.sa-muted { color: var(--sa-muted); }
.sa-small { font-size: 12px; }
.sa-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid var(--sa-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--sa-ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}
.sa-btn:hover { box-shadow: 0 8px 18px rgba(16, 24, 40, .08); }
.sa-btn-primary { background: var(--sa-blue); border-color: var(--sa-blue); color: #ffffff; }
.sa-btn-teal { background: var(--sa-teal); border-color: var(--sa-teal); color: #ffffff; }
.sa-btn-red { background: var(--sa-red); border-color: var(--sa-red); color: #ffffff; }
.sa-btn-ghost { background: transparent; }
.sa-form { display: grid; gap: 14px; }
.sa-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.sa-field { display: grid; gap: 6px; }
.sa-field label { font-size: 12px; font-weight: 900; color: #344054; }
.sa-field input,
.sa-field select,
.sa-field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #ffffff;
  color: var(--sa-ink);
  padding: 10px 12px;
}
.sa-field textarea { min-height: 128px; resize: vertical; line-height: 1.45; }
.sa-field-full { grid-column: 1 / -1; }
.sa-alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--sa-line);
  background: #ffffff;
  font-weight: 800;
}
.sa-alert-success { color: #065f46; background: #ecfdf3; border-color: #abefc6; }
.sa-alert-danger { color: #991b1b; background: #fef3f2; border-color: #fecaca; }
.sa-alert-warning { color: #92400e; background: #fffbeb; border-color: #fedf89; }
.sa-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1849a9;
  font-size: 11px;
  font-weight: 900;
  text-transform: capitalize;
}
.sa-badge-replied,
.sa-badge-negotiating,
.sa-badge-quoted { background: #fff7ed; color: #9a3412; }
.sa-badge-converted { background: #ecfdf3; color: #067647; }
.sa-badge-dnc,
.sa-badge-manual_hold,
.sa-badge-lost { background: #fef3f2; color: #b42318; }
.sa-kv {
  display: grid;
  grid-template-columns: 180px minmax(0,1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--sa-line);
}
.sa-kv span:first-child { color: var(--sa-muted); font-size: 12px; font-weight: 900; }
.sa-draft-preview {
  padding: 16px;
  border: 1px solid var(--sa-line);
  border-radius: 8px;
  background: #ffffff;
  line-height: 1.55;
}
.sa-intel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.sa-intel-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid #e4eaf1;
  border-left: 4px solid var(--sa-teal);
  border-radius: 8px;
  background: #fbfdff;
}
.sa-intel-card:nth-child(3),
.sa-intel-card:nth-child(4) {
  border-left-color: var(--sa-blue);
}
.sa-intel-card-wide { grid-column: 1 / -1; }
.sa-intel-label {
  margin-bottom: 8px;
  color: #475467;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}
.sa-intel-text {
  margin: 0;
  color: var(--sa-ink);
  font-size: 14px;
  line-height: 1.55;
}
.sa-domain-link {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--sa-blue);
  font-size: 16px;
  font-weight: 900;
}
.sa-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.sa-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid #c7d7fe;
  border-radius: 999px;
  background: #eef4ff;
  color: #1849a9;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.sa-chip-price {
  border-color: #a7f3d0;
  background: #ecfdf3;
  color: #067647;
}
.sa-insight-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sa-insight-list li {
  position: relative;
  padding-left: 18px;
  color: var(--sa-ink);
  font-size: 14px;
  line-height: 1.5;
}
.sa-insight-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--sa-teal);
}
.sa-empty {
  color: var(--sa-muted);
  font-size: 13px;
}
.sa-raw-details {
  margin-top: 14px;
  border-top: 1px solid var(--sa-line);
  padding-top: 12px;
}
.sa-raw-details summary {
  cursor: pointer;
  color: var(--sa-muted);
  font-size: 13px;
  font-weight: 900;
}
.sa-raw-block {
  max-height: 360px;
  margin-top: 10px;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--sa-line);
  border-radius: 8px;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.sa-raw-block h4 {
  margin: 12px 0 5px;
  color: #182230;
  font-size: 12px;
}
.sa-raw-block h4:first-child { margin-top: 0; }
.sa-login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.sa-login-box {
  width: min(520px, 100%);
  padding: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--sa-line);
  box-shadow: var(--sa-shadow);
}
.sa-login-box h1 { margin: 0 0 6px; font-size: 28px; }
.sa-login-box p { margin: 0 0 18px; color: var(--sa-muted); }
.sa-print-only { display: none; }

@media print {
  .sa-sidebar, .sa-topbar, .sa-actions, .sa-no-print { display: none !important; }
  .sa-main { padding: 0; }
  .sa-shell { display: block; }
  .sa-panel { box-shadow: none; border-color: #d0d5dd; }
  .sa-print-only { display: block; }
}

@media (max-width: 1100px) {
  :root { --sa-sidebar: 238px; }
  .sa-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sa-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .sa-shell { display: block; }
  .sa-sidebar { position: relative; width: 100%; min-width: 0; height: auto; }
  .sa-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .sa-main { padding: 14px; }
  .sa-topbar { align-items: flex-start; flex-direction: column; }
  .sa-grid-2, .sa-grid-3, .sa-grid-4, .sa-form-grid { grid-template-columns: 1fr; }
  .sa-intel-grid { grid-template-columns: 1fr; }
  .sa-kv { grid-template-columns: 1fr; }
}
