:root {
  --blue: #4f8cff;
  --blue-2: #8fb5ff;
  --navy: #071225;
  --navy-2: #0d1b33;
  --orange: #ff7a1a;
  --orange-2: #ffb16d;
  --bg: #071225;
  --bg-soft: #0b1730;
  --card: #101f3a;
  --card-2: #142746;
  --ink: #eef5ff;
  --muted: #aebbd4;
  --line: rgba(143,181,255,.19);
  --success: #43d68b;
  --danger: #ff7b72;
  --warning: #ffb454;
  --shadow: none;
  --radius: 22px;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 12% 0%, rgba(255,122,26,.16), transparent 28%), radial-gradient(circle at 85% 8%, rgba(79,140,255,.16), transparent 30%), linear-gradient(180deg, var(--navy), var(--bg-soft));
  color: var(--ink);
  min-height: 100vh;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::-webkit-scrollbar { width: 11px; }
body::-webkit-scrollbar-track { background: #081326; }
body::-webkit-scrollbar-thumb { background: #243e6f; border-radius: 999px; border: 2px solid #081326; }
body::-webkit-scrollbar-thumb:hover { background: #31548f; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 44px);
  background: rgba(7,18,37,.96);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; color: var(--ink); }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 13px;
  color: white;
  background: linear-gradient(135deg, var(--orange), #2d67d9);
}
.desktop-nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.desktop-nav a {
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
  padding: 9px 11px;
  border-radius: 999px;
}
.desktop-nav a:hover { background: rgba(79,140,255,.12); color: var(--ink); }

.page { width: min(1180px, calc(100% - 28px)); margin: 22px auto 92px; }
.login-shell { width: min(520px, calc(100% - 28px)); display: grid; min-height: 100vh; place-items: center; margin: 0 auto; }
.flash-wrap { margin-bottom: 14px; }
.flash { padding: 12px 14px; border-radius: 14px; font-weight: 800; margin-bottom: 10px; background: rgba(79,140,255,.14); color: var(--ink); border: 1px solid var(--line); }
.flash.error { background: rgba(255,123,114,.15); color: #ffd4d0; }
.flash.success { background: rgba(67,214,139,.14); color: #d8ffe9; }

.login-card, .hero-card, .panel, .status-card, .stat-card {
  background: linear-gradient(180deg, rgba(16,31,58,.96), rgba(13,27,51,.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.login-card { padding: clamp(24px, 6vw, 42px); width: 100%; }
.login-card h1 { margin: 8px 0 10px; font-size: clamp(32px, 7vw, 48px); line-height: 1; color: var(--ink); }
.login-badge { display: inline-flex; color: white; background: var(--orange); padding: 8px 12px; border-radius: 999px; font-weight: 900; font-size: 13px; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 6px; color: var(--orange-2); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }

.form-stack { display: grid; gap: 14px; margin-top: 24px; }
label { display: grid; gap: 8px; font-weight: 800; color: var(--blue-2); }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px 14px;
  background: #0a1529;
  color: var(--ink);
  outline: none;
}
input::placeholder { color: #7586a8; }
select option { background: #0a1529; color: var(--ink); }
input:focus, select:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255,122,26,.14); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 900;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, var(--orange), #ff9d43); color: white; }
.btn.secondary { background: rgba(79,140,255,.16); color: var(--ink); border-color: rgba(143,181,255,.2); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.full { width: 100%; }
.btn.big { min-height: 56px; padding: 14px 22px; font-size: 17px; }
.btn.tiny { min-height: 34px; padding: 7px 11px; border-radius: 11px; background: rgba(79,140,255,.16); color: var(--ink); font-size: 13px; border-color: rgba(143,181,255,.16); }
.btn.danger { background: rgba(255,123,114,.13); color: #ffd2cd; border-color: rgba(255,123,114,.25); }

.hero-card { display: flex; justify-content: space-between; align-items: center; gap: 22px; padding: clamp(20px, 4vw, 34px); margin-bottom: 16px; overflow: hidden; position: relative; }
.hero-card:after { content: ""; position: absolute; width: 220px; height: 220px; right: -86px; top: -96px; background: rgba(255,122,26,.12); border-radius: 999px; pointer-events: none; }
.hero-card h1, .page-head h1 { margin: 0; color: var(--ink); font-size: clamp(30px, 6vw, 48px); letter-spacing: -0.04em; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; position: relative; z-index: 1; }

.status-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 16px; }
.status-card p { margin: 2px 0 0; color: var(--muted); }
.status-dot { width: 13px; height: 13px; border-radius: 999px; background: var(--success); box-shadow: 0 0 0 5px rgba(67,214,139,.12); }
.status-card.running .status-dot { background: var(--orange); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.25); opacity: .65; } }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card { padding: 18px; }
.stat-card span { display: block; color: var(--muted); font-weight: 800; font-size: 13px; margin-bottom: 8px; }
.stat-card strong { display: block; color: var(--orange-2); font-size: 34px; line-height: 1; }
.stat-card .small-strong { font-size: 16px; line-height: 1.25; color: var(--ink); }

.grid-two { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 16px; }
.panel { padding: clamp(16px, 3vw, 24px); margin-bottom: 16px; }
.accent-panel { background: linear-gradient(135deg, rgba(255,122,26,.14), rgba(20,39,70,.96)); }
.panel-head, .page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; }
.panel h2, .page-head h1 { margin-top: 0; }
.panel h2 { color: var(--ink); margin: 0 0 8px; }
.panel-head h2 { margin: 0; }
.panel-head a { color: var(--orange-2); font-weight: 900; }
.panel-subtitle { color: var(--muted); margin: 6px 0 0; font-size: 13px; }
.empty { color: var(--muted); padding: 10px 0; }

.theme-list, .insight-list { display: grid; gap: 10px; }
.theme-row, .insight-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 14px; background: rgba(7,18,37,.55); border: 1px solid rgba(143,181,255,.11); border-radius: 14px; }
.theme-row span, .insight-row span { font-weight: 800; }
.theme-row strong { color: var(--orange-2); }
.theme-row:hover { background: rgba(79,140,255,.12); }

.finding-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.finding-card { display: flex; flex-direction: column; gap: 10px; min-height: 210px; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, #132744, #0d1b33); }
.finding-card h3 { margin: 0; font-size: 16px; color: var(--ink); line-height: 1.15; }
.finding-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.finding-top, .score-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.detail-topline { justify-content: flex-start; flex-wrap: wrap; }
.score-line { margin-top: auto; color: var(--blue-2); }
.card-main-link { display: contents; }
.pill, .source-chip, .seo-chip { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 900; background: rgba(79,140,255,.16); color: var(--ink); white-space: nowrap; }
.source-chip { background: rgba(79,140,255,.14); color: #cfe0ff; }
.seo-chip { background: rgba(255,180,84,.14); color: #ffd8a3; margin-left: 5px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pill.high, .pill.complete { background: rgba(67,214,139,.15); color: #a6ffd0; }
.pill.medium, .pill.running { background: rgba(255,180,84,.15); color: #ffd59b; }
.pill.low, .pill.error { background: rgba(255,123,114,.15); color: #ffd2cd; }
.pill.ok { background: rgba(67,214,139,.15); color: #a6ffd0; }
.pill.empty { background: rgba(79,140,255,.16); color: #cfe0ff; }
.pill.blocked { background: rgba(255,123,114,.15); color: #ffd2cd; }
.pill.review { background: rgba(255,180,84,.15); color: #ffd59b; }
.pill.duplicate, .pill.skipped, .pill.dismissed { background: rgba(174,187,212,.12); color: var(--muted); }
.pill.promoted { background: rgba(67,214,139,.15); color: #a6ffd0; }

.mobile-table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--blue-2); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
td { color: var(--ink); }

.filters { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr) auto auto; gap: 10px; }
.results-filters { grid-template-columns: 1.5fr repeat(4, 1fr) auto auto auto; }
.checkbox-filter { display: flex; align-items: center; gap: 8px; background: rgba(7,18,37,.5); border: 1px solid var(--line); padding: 0 12px; min-height: 42px; border-radius: 14px; color: var(--muted); }
.checkbox-filter input { width: auto; accent-color: var(--orange); }
.keyword-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.keyword-list, .report-list { display: grid; gap: 10px; }
.keyword-row, .report-card { display: flex; justify-content: space-between; gap: 14px; align-items: center; border: 1px solid var(--line); background: rgba(7,18,37,.45); border-radius: 16px; padding: 13px; }
.keyword-row span, .report-card span { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.keyword-actions { display: flex; gap: 8px; }

.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
.detail-main h2 { margin-top: 22px; }
.quote { padding: 16px; border-left: 5px solid var(--orange); background: rgba(255,122,26,.1); border-radius: 12px; color: var(--ink); font-weight: 700; }
.score-panel { align-self: start; position: sticky; top: 86px; }
.score-box { display: grid; gap: 5px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.score-box span { color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.score-box strong { color: var(--ink); }
.score-box em { color: var(--orange-2); font-style: normal; letter-spacing: 1px; }
.settings-list { display: grid; gap: 12px; }
.settings-list div, .api-grid div { display: flex; justify-content: space-between; gap: 14px; padding: 12px; border-radius: 14px; background: rgba(7,18,37,.5); border: 1px solid rgba(143,181,255,.1); }
.api-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.api-grid div { display: block; }
.api-grid strong { display: block; color: var(--ink); margin-bottom: 4px; }
.api-grid span { display: inline-block; color: var(--orange-2); font-weight: 900; margin-bottom: 7px; }
.api-grid p { color: var(--muted); margin: 0; }
code { background: rgba(7,18,37,.7); color: #ffd8a3; border: 1px solid var(--line); padding: 2px 5px; border-radius: 7px; }
.report-markdown pre { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; line-height: 1.6; color: var(--ink); margin: 0; }

.slim-filters { grid-template-columns: 1fr 1fr 1fr auto auto; }
.review-cards { grid-template-columns: repeat(3, 1fr); }
.review-card { min-height: 270px; }
.review-actions { display: flex; gap: 8px; margin-top: auto; }
.review-actions form { flex: 1; }
.review-actions .btn { width: 100%; }
.mini-note { padding: 8px 10px; border-radius: 12px; background: rgba(255,180,84,.12); color: #ffd59b !important; font-size: 12px !important; font-weight: 800; }
.mobile-nav { display: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media (max-width: 1120px) {
  .finding-cards { grid-template-columns: repeat(3, 1fr); }
  .results-filters { grid-template-columns: 1fr 1fr; }
  .results-filters input { grid-column: span 2; }
}

@media (max-width: 980px) {
  .desktop-nav { display: none; }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    background: rgba(7,18,37,.98);
    border-top: 1px solid var(--line);
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }
  .mobile-nav a { text-align: center; color: var(--ink); font-weight: 900; font-size: 13px; padding: 10px 4px; border-radius: 12px; }
  .mobile-nav a:hover { background: rgba(79,140,255,.14); }
  .hero-card, .page-head, .panel-head { align-items: flex-start; flex-direction: column; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-two, .detail-grid, .api-grid { grid-template-columns: 1fr; }
  .finding-cards, .review-cards { grid-template-columns: repeat(2, 1fr); }
  .filters, .slim-filters { grid-template-columns: 1fr 1fr; }
  .filters input { grid-column: span 2; }
  .score-panel { position: static; }
}

@media (max-width: 640px) {
  .page { width: min(100% - 22px, 1180px); margin-top: 14px; }
  .topbar { padding: 12px; }
  .brand span:last-child { font-size: 14px; }
  .hero-card h1, .page-head h1 { font-size: 32px; }
  .stat-grid, .finding-cards, .review-cards, .filters, .results-filters, .slim-filters, .keyword-form { grid-template-columns: 1fr; }
  .filters input, .results-filters input { grid-column: auto; }
  .hero-actions { flex-direction: column; }
  .btn { width: 100%; }
  .mobile-table table, .mobile-table thead, .mobile-table tbody, .mobile-table th, .mobile-table td, .mobile-table tr { display: block; }
  .mobile-table thead { display: none; }
  .mobile-table tr { border: 1px solid var(--line); border-radius: 16px; padding: 10px; margin-bottom: 10px; background: rgba(7,18,37,.48); }
  .mobile-table td { border: 0; display: grid; grid-template-columns: 95px 1fr; gap: 10px; padding: 8px 4px; }
  .mobile-table td:before { content: attr(data-label); color: var(--muted); font-weight: 900; font-size: 12px; text-transform: uppercase; }
  .keyword-row, .report-card { align-items: stretch; flex-direction: column; }
  .keyword-actions { width: 100%; }
  .keyword-actions form { flex: 1; }
}

/* V1.3 deep scan controls */
.btn.warning { background: linear-gradient(135deg, #f59e0b, #f97316); color: #071a35; box-shadow: 0 12px 30px rgba(249,115,22,.22); }
.btn.warning:hover { transform: translateY(-1px); }
.status-content { width: 100%; }
.progress-wrap { margin-top: .75rem; width: 100%; }
.progress-wrap.hidden { display: none; }
.progress-line { display: flex; justify-content: space-between; gap: 1rem; font-size: .82rem; font-weight: 800; }
.progress-bar { margin-top: .45rem; height: 10px; width: 100%; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; border: 1px solid rgba(255,255,255,.12); }
.progress-bar > div { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, #fb923c, #38bdf8); transition: width .35s ease; }
@media (max-width: 720px) { .hero-actions { display: grid; grid-template-columns: 1fr; width: 100%; } .hero-actions .btn { width: 100%; justify-content: center; } .progress-line { flex-direction: column; gap: .15rem; } }
