:root {
  --bg: #f5f7fb;
  --bg-2: #e8eef7;
  --card: #ffffff;
  --card-soft: rgba(255, 255, 255, 0.82);
  --text: #111827;
  --muted: #667085;
  --line: #d9e2ef;
  --primary: #246bfe;
  --primary-2: #1647b8;
  --ink: #0b1220;
  --good: #0f9f6e;
  --warn: #d97706;
  --bad: #dc2626;
  --neutral: #64748b;
  --shadow: 0 22px 60px rgba(15, 23, 42, .09);
  --shadow-soft: 0 12px 36px rgba(15, 23, 42, .07);
  --radius-lg: 30px;
  --radius-md: 20px;
  --radius-sm: 13px;
  --max: 1440px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(36, 107, 254, .16), transparent 37rem),
    radial-gradient(circle at 84% 4%, rgba(15, 159, 110, .11), transparent 34rem),
    linear-gradient(180deg, #f8fbff 0%, #f2f5fa 44%, #edf2f9 100%);
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

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

.boot-screen { min-height: 100vh; display: grid; place-items: center; }
.boot-card { text-align: center; padding: 36px; border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow); }
.logo-mark {
  width: 52px; height: 52px; border-radius: 16px; display: inline-grid; place-items: center;
  background: var(--ink); color: #fff; font-weight: 950; letter-spacing: -.04em;
}

