/* ==========================================================================
   Crawldron – Styles
   Dunkel ist Standard, Hell per Umschalter. Akzent: Burgund.
   ========================================================================== */

:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0c0d;
  --bg-2: #131012;
  --surface: #191517;
  --surface-2: #201b1e;
  --surface-3: #2a2427;
  --border: #2c2528;
  --border-strong: #3b3236;
  --text: #f0eaec;
  --text-2: #bcb1b5;
  --muted: #8b8084;
  --accent: #9e2f4b;
  --accent-hover: #b53a5a;
  --accent-ink: #e98aa2;
  --accent-soft: rgba(181, 58, 90, .15);
  --accent-line: rgba(233, 138, 162, .35);
  --on-accent: #fff;
  --good: #3fb950;
  --warn: #fab219;
  --serious: #ec835a;
  --crit: #f06464;
  --info: #8b8084;
  --good-soft: rgba(63, 185, 80, .14);
  --warn-soft: rgba(250, 178, 25, .14);
  --serious-soft: rgba(236, 131, 90, .15);
  --crit-soft: rgba(240, 100, 100, .15);
  --shadow: 0 10px 40px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);
  --grid: rgba(255, 255, 255, .06);
  --edge: rgba(233, 200, 210, .10);
  --tip-bg: #2a2427;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f3f4;
  --bg-2: #efe9eb;
  --surface: #ffffff;
  --surface-2: #faf8f9;
  --surface-3: #f2eef0;
  --border: #e7e0e3;
  --border-strong: #d5cbcf;
  --text: #1c1719;
  --text-2: #4e4448;
  --muted: #7d7276;
  --accent: #7a1f35;
  --accent-hover: #922743;
  --accent-ink: #7a1f35;
  --accent-soft: rgba(122, 31, 53, .08);
  --accent-line: rgba(122, 31, 53, .3);
  --on-accent: #fff;
  --good: #0c8a0c;
  --warn: #b77f00;
  --serious: #c9562b;
  --crit: #c62f2f;
  --info: #7d7276;
  --good-soft: rgba(12, 138, 12, .1);
  --warn-soft: rgba(250, 178, 25, .18);
  --serious-soft: rgba(236, 131, 90, .16);
  --crit-soft: rgba(208, 59, 59, .1);
  --shadow: 0 10px 40px rgba(60, 20, 30, .12), 0 2px 8px rgba(60, 20, 30, .06);
  --grid: rgba(0, 0, 0, .06);
  --edge: rgba(80, 30, 45, .12);
  --tip-bg: #1c1719;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { flex: none; }
