:root {
    color-scheme: dark;
    --bg: #07100b;
    --panel: rgba(14, 28, 19, .92);
    --panel-2: rgba(20, 40, 27, .82);
    --line: rgba(132, 220, 158, .16);
    --text: #f5f8f6;
    --muted: #91a096;
    --accent: #84dc9e;
    --accent-strong: #50c978;
    --danger: #ff8b8b;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 20% 0%, rgba(80, 201, 120, .14), transparent 36rem),
        linear-gradient(145deg, #040806, var(--bg));
}

button, input { font: inherit; }
.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.auth-shell { width: min(100%, 430px); }
.auth-card,
.welcome-card {
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(13, 31, 20, .96), rgba(7, 17, 11, .98));
    box-shadow: 0 30px 90px rgba(0, 0, 0, .36);
    border-radius: 24px;
}
.auth-card { padding: 34px; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 28px;
    border-radius: 14px;
    color: #07100b;
    background: var(--accent);
    font-weight: 900;
    font-size: 22px;
    box-shadow: 0 0 35px rgba(132, 220, 158, .18);
}
.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
}
h1 { margin: 0; font-size: clamp(28px, 7vw, 40px); line-height: 1.05; letter-spacing: -.04em; }
.subcopy { margin: 12px 0 28px; color: var(--muted); line-height: 1.55; }
label { display: block; margin: 18px 0 7px; color: #c9d2cc; font-size: 13px; font-weight: 700; }
input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 12px;
    outline: none;
    color: var(--text);
    background: rgba(255, 255, 255, .035);
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
input:focus {
    border-color: rgba(132, 220, 158, .55);
    background: rgba(132, 220, 158, .04);
    box-shadow: 0 0 0 4px rgba(132, 220, 158, .08);
}
button {
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 850;
}
.auth-card form > button {
    width: 100%;
    margin-top: 24px;
    color: #061009;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}
.alert {
    margin: 18px 0 8px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 139, 139, .22);
    border-radius: 11px;
    color: #ffd0d0;
    background: rgba(255, 139, 139, .07);
    font-size: 13px;
}
.security-note { margin: 20px 0 0; color: #657269; text-align: center; font-size: 11px; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 72px;
    padding: 0 clamp(18px, 5vw, 56px);
    border-bottom: 1px solid var(--line);
    background: rgba(4, 10, 7, .82);
}
.topbar-brand { font-weight: 900; letter-spacing: -.02em; }
.status-pill {
    display: inline-flex;
    margin-left: 12px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
}
.secondary-button {
    min-height: 38px;
    padding: 0 14px;
    color: #d7dfda;
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .04);
}
.dashboard-shell { width: min(1120px, calc(100% - 36px)); margin: 64px auto; }
.welcome-card { padding: clamp(24px, 5vw, 48px); }
.welcome-card > p:not(.eyebrow) { color: var(--muted); }
.foundation-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 34px;
}
.foundation-grid div {
    display: grid;
    gap: 7px;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--panel-2);
}
.foundation-grid strong { font-size: 12px; }
.foundation-grid span { color: var(--accent); font-size: 11px; font-weight: 800; }
.next-step {
    margin-top: 24px;
    padding: 18px;
    border-left: 3px solid var(--accent);
    border-radius: 0 12px 12px 0;
    color: #b9c5bd;
    background: rgba(132, 220, 158, .045);
    line-height: 1.6;
}
@media (max-width: 720px) {
    .auth-card { padding: 25px 20px; border-radius: 20px; }
    .foundation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .status-pill { display: none; }
}
@media (max-width: 420px) {
    .foundation-grid { grid-template-columns: 1fr; }
}

/* =====================================================
   STEP 5A — ANALYTICS DASHBOARD FOUNDATION
===================================================== */

