:root {
  --bg: #f8f9fa; --surface: #fff; --border: #dee2e6; --text: #212529;
  --muted: #6c757d; --primary: #0d6efd; --danger: #dc3545; --success: #198754;
  --warning: #f57f17; --mobile-bg: #fce4ec; --span-bg: #fff8e1;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }

/* ── Header + Nav ── */
.site-header { background: #1a1a2e; color: #fff; padding: 0; }
.site-header-inner { display: flex; justify-content: space-between; align-items: center; padding: 16px 28px; }
.site-header h1 { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.site-header .subtitle { color: #8b92a5; font-size: 12px; margin-top: 2px; }
.site-nav { display: flex; gap: 0; padding: 0 28px; background: #12122a; border-top: 1px solid #2a2a4a; }
.site-nav a { color: #8b92a5; text-decoration: none; font-size: 13px; font-weight: 500; padding: 10px 18px; border-bottom: 2px solid transparent; transition: all 0.15s; }
.site-nav a:hover { color: #c8ccd4; }
.site-nav a.active { color: #fff; border-bottom-color: var(--primary); }

/* ── Cards ── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; padding: 20px 28px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; }
.card .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }
.card .value { font-size: 28px; font-weight: 700; margin-top: 4px; line-height: 1.1; }
.card.warn { border-left: 4px solid var(--danger); }
.card.good { border-left: 4px solid var(--success); }

/* ── Content area ── */
.content { padding: 24px 28px; }
h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.desc { color: var(--muted); font-size: 13px; margin-bottom: 16px; line-height: 1.5; }

/* ── Toolbar ── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type="search"] { padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; width: 300px; background: var(--surface); }
.toolbar input[type="search"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,110,253,0.12); }
.toolbar select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: var(--surface); }
.btn { padding: 8px 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 500; transition: all 0.12s; }
.btn:hover { background: #e9ecef; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #0b5ed7; }

/* ── Sub-tabs (for sitemap page) ── */
.subtabs { display: flex; gap: 0; padding: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.subtab { padding: 10px 20px; border: none; background: none; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.12s; }
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--primary); border-bottom-color: var(--primary); }
.subtab .badge { display: inline-block; background: #e9ecef; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; margin-left: 5px; }
.subtab .badge.red { background: var(--mobile-bg); color: #c62828; }
.subpanel { display: none; }
.subpanel.active { display: block; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #f1f3f5; position: sticky; top: 0; z-index: 10; cursor: pointer; user-select: none; font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }
th:hover { background: #e2e6ea; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
td a { color: var(--primary); text-decoration: none; word-break: break-all; }
td a:hover { text-decoration: underline; }
tr:hover td { background: #f8f9fa; }
tr.miss td { background: #fff5f5; }
tr.miss td:last-child { color: var(--danger); font-weight: 600; }
tr.mobile-row td { background: #fce4ec22; }

/* ── Tree view ── */
.tree-item { padding: 3px 0 3px 20px; border-left: 1px solid #e0e0e0; font-size: 13px; }
.tree-item.d0 { border-left: none; padding-left: 0; margin-top: 8px; }
details.tree-item > summary { cursor: pointer; padding: 5px 8px; border-radius: 4px; list-style: none; }
details.tree-item > summary::-webkit-details-marker { display: none; }
details.tree-item > summary::before { content: '\25B6'; font-size: 10px; margin-right: 8px; display: inline-block; transition: transform 0.15s; color: var(--muted); }
details[open] > summary::before { transform: rotate(90deg); }
.t-name { font-weight: 500; }
.d0 > summary > .t-name, .d0 > .t-name { font-size: 15px; font-weight: 700; }
.t-url { margin-left: 8px; color: var(--primary); font-size: 12px; text-decoration: none; word-break: break-all; }
.t-url:hover { text-decoration: underline; }
.t-nourl { color: var(--danger); font-size: 12px; font-style: italic; margin-left: 8px; }
.t-badge { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; margin-left: 4px; vertical-align: middle; }
.t-badge.mob { background: var(--mobile-bg); color: #c62828; }
.t-badge.span { background: var(--span-bg); color: var(--warning); }
.t-badge.viewall { background: #e8eaf6; color: #283593; }
.children { margin-left: 12px; }
.search-hide { display: none !important; }

/* ── Loading / empty states ── */
.loading { text-align: center; padding: 60px; color: var(--muted); font-size: 15px; }
.error { color: var(--danger); }