::selection { background: var(--accent); color: #fff; }
.mono, code, pre { font-family: "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.t2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- Logo */
.logo { width: 32px; height: 32px; }
.logo-bg { fill: var(--accent); }
.logo-line { fill: none; stroke: #f6e7eb; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.logo-fill { fill: #f6e7eb; }
.nav a svg .fill, .icon-btn svg .fill, .empty svg .fill { fill: currentColor; stroke: none; }

/* ---------------------------------------------------------------- Auth */
body.auth { display: grid; place-items: center; padding: 24px 16px; min-height: 100%;
  background: radial-gradient(1200px 600px at 80% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.auth-card.wide { max-width: 560px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.auth-brand .logo { width: 40px; height: 40px; }
.auth-brand strong { display: block; font-size: 20px; letter-spacing: -.01em; }
.auth-brand span { color: var(--muted); font-size: 13px; }
.req-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.req-list li { display: grid; grid-template-columns: 10px auto 1fr; gap: 10px; align-items: center; font-size: 13px; }
.req-list .muted { text-align: right; font-size: 12px; }
.req-list .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.req-list .fail .dot { background: var(--crit); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset.seg { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0; display: grid; gap: 6px; }
fieldset.seg legend { padding: 0 6px; color: var(--muted); font-size: 12px; }
label.radio { display: flex; gap: 8px; align-items: center; font-weight: 400; }

/* ---------------------------------------------------------------- Forms */
label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 8px 11px; min-height: 36px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; font-family: "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-ink); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); margin: 0; }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; color: var(--text); cursor: pointer; }
.check input { margin-top: 3px; }
.check small { display: block; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
  text-decoration: none !important;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger:hover { color: var(--crit); border-color: var(--crit); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; height: 40px; }
.btn svg, .icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- Alerts */
.alert { padding: 10px 12px; border-radius: 10px; background: var(--crit-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--crit) 40%, transparent); font-size: 13px; }
.alert.ok { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.alert.info { background: var(--accent-soft); border-color: var(--accent-line); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

/* ---------------------------------------------------------------- App layout */
body.app { overflow: hidden; }
#app { display: grid; grid-template-columns: 228px 1fr; height: 100vh; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px; gap: 18px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: var(--text); text-decoration: none !important; }
.brand strong { display: block; font-size: 16px; letter-spacing: -.01em; line-height: 1.1; }
.brand small { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-weight: 500; text-decoration: none !important; position: relative; }
.nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-ink); }
.sidebar-foot { margin-top: auto; display: flex; gap: 6px; padding: 0 4px; }
:root[data-theme="dark"] .i-sun, :root:not([data-theme]) .i-sun { display: none; }
:root[data-theme="light"] .i-moon { display: none; }

.view { overflow: auto; min-width: 0; outline: none; position: relative; }
.page { padding: 26px 32px 60px; max-width: 1500px; margin: 0 auto; }
.page.full { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.015em; font-weight: 650; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; letter-spacing: -.005em; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }

/* ---------------------------------------------------------------- Cards & KPIs */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; line-height: 1.2; }
.kpi .value small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.kpi.link { cursor: pointer; transition: border-color .15s; }
.kpi.link:hover { border-color: var(--accent-line); }

/* ---------------------------------------------------------------- Pills & Badges */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.running { background: var(--accent-soft); color: var(--accent-ink); }
.pill.running::before { animation: pulse 1.2s infinite; }
.pill.done { background: var(--good-soft); color: var(--good); }
.pill.paused { background: var(--warn-soft); color: var(--warn); }
.pill.stopping, .pill.finalizing { background: var(--serious-soft); color: var(--serious); }
@keyframes pulse { 50% { opacity: .25; } }
.sc { display: inline-block; min-width: 38px; padding: 1px 7px; border-radius: 6px; font-weight: 650; font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.sc.s2 { background: var(--good-soft); color: var(--good); }
.sc.s3 { background: var(--warn-soft); color: var(--warn); }
.sc.s4 { background: var(--crit-soft); color: var(--crit); }
.sc.s5 { background: var(--serious-soft); color: var(--serious); }
.sc.s0 { background: var(--surface-3); color: var(--muted); }
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.prio i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.prio.high { color: var(--crit); } .prio.high i { background: var(--crit); }
.prio.medium { color: var(--serious); } .prio.medium i { background: var(--serious); border-radius: 50%; }
.prio.low { color: var(--warn); } .prio.low i { background: var(--warn); transform: rotate(45deg) scale(.85); }
.prio.info { color: var(--muted); } .prio.info i { background: var(--muted); border-radius: 50%; width: 7px; height: 7px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; font-weight: 600; }
.tag.acc { background: var(--accent-soft); color: var(--accent-ink); }
.idx-yes { color: var(--good); font-weight: 600; }
.idx-no { color: var(--serious); font-weight: 600; }

/* ---------------------------------------------------------------- Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent-ink); }
.tabs a .count { font-size: 11px; background: var(--surface-3); color: var(--muted); padding: 0 6px; border-radius: 99px; font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--border-strong); background: transparent; color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.chip .count { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.chip.active .count { color: inherit; opacity: .8; }

/* ---------------------------------------------------------------- Toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
.search { position: relative; min-width: 240px; flex: 1; max-width: 460px; }
.search input { padding-left: 34px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2; pointer-events: none; }

/* ---------------------------------------------------------------- Tables */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); max-height: calc(100vh - 290px); min-height: 200px; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th, table.t td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; user-select: none; }
table.t th.sortable { cursor: pointer; }
table.t th.sortable:hover { color: var(--text); }
table.t th.sorted { color: var(--accent-ink); }
table.t th .arr { opacity: .8; margin-left: 4px; }
table.t tbody tr { transition: background .08s; }
table.t tbody tr:hover { background: var(--surface-2); }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.sel { background: var(--accent-soft); }
table.t td.url { max-width: 560px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
table.t td.txt { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.t td.wrap { white-space: normal; word-break: break-word; }
table.t tr:last-child td { border-bottom: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 36px; height: 36px; stroke: var(--border-strong); fill: none; stroke-width: 1.5; margin-bottom: 8px; }

/* ---------------------------------------------------------------- Crawl list */
.crawl-list { display: grid; gap: 10px; }
.crawl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 18px; align-items: center; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.crawl-row:hover { border-color: var(--accent-line); }
.crawl-row .name { font-weight: 650; font-size: 14.5px; }
.crawl-row .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.crawl-row .nums { display: flex; gap: 18px; text-align: right; }
.crawl-row .nums div b { display: block; font-size: 16px; }
.crawl-row .nums div span { color: var(--muted); font-size: 11.5px; }
.issue-dots { display: flex; gap: 10px; font-size: 12.5px; }

/* ---------------------------------------------------------------- Progress */
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-ink)); border-radius: 99px; transition: width .4s ease; }
.progress.indet > div { width: 30% !important; animation: indet 1.4s infinite ease-in-out; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.live { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
.live-feed { margin-top: 12px; display: grid; gap: 3px; max-height: 190px; overflow: hidden; }
.live-feed div { display: grid; grid-template-columns: 50px 1fr 64px; gap: 10px; font-size: 12px; align-items: center; animation: fadein .3s; }
.live-feed .u { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: "Cascadia Mono", Consolas, monospace; color: var(--text-2); }
@keyframes fadein { from { opacity: 0; transform: translateY(-3px); } }

/* ---------------------------------------------------------------- Forms page */
.form-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.form-section { display: grid; gap: 14px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
details.adv { border-top: 1px solid var(--border); padding-top: 12px; }
details.adv summary { cursor: pointer; color: var(--text-2); font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.adv summary::before { content: "›"; font-size: 18px; transition: transform .15s; display: inline-block; }
details.adv[open] summary::before { transform: rotate(90deg); }
details.adv > div { margin-top: 14px; display: grid; gap: 14px; }
.seg-ctl { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-ctl button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-weight: 600; font-size: 12.5px; padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.seg-ctl button.active { background: var(--accent); color: #fff; }

/* ---------------------------------------------------------------- Issues */
.issues-layout { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.issue-list { max-height: calc(100vh - 230px); overflow: auto; }
.issue-cat { padding: 10px 14px 4px; color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.issue-item { display: grid; grid-template-columns: 76px 1fr auto; gap: 10px; align-items: center; padding: 8px 14px; cursor: pointer; border-left: 2px solid transparent; }
.issue-item:hover { background: var(--surface-2); }
.issue-item.active { background: var(--accent-soft); border-left-color: var(--accent-ink); }
.issue-item .n { font-weight: 650; font-variant-numeric: tabular-nums; }
.issue-item.zero { opacity: .45; }
.issue-detail .explain { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.issue-detail .explain div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--text-2); }
.issue-detail .explain b { display: block; color: var(--text); margin-bottom: 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------------------------------------------------------------- Charts */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11.5px; font-family: inherit; }
.chart .lbl { fill: var(--text-2); font-size: 12px; }
.chart .val { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart .gridline { stroke: var(--grid); }
.chart .bar { transition: opacity .15s; cursor: default; }
.chart .hit:hover + .bar, .chart g.row:hover .bar { opacity: .82; }
.chart g.row.click { cursor: pointer; }
.chart-tip { position: fixed; z-index: 100; pointer-events: none; background: var(--tip-bg); color: #f6eff1; padding: 7px 10px; border-radius: 8px; font-size: 12px; box-shadow: var(--shadow); max-width: 420px; opacity: 0; transition: opacity .1s; }
.chart-tip.show { opacity: 1; }
.chart-tip b { font-weight: 650; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------------------------------------------------------------- Graph */
.graph-shell { position: relative; height: calc(100vh - 200px); min-height: 480px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background:
  radial-gradient(circle at 50% 40%, var(--accent-soft), transparent 65%), var(--surface); }
.graph-shell canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.graph-shell canvas.drag { cursor: grabbing; }
.graph-panel { position: absolute; top: 12px; left: 12px; width: 268px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 10px; box-shadow: var(--shadow); max-height: calc(100% - 24px); overflow: auto; z-index: 2; }
.graph-panel label { font-size: 12px; }
.graph-panel select, .graph-panel input:not([type=checkbox]):not([type=range]) { min-height: 32px; padding: 5px 9px; font-size: 12.5px; }
.graph-panel .search input { padding-left: 32px !important; }
.graph-panel input[type=range] { padding: 0; min-height: 0; accent-color: var(--accent); }
.graph-panel .collapse-btn { justify-self: end; }
.graph-panel.collapsed > :not(.gp-head) { display: none; }
.gp-head { display: flex; justify-content: space-between; align-items: center; }
.gp-head strong { font-size: 13px; }
.graph-legend { position: absolute; bottom: 12px; left: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; z-index: 2; max-width: calc(100% - 24px); }
.graph-info { position: absolute; top: 12px; right: 12px; width: 340px; background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); z-index: 2; max-height: calc(100% - 24px); overflow: auto; font-size: 12.5px; }
.graph-info .u { font-family: "Cascadia Mono", Consolas, monospace; word-break: break-all; font-size: 12px; margin-bottom: 8px; color: var(--text); }
.graph-info dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0; }
.graph-info dt { color: var(--muted); }
.graph-info dd { margin: 0; }
.graph-stats { position: absolute; bottom: 12px; right: 12px; font-size: 11.5px; color: var(--muted); z-index: 2; background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 4px 9px; border-radius: 8px; }
.graph-zoom { position: absolute; right: 12px; bottom: 44px; display: grid; gap: 4px; z-index: 2; }
.graph-zoom .icon-btn { background: var(--surface); border-color: var(--border); }

/* ---------------------------------------------------------------- Tree */
.tree-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 150px 80px 70px; gap: 12px; align-items: center; padding: 6px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.tree-row.head { color: var(--muted); font-size: 12px; font-weight: 600; background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
.tree-row:not(.head):hover { background: var(--surface-2); }
.tree-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tree-name span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.tree-tog { width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 5px; cursor: pointer; color: var(--muted); flex: none; border: 0; background: none; padding: 0; }
.tree-tog:hover { background: var(--surface-3); color: var(--text); }
.tree-tog svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.5; transition: transform .15s; }
.tree-tog.open svg { transform: rotate(90deg); }
.mini-bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; display: flex; gap: 2px; }
.mini-bar i { display: block; height: 100%; border-radius: 4px; }

/* ---------------------------------------------------------------- Drawer */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(680px, 100vw); transform: translateX(100%); transition: transform .22s ease; z-index: 50; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-inner { overflow: auto; flex: 1; padding: 20px 22px 40px; }
.drawer-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.drawer-head .u { font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; word-break: break-all; }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 0; font-size: 13px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.kv > div { padding: 7px 12px; border-bottom: 1px solid var(--border); word-break: break-word; }
.kv > div:nth-child(odd) { color: var(--muted); background: var(--surface-2); }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.serp { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; font-family: Arial, sans-serif; }
.serp .s-url { font-size: 12px; color: var(--text-2); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp .s-title { font-size: 20px; line-height: 1.3; color: #8ab4f8; margin-bottom: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 600px; }
:root[data-theme="light"] .serp .s-title { color: #1a0dab; }
.serp .s-desc { font-size: 14px; line-height: 1.58; color: var(--text-2); max-width: 600px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.px-meter { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.px-meter .progress { flex: 1; height: 5px; }
.path-crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; }
.path-crumbs a { font-family: "Cascadia Mono", Consolas, monospace; background: var(--surface-2); padding: 2px 7px; border-radius: 6px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-gap { margin-top: 18px; }

/* ---------------------------------------------------------------- Keywords */
.kw-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; align-items: start; }
.kw-groups { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.kw-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.kw-cloud span { padding: 4px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; cursor: pointer; }
.kw-cloud span:hover { border-color: var(--accent-line); color: var(--accent-ink); }
.src-badges { display: inline-flex; gap: 3px; }
.src-badges b { font-size: 10px; width: 18px; height: 18px; border-radius: 5px; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.src-badges b.on { background: var(--accent-soft); color: var(--accent-ink); }
#kwTable td { vertical-align: middle; }
.history { display: grid; gap: 2px; }
.history a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-size: 13px; text-decoration: none !important; }
.history a:hover { background: var(--surface-2); color: var(--text); }
.history a.active { background: var(--accent-soft); color: var(--accent-ink); }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }

/* ---------------------------------------------------------------- Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: var(--tip-bg); color: #f6eff1; padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); opacity: 0; transition: all .2s; z-index: 200; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #8f2424; }

/* ---------------------------------------------------------------- Loader */
.loader { display: grid; place-items: center; padding: 60px; color: var(--muted); gap: 12px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent-ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1180px) {
  .issues-layout, .kw-layout, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .issue-list { max-height: 360px; }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { flex-direction: row; align-items: center; padding: 8px 12px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .brand small, .nav a span { display: none; }
  .nav { display: flex; }
  .nav a.active::before { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; }
  .page { padding: 18px 16px 50px; }
  .cols-2, .cols-3, .row-2, .row-3, .grid2, .issue-detail .explain { grid-template-columns: minmax(0, 1fr); }
  .crawl-row { grid-template-columns: 1fr; gap: 8px; }
  .crawl-row .nums { text-align: left; }
  .graph-panel { width: calc(100% - 24px); }
  .graph-info { width: calc(100% - 24px); top: auto; bottom: 56px; max-height: 45%; }
  .tree-row { grid-template-columns: minmax(0, 1fr) 70px 90px; }
  .tree-row > :nth-child(4), .tree-row > :nth-child(5) { display: none; }
  .table-wrap { max-height: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