.app-shell { min-height: 100vh; width: 100%; overflow-x: clip; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(18px);
  background: rgba(248, 251, 255, .88);
  border-bottom: 1px solid rgba(217, 226, 239, .75);
}
.topbar-inner {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 178px; flex: 0 0 auto; }
.brand .logo-mark { width: 42px; height: 42px; border-radius: 13px; }
.brand-title { display: block; font-weight: 950; letter-spacing: -.04em; font-size: 18px; line-height: 1; }
.brand-sub { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; font-weight: 850; letter-spacing: .03em; white-space: nowrap; }
.nav {
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.nav button, .lang button, .ghost-btn, .primary-btn, .small-btn, .crm-pill, .footer button {
  border: 0; border-radius: 999px; padding: 10px 13px; background: transparent; color: var(--muted); font-weight: 800;
}
.nav button.active { background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgba(15,23,42,.16); }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.lang { display: flex; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.72); }
.lang button { padding: 8px 10px; font-size: 12px; }
.lang button.active { background: var(--primary); color: #fff; }
.crm-pill { border: 1px solid var(--line); background: #fff; color: var(--ink); white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.crm-pill.active { background: #0b1220; color: #fff; border-color: #0b1220; }
.online-dot { width: 8px; height: 8px; border-radius: 99px; background: #20d47b; box-shadow: 0 0 0 4px rgba(32,212,123,.16); }

.main { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; padding: 28px 0 60px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .75fr); gap: 22px; align-items: stretch; margin-top: 10px; min-width: 0; }
.hero-card, .panel, .result-card, .metric-card, .table-card, .form-card, .doc-card, .cta-card, .price-card, .login-card, .blocked-card, .success-box {
  background: rgba(255,255,255,.89); border: 1px solid rgba(217,226,239,.82); box-shadow: var(--shadow); border-radius: var(--radius-lg);
}
.hero-card { padding: 36px; overflow: hidden; position: relative; min-height: 430px; }
.hero-card::after {
  content: ""; position: absolute; inset: auto -70px -100px auto; width: 300px; height: 300px; border-radius: 999px; background: rgba(36,107,254,.10);
}
.kicker { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; color: var(--primary-2); background: #fff; font-weight: 850; font-size: 13px; }
.kicker-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--good); }
h1 { margin: 18px 0 12px; font-size: clamp(34px, 4.7vw, 58px); line-height: .98; letter-spacing: -.06em; }
.lead { color: var(--muted); font-size: 18px; line-height: 1.56; max-width: 760px; }
.search-box { margin-top: 26px; padding: 10px; border-radius: 24px; background: #fff; border: 1px solid var(--line); display: flex; gap: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.06); position: relative; z-index: 2; }
.search-box input { flex: 1; border: 0; outline: 0; padding: 14px 16px; font-size: 17px; min-width: 0; }
.primary-btn { background: var(--primary); color: #fff; padding: 14px 20px; box-shadow: 0 14px 28px rgba(36,107,254,.22); }
.primary-btn:hover { background: var(--primary-2); }
.danger-btn { background: var(--bad); box-shadow: 0 14px 28px rgba(220,38,38,.18); }
.danger-btn:hover { background: #b91c1c; }
.ghost-btn { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.small-btn { padding: 8px 11px; border: 1px solid var(--line); background: #fff; font-size: 12px; }
.small-btn.danger { color: var(--bad); }
.small-btn.good { color: var(--good); }
.button-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.button-stack { display: flex; gap: 7px; flex-wrap: wrap; }
.detect-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; color: var(--muted); font-size: 13px; position: relative; z-index: 2; }
.chip { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 7px 10px; background: #eef4ff; color: #1747a6; font-weight: 850; font-size: 12px; }
.chip.grey { background: #f1f5f9; color: var(--neutral); }
.chip.good { background: #e8fff6; color: var(--good); }
.chip.warn { background: #fff7ed; color: var(--warn); }
.chip.bad { background: #fef2f2; color: var(--bad); }
.chip.high, .chip.critical { background: #fef2f2; color: var(--bad); }
.chip.medium { background: #fff7ed; color: var(--warn); }
.chip.moderate, .chip.trusted { background: #e8fff6; color: var(--good); }

.side-panel { padding: 24px; display: grid; gap: 14px; }
.workflow-item { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 20px; background: #fff; border: 1px solid var(--line); }
.step-num { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 950; }
.workflow-item b { display: block; margin-bottom: 4px; color: var(--text); }
.workflow-item span { color: var(--muted); line-height: 1.45; font-size: 14px; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.section { margin-top: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 0 0 14px; }
.section h2 { margin: 0; font-size: 26px; letter-spacing: -.04em; }
.section p { color: var(--muted); }
.panel { padding: 24px; }
.result-card { padding: 24px; }
.result-head h2 { margin-top: 12px; }
.score-wrap { display: grid; grid-template-columns: 170px 1fr; gap: 22px; align-items: center; }
.score-circle { width: 160px; height: 160px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--primary) calc(var(--score) * 1%), #e7edf7 0); position: relative; }
.score-circle.high, .score-circle.critical { background: conic-gradient(var(--bad) calc(var(--score) * 1%), #e7edf7 0); }
.score-circle.medium { background: conic-gradient(var(--warn) calc(var(--score) * 1%), #e7edf7 0); }
.score-circle.moderate, .score-circle.trusted { background: conic-gradient(var(--good) calc(var(--score) * 1%), #e7edf7 0); }
.score-circle::before { content: ""; position: absolute; inset: 13px; background: #fff; border-radius: 50%; }
.score-value { position: relative; text-align: center; }
.score-value strong { display: block; font-size: 44px; letter-spacing: -.05em; }
.score-value span { color: var(--muted); font-size: 12px; font-weight: 850; }
.factor-list { display: grid; gap: 10px; }
.factor { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.factor-points { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 950; background: #f1f5f9; color: var(--neutral); }
.factor.positive .factor-points { background: #e8fff6; color: var(--good); }
.factor.negative .factor-points { background: #fef2f2; color: var(--bad); }
.factor.neutral .factor-points { background: #fff7ed; color: var(--warn); }
.factor b { display: block; margin-bottom: 4px; }
.factor small, .muted { color: var(--muted); }
.form-card { padding: 22px; }
.big-form { padding: 26px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 7px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 850; color: #344054; }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 14px; padding: 12px 13px; outline: 0; background: #fff; }
.field textarea { min-height: 118px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(36,107,254,.55); box-shadow: 0 0 0 4px rgba(36,107,254,.08); }
.checkline { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 10px 0 18px; }

.metric-card { padding: 20px; }
.metric-card.feature { min-height: 170px; }
.metric-card .label { color: var(--muted); font-size: 13px; font-weight: 850; }
.metric-card .value { font-size: 34px; font-weight: 950; letter-spacing: -.05em; margin-top: 6px; }
.metric-card .small-value { font-size: 24px; letter-spacing: -.04em; }
.metric-card .medium-value { font-size: 22px; letter-spacing: -.04em; }
.table-card { overflow: hidden; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); gap: 12px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 13px 16px; border-bottom: 1px solid #eef2f7; text-align: left; font-size: 14px; vertical-align: top; }
th { color: #475467; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: #f8fafc; }
tr:hover td { background: #fbfdff; }
.status { display: inline-flex; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 900; background: #f1f5f9; color: var(--neutral); }
.status.published, .status.completed, .status.index, .status.resolved, .status.good, .status.moderate, .status.trusted { background: #e8fff6; color: var(--good); }
.status.under_review, .status.needs_evidence, .status.needs_clarification, .status.new, .status.in_progress, .status.medium, .status.normal { background: #fff7ed; color: var(--warn); }
.status.high, .status.critical, .status.failed, .status.rejected { background: #fef2f2; color: var(--bad); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.tabs button { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 10px 13px; font-weight: 850; }
.tabs button.active { background: var(--ink); color: #fff; }
.empty { padding: 26px; border: 1px dashed var(--line); border-radius: var(--radius-md); background: rgba(255,255,255,.65); color: var(--muted); text-align: center; }
.hero-empty { min-height: 120px; display: grid; place-items: center; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 200; background: var(--ink); color: #fff; padding: 14px 16px; border-radius: 16px; box-shadow: var(--shadow); max-width: 380px; }
.footer { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; padding: 28px 0 45px; color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.footer button { padding: 0; color: var(--muted); }
.code, .code-inline { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #0b1220; color: #e5f0ff; border-radius: 18px; padding: 18px; overflow: auto; }
.code-inline { padding: 4px 8px; border-radius: 9px; font-size: 12px; }
.doc-card { padding: 22px; border-radius: var(--radius-md); }
.doc-card h3, .cta-card h3, .price-card h3 { margin-top: 0; }

.action-grid .cta-card { padding: 26px; min-height: 220px; display: flex; flex-direction: column; align-items: flex-start; }
.cta-card .primary-btn { margin-top: auto; }
.danger-soft { background: linear-gradient(135deg, #fff, #fff5f5); }
.blue-soft { background: linear-gradient(135deg, #fff, #eff6ff); }
.cta-wide { padding: 28px; border-radius: var(--radius-lg); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-soft); }

.page-hero { padding: 34px; border-radius: var(--radius-lg); background: rgba(255,255,255,.88); border: 1px solid var(--line); box-shadow: var(--shadow); }
.page-hero.compact h1 { max-width: 900px; }
.blue-hero { background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(239,246,255,.92)); }
.intake-section { align-items: start; }
.info-panel { position: sticky; top: 92px; }
.timeline { display: grid; gap: 12px; }
.timeline div { padding: 15px; border-radius: 18px; background: #fff; border: 1px solid var(--line); }
.timeline b { display: block; margin-bottom: 4px; }
.timeline span { color: var(--muted); line-height: 1.45; }
.checklist { display: grid; gap: 10px; }
.checklist span { padding: 13px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.checklist span::before { content: "✓"; color: var(--good); font-weight: 950; margin-right: 8px; }
.success-box { margin-top: 18px; padding: 20px; background: #f2fff9; border-color: #b8f0d5; }
.success-box h3 { margin: 12px 0 8px; }

.login-layout { display: grid; grid-template-columns: 1fr 410px; gap: 24px; align-items: start; margin-top: 18px; }
.login-copy { padding: 32px; border-radius: var(--radius-lg); background: rgba(255,255,255,.82); border: 1px solid var(--line); box-shadow: var(--shadow); }
.security-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 24px; }
.login-card { padding: 28px; position: sticky; top: 96px; }
.login-card .logo-mark { margin-bottom: 14px; }
.demo-creds { margin-top: 18px; padding: 14px; border-radius: 16px; background: #f8fafc; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.alert { padding: 12px 13px; border-radius: 14px; margin: 10px 0 14px; }
.alert.bad { background: #fef2f2; color: var(--bad); }
.blocked-card { padding: 34px; text-align: center; max-width: 720px; margin: 60px auto; }

.crm-shell { margin-top: 8px; }
.crm-head { align-items: center; }
.crm-tabs { position: sticky; top: 77px; z-index: 20; padding: 9px; border: 1px solid var(--line); background: rgba(248,251,255,.92); border-radius: 999px; backdrop-filter: blur(12px); }
.price-card { padding: 24px; }
.price { font-size: 34px; font-weight: 950; letter-spacing: -.05em; margin: 10px 0 8px; }

@media (max-width: 1100px) {
  .topbar-inner { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; justify-content: space-between; }
  .nav { width: 100%; overflow-x: auto; justify-content: flex-start; border-radius: 18px; }
  .crm-tabs { border-radius: 22px; top: 112px; }
}
@media (max-width: 980px) {
  .hero, .grid.two, .grid.three, .grid.four, .score-wrap, .login-layout, .security-grid { grid-template-columns: 1fr; }
  .search-box { flex-direction: column; }
  .primary-btn { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .table-card { overflow-x: auto; }
  .info-panel, .login-card { position: static; }
}
@media (max-width: 640px) {
  .main { padding: 18px 12px 45px; }
  .hero-card, .page-hero, .login-copy { padding: 24px; }
  h1 { font-size: 38px; }
  .lead { font-size: 16px; }
  .top-actions { flex-direction: column; align-items: stretch; }
  .lang, .crm-pill { justify-content: center; }
}

/* v0.4 product modules */
.graph-canvas { display: grid; gap: 12px; padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius-md); background: #f8fafc; min-height: 260px; align-content: start; }
.graph-node { padding: 14px 15px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow-soft); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.graph-node span { color: var(--muted); font-size: 13px; font-weight: 800; }
.graph-node.high, .graph-node.critical { border-color: rgba(220,38,38,.28); background: #fff7f7; }
.graph-node.medium { border-color: rgba(217,119,6,.28); background: #fffaf2; }
.graph-node.moderate, .graph-node.trusted { border-color: rgba(15,159,110,.24); background: #f3fff9; }
.action-grid.grid.four .cta-card { min-height: 240px; }
.nav button { white-space: nowrap; }
@media (max-width: 1100px) { .action-grid.grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .action-grid.grid.four { grid-template-columns: 1fr; } }

/* v0.4 full product additions */
.crm-pill.soft { background: #eff6ff; color: var(--primary-2); border-color: rgba(36,107,254,.25); }
.full-btn { width: 100%; margin-top: 10px; }
.ai-summary { padding: 12px 14px; border: 1px solid #dbeafe; background: #eff6ff; border-radius: 16px; color: #1e3a8a !important; }
.graph-card { background: linear-gradient(135deg, rgba(255,255,255,.94), rgba(248,250,252,.94)); }
.graph-nodes { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 18px; }
.graph-node { min-width: 170px; border: 1px solid var(--line); background: #fff; border-radius: 18px; padding: 13px; box-shadow: var(--shadow-soft); }
.graph-node.root { border-color: rgba(36,107,254,.45); box-shadow: 0 16px 36px rgba(36,107,254,.12); }
.graph-node.high, .graph-node.critical { background: #fff7f7; border-color: #fecaca; }
.graph-node.medium { background: #fffdf5; border-color: #fed7aa; }
.graph-node.moderate, .graph-node.trusted { background: #f2fff9; border-color: #bbf7d0; }
.graph-node b, .graph-node small { display: block; }
.graph-node small { color: var(--muted); margin-top: 4px; }
.relation-list { display: grid; gap: 8px; }
.relation-row { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); background: #fff; border-radius: 14px; color: var(--muted); }
.relation-row b { color: var(--ink); font-size: 12px; background: #f1f5f9; border-radius: 999px; padding: 6px 9px; white-space: nowrap; }
.relation-row em { font-style: normal; color: var(--primary-2); font-weight: 900; }
@media (max-width: 980px) { .relation-row { grid-template-columns: 1fr; } }


/* v0.5 responsive/public polish: no public CRM button, no horizontal overflow, mobile-first navigation */
.nav::-webkit-scrollbar { display: none; }
.nav button { flex: 0 0 auto; white-space: nowrap; }
.panel, .result-card, .metric-card, .table-card, .form-card, .doc-card, .cta-card, .price-card, .login-card, .blocked-card, .success-box, .hero-card, .side-panel { min-width: 0; }
img, svg, video, canvas { max-width: 100%; }
.table-card { max-width: 100%; }
.brand-sub .version-label { display: none; }
.public-only-note { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 850; }
.service-note { color: var(--muted); font-size: 12px; }

@media (max-width: 1320px) {
  .topbar-inner { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "brand actions" "nav nav"; row-gap: 10px; }
  .brand { grid-area: brand; }
  .nav { grid-area: nav; width: 100%; border-radius: 18px; }
  .top-actions { grid-area: actions; }
  .crm-tabs { top: 124px; }
}

@media (max-width: 980px) {
  .hero, .grid.two, .grid.three, .grid.four, .score-wrap, .login-layout, .security-grid { grid-template-columns: 1fr; }
  .side-panel { padding: 20px; }
  .workflow-item { padding: 14px; }
  .search-box { flex-direction: column; }
  .primary-btn { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .table-card { overflow-x: auto; }
  .info-panel, .login-card { position: static; }
  .section-head { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 760px) {
  .topbar-inner { width: min(100% - 20px, var(--max)); padding: 10px 0; grid-template-columns: 1fr auto; }
  .brand { min-width: 0; gap: 9px; }
  .brand .logo-mark { width: 38px; height: 38px; border-radius: 12px; }
  .brand-title { font-size: 16px; }
  .brand-sub { font-size: 9px; }
  .top-actions { gap: 6px; }
  .lang { padding: 3px; gap: 2px; }
  .lang button { padding: 7px 8px; font-size: 11px; }
  .crm-pill { padding: 9px 11px; font-size: 13px; }
  .nav { padding: 4px; gap: 4px; border-radius: 16px; }
  .nav button { padding: 9px 11px; font-size: 13px; }
  .main { width: min(100% - 20px, var(--max)); padding-top: 18px; }
  .footer { width: min(100% - 20px, var(--max)); }
  .hero-card, .page-hero, .login-copy, .result-card { padding: 22px; border-radius: 24px; }
  h1 { font-size: clamp(30px, 9vw, 40px); line-height: 1.03; letter-spacing: -.055em; }
  .lead { font-size: 15px; line-height: 1.55; }
  .search-box { border-radius: 19px; padding: 8px; }
  .search-box input { font-size: 15px; padding: 12px 12px; }
  .detect-line { gap: 7px; font-size: 12px; }
  .chip { padding: 6px 8px; font-size: 11px; }
  .grid { gap: 14px; }
  .metric-card .value { font-size: 28px; }
  .score-circle { width: 154px; height: 154px; }
  .factor { grid-template-columns: 42px 1fr; }
  .factor .chip { grid-column: 2; width: fit-content; }
  th, td { padding: 11px 12px; font-size: 13px; }
}

@media (max-width: 430px) {
  .topbar-inner { width: calc(100% - 16px); }
  .main, .footer { width: calc(100% - 16px); }
  .top-actions { flex-direction: column; align-items: flex-end; }
  .crm-pill { font-size: 12px; padding: 8px 10px; }
  .brand-sub { display: none; }
  .hero-card, .page-hero, .login-copy, .result-card, .side-panel { padding: 18px; }
  h1 { font-size: 30px; }
  .button-row, .button-stack { align-items: stretch; }
  .button-row > *, .button-stack > * { width: 100%; justify-content: center; }
  .workflow-item { gap: 10px; }
}


/* v0.7 deep auto check */
.deep-check-card { background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(240,247,255,.92)); }
.deep-kpis { display: grid; grid-template-columns: repeat(3, minmax(82px, 1fr)); gap: 10px; min-width: 300px; }
.deep-kpis div { padding: 12px 14px; border: 1px solid var(--line); border-radius: 18px; background: #fff; text-align: center; }
.deep-kpis b { display: block; font-size: 24px; letter-spacing: -.04em; }
.deep-kpis span { color: var(--muted); font-size: 12px; font-weight: 850; }
.deep-module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.deep-module { border: 1px solid var(--line); border-radius: 20px; background: #fff; padding: 16px; box-shadow: var(--shadow-soft); min-width: 0; }
.deep-module.passed { border-color: rgba(15,159,110,.26); background: #fbfffd; }
.deep-module.warning { border-color: rgba(220,38,38,.28); background: #fffafa; }
.deep-module.review { border-color: rgba(217,119,6,.28); background: #fffdf7; }
.deep-module.local_only, .deep-module.needs_live_data { background: #f8fafc; }
.module-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.module-top small, .module-source, .factor-source { color: var(--muted); display: block; margin-top: 6px; font-size: 12px; }
.deep-module h3 { margin: 12px 0 8px; font-size: 18px; letter-spacing: -.03em; }
.deep-module p { margin: 0 0 10px; color: var(--muted); line-height: 1.45; }
.deep-module ul { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.5; font-size: 13px; }
.brand-verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border: 1px solid #bbf7d0; background: #f0fff8; border-radius: 20px; margin: 12px 0 4px; }
.brand-verdict.danger { border-color: #fecaca; background: #fff7f7; }
.brand-verdict b { font-size: 18px; }
.brand-verdict span, .brand-verdict small { color: var(--muted); }
@media (max-width: 980px) { .deep-module-grid { grid-template-columns: 1fr; } .deep-kpis { min-width: 0; width: 100%; } }
@media (max-width: 560px) { .deep-kpis { grid-template-columns: 1fr; } }


/* v0.8: separated CRM admin console + universal help tooltips */
.crm-admin-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 0% 0%, rgba(36, 107, 254, .12), transparent 36rem),
    radial-gradient(circle at 100% 10%, rgba(15, 159, 110, .11), transparent 32rem),
    linear-gradient(180deg, #eef4fb 0%, #f8fbff 45%, #edf2f9 100%);
}
.crm-topbar {
  position: sticky;
  top: 0;
  z-index: 70;
  background: rgba(11, 18, 32, .92);
  color: #fff;
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.crm-topbar-inner {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}
.crm-brand .brand-title { color: #fff; }
.crm-brand .brand-sub { color: rgba(255,255,255,.62); }
.crm-brand .logo-mark { background: #fff; color: var(--ink); }
.crm-top-status { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; min-width: 0; }
.crm-only-actions .crm-pill { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.20); color: #fff; }
.crm-only-actions .crm-pill.active { background: #fff; color: var(--ink); }
.crm-only-actions .lang { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }
.crm-only-actions .lang button { color: rgba(255,255,255,.72); }
.crm-only-actions .lang button.active { color: #fff; }
.crm-main {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 70px;
}
.crm-shell .lead { max-width: 920px; }
.crm-tabs-panel { position: sticky; top: 77px; z-index: 35; padding: 8px 0; }
.crm-tabs {
  margin: 0 0 18px;
  padding: 9px;
  border: 1px solid var(--line);
  background: rgba(248,251,255,.94);
  border-radius: 28px;
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 32px rgba(15,23,42,.06);
}
.crm-tabs button { display: inline-flex; align-items: center; gap: 7px; }
.help-heading { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.help-dot {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin-left: 4px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1747a6;
  border: 1px solid #cfe0ff;
  font-size: 12px;
  line-height: 1;
  font-weight: 950;
  cursor: help;
  vertical-align: middle;
}
.active .help-dot,
.crm-tabs button.active .help-dot {
  background: rgba(255,255,255,.16);
  color: #fff;
  border-color: rgba(255,255,255,.35);
}
.help-dot::after {
  content: attr(data-help);
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%) translateY(-4px);
  width: min(330px, calc(100vw - 40px));
  padding: 11px 12px;
  border-radius: 14px;
  background: #0b1220;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  box-shadow: 0 18px 40px rgba(15,23,42,.24);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity .15s ease, transform .15s ease;
}
.help-dot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: #0b1220;
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 1000;
}
.help-dot:hover::after,
.help-dot:focus::after,
.help-dot:focus-visible::after,
.help-dot:hover::before,
.help-dot:focus::before,
.help-dot:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
button .help-dot { margin-left: 3px; pointer-events: auto; }
.table-toolbar .help-dot::after,
.section-head .help-dot::after { left: auto; right: 0; transform: translateY(-4px); }
.table-toolbar .help-dot:hover::after,
.table-toolbar .help-dot:focus::after,
.section-head .help-dot:hover::after,
.section-head .help-dot:focus::after { transform: translateY(0); }
.table-toolbar .help-dot::before,
.section-head .help-dot::before { left: auto; right: 4px; transform: none; }

@media (max-width: 1100px) {
  .crm-topbar-inner { grid-template-columns: 1fr; align-items: flex-start; }
  .crm-top-status { justify-content: flex-start; }
  .crm-only-actions { width: 100%; justify-content: space-between; }
  .crm-tabs-panel { top: 162px; }
}
@media (max-width: 760px) {
  .crm-main { width: min(100% - 24px, var(--max)); padding-top: 18px; }
  .crm-topbar-inner { width: min(100% - 24px, var(--max)); }
  .crm-tabs-panel { position: static; }
  .crm-tabs { border-radius: 20px; overflow-x: auto; flex-wrap: nowrap; }
  .crm-tabs button { white-space: nowrap; }
  .help-dot::after { left: auto; right: -6px; transform: translateY(-4px); width: min(300px, calc(100vw - 28px)); }
  .help-dot:hover::after, .help-dot:focus::after { transform: translateY(0); }
  .help-dot::before { left: auto; right: 2px; transform: none; }
  .section-head.crm-head { align-items: flex-start; flex-direction: column; }
}


/* v0.8.1: fixed tooltip portal. Tooltips are rendered at body level, so they are not clipped by cards, tables, sticky tabs or overflow containers. */
.crm-admin-shell .table-card,
.crm-admin-shell .doc-card,
.crm-admin-shell .metric-card,
.crm-admin-shell .panel,
.crm-admin-shell .grid,
.crm-admin-shell .crm-shell,
.crm-admin-shell .crm-main {
  overflow: visible;
}

.crm-admin-shell .help-dot::after,
.crm-admin-shell .help-dot::before {
  display: none !important;
  content: none !important;
}

.help-tooltip-portal {
  position: fixed;
  left: 0;
  top: 0;
  max-width: min(380px, calc(100vw - 24px));
  min-width: min(260px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 15px;
  background: #0b1220;
  color: #fff;
  box-shadow: 0 22px 54px rgba(15, 23, 42, .30);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.48;
  text-align: left;
  opacity: 0;
  transform: translate3d(-9999px, -9999px, 0) translateY(-4px);
  pointer-events: none;
  z-index: 3000;
  transition: opacity .14s ease, transform .14s ease;
  white-space: normal;
}

.help-tooltip-portal.is-visible {
  opacity: 1;
  transform: translate3d(var(--tooltip-left, -9999px), var(--tooltip-top, -9999px), 0) translateY(0);
}

.help-tooltip-portal::before {
  content: "";
  position: absolute;
  left: var(--tooltip-arrow-left, 50%);
  top: -6px;
  width: 12px;
  height: 12px;
  background: #0b1220;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}

.help-tooltip-portal.tooltip-above::before {
  top: auto;
  bottom: -6px;
}

.help-dot.is-open,
.help-dot:hover,
.help-dot:focus-visible {
  background: #dbeafe;
  color: #123a8c;
  border-color: #aac7ff;
  outline: none;
}

.crm-tabs button.active .help-dot:hover,
.crm-tabs button.active .help-dot.is-open,
.active .help-dot:hover,
.active .help-dot.is-open {
  background: rgba(255,255,255,.26);
  color: #fff;
  border-color: rgba(255,255,255,.50);
}

@media (max-width: 760px) {
  .help-tooltip-portal {
    min-width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    font-size: 12px;
    border-radius: 16px;
  }
}
