/** SEO Dashboard design tokens and responsive application shell. */
:root {
  --sidebar: #1e3042;
  --sidebar-deep: #172738;
  --sidebar-text: #dce6ef;
  --primary: #0d6efd;
  --primary-dark: #0a58ca;
  --canvas: #f7f9fc;
  --surface: #ffffff;
  --text: #17212b;
  --muted: #64748b;
  --border: #dce3eb;
  --border-light: #e9eef4;
  --success: #198754;
  --warning: #f07c16;
  --danger: #dc3545;
  --radius: 10px;
  --sidebar-width: 240px;
  --topbar-height: 58px;
  --shadow-modal: 0 18px 50px rgba(15, 23, 42, .16);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--text); background: var(--canvas); font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
a { text-decoration: none; }
.app-icon { flex: 0 0 auto; vertical-align: -0.18em; }
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1040; width: var(--sidebar-width); color: var(--sidebar-text); background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-deep) 100%); display: flex; flex-direction: column; transition: transform .22s ease; }
.brand { height: var(--topbar-height); display: flex; align-items: center; gap: 12px; padding: 0 20px; color: #fff; font-weight: 700; font-size: 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand:hover { color: #fff; }
.brand-mark { width: 25px; height: 25px; display: inline-flex; gap: 3px; align-items: flex-end; justify-content: center; }
.brand-mark i { display: block; width: 5px; border-radius: 1px; background: currentColor; }
.brand-mark i:nth-child(1) { height: 10px; }.brand-mark i:nth-child(2) { height: 18px; }.brand-mark i:nth-child(3) { height: 24px; }
.sidebar-nav { padding: 18px 8px; display: grid; gap: 6px; }
.nav-item { color: var(--sidebar-text); min-height: 48px; display: flex; align-items: center; gap: 13px; padding: 0 15px; border-radius: 6px; font-size: 15px; transition: background .15s, color .15s; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: #fff; background: var(--primary); box-shadow: inset 3px 0 0 rgba(255,255,255,.45); }
.sidebar-note { margin-top: auto; padding: 18px 24px; border-top: 1px solid rgba(255,255,255,.08); color: #95a8ba; font-size: 12px; letter-spacing: .06em; }
.app-main { min-width: 0; width: calc(100% - var(--sidebar-width)); margin-left: var(--sidebar-width); }
.app-topbar { position: sticky; top: 0; z-index: 1020; height: var(--topbar-height); display: flex; align-items: center; gap: 8px; padding: 0 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); }
.icon-button { width: 38px; height: 38px; border: 0; background: transparent; color: #334155; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; }
.icon-button:hover { background: #f0f4f8; color: var(--primary); }
.icon-button:focus-visible { outline: 3px solid rgba(13,110,253,.24); outline-offset: 1px; }
.topbar-spacer { flex: 1; }.user-menu { display: flex; align-items: center; gap: 8px; color: #334155; font-weight: 500; }
.content-wrap { width: 100%; max-width: 1540px; margin: 0 auto; padding: 24px 28px 40px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1 { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 720; letter-spacing: -.02em; }
.page-heading p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.dashboard-heading { align-items: center; }.site-selector { min-width: 210px; }
.form-control, .form-select { min-height: 42px; border-color: #cfd8e3; border-radius: 7px; font-size: 14px; color: #1f2937; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: #86b7fe; box-shadow: 0 0 0 .2rem rgba(13,110,253,.14); }
.form-label { color: #334155; font-weight: 600; margin-bottom: 7px; }
.form-text { color: #718096; font-size: 12px; }
.btn { min-height: 39px; border-radius: 7px; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 15px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-heading { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 17px; border-bottom: 1px solid var(--border-light); }
.panel-heading h2 { margin: 0; font-size: 16px; font-weight: 700; }.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(8, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.metric-item { min-height: 102px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 14px 8px; }
.metric-item span { color: #526173; font-size: 13px; white-space: nowrap; }.metric-item strong { margin-top: 9px; color: var(--primary); font-size: clamp(23px, 2vw, 30px); line-height: 1; font-weight: 600; letter-spacing: -.035em; }
.metric-item strong.warning { color: var(--warning); }.metric-item strong.danger { color: var(--danger); }.metric-item.score strong { color: #5f6b78; font-size: 20px; letter-spacing: 0; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, .9fr); gap: 14px; margin-bottom: 14px; }
.chart-frame { height: 300px; padding: 12px 16px 16px; position: relative; }.spider-layout { min-height: 300px; display: grid; grid-template-columns: minmax(145px, 1fr) minmax(130px, .8fr); align-items: center; gap: 12px; padding: 18px; }.donut-frame { height: 210px; position: relative; }
.spider-legend { display: grid; gap: 0; }.spider-legend > div { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 9px; min-height: 42px; border-bottom: 1px solid var(--border-light); }.spider-legend > div:last-child { border-bottom: 0; }.spider-legend strong { font-variant-numeric: tabular-nums; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }.spider-bing { background: #0d6efd; }.spider-google { background: #2ca66f; }.spider-baidu { background: #f4b400; }.spider-other { background: #9aa6b2; }
.table-panel { margin-bottom: 16px; }.app-table { --bs-table-bg: transparent; --bs-table-hover-bg: #f4f8ff; font-size: 13px; }.app-table > :not(caption) > * > * { padding: 11px 14px; border-bottom-color: var(--border-light); vertical-align: middle; }.app-table thead th { color: #334155; background: #fbfcfe; font-weight: 650; white-space: nowrap; }.app-table tbody tr:last-child td { border-bottom: 0; }.app-table code { color: #334155; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; white-space: nowrap; }.rank-col { width: 76px; }.empty-row { height: 90px; text-align: center; color: var(--muted) !important; }
.sites-table { min-width: 980px; }.sites-table td code { display: inline-block; max-width: 250px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.row-actions { display: flex; align-items: center; gap: 11px; white-space: nowrap; }.row-actions form { margin: 0; }.row-actions a, .row-actions button { padding: 0; color: var(--primary); border: 0; background: none; font-size: 13px; }.row-actions .danger { color: var(--danger); }
.status-text { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }.status-text i { width: 8px; height: 8px; border-radius: 50%; }.status-text.enabled i { background: var(--success); }.status-text.disabled { color: var(--muted); }.status-text.disabled i { background: #94a3b8; }
.security-strip, .readonly-callout { display: flex; align-items: center; gap: 9px; padding: 12px 14px; color: #8a5a08; background: #fff9e8; border: 1px solid #f4d28a; border-radius: 8px; font-size: 13px; }
.form-panel { max-width: 880px; padding: 24px; }.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }.form-field.wide { grid-column: 1 / -1; }.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 20px; border-top: 1px solid var(--border-light); }
.run-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }.run-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; }.run-status.success { color: var(--success); }.run-status.success::before { background: var(--success); }.run-status.failed { color: var(--danger); }.run-status.failed::before { background: var(--danger); }.run-status.running { color: var(--primary); }.run-status.running::before { background: var(--primary); }
.modal-content { border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-modal); }.modal-header, .modal-footer { border-color: var(--border-light); }.modal-body { padding: 20px; }.readonly-callout { margin-top: 18px; }
.report-filters { display: flex; align-items: flex-end; gap: 14px; padding: 17px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }.report-filters > div { min-width: 230px; }.report-summary { display: grid; grid-template-columns: repeat(6, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }.report-summary span { padding: 15px; color: var(--muted); text-align: center; border-right: 1px solid var(--border-light); }.report-summary span:last-child { border-right: 0; }.report-summary strong { display: block; margin-top: 4px; color: var(--text); font-size: 20px; }.report-chart { height: 280px; }.report-tables { display: grid; grid-template-columns: .65fr 1.35fr; gap: 14px; margin-top: 14px; }.ua-cell { max-width: 440px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { min-height: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; text-align: center; }.empty-state h2 { margin: 14px 0 6px; font-size: 20px; }.empty-state p { color: var(--muted); margin-bottom: 20px; }.empty-icon { width: 58px; height: 58px; display: grid; place-items: center; color: var(--primary); background: #edf5ff; border-radius: 50%; }.error-state > strong { color: var(--primary); font-size: 56px; line-height: 1; }
.flash-stack { display: grid; gap: 8px; margin-bottom: 16px; }.flash-stack .alert { margin: 0; border-radius: 8px; }
.auth-body { background: #edf2f7; }.auth-layout { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0%, #ffffff 0, #edf2f7 54%, #e5ebf2 100%); }.auth-panel { width: min(420px, 100%); padding: 36px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 18px 60px rgba(20,40,60,.1); }.auth-brand { display: flex; align-items: center; gap: 10px; color: var(--sidebar); font-size: 18px; font-weight: 750; margin-bottom: 34px; }.auth-panel h1 { font-size: 25px; margin: 0; }.auth-panel > p { color: var(--muted); margin: 8px 0 26px; }.readonly-assurance { color: var(--muted); font-size: 12px; text-align: center; margin-top: 24px; }
.report-filters { flex-wrap: wrap; }
.report-filters > div { min-width: 210px; }
.sidebar-backdrop { display: none; }

@media (max-width: 1200px) {
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .spider-layout { min-height: 250px; }.report-summary { grid-template-columns: repeat(3, 1fr); }.report-summary span:nth-child(3n) { border-right: 0; }
}
@media (max-width: 860px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: 18px 0 40px rgba(15,23,42,.2); }.sidebar-open .app-sidebar { transform: translateX(0); }.app-main { width: 100%; margin-left: 0; }.sidebar-backdrop { position: fixed; inset: 0; z-index: 1030; background: rgba(15,23,42,.45); }.sidebar-open .sidebar-backdrop { display: block; }.content-wrap { padding: 20px 18px 34px; }.report-tables { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .content-wrap { padding-inline: 14px; }.app-topbar { padding-inline: 14px; }.page-heading { align-items: stretch; flex-direction: column; }.dashboard-heading { align-items: stretch; }.site-selector { min-width: 0; }.metric-grid { grid-template-columns: repeat(2, 1fr); }.metric-item { min-height: 94px; }.spider-layout { grid-template-columns: 1fr; }.donut-frame { height: 190px; }.form-grid { grid-template-columns: 1fr; }.form-field.wide { grid-column: auto; }.form-panel { padding: 18px; }.report-filters { align-items: stretch; flex-direction: column; }.report-filters > div { min-width: 0; width: 100%; }.report-filters .btn { width: 100%; }.report-summary { grid-template-columns: repeat(2, 1fr); }.report-summary span:nth-child(3n) { border-right: 1px solid var(--border-light); }.report-summary span:nth-child(2n) { border-right: 0; }.auth-panel { padding: 28px 22px; }
}

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