.dashboard-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 0%, rgba(80, 201, 120, .10), transparent 34rem),
        linear-gradient(145deg, #040806, #07100b 55%, #050906);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 68px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.topbar-identity,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-actions form { margin: 0; }
.admin-name { color: #9eaaa2; font-size: 12px; font-weight: 700; }

.admin-layout {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    min-height: calc(100vh - 68px);
}

.restaurant-sidebar {
    position: sticky;
    top: 68px;
    align-self: start;
    height: calc(100vh - 68px);
    padding: 30px 22px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: rgba(6, 14, 9, .72);
}

.sidebar-heading h2,
.panel-heading h2 {
    margin: 0;
    font-size: 21px;
    letter-spacing: -.03em;
}

.sidebar-heading > p:not(.eyebrow) {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.restaurant-search { margin-top: 24px; }
.restaurant-search label { margin-top: 0; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.search-row input { min-width: 0; min-height: 42px; font-size: 12px; }
.search-row button {
    min-height: 42px;
    padding: 0 13px;
    color: #061009;
    background: var(--accent);
    font-size: 11px;
}

.clear-search {
    display: inline-block;
    margin: 10px 0 0;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
}

.restaurant-list {
    display: grid;
    gap: 8px;
    margin-top: 22px;
}

.restaurant-list-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 11px;
    border: 1px solid rgba(255, 255, 255, .055);
    border-radius: 13px;
    color: inherit;
    background: rgba(255, 255, 255, .025);
    text-decoration: none;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.restaurant-list-item:hover {
    transform: translateY(-1px);
    border-color: rgba(132, 220, 158, .19);
    background: rgba(132, 220, 158, .045);
}

.restaurant-list-item.is-active {
    border-color: rgba(132, 220, 158, .34);
    background: rgba(132, 220, 158, .075);
    box-shadow: inset 3px 0 0 var(--accent);
}

.restaurant-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: var(--accent);
    background: rgba(132, 220, 158, .08);
    border: 1px solid rgba(132, 220, 158, .13);
    font-size: 13px;
    font-weight: 900;
}

.restaurant-list-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.restaurant-list-copy strong,
.restaurant-list-copy small {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.restaurant-list-copy strong { font-size: 12px; }
.restaurant-list-copy small { color: #76837a; font-size: 9px; }

.restaurant-state,
.restaurant-status {
    display: inline-flex;
    align-items: center;
    width: max-content;
    border-radius: 999px;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: .08em;
}

.restaurant-state {
    padding: 4px 6px;
    font-size: 7px;
}

.restaurant-status {
    padding: 5px 8px;
    font-size: 8px;
}

.is-live {
    color: #8ce5a5;
    border: 1px solid rgba(132, 220, 158, .15);
    background: rgba(132, 220, 158, .065);
}

.is-offline {
    color: #d7a4a4;
    border: 1px solid rgba(255, 139, 139, .13);
    background: rgba(255, 139, 139, .055);
}

.analytics-main {
    min-width: 0;
    padding: clamp(24px, 4vw, 52px);
}

.restaurant-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.title-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.restaurant-header h1 {
    margin-top: 3px;
    font-size: clamp(32px, 4vw, 52px);
}

.restaurant-domain {
    display: inline-block;
    margin-top: 9px;
    color: #8d9a91;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.restaurant-domain:hover { color: var(--accent); }

.range-filter {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .025);
}

.range-filter a {
    display: grid;
    place-items: center;
    min-width: 44px;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    color: #87938b;
    font-size: 10px;
    font-weight: 900;
    text-decoration: none;
}

.range-filter a.is-active {
    color: #07100b;
    background: var(--accent);
}

.period-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    margin-top: 30px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--line);
}

.period-strip > div {
    display: grid;
    gap: 5px;
    padding: 14px 16px;
    background: rgba(9, 20, 13, .96);
}

.period-strip span { color: #6e7b72; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.period-strip strong { font-size: 11px; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.kpi-card {
    position: relative;
    min-width: 0;
    padding: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 17px;
    background: linear-gradient(145deg, rgba(16, 31, 21, .89), rgba(8, 18, 12, .94));
    box-shadow: 0 16px 40px rgba(0, 0, 0, .14);
}

.kpi-card::after {
    content: "";
    position: absolute;
    width: 80px;
    height: 80px;
    top: -46px;
    right: -36px;
    border-radius: 50%;
    background: rgba(132, 220, 158, .045);
}

.kpi-card-primary { border-color: rgba(132, 220, 158, .22); }
.kpi-card-accent { background: linear-gradient(145deg, rgba(25, 59, 37, .94), rgba(11, 26, 17, .96)); }
.kpi-label { display: block; color: #87948b; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.kpi-card > strong { display: block; margin-top: 12px; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.04em; }
.kpi-card small { display: block; margin-top: 7px; color: #68766d; font-size: 9px; line-height: 1.4; }

.overview-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.overview-panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(11, 24, 16, .78);
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 17px;
    border-bottom: 1px solid rgba(255, 255, 255, .055);
}

.panel-total { color: #718078; font-size: 9px; font-weight: 800; white-space: nowrap; }
.metric-list { display: grid; margin-top: 7px; }
.metric-list > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-width: 0;
    padding: 12px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, .045);
}
.metric-list > div:last-child { border-bottom: 0; }
.metric-list span { color: #89958d; font-size: 11px; }
.metric-list strong { font-size: 13px; }
.metric-list .text-value { max-width: 58%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--accent); font-size: 10px; }

.dashboard-note {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 20px;
    padding: 14px 16px;
    border: 1px dashed rgba(132, 220, 158, .18);
    border-radius: 13px;
    color: #829087;
    background: rgba(132, 220, 158, .025);
    font-size: 10px;
    line-height: 1.5;
}
.dashboard-note strong { color: var(--accent); }

.empty-state {
    border: 1px dashed rgba(255, 255, 255, .10);
    border-radius: 16px;
    color: var(--muted);
    background: rgba(255, 255, 255, .02);
}
.compact-empty { display: grid; gap: 5px; padding: 15px; font-size: 10px; }
.compact-empty strong { color: #dce4df; }
.main-empty { padding: 40px; }
.main-empty > p:not(.eyebrow) { color: var(--muted); }

@media (max-width: 1180px) {
    .admin-layout { grid-template-columns: 270px minmax(0, 1fr); }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    .admin-layout { display: block; }
    .restaurant-sidebar {
        position: static;
        height: auto;
        padding: 22px 18px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .restaurant-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 260px;
        overflow-y: auto;
    }
    .analytics-main { padding: 26px 18px 42px; }
    .restaurant-header { align-items: flex-start; flex-direction: column; }
    .period-strip { grid-template-columns: 1fr; }
    .overview-panels { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .topbar { padding: 0 13px; }
    .admin-name { display: none; }
    .topbar-brand { font-size: 13px; }
    .restaurant-list { grid-template-columns: 1fr; }
    .restaurant-header h1 { font-size: 34px; }
    .range-filter { width: 100%; }
    .range-filter a { flex: 1; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .kpi-card { padding: 16px 14px; }
    .kpi-card > strong { font-size: 27px; }
    .overview-panel { padding: 17px; }
    .dashboard-note { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 390px) {
    .kpi-grid { grid-template-columns: 1fr; }
}

/* =====================================================
   STEP 5B — BEHAVIOR + TRAFFIC ANALYTICS
===================================================== */

.behavior-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.behavior-grid-trend {
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr);
}

.analytics-panel {
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background:
        linear-gradient(145deg, rgba(12, 27, 18, .90), rgba(7, 17, 11, .92));
    box-shadow: 0 18px 44px rgba(0, 0, 0, .12);
}

.analytics-panel-wide {
    min-width: 0;
}

.panel-empty {
    margin-top: 18px;
    padding: 18px;
    border: 1px dashed rgba(255, 255, 255, .08);
    border-radius: 13px;
    color: #718078;
    background: rgba(255, 255, 255, .018);
    font-size: 11px;
    line-height: 1.55;
}

.bar-list {
    display: grid;
    gap: 7px;
    margin-top: 16px;
}

.trend-list {
    max-height: 430px;
    padding-right: 5px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(132, 220, 158, .18) transparent;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(128px, .9fr) minmax(120px, 1.4fr) 68px;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
}

.bar-row:last-child {
    border-bottom: 0;
}

.bar-row-label {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.bar-row-label strong,
.bar-row-label small {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.bar-row-label strong {
    color: #e8eeea;
    font-size: 11px;
}

.bar-row-label small {
    color: #68766d;
    font-size: 8px;
}

.bar-row-value {
    display: grid;
    justify-items: end;
    gap: 2px;
}

.bar-row-value strong {
    color: #eff5f1;
    font-size: 12px;
}

.bar-row-value small {
    color: #637068;
    font-size: 7px;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.bar-row progress {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, .045);
}

.bar-row progress::-webkit-progress-bar {
    border-radius: 999px;
    background: rgba(255, 255, 255, .045);
}

.bar-row progress::-webkit-progress-value {
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.bar-row progress::-moz-progress-bar {
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.compact-bars .bar-row {
    grid-template-columns: minmax(105px, .95fr) minmax(80px, 1.1fr) 58px;
    gap: 9px;
}

.top-items-panel {
    margin-top: 20px;
}

.analytics-table-wrap {
    width: 100%;
    margin-top: 12px;
    overflow-x: auto;
}

.analytics-table {
    width: 100%;
    min-width: 690px;
    border-collapse: collapse;
}

.analytics-table th,
.analytics-table td {
    padding: 13px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .045);
    text-align: left;
    vertical-align: middle;
}

.analytics-table th {
    color: #67736b;
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .09em;
}

.analytics-table td {
    color: #aeb9b1;
    font-size: 10px;
}

.analytics-table tbody tr:hover {
    background: rgba(132, 220, 158, .025);
}

.ranked-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.rank-number {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(132, 220, 158, .12);
    border-radius: 8px;
    color: var(--accent);
    background: rgba(132, 220, 158, .055);
    font-size: 8px;
    font-weight: 900;
}

.ranked-item > span:last-child {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.ranked-item strong,
.ranked-item small {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ranked-item strong {
    color: #eef4f0;
    font-size: 10px;
}

.ranked-item small {
    max-width: 250px;
    color: #5f6c63;
    font-family: Consolas, Monaco, monospace;
    font-size: 7px;
}

.rate-value {
    color: var(--accent);
}

@media (max-width: 1180px) {
    .behavior-grid-trend {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .behavior-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .analytics-panel {
        padding: 17px;
    }

    .bar-row,
    .compact-bars .bar-row {
        grid-template-columns: minmax(92px, .9fr) minmax(72px, 1fr) 48px;
        gap: 7px;
    }

    .bar-row-label small {
        display: none;
    }

    .bar-row-value strong {
        font-size: 10px;
    }

    .bar-row-value small {
        display: none;
    }

    .trend-list {
        max-height: 360px;
    }
}

/* =====================================================
   STEP 5C — SEARCH INTELLIGENCE
===================================================== */

.search-intelligence-section {
    display: grid;
    gap: 18px;
    margin-top: 20px;
}

.section-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 4px 2px 0;
}

.section-heading-row h2 {
    margin: 3px 0 6px;
    color: #f1f6f3;
    font-size: 18px;
}

.section-heading-row p:last-child {
    max-width: 760px;
    margin: 0;
    color: #718078;
    font-size: 10px;
    line-height: 1.6;
}

.search-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.search-kpi-card {
    display: grid;
    gap: 6px;
    min-width: 0;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, .055);
    border-radius: 15px;
    background: rgba(255, 255, 255, .022);
}

.search-kpi-card > span {
    color: #748178;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.search-kpi-card > strong {
    color: #eef5f0;
    font-size: 24px;
    line-height: 1;
}

.search-kpi-card > small {
    color: #647168;
    font-size: 8px;
}

.search-kpi-card-success {
    border-color: rgba(132, 220, 158, .13);
    background: rgba(132, 220, 158, .035);
}

.search-kpi-card-success > strong {
    color: var(--accent);
}

.search-kpi-card-gap {
    border-color: rgba(244, 208, 111, .13);
    background: rgba(244, 208, 111, .028);
}

.search-kpi-card-gap > strong {
    color: #f4d06f;
}

.search-intelligence-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr);
    gap: 16px;
    min-width: 0;
}

.search-query-panel,
.unmet-demand-panel {
    min-width: 0;
}

.search-table {
    min-width: 720px;
}

.search-term-cell strong {
    max-width: 320px;
}

.demand-gap-list {
    display: grid;
    gap: 2px;
    margin-top: 14px;
}

.demand-gap-row {
    display: grid;
    grid-template-columns: 27px minmax(0, 1fr) 58px;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 11px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .045);
}

.demand-gap-row:last-child {
    border-bottom: 0;
}

.demand-gap-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.demand-gap-copy strong {
    overflow: hidden;
    color: #eef4f0;
    font-size: 10px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.demand-gap-copy small {
    overflow: hidden;
    color: #627068;
    font-size: 7px;
    line-height: 1.4;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.demand-gap-count {
    display: grid;
    justify-items: end;
    gap: 2px;
}

.demand-gap-count strong {
    color: #f4d06f;
    font-size: 12px;
}

.demand-gap-count small {
    color: #667168;
    font-size: 6px;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.positive-empty {
    display: grid;
    gap: 5px;
    margin-top: 16px;
    padding: 18px;
    border: 1px solid rgba(132, 220, 158, .10);
    border-radius: 13px;
    background: rgba(132, 220, 158, .025);
}

.positive-empty strong {
    color: var(--accent);
    font-size: 11px;
}

.positive-empty span {
    color: #69766e;
    font-size: 9px;
    line-height: 1.5;
}

.searched-items-panel {
    min-width: 0;
}

@media (max-width: 1180px) {
    .search-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-intelligence-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .section-heading-row {
        display: grid;
    }

    .search-kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .search-kpi-card {
        padding: 13px;
    }

    .search-kpi-card > strong {
        font-size: 20px;
    }
}

@media (max-width: 390px) {
    .search-kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   STEP 5D — GEOGRAPHIC INTELLIGENCE
===================================================== */

.geographic-intelligence-section {
    display: grid;
    gap: 18px;
    margin-top: 20px;
}

.geo-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.geo-kpi-card {
    display: grid;
    gap: 6px;
    min-width: 0;
    padding: 16px;
    border: 1px solid rgba(132, 220, 158, .08);
    border-radius: 15px;
    background:
        linear-gradient(145deg, rgba(132, 220, 158, .035), rgba(255, 255, 255, .018));
}

.geo-kpi-card > span {
    color: #718078;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.geo-kpi-card > strong {
    overflow: hidden;
    color: #eef5f0;
    font-size: 23px;
    line-height: 1.05;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.geo-kpi-card > small {
    color: #657169;
    font-size: 8px;
    line-height: 1.45;
}

.geo-primary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, .65fr);
    gap: 16px;
    min-width: 0;
}

.geo-secondary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
    gap: 16px;
    min-width: 0;
}

.geo-map-panel,
.geo-country-panel,
.geo-city-panel {
    min-width: 0;
}

.geo-map-wrap {
    position: relative;
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid rgba(132, 220, 158, .08);
    border-radius: 15px;
    background: #07110b;
}

.geo-map {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 1;
}

.geo-map-grid line {
    stroke: rgba(132, 220, 158, .045);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.geo-map-halo {
    fill: rgba(132, 220, 158, .11);
    stroke: rgba(132, 220, 158, .10);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.geo-map-dot {
    fill: #84dc9e;
    stroke: #dff8e7;
    stroke-width: 1.4;
    vector-effect: non-scaling-stroke;
}

.geo-map-label {
    fill: #d9e9df;
    font-size: 9px;
    font-weight: 800;
    paint-order: stroke;
    stroke: rgba(4, 10, 7, .92);
    stroke-width: 3px;
    stroke-linejoin: round;
}

.geo-map-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 13px;
    border-top: 1px solid rgba(255, 255, 255, .045);
    color: #637168;
    background: rgba(0, 0, 0, .12);
    font-size: 7px;
    line-height: 1.45;
}

.geo-map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.geo-legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(132, 220, 158, .08);
}

.geo-ranking-list {
    display: grid;
    gap: 3px;
    margin-top: 12px;
}

.geo-ranking-row {
    display: grid;
    grid-template-columns: minmax(150px, 1.1fr) minmax(90px, .9fr) 48px;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
}

.geo-ranking-row:last-child {
    border-bottom: 0;
}

.geo-ranking-copy {
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.geo-ranking-copy > span:last-child {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.geo-ranking-copy strong {
    overflow: hidden;
    color: #e7efea;
    font-size: 9px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.geo-ranking-copy small {
    overflow: hidden;
    color: #647168;
    font-size: 6.5px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.geo-ranking-progress {
    width: 100%;
    height: 7px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, .04);
}

.geo-ranking-progress::-webkit-progress-bar {
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
}

.geo-ranking-progress::-webkit-progress-value {
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(132, 220, 158, .38), var(--accent));
}

.geo-ranking-progress::-moz-progress-bar {
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(132, 220, 158, .38), var(--accent));
}

.geo-ranking-value {
    color: #dce9e0;
    font-size: 10px;
    text-align: right;
}

.geo-quality-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.geo-quality-list > div {
    display: grid;
    gap: 4px;
    padding: 13px 10px;
    border: 1px solid rgba(255, 255, 255, .045);
    border-radius: 12px;
    background: rgba(255, 255, 255, .018);
}

.geo-quality-list strong {
    color: var(--accent);
    font-size: 16px;
}

.geo-quality-list span {
    color: #647168;
    font-size: 6.5px;
    line-height: 1.45;
}

.geo-quality-note {
    margin: 13px 0 0;
    padding: 12px 13px;
    border-left: 2px solid rgba(244, 208, 111, .55);
    border-radius: 0 10px 10px 0;
    color: #8a8b78;
    background: rgba(244, 208, 111, .025);
    font-size: 8px;
    line-height: 1.65;
}

.geo-city-table {
    min-width: 980px;
}

.geo-city-table td:last-child {
    color: #8b978f;
    white-space: nowrap;
}

@media (max-width: 1180px) {
    .geo-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .geo-primary-grid,
    .geo-secondary-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .geo-kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .geo-kpi-card {
        padding: 13px;
    }

    .geo-kpi-card > strong {
        font-size: 19px;
    }

    .geo-map-legend {
        display: grid;
        gap: 5px;
    }

    .geo-map-label {
        font-size: 11px;
    }

    .geo-ranking-row {
        grid-template-columns: minmax(125px, 1fr) minmax(65px, .7fr) 40px;
        gap: 7px;
    }

    .geo-ranking-copy small {
        display: none;
    }

    .geo-quality-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .geo-kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   OPTIMIZED DASHBOARD VIEWS
===================================================== */

.dashboard-view-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 12px;
    padding: 6px;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, .055);
    border-radius: 16px;
    background: rgba(255, 255, 255, .018);
    scrollbar-width: none;
}

.dashboard-view-nav::-webkit-scrollbar {
    display: none;
}

.dashboard-view-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #839087;
    background: transparent;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .035em;
    text-decoration: none;
    transition: color .18s ease,
        background .18s ease,
        border-color .18s ease,
        transform .18s ease;
}

.dashboard-view-tab:hover {
    color: #dce9e0;
    background: rgba(255, 255, 255, .035);
    border-color: rgba(255, 255, 255, .055);
}

.dashboard-view-tab.is-active {
    color: #08120c;
    background: var(--accent);
    border-color: rgba(132, 220, 158, .78);
    box-shadow: 0 8px 22px rgba(80, 201, 120, .12);
}

.dashboard-view-tab.is-disabled {
    color: #59635c;
    cursor: default;
    opacity: .72;
}

.dashboard-view-tab.is-disabled:hover {
    color: #59635c;
    background: transparent;
    border-color: transparent;
}

.dashboard-view-tab small {
    padding: 2px 5px;
    border-radius: 999px;
    color: #77827b;
    background: rgba(255, 255, 255, .045);
    font-size: 5.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.dashboard-view-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 12px;
    padding: 17px 18px;
    border: 1px solid rgba(255, 255, 255, .045);
    border-radius: 15px;
    background: linear-gradient(135deg,
        rgba(132, 220, 158, .035),
        rgba(255, 255, 255, .012));
}

.dashboard-view-heading h2 {
    margin: 4px 0 0;
    color: #e7efe9;
    font-size: 18px;
    line-height: 1.15;
}

.dashboard-view-heading > p {
    max-width: 520px;
    margin: 0;
    color: #758078;
    font-size: 8px;
    line-height: 1.65;
    text-align: right;
}

@media (max-width: 760px) {
    .dashboard-view-nav {
        margin-top: 10px;
    }

    .dashboard-view-tab {
        min-height: 34px;
        padding: 0 12px;
        font-size: 8px;
    }

    .dashboard-view-heading {
        display: grid;
        align-items: start;
        gap: 8px;
        padding: 14px;
    }

    .dashboard-view-heading > p {
        max-width: none;
        text-align: left;
    }
}

/* =====================================================
   CONVERSION FUNNELS
===================================================== */

.conversion-section {
    display: grid;
    gap: 14px;
}

.conversion-hero-panel,
.conversion-search-panel {
    overflow: hidden;
}

.funnel-flow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 80px minmax(0, 1fr) 80px minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
    margin-top: 16px;
}

.funnel-flow-four {
    grid-template-columns:
        minmax(0, 1fr) 62px
        minmax(0, 1fr) 62px
        minmax(0, 1fr) 62px
        minmax(0, 1fr);
}

.funnel-stage {
    position: relative;
    display: grid;
    align-content: start;
    gap: 5px;
    min-width: 0;
    padding: 17px;
    border: 1px solid rgba(255, 255, 255, .055);
    border-radius: 15px;
    background:
        linear-gradient(145deg,
            rgba(255, 255, 255, .028),
            rgba(132, 220, 158, .018));
}

.funnel-stage.is-conversion {
    border-color: rgba(132, 220, 158, .20);
    background:
        linear-gradient(145deg,
            rgba(132, 220, 158, .09),
            rgba(80, 201, 120, .025));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
}

.funnel-step {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 22px;
    margin-bottom: 4px;
    border-radius: 7px;
    color: var(--accent);
    background: rgba(132, 220, 158, .07);
    font-size: 6px;
    font-weight: 900;
    letter-spacing: .1em;
}

.funnel-stage small {
    color: #7f8b83;
    font-size: 7px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.funnel-stage > strong {
    color: #eff8f1;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1;
    letter-spacing: -.045em;
}

.funnel-stage em {
    margin-top: 2px;
    color: #647068;
    font-size: 7px;
    font-style: normal;
    line-height: 1.5;
}

.funnel-connector {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 5px;
    min-width: 0;
    color: var(--accent);
}

.funnel-connector span {
    font-size: 8px;
    font-weight: 900;
}

.funnel-connector i {
    color: rgba(132, 220, 158, .42);
    font-size: 22px;
    font-style: normal;
    line-height: 1;
}

.conversion-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.conversion-summary-grid > div {
    display: grid;
    gap: 3px;
    padding: 12px 13px;
    border: 1px solid rgba(255, 255, 255, .045);
    border-radius: 12px;
    background: rgba(255, 255, 255, .016);
}

.conversion-summary-grid span {
    color: #6e7a72;
    font-size: 6px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.conversion-summary-grid strong {
    color: var(--accent);
    font-size: 19px;
    letter-spacing: -.035em;
}

.conversion-summary-grid small {
    color: #566158;
    font-size: 6.5px;
}

.conversion-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.conversion-grid .analytics-panel {
    min-width: 0;
}

.conversion-table {
    min-width: 660px;
}

.conversion-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 15px;
    border: 1px solid rgba(244, 208, 111, .10);
    border-left: 2px solid rgba(244, 208, 111, .55);
    border-radius: 12px;
    background: rgba(244, 208, 111, .022);
}

.conversion-note strong {
    flex: 0 0 auto;
    color: #d8c78a;
    font-size: 8px;
}

.conversion-note span {
    color: #787663;
    font-size: 7px;
    line-height: 1.65;
}

@media (max-width: 1220px) {
    .funnel-flow,
    .funnel-flow-four {
        grid-template-columns: 1fr;
    }

    .funnel-connector {
        grid-template-columns: auto auto;
        justify-content: center;
        padding: 1px 0;
    }

    .funnel-connector i {
        transform: rotate(90deg);
        font-size: 18px;
    }

    .conversion-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .conversion-summary-grid {
        grid-template-columns: 1fr;
    }

    .funnel-stage {
        padding: 14px;
    }

    .conversion-note {
        display: grid;
        gap: 5px;
    }
}

/* =====================================================
   AUTOMATED MARKETING INSIGHTS
===================================================== */

.insights-section {
    display: grid;
    gap: 14px;
}

.insights-hero {
    overflow: hidden;
}

.insights-intro {
    max-width: 760px;
    margin: 6px 0 0;
    color: #7a857e;
    font-size: 8px;
    line-height: 1.75;
}

.insight-confidence {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 999px;
    font-size: 6.5px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.insight-confidence--strong {
    color: var(--accent);
    border-color: rgba(132, 220, 158, .18);
    background: rgba(132, 220, 158, .06);
}

.insight-confidence--medium {
    color: #d7c579;
    border-color: rgba(244, 208, 111, .17);
    background: rgba(244, 208, 111, .045);
}

.insight-confidence--early {
    color: #9aa49e;
    background: rgba(255, 255, 255, .025);
}

.insights-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.insights-summary-grid > div {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid rgba(255, 255, 255, .045);
    border-radius: 13px;
    background: rgba(255, 255, 255, .018);
}

.insights-summary-grid span {
    color: #6e7972;
    font-size: 6px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.insights-summary-grid strong {
    color: #eef7f0;
    font-size: 21px;
    line-height: 1;
    letter-spacing: -.04em;
}

.insights-summary-grid small {
    color: #566159;
    font-size: 6.5px;
}

.insight-confidence-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
    padding: 11px 13px;
    border-left: 2px solid rgba(132, 220, 158, .30);
    border-radius: 9px;
    background: rgba(132, 220, 158, .025);
}

.insight-confidence-note strong {
    flex: 0 0 auto;
    color: var(--accent);
    font-size: 7px;
}

.insight-confidence-note span {
    color: #6c786f;
    font-size: 7px;
    line-height: 1.6;
}

.insight-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.insight-card {
    position: relative;
    display: grid;
    align-content: start;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, .055);
    border-radius: 16px;
    background:
        linear-gradient(145deg,
            rgba(255, 255, 255, .026),
            rgba(255, 255, 255, .008));
}

.insight-card::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: rgba(255, 255, 255, .12);
}

.insight-card--positive::after {
    background: rgba(132, 220, 158, .75);
}

.insight-card--opportunity::after {
    background: rgba(130, 170, 255, .70);
}

.insight-card--warning::after {
    background: rgba(244, 208, 111, .78);
}

.insight-card--neutral::after {
    background: rgba(137, 221, 255, .55);
}

.insight-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.insight-rank {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 22px;
    border-radius: 7px;
    color: #69756d;
    background: rgba(255, 255, 255, .028);
    font-size: 6px;
    font-weight: 900;
    letter-spacing: .1em;
}

.insight-tone {
    color: #7c8780;
    font-size: 6px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.insight-card--positive .insight-tone {
    color: var(--accent);
}

.insight-card--opportunity .insight-tone {
    color: #8daeff;
}

.insight-card--warning .insight-tone {
    color: #d8c67b;
}

.insight-card h3 {
    margin: 0;
    color: #edf6ef;
    font-size: 15px;
    line-height: 1.3;
    letter-spacing: -.02em;
}

.insight-card > p {
    margin: 0;
    color: #778279;
    font-size: 7.5px;
    line-height: 1.7;
}

.insight-metric {
    width: max-content;
    max-width: 100%;
    padding: 6px 9px;
    border-radius: 8px;
    color: var(--accent);
    background: rgba(132, 220, 158, .055);
    font-family: Consolas, Monaco, monospace;
    font-size: 7px;
    font-weight: 800;
}

.insight-action {
    display: grid;
    gap: 5px;
    margin-top: 2px;
    padding-top: 11px;
    border-top: 1px solid rgba(255, 255, 255, .045);
}

.insight-action span {
    color: #58625b;
    font-size: 5.8px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.insight-action strong {
    color: #a6b0a9;
    font-size: 7.3px;
    font-weight: 650;
    line-height: 1.65;
}

.insights-empty {
    min-height: 140px;
}

.insight-method-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.insight-method-grid > div {
    display: grid;
    align-content: start;
    gap: 5px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .04);
    border-radius: 11px;
    background: rgba(255, 255, 255, .012);
}

.insight-method-grid strong {
    color: #c9d3cb;
    font-size: 7px;
}

.insight-method-grid span {
    color: #667169;
    font-size: 6.6px;
    line-height: 1.6;
}

@media (max-width: 1000px) {
    .insights-summary-grid,
    .insight-method-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .insight-card-grid,
    .insights-summary-grid,
    .insight-method-grid {
        grid-template-columns: 1fr;
    }

    .insight-confidence-note {
        display: grid;
        gap: 4px;
    }
}

/* =====================================================
   STEP 6 — PRODUCTION HARDENING
===================================================== */

.dashboard-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 22px;
    padding: 16px 18px;
    border: 1px solid rgba(255, 111, 111, .22);
    border-radius: 16px;
    background: rgba(255, 111, 111, .055);
}

.dashboard-error > div {
    display: grid;
    gap: 5px;
}

.dashboard-error strong {
    font-size: 14px;
}

.dashboard-error span {
    color: var(--muted, rgba(255, 255, 255, .58));
    font-size: 12px;
    line-height: 1.55;
}

.dashboard-error code {
    flex: 0 0 auto;
    padding: 7px 9px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 9px;
    color: rgba(255, 255, 255, .78);
    background: rgba(0, 0, 0, .16);
    font-size: 10px;
    letter-spacing: .08em;
}

.data-attribution {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 14px 0 2px;
    padding: 11px 14px;
    border-top: 1px solid rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .38);
    font-size: 9px;
    line-height: 1.45;
}

.data-attribution span {
    flex: 0 0 auto;
    color: rgba(255, 255, 255, .52);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.data-attribution a {
    color: inherit;
    text-decoration: none;
}

.data-attribution a:hover {
    color: rgba(255, 255, 255, .72);
}

@media (max-width: 700px) {
    .dashboard-error,
    .data-attribution {
        align-items: flex-start;
        flex-direction: column;
    }
}


/* =====================================================
   ADVANCED IP INVESTIGATION — CONSOLIDATED
===================================================== */

.investigation-shell {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 16px;
}

.investigation-directory,
.investigation-workspace,
.investigation-results {
    min-width: 0;
}

.investigation-directory {
    flex: 0 0 310px;
    padding: 15px;
    border: 1px solid rgba(132, 220, 158, .14);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(132, 220, 158, .042), rgba(255, 255, 255, .012));
}

.investigation-directory-head,
.investigation-search-copy,
.investigation-event-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.investigation-directory h2,
.investigation-search-panel h2,
.investigation-panel h2,
.investigation-sessions-panel h2,
.investigation-timeline-panel h2 {
    margin: 3px 0 0;
}

.investigation-directory h2,
.investigation-search-panel h2 {
    font-size: 20px;
}

.investigation-directory-copy,
.investigation-search-copy > p:last-child,
.investigation-explainer {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
}

.investigation-directory-copy {
    margin: 7px 0 12px;
}

.investigation-ip-list {
    display: grid;
    gap: 7px;
    max-height: calc(100vh - 245px);
    min-height: 260px;
    overflow-y: auto;
    padding-right: 3px;
    scrollbar-width: thin;
}

.investigation-ip-choice-form {
    margin: 0;
}

.investigation-ip-choice {
    display: grid;
    gap: 7px;
    width: 100%;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: rgba(0, 0, 0, .13);
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.investigation-ip-choice:hover,
.investigation-ip-choice.is-active {
    border-color: rgba(132, 220, 158, .34);
    background: rgba(132, 220, 158, .065);
}

.investigation-ip-choice:hover {
    transform: translateY(-1px);
}

.investigation-ip-choice-main {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.investigation-ip-choice-main strong {
    overflow: hidden;
    color: #fff;
    font-family: Consolas, Monaco, monospace;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.investigation-ip-choice-main small,
.investigation-ip-choice time {
    color: var(--muted);
    font-size: 8px;
}

.investigation-ip-choice-stats,
.investigation-event-meta,
.investigation-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.investigation-ip-choice-stats small {
    padding: 3px 6px;
    border: 1px solid rgba(132, 220, 158, .09);
    border-radius: 999px;
    color: rgba(255, 255, 255, .64);
    background: rgba(132, 220, 158, .035);
    font-size: 7.5px;
}

.investigation-workspace {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.investigation-search-panel {
    padding: 14px 15px;
    border: 1px solid rgba(132, 220, 158, .14);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(132, 220, 158, .055), rgba(255, 255, 255, .018));
}

.investigation-search-copy {
    align-items: end;
}

.investigation-search-copy > p:last-child {
    max-width: 480px;
    margin: 0;
    text-align: right;
}

.investigation-ip-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 8px;
    align-items: end;
    margin-top: 10px;
}

.investigation-ip-form label {
    display: grid;
    gap: 6px;
}

.investigation-ip-form label span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.investigation-ip-form input {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: rgba(0, 0, 0, .18);
    font: inherit;
}

.investigation-ip-form button,
.investigation-clear-form button {
    border: 1px solid rgba(132, 220, 158, .28);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 850;
}

.investigation-ip-form button {
    display: grid;
    place-items: center;
    min-width: 150px;
    min-height: 42px;
    padding: 0 15px;
    color: #061009 !important;
    background: linear-gradient(135deg, #9ce7af, #72d992) !important;
    box-shadow: 0 7px 18px rgba(80, 201, 120, .12);
    font-size: 11px;
}

.investigation-clear-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 7px;
}

.investigation-clear-form button {
    min-height: 30px;
    padding: 0 9px;
    color: var(--muted);
    background: rgba(255, 255, 255, .02);
    font-size: 9px;
}

.investigation-warning,
.investigation-directory-empty,
.investigation-start-state {
    padding: 13px 14px;
    border: 1px dashed var(--line);
    border-radius: 11px;
    color: var(--muted);
    background: rgba(255, 255, 255, .012);
}

.investigation-warning {
    margin-top: 8px;
    border-style: solid;
    border-color: rgba(244, 208, 111, .22);
}

.investigation-results {
    display: grid;
    gap: 10px;
    width: 100%;
}

.investigation-results > * {
    min-width: 0;
    margin-top: 0 !important;
}

.investigation-start-state {
    display: grid;
    gap: 5px;
    min-height: 105px;
    place-content: center;
    text-align: center;
}

.investigation-start-state strong {
    color: var(--text);
}

.investigation-identity-strip,
.investigation-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.investigation-identity-strip > div,
.investigation-kpis article {
    display: grid;
    gap: 4px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(132, 220, 158, .025);
}

.investigation-identity-strip span,
.investigation-kpis span {
    color: var(--muted);
    font-size: 8px;
}

.investigation-identity-strip strong {
    overflow-wrap: anywhere;
    font-size: 11px;
}

.investigation-kpis strong {
    font-size: 20px;
}

.investigation-filter-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 11px;
    border: 1px solid rgba(132, 220, 158, .12);
    border-radius: 10px;
    color: var(--muted);
    background: rgba(132, 220, 158, .025);
    font-size: 9px;
}

.investigation-filter-banner a {
    color: var(--green);
    font-weight: 800;
    text-decoration: none;
}

.investigation-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
    gap: 10px;
}

.investigation-panel,
.investigation-sessions-panel,
.investigation-timeline-panel {
    padding: 15px;
}

.investigation-profile-list,
.investigation-session-list,
.investigation-browser-list {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.investigation-profile,
.investigation-session,
.investigation-browser {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: inherit;
    background: rgba(255, 255, 255, .018);
    text-decoration: none;
    transition: border-color .18s ease, background .18s ease;
}

.investigation-profile:hover,
.investigation-session:hover,
.investigation-browser:hover,
.investigation-profile.is-active,
.investigation-session.is-active,
.investigation-browser.is-active {
    border-color: rgba(132, 220, 158, .34);
    background: rgba(132, 220, 158, .065);
}

.investigation-profile.is-active,
.investigation-session.is-active,
.investigation-browser.is-active,
.investigation-chip.is-active {
    box-shadow: inset 3px 0 0 var(--green);
}

.investigation-profile > div:first-child,
.investigation-session > div:first-child {
    min-width: 0;
}

.investigation-profile strong,
.investigation-session strong,
.investigation-browser span {
    display: block;
}

.investigation-profile small,
.investigation-session small,
.investigation-browser small,
.investigation-profile-stats span,
.investigation-session > div:last-child span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.investigation-profile-stats,
.investigation-session > div:last-child {
    flex: 0 0 auto;
    text-align: right;
}

.investigation-filter-group + .investigation-filter-group {
    margin-top: 15px;
}

.investigation-filter-group > strong {
    display: block;
    margin-bottom: 7px;
    font-size: 10px;
}

.investigation-chip {
    display: grid;
    gap: 2px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    background: rgba(255, 255, 255, .018);
    text-decoration: none;
    font-size: 10px;
    font-weight: 800;
}

.investigation-chip small {
    color: var(--muted);
    font-size: 8px;
    font-weight: 600;
}

.investigation-chip:hover,
.investigation-chip.is-active {
    border-color: rgba(132, 220, 158, .34);
    background: rgba(132, 220, 158, .065);
}

.investigation-timeline {
    position: relative;
    display: grid;
    gap: 0;
    margin-top: 12px;
}

.investigation-event {
    display: grid;
    grid-template-columns: 135px 16px minmax(0, 1fr);
    gap: 10px;
    padding: 0 0 15px;
}

.investigation-event time {
    padding-top: 2px;
    color: var(--muted);
    font-size: 9px;
    text-align: right;
}

.investigation-event-dot {
    position: relative;
    width: 9px;
    height: 9px;
    margin-top: 3px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(132, 220, 158, .08);
}

.investigation-event-dot::after {
    content: "";
    position: absolute;
    top: 13px;
    left: 4px;
    width: 1px;
    height: calc(100% + 50px);
    background: var(--line);
}

.investigation-event:last-child .investigation-event-dot::after {
    display: none;
}

.investigation-event-body {
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .018);
}

.investigation-event-title code {
    color: var(--green);
    font-size: 9px;
}

.investigation-event-body p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 10px;
}

.investigation-event-meta {
    margin-top: 8px;
}

.investigation-event-meta span {
    padding: 4px 6px;
    border-radius: 6px;
    color: var(--muted);
    background: rgba(255, 255, 255, .03);
    font-size: 8px;
}

.investigation-privacy-note {
    margin-top: 0 !important;
}

@media (min-width: 1051px) {
    .investigation-directory {
        position: sticky;
        top: 78px;
        max-height: calc(100vh - 96px);
        overflow: hidden;
    }
}

@media (max-width: 1050px) {
    .investigation-shell {
        display: block;
    }

    .investigation-directory {
        position: static;
        max-height: none;
        margin-bottom: 12px;
    }

    .investigation-ip-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 360px;
        min-height: 0;
    }

    .investigation-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .investigation-ip-list,
    .investigation-identity-strip,
    .investigation-kpis {
        grid-template-columns: 1fr;
    }

    .investigation-search-copy,
    .investigation-filter-banner {
        display: block;
    }

    .investigation-search-copy > p:last-child {
        margin-top: 6px;
        text-align: left;
    }

    .investigation-ip-form {
        grid-template-columns: 1fr;
    }

    .investigation-ip-form button {
        width: 100%;
    }

    .investigation-filter-banner a {
        display: inline-block;
        margin-top: 6px;
    }

    .investigation-profile,
    .investigation-session,
    .investigation-browser {
        display: grid;
    }

    .investigation-profile-stats,
    .investigation-session > div:last-child {
        text-align: left;
    }

    .investigation-event {
        grid-template-columns: 12px minmax(0, 1fr);
    }

    .investigation-event time {
        grid-column: 2;
        grid-row: 1;
        margin-bottom: 4px;
        text-align: left;
    }

    .investigation-event-dot {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    .investigation-event-body {
        grid-column: 2;
        grid-row: 2;
    }
}

/* =====================================================
   MONTHLY PDF REPORTS
===================================================== */

.report-header-badge {
    display: grid;
    gap: 3px;
    min-width: 150px;
    padding: 12px 16px;
    border: 1px solid rgba(132, 220, 158, .16);
    border-radius: 14px;
    background: rgba(132, 220, 158, .055);
    text-align: right;
}

.report-header-badge span {
    color: rgba(255, 255, 255, .42);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.report-header-badge strong {
    color: #ffffff;
    font-size: 13px;
}

.reports-section {
    margin-top: 22px;
}

.reports-workspace {
    display: grid;
    grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr);
    gap: 18px;
    align-items: stretch;
}

.reports-control-panel,
.reports-preview-panel {
    min-width: 0;
    padding: 24px;
    border: 1px solid rgba(132, 220, 158, .13);
    border-radius: 20px;
    background:
        linear-gradient(145deg,
            rgba(132, 220, 158, .035),
            rgba(255, 255, 255, .012));
    box-shadow: 0 18px 45px rgba(0, 0, 0, .13);
}

.reports-control-panel h2,
.reports-preview-panel h2 {
    margin: 6px 0 8px;
    color: #ffffff;
}

.reports-control-panel > div > p:not(.eyebrow),
.report-preview-heading p,
.report-privacy-note {
    color: rgba(232, 244, 235, .55);
    line-height: 1.65;
}

.report-month-form {
    margin-top: 26px;
}

.report-month-form label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, .54);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
}

.report-month-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.report-month-row select {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0 14px;
    color: #ffffff;
    background: #07150d;
    border: 1px solid rgba(132, 220, 158, .16);
    border-radius: 13px;
    outline: none;
}

.report-month-row select:focus {
    border-color: rgba(132, 220, 158, .52);
    box-shadow: 0 0 0 3px rgba(132, 220, 158, .08);
}

.report-month-row button {
    min-width: 112px;
    padding: 0 18px;
    border: 0;
    border-radius: 13px;
    color: #06120a;
    background: #84dc9e;
    font-weight: 900;
    cursor: pointer;
}

.report-engine-state {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 14px;
    align-items: center;
    margin-top: 18px;
    padding: 14px 15px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .07);
    background: rgba(255, 255, 255, .025);
}

.report-engine-state > span {
    color: rgba(255, 255, 255, .43);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.report-engine-state strong {
    font-size: 12px;
}

.report-engine-state small {
    grid-column: 1 / -1;
    color: rgba(255, 255, 255, .40);
    line-height: 1.45;
}

.report-engine-state.is-ready strong {
    color: #84dc9e;
}

.report-engine-state.is-missing {
    border-color: rgba(235, 172, 72, .24);
}

.report-engine-state.is-missing strong {
    color: #f4d06f;
}

.reports-preview-panel {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 90% 0%, rgba(132, 220, 158, .13), transparent 32%),
        linear-gradient(145deg, #09180f, #07130c);
}

.reports-preview-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .11;
    background-image:
        linear-gradient(rgba(132, 220, 158, .12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(132, 220, 158, .12) 1px, transparent 1px);
    background-size: 28px 28px;
}

.reports-preview-panel > * {
    position: relative;
    z-index: 1;
}

.report-preview-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.report-preview-kicker {
    color: #84dc9e;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .16em;
}

.report-format-chip {
    flex: 0 0 auto;
    padding: 8px 10px;
    border: 1px solid rgba(132, 220, 158, .16);
    border-radius: 10px;
    color: #84dc9e;
    background: rgba(132, 220, 158, .07);
    font-size: 10px;
    font-weight: 800;
}

.report-preview-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 24px 0 18px;
}

.report-preview-kpis div {
    padding: 12px 10px;
    border: 1px solid rgba(255, 255, 255, .055);
    border-radius: 12px;
    background: rgba(255, 255, 255, .027);
}

.report-preview-kpis span {
    display: block;
    color: rgba(255, 255, 255, .38);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.report-preview-kpis strong {
    display: block;
    margin-top: 5px;
    color: #ffffff;
    font-size: 18px;
}

.report-contents-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin: 18px 0 22px;
}

.report-contents-list span {
    position: relative;
    min-width: 0;
    padding: 10px 10px 10px 27px;
    border-radius: 10px;
    color: rgba(238, 247, 241, .69);
    background: rgba(255, 255, 255, .022);
    font-size: 11px;
}

.report-contents-list span::before {
    content: "✓";
    position: absolute;
    left: 10px;
    color: #84dc9e;
    font-weight: 900;
}

.report-download-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 10px 16px;
    border-radius: 13px;
    color: #06120a;
    background: linear-gradient(135deg, #84dc9e, #65d88a);
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 13px 28px rgba(50, 177, 91, .16);
}

.report-download-button:hover {
    transform: translateY(-1px);
}

.report-download-button.is-disabled {
    color: rgba(255, 255, 255, .44);
    background: rgba(255, 255, 255, .055);
    box-shadow: none;
    cursor: default;
}

.report-privacy-note {
    margin: 12px 0 0;
    font-size: 10px;
}

@media (max-width: 980px) {
    .reports-workspace {
        grid-template-columns: 1fr;
    }

    .report-preview-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .reports-control-panel,
    .reports-preview-panel {
        padding: 18px;
        border-radius: 16px;
    }

    .report-month-row,
    .report-contents-list {
        grid-template-columns: 1fr;
    }

    .report-month-row button {
        min-height: 46px;
    }

    .report-preview-heading {
        display: grid;
    }

    .report-format-chip {
        width: max-content;
    }
}
