/* SEO OS — command center. Dark, dense, motion only for state and change. */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.num, .kpi-value, .mono-num { font-variant-numeric: tabular-nums; }
h1 { font-size: 18px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.sub { color: var(--muted); margin: 2px 0 0; font-size: 12px; }
.hidden { display: none !important; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--flat); }
.meta { font-size: 11.5px; color: var(--muted); } .meta b { color: var(--text); font-weight: 600; }
/* layout */
.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--bg-2); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 14px 10px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 8px; font-weight: 700; letter-spacing: .02em; font-size: 12px; text-transform: uppercase; color: var(--text); }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--inverse); display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); padding: 4px 8px 6px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 9px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; transition: background .12s, color .12s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .pill { font-size: 10.5px; color: var(--faint); font-family: var(--mono); }
.nav-item.active .pill { color: var(--accent); }
.side-foot { margin-top: auto; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; padding: 0 8px; }
main { min-width: 0; }
.toph { display: flex; align-items: center; gap: 10px; min-height: var(--top); padding: 6px 18px; flex-wrap: wrap; background: var(--top-bg); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.toph .crumb { font-weight: 650; font-size: 13px; white-space: nowrap; }
.toph .spacer { flex: 1; }
.toph select, .toph .seg { height: 30px; }
.toph select { padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); max-width: 200px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 0 10px; height: 100%; cursor: pointer; font-size: 12px; font-weight: 600; transition: background .12s, color .12s; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.seg button:hover:not(.on) { color: var(--text); }
.kbtn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 12px; }
.kbtn kbd { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--border-2); border-radius: 4px; padding: 0 4px; color: var(--faint); }
.kbtn:hover { color: var(--text); border-color: var(--border-2); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2.2s infinite; }
.live.stale .dot { background: var(--warn); animation: none; } .live.bad .dot { background: var(--bad); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.45); } 70% { box-shadow: 0 0 0 7px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }
.wrap { padding: 16px 18px 56px; max-width: 1600px; }
.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.panel, .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.panel.tight, .card.pad-0 { padding: 0; }
.panel.flat { box-shadow: none; }
.panel-head, .card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }
.panel.pad .tbl-wrap { margin: 0 -14px -12px; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.section { margin: 18px 0 8px; display: flex; align-items: baseline; gap: 10px; }
.section h2 { margin: 0; color: var(--text); font-size: 12.5px; }
.section .meta { margin-left: auto; }
/* header block */
.hdr { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.hdr .title { font-size: 20px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.hdr .title span { color: var(--accent); }
.hdr .facts { display: flex; gap: 18px; flex-wrap: wrap; }
.fact { display: flex; flex-direction: column; gap: 1px; }
.fact .v { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.fact .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
/* data health */
.health { display: flex; gap: 8px; flex-wrap: wrap; }
.health .src { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 12px; }
.health .src i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--faint); }
.health .src.ok i { background: var(--ok); } .health .src.warn i { background: var(--warn); } .health .src.bad i { background: var(--bad); } .health .src.off i { background: var(--faint); }
.health .src small { color: var(--faint); font-size: 10.5px; }
/* badges / chips */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); white-space: nowrap; letter-spacing: .02em; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.missing { background: transparent; border-style: dashed; color: var(--muted); font-weight: 500; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 12px; cursor: pointer; }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip:hover { color: var(--text); }
.dir { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 11px; letter-spacing: .05em; padding: 2px 8px; border-radius: 6px; }
.dir.RISING, .dir.GROWING, .dir.STRONG, .dir.BREAKING_OUT { background: var(--ok-soft); color: var(--ok); }
.dir.ACCELERATING { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px rgba(52,211,153,.35); }
.dir.STABLE, .dir.STALLED, .dir.STUCK { background: var(--surface-3); color: var(--muted); }
.dir.DECLINING, .dir.TECHNICAL_RISK, .dir.TECHNICAL_ISSUE, .dir.LOW_CTR { background: var(--bad-soft); color: var(--bad); }
.dir.RECOVERING, .dir.NEAR_TOP_10, .dir.NEEDS_INTERNAL_LINKS, .dir.NEEDS_CONTENT, .dir.HIGH_IMPRESSIONS { background: var(--warn-soft); color: var(--warn); }
.dir.AUTHORITY_CONSTRAINED, .dir.NEEDS_AUTHORITY, .dir.CANNIBALIZATION, .dir.CONTENT_OPPORTUNITY { background: var(--info-soft); color: var(--info); }
.dir.NO_SIGNAL, .dir.INSUFFICIENT_DATA { background: transparent; color: var(--faint); border: 1px dashed var(--border-2); }
.arrow { font-family: var(--mono); }
/* metric tiles (pulse) */
.pulse { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 10px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 8px; cursor: pointer; transition: border-color .15s, transform .15s; position: relative; overflow: hidden; }
.metric:hover { border-color: var(--border-2); }
.metric.on { border-color: var(--accent); box-shadow: var(--glow); }
.metric .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.metric .v { font-size: 24px; font-weight: 700; line-height: 1.1; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.metric .v.missing { font-size: 13px; font-weight: 500; color: var(--muted); padding: 6px 0; }
.metric .d { display: flex; align-items: baseline; gap: 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.metric .d .abs { color: var(--muted); }
.metric .spark { margin-top: 6px; height: 28px; }
.metric.changed .v { animation: flash .9s ease-out; }
@keyframes flash { 0% { color: var(--accent); } 100% { color: inherit; } }
/* sparkline */
.spark { width: 100%; height: 34px; display: block; overflow: visible; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark path.area { fill: url(#sparkfill); stroke: none; opacity: .7; }
.spark.up path.line { stroke: var(--up); } .spark.down path.line { stroke: var(--down); }
.spark path.line.draw { stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw .9s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
/* chart */
.chart { position: relative; width: 100%; height: 260px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { font-size: 10.5px; fill: var(--faint); font-family: var(--mono); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
.chart .line.prev { stroke: var(--faint); stroke-dasharray: 3 4; stroke-width: 1.2; }
.chart .area { fill: url(#chartfill); }
.chart .cross { stroke: var(--border-2); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .pt { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.tip { position: absolute; z-index: 30; pointer-events: none; background: var(--surface-3); border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 11.5px; box-shadow: var(--shadow); min-width: 160px; transform: translate(-50%, calc(-100% - 10px)); }
.tip b { font-variant-numeric: tabular-nums; }
.tip .l { display: flex; justify-content: space-between; gap: 12px; }
/* tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th, .tbl td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; background: var(--bg-2); position: sticky; top: 0; }
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.link { cursor: pointer; } .tbl tr.link:hover td { background: var(--surface-2); }
.tbl tr.xp { cursor: pointer; } .tbl tr.xp:hover td { background: var(--surface-2); }
.tbl tr.xp.open td { background: var(--surface-2); }
.tbl tr.detail td { background: var(--bg-2); padding: 10px 14px 12px; border-bottom: 1px solid var(--border-2); animation: fade .18s ease-out; }
.tbl.dense th, .tbl.dense td { padding: 5px 8px; }
@keyframes fade { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
/* movement */
.mv { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mv .from { color: var(--faint); } .mv .to { font-weight: 700; }
/* feed */
.feed { display: flex; flex-direction: column; gap: 0; }
.ev { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); animation: fade .25s ease-out; }
.ev:last-child { border-bottom: 0; }
.ev i { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--faint); }
.ev.ok i { background: var(--ok); } .ev.bad i { background: var(--bad); } .ev.warn i { background: var(--warn); } .ev.info i { background: var(--info); } .ev.accent i { background: var(--accent); }
.ev .what { font-weight: 600; }
.ev .where { color: var(--muted); font-size: 11.5px; }
.ev .when { color: var(--faint); font-size: 11px; font-family: var(--mono); white-space: nowrap; }
.ev .more { display: none; color: var(--muted); font-size: 12px; margin-top: 4px; }
.ev.open .more { display: block; }
.ev { cursor: pointer; }
/* focus cards */
.focus { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.fcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.fcard .rank { font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: .06em; }
.fcard .site { font-weight: 700; }
.fcard .url { font-family: var(--mono); font-size: 11.5px; color: var(--muted); word-break: break-all; }
.fcard .kw { font-size: 15px; font-weight: 650; }
.facts-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 10px; }
.facts-grid .fact .v { font-size: 13.5px; }
.fcard .why { font-size: 12px; color: var(--text); }
.fcard .why b, .why-k { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 10.5px; letter-spacing: .06em; margin-right: 6px; }
.fcard .foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
/* moves */
.move { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.move:last-child { border-bottom: 0; }
.move .n { font-family: var(--mono); color: var(--accent); font-weight: 700; font-size: 14px; }
.move .what { font-weight: 650; }
.move .line { font-size: 12px; color: var(--muted); }
.move .line b { color: var(--text); font-weight: 600; }
/* matrix */
.matrix td .cell { display: flex; flex-direction: column; gap: 1px; min-width: 76px; }
.matrix td .cell .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.matrix td .cell .s { font-size: 11px; }
/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 600; font-size: 12px; transition: background .12s, border-color .12s, transform .08s; }
.btn:hover { border-color: var(--border-2); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--inverse); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 2px 0; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 3px 8px; font-size: 11.5px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field input, .field select, .field textarea { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2); color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.notice { padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; }
.notice.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.notice.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate .card { width: 100%; max-width: 380px; }
.list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.list li { display: flex; gap: 8px; align-items: flex-start; }
pre.brief { font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; max-height: 420px; overflow: auto; margin: 0; }
/* drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 92vw); background: var(--surface); border-left: 1px solid var(--border-2); box-shadow: -12px 0 40px rgba(0,0,0,.45); z-index: 60; transform: translateX(100%); transition: transform .22s ease-out; overflow-y: auto; padding: 16px 18px 40px; }
.drawer.open { transform: none; }
.drawer .close { position: absolute; top: 10px; right: 12px; }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
/* command palette */
.pal-scrim { position: fixed; inset: 0; background: var(--pal-scrim); z-index: 80; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.pal-scrim.open { display: flex; }
.pal { width: min(680px, 94vw); background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.6); overflow: hidden; animation: fade .12s ease-out; }
.pal input { width: 100%; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--border); background: transparent; font-size: 15px; outline: none; }
.pal ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.pal li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.pal li.on, .pal li:hover { background: var(--accent-soft); }
.pal li .t { font-weight: 600; } .pal li .s { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.pal li .kind { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); width: 62px; }
.pal .hint { padding: 6px 12px 10px; font-size: 11px; color: var(--faint); display: flex; gap: 14px; }
/* responsive */
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .facts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1023px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; gap: 6px; padding: 8px 10px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav-group { flex-direction: row; gap: 2px; } .nav-label { display: none; } .side-foot { display: none; }
  .nav-item { padding: 5px 8px; white-space: nowrap; } .nav-item .pill { display: none; } .brand span { display: none; }
  .grid.two, .grid.cols-2 { grid-template-columns: 1fr; }
  .wrap { padding: 12px; } .toph { padding: 0 12px; gap: 6px; height: auto; min-height: var(--top); flex-wrap: wrap; padding-block: 6px; }
}
@media (max-width: 640px) {
  .metric .v { font-size: 20px; } .hdr .title { font-size: 16px; }
  .grid.cols-4, .grid.cols-3 { grid-template-columns: 1fr; } .facts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tbl.stack-sm thead { display: none; }
  .tbl.stack-sm tr { display: block; border-bottom: 1px solid var(--border); padding: 6px 0; }
  .tbl.stack-sm td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 10px; text-align: left; }
  .tbl.stack-sm td::before { content: attr(data-label); color: var(--muted); font-size: 11px; }
  .tbl.stack-sm td.num { text-align: right; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.tbtn { white-space: nowrap; }
.side-foot .btn.link { align-self: flex-start; padding: 0; }

.form-grid .field.wide { grid-column: 1 / -1; }
