:root {
    --app-bg: #f4f7fb;
    --app-surface: #ffffff;
    --app-border: #e5eaf2;
    --app-text: #101828;
    --app-muted: #667085;
    --app-primary: #2563eb;
    --app-primary-dark: #1d4ed8;
    --app-success: #12b76a;
    --app-shadow: 0 18px 50px rgba(15, 23, 42, .08);
}

[data-bs-theme="dark"] {
    --app-bg: #0b1120;
    --app-surface: #111827;
    --app-border: #243044;
    --app-text: #f8fafc;
    --app-muted: #94a3b8;
    --app-shadow: 0 18px 55px rgba(0, 0, 0, .28);
}

body { background: var(--app-bg); color: var(--app-text); min-height: 100vh; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.app-nav { background: color-mix(in srgb, var(--app-surface) 88%, transparent); border-bottom: 1px solid var(--app-border); backdrop-filter: blur(16px); }
.navbar-brand { color: var(--app-text); font-weight: 800; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: white; background: linear-gradient(135deg, #2563eb, #7c3aed); box-shadow: 0 8px 20px rgba(37, 99, 235, .28); }
.live-pill, .secure-badge { display: inline-flex; align-items: center; gap: .45rem; color: var(--app-muted); background: color-mix(in srgb, var(--app-surface) 80%, #e2e8f0); border: 1px solid var(--app-border); border-radius: 999px; padding: .45rem .75rem; font-size: .78rem; font-weight: 700; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--app-success); box-shadow: 0 0 0 5px rgba(18,183,106,.12); }
.btn-icon { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--app-border); color: var(--app-text); border-radius: 12px; }
.hero-section { min-height: 380px; color: white; background: radial-gradient(circle at 85% 20%, rgba(96, 165, 250, .35), transparent 28%), radial-gradient(circle at 15% 85%, rgba(124, 58, 237, .28), transparent 35%), linear-gradient(135deg, #0f172a, #172554 60%, #1e3a8a); overflow: hidden; }
.hero-section .text-secondary { color: #cbd5e1 !important; max-width: 680px; }
.eyebrow { display: inline-flex; gap: .45rem; align-items: center; padding: .45rem .75rem; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); font-size: .82rem; font-weight: 700; }
.gradient-text { background: linear-gradient(90deg, #93c5fd, #c4b5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-visual { position: relative; min-height: 250px; }
.mini-card { position: absolute; border: 1px solid rgba(255,255,255,.17); background: rgba(15,23,42,.56); backdrop-filter: blur(16px); box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.mini-card-main { inset: 15px 40px 20px 20px; padding: 1.5rem; border-radius: 24px; transform: rotate(2deg); }
.mini-label { color: #cbd5e1; font-size: .9rem; }
.mini-card strong { font-size: 4.2rem; letter-spacing: -.08em; }
.trend { color: #86efac; font-weight: 800; margin-bottom: 1.1rem; }
.mini-card-float { right: 0; bottom: 8px; border-radius: 16px; padding: .8rem 1rem; display: flex; gap: .55rem; align-items: center; font-weight: 700; transform: rotate(-3deg); }
.chart-bars { display: flex; align-items: end; gap: 8px; height: 66px; margin-top: .5rem; }
.chart-bars i { flex: 1; border-radius: 5px 5px 2px 2px; background: linear-gradient(#60a5fa, #7c3aed); opacity: .9; }
.chart-bars i:nth-child(1) { height: 32%; } .chart-bars i:nth-child(2) { height: 48%; } .chart-bars i:nth-child(3) { height: 42%; } .chart-bars i:nth-child(4) { height: 67%; } .chart-bars i:nth-child(5) { height: 60%; } .chart-bars i:nth-child(6) { height: 82%; } .chart-bars i:nth-child(7) { height: 100%; }
.mt-n4 { margin-top: -2.25rem; position: relative; z-index: 2; }
.app-card { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 22px; box-shadow: var(--app-shadow); }
.search-card { padding: clamp(1.1rem, 3vw, 2rem); }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1.35rem; }
.app-card .text-secondary { color: var(--app-muted) !important; }
.form-label { font-size: .88rem; font-weight: 750; margin-bottom: .55rem; }
.form-control, .form-select, .input-group-text { border-color: var(--app-border); min-height: 50px; }
.form-control:focus, .form-select:focus { border-color: #60a5fa; box-shadow: 0 0 0 .22rem rgba(37,99,235,.11); }
.input-group-text { color: #64748b; background: color-mix(in srgb, var(--app-bg) 55%, var(--app-surface)); }
.device-toggle { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--app-border); border-radius: .65rem; padding: 4px; min-height: 50px; background: color-mix(in srgb, var(--app-bg) 55%, var(--app-surface)); }
.device-toggle .btn { border: 0; display: flex; align-items: center; justify-content: center; gap: .4rem; color: var(--app-muted); font-weight: 700; }
.device-toggle .btn-check:checked + .btn { color: var(--app-primary); background: var(--app-surface); box-shadow: 0 2px 8px rgba(15,23,42,.08); }
.btn-primary { background: linear-gradient(135deg, var(--app-primary), #4f46e5); border: 0; font-weight: 750; box-shadow: 0 10px 24px rgba(37,99,235,.2); }
.btn-primary:hover { background: linear-gradient(135deg, var(--app-primary-dark), #4338ca); transform: translateY(-1px); }
.result-grid { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap: 1rem; }
.rank-card, .metric-card { padding: 1.35rem; min-height: 175px; position: relative; overflow: hidden; }
.rank-card { color: white; background: radial-gradient(circle at 90% 5%, rgba(255,255,255,.19), transparent 35%), linear-gradient(145deg, #2563eb, #4338ca); border: 0; }
.rank-card .text-secondary { color: #dbeafe !important; }
.rank-icon { position: absolute; right: 1.2rem; top: 1.1rem; color: #fde68a; font-size: 1.5rem; }
.rank-number { font-size: 3.7rem; line-height: 1.05; font-weight: 900; letter-spacing: -.08em; margin: .35rem 0; }
.rank-status { display: inline-flex; background: rgba(255,255,255,.13); border-radius: 999px; padding: .25rem .55rem; font-size: .78rem; font-weight: 750; }
.metric-card { display: flex; flex-direction: column; justify-content: flex-end; }
.metric-icon { position: absolute; top: 1.15rem; right: 1.15rem; display: grid; place-items: center; width: 42px; height: 42px; color: var(--app-primary); background: rgba(37,99,235,.1); border-radius: 13px; font-size: 1.2rem; }
.metric-card strong { font-size: 2rem; letter-spacing: -.04em; line-height: 1.2; margin: .25rem 0; }
.metric-card small { color: var(--app-muted); }
.metric-card .domain-value { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.results-table thead th { color: var(--app-muted); background: color-mix(in srgb, var(--app-bg) 60%, var(--app-surface)); border-bottom-color: var(--app-border); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; padding: .9rem 1.25rem; }
.results-table td { border-bottom-color: var(--app-border); padding: 1rem 1.25rem; }
.results-table tr.result-match td { background: rgba(18,183,106,.06); }
.position-pill { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; font-weight: 850; background: color-mix(in srgb, var(--app-bg) 70%, var(--app-surface)); }
.result-title { color: var(--app-text); font-weight: 750; text-decoration: none; display: block; max-width: 620px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-title:hover { color: var(--app-primary); }
.result-snippet { display: block; max-width: 620px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--app-muted); font-size: .8rem; }
.host-text { color: var(--app-muted); font-size: .86rem; }
.recent-list { display: grid; }
.recent-item { display: grid; grid-template-columns: 1.2fr 1fr .7fr .5fr; align-items: center; gap: 1rem; padding: 1rem 1.35rem; border-bottom: 1px solid var(--app-border); }
.recent-item:last-child { border-bottom: 0; }
.recent-keyword { font-weight: 750; }
.recent-meta { color: var(--app-muted); font-size: .82rem; }
footer { color: var(--app-muted); border-color: var(--app-border) !important; }

@media (max-width: 991.98px) {
    .hero-visual { display: none; }
    .hero-section { min-height: 330px; }
    .result-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575.98px) {
    .hero-section { min-height: 360px; }
    .hero-section .display-5 { font-size: 2.3rem; }
    .live-pill { display: none; }
    .card-heading { align-items: flex-start; flex-direction: column; }
    .secure-badge { display: none; }
    .result-grid { grid-template-columns: 1fr; }
    .recent-item { grid-template-columns: 1fr auto; }
    .recent-item > :nth-child(2), .recent-item > :nth-child(3) { display: none; }
    .results-table th:nth-child(3), .results-table td:nth-child(3) { display: none; }
    .results-table td, .results-table thead th { padding: .8rem; }
}

