:root {
  --navy: #081021;
  --navy-2: #101b34;
  --surface: #ffffff;
  --bg: #f4f7fb;
  --text: #111827;
  --muted: #667085;
  --line: #e5e9f0;
  --green: #26d99a;
  --green-dark: #118860;
  --cyan: #37bfe9;
  --purple: #725ce9;
  --yellow: #f5b52e;
  --red: #eb5560;
  --shadow: 0 10px 30px rgba(16, 24, 40, .055);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font-family: Vazirmatn, Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 270px; }
.sidebar {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 24px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: var(--green); color: var(--navy); font-size: 21px; font-weight: 900;
  box-shadow: 0 10px 24px rgba(38, 217, 154, .22);
}
.brand strong { display: block; font-size: 18px; direction: ltr; }
.brand span { display: block; color: #93a0b6; font-size: 12px; margin-top: 3px; }
.nav-list { display: grid; gap: 6px; }
.nav-item {
  border: 0; width: 100%; min-height: 48px; border-radius: 14px; padding: 0 14px;
  display: flex; align-items: center; gap: 12px; color: #aab4c5; background: transparent;
  text-align: right; font-size: 14px; transition: .2s ease;
}
.nav-item:hover { background: rgba(255,255,255,.055); color: #fff; }
.nav-item.active { background: #123439; color: var(--green); }
.nav-icon { width: 22px; text-align: center; font-size: 17px; }
.sidebar-spacer { flex: 1; }
.health-mini { padding: 16px; border-radius: 17px; background: var(--navy-2); }
.legal-links { display:flex; gap:12px; justify-content:center; padding:12px 4px; }
.legal-links a { color:#93a0b6; font-size:11px; text-decoration:none; }
.legal-links a:hover { color:var(--green); }
.health-mini__title { display: flex; justify-content: space-between; align-items: center; color: #c6ceda; font-size: 13px; }
.health-mini__title b { color: #fff; font-size: 22px; }
.health-mini__state { color: var(--green); font-size: 12px; margin: 8px 0 12px; }
.progress { height: 7px; border-radius: 99px; background: #25304a; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--green); }

.main-area { grid-column: 1; grid-row: 1; min-width: 0; }
.topbar {
  height: 88px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20;
}
.page-heading h1 { margin: 0; font-size: 23px; }
.page-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; direction: ltr; }
.icon-btn, .avatar, .install-btn {
  border: 0; min-width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
}
.icon-btn { background: #f3f6fa; color: #657086; position: relative; font-size: 18px; }
.avatar { background: var(--navy-2); color: #fff; font-weight: 800; }
.install-btn { display: block; padding: 0 17px; color: #073828; background: var(--green); font-weight: 700; }
.install-btn[hidden] { display: none; }
.notification-dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }
.mobile-menu { display: none; }
.connection-badge { direction: rtl; color: #9a6810; background: #fff8e7; padding: 8px 11px; border-radius: 10px; font-size: 12px; font-weight: 700; }

.content { padding: 28px 32px 38px; max-width: 1500px; margin: 0 auto; }
.dashboard-grid { display: grid; gap: 22px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 19px;
  box-shadow: var(--shadow);
}
.kpi-card { min-height: 142px; padding: 19px; }
.kpi-head, .kpi-value, .section-head, .audit-row, .task-row, .table-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kpi-head { color: var(--muted); font-size: 13px; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; }
.kpi-value { margin-top: 18px; }
.kpi-value b { font-size: clamp(25px, 2.4vw, 34px); line-height: 1; }
.delta { font-size: 12px; font-weight: 700; color: var(--green-dark); }
.delta.danger { color: var(--red); }

.insights-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, .9fr); gap: 18px; }
.chart-card, .audit-card, .tasks-card, .ai-card, .panel { padding: 22px; }
.section-head h2, .panel h2 { margin: 0; font-size: 18px; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.select-pill { border: 0; background: var(--bg); color: var(--muted); padding: 9px 12px; border-radius: 10px; }
.chart-wrap { height: 236px; margin-top: 18px; }
.chart-wrap svg { width: 100%; height: 100%; overflow: visible; }
.chart-labels { display: flex; justify-content: space-between; color: #98a2b3; font-size: 11px; margin-top: -5px; }
.audit-score { margin: 18px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.score-ring { width: 74px; height: 74px; border-radius: 50%; border: 6px solid var(--green); background: #edfcf6; display: grid; place-items: center; font-size: 24px; font-weight: 900; }
.score-copy strong { display: block; color: var(--green-dark); }
.score-copy span { color: var(--muted); font-size: 12px; }
.audit-list { display: grid; }
.audit-row { min-height: 49px; border-top: 1px solid var(--line); font-size: 13px; }
.count-pill, .status-pill { min-width: 42px; text-align: center; padding: 5px 9px; border-radius: 9px; font-size: 12px; font-weight: 700; }

.actions-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, .9fr); gap: 18px; }
.text-link { border: 0; background: transparent; color: var(--green-dark); font-weight: 700; }
.task-list { margin-top: 12px; }
.task-row { min-height: 50px; border-top: 1px solid var(--line); font-size: 13px; }
.task-name { flex: 1; font-weight: 600; }
.task-meta { color: var(--muted); min-width: 72px; }
.task-check { appearance: none; width: 19px; height: 19px; border: 2px solid #ccd3de; border-radius: 6px; }
.task-check:checked { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 3px #fff; }
.ai-card { color: #fff; border: 0; background: linear-gradient(145deg, #081021, #0d3030); }
.ai-mark { width: 43px; height: 43px; border-radius: 13px; display: grid; place-items: center; color: var(--navy); background: var(--green); font-size: 22px; }
.ai-card p { color: #c8d1dc; font-size: 14px; line-height: 1.9; margin: 22px 0; }
.ai-action { width: 100%; min-height: 48px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; color: var(--green); background: rgba(255,255,255,.07); font-weight: 700; }

.view-stack { display: grid; gap: 20px; }
.setup-shell { min-height: calc(100vh - 170px); display: grid; place-items: center; }
.setup-card { width: min(680px, 100%); padding: clamp(22px, 5vw, 42px); }
.setup-card h2 { margin: 0 0 8px; font-size: 25px; }
.setup-card > p { color: var(--muted); line-height: 1.9; margin: 0 0 26px; }
.setup-steps { display: grid; gap: 14px; margin: 22px 0; }
.setup-step { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: start; padding: 15px; border: 1px solid var(--line); border-radius: 14px; }
.setup-step b { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #e9fbf4; color: var(--green-dark); }
.setup-step strong { display: block; margin-bottom: 4px; }
.setup-step span { color: var(--muted); font-size: 13px; }
.url-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.url-input { min-width: 0; direction: ltr; text-align: left; height: 48px; border: 1px solid var(--line); border-radius: 13px; padding: 0 14px; outline: 0; }
.url-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(38,217,154,.13); }
.google-btn { width: 100%; height: 50px; margin-top: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--text); font-weight: 700; }
.google-btn::before { content: "G"; display: inline-grid; place-items: center; width: 25px; height: 25px; margin-left: 9px; border-radius: 50%; color: #fff; background: conic-gradient(#4285f4 0 25%,#34a853 0 50%,#fbbc05 0 75%,#ea4335 0); }
.demo-link { border: 0; background: transparent; color: var(--green-dark); font-weight: 700; margin-top: 14px; }
.audit-results { display: grid; gap: 12px; }
.live-audit { display:grid; gap:16px; }
.live-audit h2 { margin:0 0 6px; }
.live-audit p { margin:0; color:var(--muted); font-size:13px; line-height:1.8; }
#liveAuditOutput:empty { display:none; }
#liveAuditOutput .page-result { box-shadow:none; }
.live-loading,.live-error { padding:14px 16px; border-radius:12px; font-size:13px; line-height:1.8; }
.live-loading { background:#eaf8fd; color:#176f8b; }
.live-error { display:grid; gap:3px; background:#fff0f1; color:#a52d37; }
.primary-btn:disabled { opacity:.62; cursor:wait; }
.page-result { padding: 0; overflow: hidden; }
.page-result__head { display: grid; grid-template-columns: 34px minmax(180px, 1.5fr) repeat(4, minmax(72px,.6fr)) 34px; align-items: center; gap: 10px; min-height: 64px; padding: 0 16px; }
.severity-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; }
.severity-icon.good { color:#08764f;background:#dcfaef; }.severity-icon.warn { color:#986000;background:#fff1ca; }.severity-icon.bad { color:#c52d3a;background:#ffe3e6; }
.page-url { direction: ltr; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 13px; }
.metric { text-align: center; font-size: 12px; color: var(--muted); }.metric b { display: block; color: var(--text); font-size: 15px; }
.details-toggle { border: 0; background: #f3f6fa; width: 32px; height: 32px; border-radius: 9px; }
.page-result__details { display: none; border-top: 1px solid var(--line); padding: 16px; background: #fafbfd; }
.page-result.open .page-result__details { display: grid; gap: 12px; }
.finding { padding: 13px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.finding strong { display: block; margin-bottom: 5px; }.finding p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.studio-grid { display:grid; grid-template-columns:minmax(300px,.78fr) minmax(0,1.35fr); gap:18px; align-items:start; }
.form-stack { display:grid; gap:14px; margin-top:18px; }
.field { display:grid; gap:7px; }.field label { font-size:13px; font-weight:700; }.field small { color:var(--muted); }
.field input,.field select,.field textarea { width:100%; border:1px solid var(--line); border-radius:12px; background:#fff; color:var(--text); padding:11px 12px; outline:0; }
.field textarea { resize:vertical; min-height:95px; line-height:1.8; }
.field input:focus,.field select:focus,.field textarea:focus { border-color:var(--green); box-shadow:0 0 0 3px rgba(38,217,154,.13); }
.quality-list { display:grid; gap:9px; margin-top:16px; }.quality-item { display:flex; justify-content:space-between; gap:10px; padding:11px 12px; border-radius:11px; background:#f8fafc; font-size:13px; }.quality-item b { color:var(--green-dark); }
.result-block { padding:15px 0; border-top:1px solid var(--line); }.result-block:first-of-type { border-top:0; }.result-block h3 { margin:0 0 7px; font-size:14px; }.result-block p { margin:0; color:#344054; line-height:1.9; }
.faq-item { padding:12px; border:1px solid var(--line); border-radius:11px; margin-top:9px; }.faq-item b { display:block; margin-bottom:5px; }.faq-item span { color:var(--muted); font-size:13px; line-height:1.8; }
.connector-note { padding:13px; border-radius:12px; background:#fff8e7; color:#805b13; font-size:13px; line-height:1.8; }
.ux-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:15px; }.ux-card { padding:18px; }.ux-card h3 { margin:0 0 7px; font-size:15px; }.ux-card p { margin:0; color:var(--muted); font-size:13px; line-height:1.8; }.ux-score { display:flex; justify-content:space-between; align-items:center; margin-bottom:13px; }.ux-score b { font-size:24px; }
@media print { .sidebar,.topbar,.toolbar,.details-toggle,.toast { display:none !important; } .app-shell,.main-area { display:block !important; } .content { max-width:none;padding:0; } .page-result__details { display:grid !important; } body { background:#fff; } }
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.summary-item { padding: 18px; }
.summary-item span { color: var(--muted); font-size: 13px; }
.summary-item b { display: block; margin-top: 8px; font-size: 25px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
.search-box { flex: 1; min-width: 210px; max-width: 390px; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text); outline: none; }
.search-box:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(38,217,154,.13); }
.primary-btn, .secondary-btn { min-height: 44px; border-radius: 12px; padding: 0 16px; font-weight: 700; }
.primary-btn { border: 0; color: #073828; background: var(--green); }
.secondary-btn { border: 1px solid var(--line); color: var(--text); background: #fff; }
.data-table { overflow-x: auto; }
.table-row { min-width: 690px; min-height: 54px; border-top: 1px solid var(--line); font-size: 13px; }
.table-row.header { color: var(--muted); font-weight: 700; border-top: 0; }
.table-cell { padding: 0 8px; flex: 1; }
.table-cell.wide { flex: 2.2; }
.table-cell.small { flex: .7; }
.issue-card { padding: 18px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; border-top: 1px solid var(--line); }
.issue-card:first-child { border-top: 0; }
.issue-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.issue-copy strong { display: block; font-size: 14px; }
.issue-copy span { color: var(--muted); font-size: 12px; }
.empty-note { padding: 44px 20px; text-align: center; color: var(--muted); }
.legal-shell { min-height:100vh; padding:34px 16px; background:var(--bg); }
.legal-document { width:min(860px,100%); margin:0 auto; padding:clamp(22px,5vw,48px); }
.legal-document h1 { margin:0 0 8px; font-size:clamp(24px,4vw,34px); }
.legal-document h2 { margin:30px 0 10px; font-size:18px; }
.legal-document p,.legal-document li { color:#475467; line-height:2; font-size:14px; }
.legal-document ul { padding-right:22px; }
.legal-meta { color:var(--muted); font-size:12px; margin-bottom:28px; }
.legal-home { display:inline-flex; margin-top:24px; color:#073828; background:var(--green); padding:11px 16px; border-radius:12px; text-decoration:none; font-weight:700; }

.backdrop { display: none; }
.toast { position: fixed; left: 24px; bottom: 24px; z-index: 60; background: #101828; color: #fff; padding: 12px 17px; border-radius: 12px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .insights-grid, .actions-grid { grid-template-columns: 1fr; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; right: 0; width: min(84vw, 300px); transform: translateX(105%); transition: transform .25s ease; box-shadow: -20px 0 50px rgba(0,0,0,.22); }
  body.menu-open .sidebar { transform: translateX(0); }
  .backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(4,10,22,.52); }
  body.menu-open .backdrop { display: block; }
  .mobile-menu { display: grid; }
  .topbar { height: 76px; padding: 0 16px; }
  .page-heading h1 { font-size: 19px; }
  .page-heading p { max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .content { padding: 18px 14px 28px; }
  .kpi-grid, .summary-strip { grid-template-columns: 1fr; gap: 12px; }
  .kpi-card { min-height: 125px; }
  .chart-card, .audit-card, .tasks-card, .ai-card, .panel { padding: 17px; }
  .chart-wrap { height: 190px; }
  .task-meta { display: none; }
  .install-btn { width: 44px; overflow: hidden; padding: 0; font-size: 0; }
  .install-btn::before { content: "↓"; font-size: 20px; }
  .issue-card { grid-template-columns: auto 1fr; }
  .issue-card .primary-btn { grid-column: 1 / -1; }
  .connection-badge { display:none; }
  .url-form { grid-template-columns: 1fr; }
  .page-result__head { grid-template-columns: 30px minmax(160px,1fr) 55px 30px; }
  .page-result__head .metric:nth-of-type(2), .page-result__head .metric:nth-of-type(3) { display:none; }
  .studio-grid,.ux-grid { grid-template-columns:1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
