*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --accent: #2f6bff;
    --accent-strong: #66a6ff;
    --accent-soft: rgba(47, 107, 255, 0.12);
    --accent-glow: rgba(47, 107, 255, 0.18);
    --gold: #d97706;
    --gold-soft: rgba(217, 119, 6, 0.14);
    --locked: #243144;
    --locked-soft: rgba(36, 49, 68, 0.14);
    --open: #f8fbff;
    --surface: rgba(255, 255, 255, 0.74);
    --surface-strong: rgba(255, 255, 255, 0.9);
    --border: rgba(255, 255, 255, 0.72);
    --line: rgba(148, 163, 184, 0.24);
    --text-main: #22304a;
    --text-soft: #607089;
    --shadow: 0 22px 44px rgba(148, 163, 184, 0.14);
    --sale: linear-gradient(135deg, rgba(47, 107, 255, 0.98), rgba(102, 166, 255, 0.92));
}

html {
    scroll-behavior: smooth;
}

body.grid-page {
    margin: 0;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    background:
        radial-gradient(circle at 0% 0%, rgba(47, 107, 255, 0.08), transparent 28%),
        radial-gradient(circle at 100% 0%, rgba(217, 119, 6, 0.06), transparent 22%),
        linear-gradient(135deg, #ffffff 0%, #edf3f7 22%, #ffffff 52%, #e5edf1 78%, #ffffff 100%);
    min-height: 100vh;
    padding: 118px 0 88px;
    overflow-x: hidden;
}

body.grid-page.sheet-open {
    overflow: hidden;
}

.container.grid-shell {
    max-width: 1460px;
    margin: 0 auto;
    padding: 0 18px;
}

.glass-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.grid-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
    gap: 20px;
    padding: 28px;
    border-radius: 34px;
    margin-bottom: 20px;
}

.grid-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.95);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.grid-title {
    margin: 18px 0 0;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    line-height: 0.94;
    letter-spacing: 0.06em;
    color: var(--text-main);
}

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

.hero-stat-card {
    border-radius: 24px;
    padding: 18px 18px 16px;
}

.hero-stat-label {
    display: block;
    color: var(--text-soft);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hero-stat-value {
    display: block;
    margin-top: 10px;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.1rem, 2vw, 1.7rem);
    color: var(--text-main);
}

.grid-hero-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.toggle-card,
.legend-card {
    border-radius: 24px;
    padding: 18px 20px;
}

.toggle-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 68px;
}

.toggle-label {
    color: var(--text-soft);
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: color 0.22s ease;
}

.toggle-label.active {
    color: var(--accent);
}

.toggle-switch {
    position: relative;
    display: inline-flex;
    width: 62px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(226, 232, 240, 0.92);
    border: 1px solid rgba(203, 213, 225, 0.92);
    cursor: pointer;
    transition: all 0.25s ease;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(47, 107, 255, 0.98), rgba(102, 166, 255, 0.9));
    box-shadow: 0 8px 18px rgba(47, 107, 255, 0.22);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(28px);
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.98), rgba(245, 158, 11, 0.92));
    box-shadow: 0 8px 18px rgba(217, 119, 6, 0.22);
}

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

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid rgba(255, 255, 255, 0.88);
    color: var(--text-main);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.legend-mark {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    flex: 0 0 12px;
}

.legend-mark.open {
    background: #f8fbff;
    border: 1px solid #d7e4ef;
}

.legend-mark.sale {
    background: linear-gradient(135deg, rgba(47, 107, 255, 0.98), rgba(102, 166, 255, 0.92));
    box-shadow: 0 0 12px rgba(47, 107, 255, 0.24);
}

.legend-mark.locked {
    background: #243144;
}

.legend-mark.premium {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.98), rgba(245, 158, 11, 0.92));
    box-shadow: 0 0 12px rgba(217, 119, 6, 0.2);
}

#legendHeat {
    display: none;
}

body.heatmap-mode #legendMatrix {
    display: none;
}

body.heatmap-mode #legendHeat {
    display: block;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 12px;
}

.heat-label {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.heat-label.cold {
    color: var(--accent);
}

.heat-label.peak {
    color: var(--gold);
}

.heat-bar {
    width: 180px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, #d7e6ff 0%, #60a5fa 45%, #d97706 100%);
}

.heat-owned {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-soft);
    font-size: 0.85rem;
    font-weight: 700;
}

.owned-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #111827;
}

.sector-nav {
    position: sticky;
    top: 88px;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
    padding: 12px 0;
}

.sector-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.92);
    color: var(--text-soft);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 20px rgba(148, 163, 184, 0.08);
    transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.sector-pill:hover,
.sector-pill.active {
    color: var(--accent);
    border-color: rgba(47, 107, 255, 0.28);
    box-shadow: 0 14px 28px rgba(47, 107, 255, 0.12);
    transform: translateY(-1px);
}

.matrix-sector + .matrix-sector {
    margin-top: 34px;
}

.sector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 0 6px;
}

.sector-range {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(47, 107, 255, 0.08);
    border: 1px solid rgba(47, 107, 255, 0.12);
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sector-title {
    flex: 1;
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
}

.sector-peak {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-soft);
    font-size: 0.84rem;
    font-weight: 700;
}

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

.hour-card {
    border-radius: 28px;
    padding: 18px;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.hour-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 28px 44px rgba(148, 163, 184, 0.18);
}

.hour-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.hour-head-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hour-n {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.08rem;
    font-weight: 900;
    color: var(--text-main);
}

.hour-sub {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(217, 119, 6, 0.08);
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.hour-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hour-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(241, 245, 249, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.9);
    color: var(--text-soft);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.heat-stat {
    display: none;
}

body.heatmap-mode .matrix-stat {
    display: none;
}

body.heatmap-mode .heat-stat {
    display: inline-flex;
    color: var(--accent);
}

.minute-matrix {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 7px;
}

.cell-m {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.88);
    margin: 0;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
    position: relative;
    background: #f8fbff;
}

.cell-m:hover {
    transform: scale(1.18);
    z-index: 5;
    border-color: rgba(255, 255, 255, 1);
}

.st-system {
    background: #f8fbff;
    box-shadow: inset 0 0 0 1px rgba(215, 228, 239, 0.6);
}

.st-sale {
    background: linear-gradient(135deg, rgba(47, 107, 255, 0.98), rgba(102, 166, 255, 0.92));
    box-shadow: 0 0 14px rgba(47, 107, 255, 0.24);
}

.st-locked {
    background: #243144;
}

.st-premium {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.98), rgba(245, 158, 11, 0.92));
    box-shadow: 0 0 14px rgba(217, 119, 6, 0.2);
}

body.heatmap-mode .cell-m {
    background: rgba(221, 229, 240, 0.48) !important;
    border-color: rgba(203, 213, 225, 0.64) !important;
    box-shadow: none !important;
}

body.heatmap-mode .cell-m[data-heat="active"] {
    background: var(--heat-bg) !important;
    border-color: var(--heat-bg) !important;
    box-shadow: 0 0 16px color-mix(in srgb, var(--heat-bg) 38%, white) !important;
}

body.heatmap-mode .cell-m[data-owned="1"]::after {
    content: "";
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #111827;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.grid-overlay {
    position: fixed;
    inset: 0;
    background: rgba(232, 239, 245, 0.52);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.24s ease, visibility 0.24s ease;
    z-index: 9998;
}

.grid-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.grid-sheet {
    position: fixed;
    left: 50%;
    top: 50%;
    width: min(560px, calc(100vw - 28px));
    padding: 26px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 28px 60px rgba(148, 163, 184, 0.24);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    transform: translate(-50%, calc(-50% + 28px));
    opacity: 0;
    visibility: hidden;
    transition: transform 0.24s ease, opacity 0.24s ease, visibility 0.24s ease;
    z-index: 9999;
}

.grid-sheet.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
}

.grid-sheet-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 14px;
    background: rgba(241, 245, 249, 0.96);
    color: var(--text-soft);
    cursor: pointer;
}

.grid-sheet-kicker {
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.grid-sheet-time {
    margin-top: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2.4rem, 5vw, 3.4rem);
    font-weight: 900;
    color: var(--text-main);
}

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

.grid-sheet-stats-secondary {
    margin-top: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-sheet-box {
    padding: 16px;
    border-radius: 20px;
    background: rgba(248, 250, 252, 0.98);
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.grid-sheet-box.compact {
    padding: 14px;
}

.grid-sheet-label {
    color: var(--text-soft);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.grid-sheet-value {
    margin-top: 8px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
    word-break: break-word;
}

.grid-sheet-value.price {
    color: var(--gold);
}

.grid-sheet-value.hot {
    color: var(--gold);
}

.grid-sheet-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    margin-top: 18px;
    padding: 0 16px;
    border-radius: 999px;
    background: rgba(241, 245, 249, 0.96);
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.grid-sheet-status.is-system {
    color: var(--accent);
    background: rgba(47, 107, 255, 0.08);
}

.grid-sheet-status.is-sale {
    color: var(--accent);
    background: rgba(47, 107, 255, 0.08);
}

.grid-sheet-status.is-premium {
    color: var(--gold);
    background: rgba(217, 119, 6, 0.1);
}

.grid-sheet-status.is-locked {
    color: #334155;
    background: rgba(36, 49, 68, 0.08);
}

.grid-sheet-copy-card {
    margin-top: 16px;
    padding: 16px 18px;
    border-radius: 20px;
    background: rgba(248, 250, 252, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.92);
}

.grid-sheet-copy-title {
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.grid-sheet-copy {
    margin: 8px 0 0;
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.6;
}

.grid-sheet-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 54px;
    margin-top: 16px;
    border-radius: 18px;
    color: #fff;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    box-shadow: 0 16px 28px rgba(47, 107, 255, 0.18);
}

.grid-sheet-action.is-system,
.grid-sheet-action.is-sale {
    background: linear-gradient(135deg, rgba(47, 107, 255, 0.98), rgba(102, 166, 255, 0.92));
}

.grid-sheet-action.is-premium {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.98), rgba(245, 158, 11, 0.92));
    box-shadow: 0 16px 28px rgba(217, 119, 6, 0.18);
}

.grid-sheet-action.is-locked {
    background: #243144;
    box-shadow: 0 16px 28px rgba(36, 49, 68, 0.16);
}

@media (max-width: 1280px) {
    .hours-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .grid-stats-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    body.grid-page {
        padding-top: 100px;
    }

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

    .sector-header {
        flex-wrap: wrap;
        align-items: flex-start;
    }

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

@media (max-width: 640px) {
    .container.grid-shell {
        padding: 0 14px;
    }

    .grid-hero {
        padding: 18px;
        border-radius: 26px;
    }

    .grid-title {
        letter-spacing: 0.04em;
    }

    .grid-stats-row,
    .legend-list,
    .grid-sheet-stats {
        grid-template-columns: 1fr;
    }

    .grid-sheet-stats-secondary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sector-nav {
        top: 74px;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }

    .sector-pill {
        flex: 0 0 auto;
    }

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

    .hour-card {
        padding: 14px;
        border-radius: 24px;
    }

    .minute-matrix {
        gap: 5px;
    }

    .cell-m {
        border-radius: 8px;
    }

    .grid-sheet {
        left: 8px;
        right: 8px;
        top: auto;
        bottom: 72px;
        width: calc(100% - 16px);
        max-width: none;
        max-height: calc(100dvh - 96px);
        overflow-y: auto;
        border-radius: 24px;
        transform: translateY(calc(100% + 16px));
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

    .grid-sheet.visible {
        transform: translateY(0);
    }

    .grid-sheet-close {
        top: 12px;
        right: 12px;
    }
}

/* ==========================================================================
   GRID EXECUTIVE WOW PASS
   Premium command-center / flagship authority alignment
   ========================================================================== */

:root {
    --grid-premium-shadow: 0 30px 70px rgba(15, 23, 42, 0.10), 0 10px 24px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255,255,255,0.92), inset 0 0 0 1px rgba(15, 23, 42, 0.04);
    --grid-premium-shadow-hover: 0 38px 88px rgba(15, 23, 42, 0.14), 0 16px 34px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255,255,255,0.96), inset 0 0 0 1px rgba(15, 23, 42, 0.05);
    --grid-copy: #475569;
    --grid-copy-strong: #334155;
    --grid-focus-ring: 0 0 0 3px rgba(96, 165, 250, 0.22);
}

body.grid-page {
    background:
        radial-gradient(circle at 50% -8%, rgba(96, 165, 250, 0.12), rgba(96, 165, 250, 0) 28%),
        radial-gradient(circle at 100% 100%, rgba(217, 119, 6, 0.08), rgba(217, 119, 6, 0) 24%),
        linear-gradient(180deg, #f8fbfd 0%, #eef4f7 44%, #ffffff 100%) !important;
    line-height: 1.65;
}

.container.grid-shell {
    max-width: 1500px;
    padding: 0 20px;
}

.glass-panel {
    background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.74)) !important;
    border: 1px solid rgba(255, 255, 255, 0.94) !important;
    box-shadow: var(--grid-premium-shadow) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.grid-hero {
    position: relative;
    gap: 24px;
    padding: 40px;
    border-radius: 38px;
    margin-bottom: 24px;
    background:
        radial-gradient(circle at 50% 0%, rgba(96, 165, 250, 0.14), rgba(96, 165, 250, 0) 42%),
        linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.80)) !important;
    box-shadow: var(--grid-premium-shadow-hover) !important;
}

.grid-hero::before {
    content: "";
    position: absolute;
    left: 34px;
    right: 34px;
    top: 0;
    height: 2px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(96,165,250,0.40), rgba(255,255,255,0));
    pointer-events: none;
}

.grid-kicker,
.hero-stat-label,
.toggle-label,
.grid-sheet-kicker,
.grid-sheet-label,
.sector-range,
.hour-pill,
.hour-sub,
body.grid-page .grid-insights-kicker,
body.grid-page .grid-insight-eyebrow {
    letter-spacing: 0.12em;
}

.grid-kicker {
    min-height: 42px;
    padding: 0 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.88));
    border-color: rgba(96, 165, 250, 0.22);
    box-shadow: 0 14px 30px rgba(96, 165, 250, 0.12);
}

.grid-title {
    max-width: 12ch;
    letter-spacing: 0.04em;
    line-height: 0.98;
    text-shadow: 0 1px 0 rgba(255,255,255,0.92);
}

.grid-stats-row {
    gap: 18px;
    margin-top: 30px;
}

.hero-stat-card {
    padding: 20px 20px 18px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.88));
    border: 1px solid rgba(255,255,255,0.92);
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.08);
}

.hero-stat-value {
    text-shadow: 0 1px 0 rgba(255,255,255,0.92);
}

.grid-hero-side {
    gap: 18px;
}

.toggle-card,
.legend-card {
    border-radius: 26px;
    padding: 20px 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(248,250,252,0.84));
}

.toggle-copy {
    min-height: 72px;
}

.toggle-slider {
    background: linear-gradient(180deg, rgba(248,250,252,0.98), rgba(241,245,249,0.90));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.84);
}

.legend-list {
    gap: 14px;
}

.legend-item {
    min-height: 46px;
    padding: 0 15px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.90));
    border-color: rgba(226, 232, 240, 0.96);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
}

.sector-nav {
    top: 92px;
    z-index: 35;
    gap: 12px;
    margin-bottom: 30px;
    padding: 14px;
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(248,250,252,0.84));
    border: 1px solid rgba(255,255,255,0.92);
    box-shadow: 0 20px 36px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sector-pill {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.90));
    border-color: rgba(226, 232, 240, 0.96);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
    backdrop-filter: none;
}

.sector-pill:hover,
.sector-pill.active {
    color: #1d4ed8;
    border-color: rgba(96, 165, 250, 0.28);
    box-shadow: 0 14px 26px rgba(59, 130, 246, 0.10);
    transform: translateY(-2px);
}

.matrix-sector + .matrix-sector {
    margin-top: 38px;
}

.sector-header {
    margin-bottom: 18px;
    padding: 0 4px;
}

.sector-range {
    min-height: 38px;
    padding: 0 14px;
    background: linear-gradient(180deg, rgba(239,246,255,0.98), rgba(219,234,254,0.88));
    border-color: rgba(96, 165, 250, 0.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.84);
}

.sector-title {
    font-size: 1.42rem;
    line-height: 1.16;
    letter-spacing: 0.02em;
}

.sector-peak {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.90));
    border: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
}

.hours-grid {
    gap: 20px;
}

.hour-card {
    border-radius: 30px;
    padding: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(248,250,252,0.84));
}

.hour-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--grid-premium-shadow-hover) !important;
}

.hour-head {
    margin-bottom: 18px;
}

.hour-n {
    letter-spacing: 0.03em;
}

.hour-sub,
.hour-pill {
    min-height: 32px;
    padding: 0 11px;
}

.hour-sub {
    background: linear-gradient(180deg, rgba(255,248,240,0.98), rgba(254,243,199,0.88));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.84);
}

.hour-pill {
    background: linear-gradient(180deg, rgba(248,250,252,0.98), rgba(241,245,249,0.90));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.84);
}

.minute-matrix {
    gap: 8px;
}

.cell-m {
    border-radius: 12px;
    border-color: rgba(255, 255, 255, 0.96);
    box-shadow: inset 0 0 0 1px rgba(215, 228, 239, 0.18);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.cell-m:hover {
    transform: scale(1.12);
    border-color: rgba(255, 255, 255, 1);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.10);
}

.cell-m:focus-visible {
    outline: none;
    z-index: 7;
    border-color: rgba(59, 130, 246, 0.46) !important;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.92), var(--grid-focus-ring), 0 14px 26px rgba(15, 23, 42, 0.10) !important;
}

.st-system {
    box-shadow: inset 0 0 0 1px rgba(215, 228, 239, 0.70);
}

.st-sale {
    box-shadow: 0 0 16px rgba(47, 107, 255, 0.24);
}

.st-premium {
    box-shadow: 0 0 16px rgba(217, 119, 6, 0.22);
}

.grid-overlay {
    background: rgba(15, 23, 42, 0.34);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.grid-sheet {
    width: min(580px, calc(100vw - 28px));
    padding: 30px;
    border-radius: 32px;
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.90));
    border-color: rgba(255,255,255,0.94);
    box-shadow: var(--grid-premium-shadow-hover);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.grid-sheet::before {
    content: "";
    position: absolute;
    left: 28px;
    right: 28px;
    top: 0;
    height: 2px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(96,165,250,0.42), rgba(255,255,255,0));
    pointer-events: none;
}

.grid-sheet-close {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.92));
    border: 1px solid rgba(226, 232, 240, 0.96);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
}

.grid-sheet-time {
    line-height: 1;
    letter-spacing: 0.03em;
    text-shadow: 0 1px 0 rgba(255,255,255,0.92);
}

.grid-sheet-stats {
    gap: 14px;
    margin-top: 22px;
}

.grid-sheet-box {
    padding: 17px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.90));
    border-color: rgba(226, 232, 240, 0.92);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.84), 0 10px 20px rgba(15, 23, 42, 0.04);
}

.grid-sheet-value.owner-link {
    text-decoration: none;
}

.grid-sheet-action {
    min-height: 48px;
    border-radius: 16px;
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.20);
}

.grid-sheet-action:focus-visible,
.grid-sheet-close:focus-visible,
.toggle-switch input:focus-visible + .toggle-slider,
.sector-pill:focus-visible {
    outline: none;
    border-color: rgba(59, 130, 246, 0.42) !important;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.92), var(--grid-focus-ring), 0 18px 34px rgba(15, 23, 42, 0.10) !important;
}

/* Grid insights overrides (higher specificity than inline styles in grid.php) */
body.grid-page .grid-insights {
    margin: 20px 0 28px;
    padding: 24px 26px;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.94);
    background: linear-gradient(180deg, rgba(255,255,255,0.90), rgba(248,250,252,0.82)) !important;
    box-shadow: var(--grid-premium-shadow) !important;
}

body.grid-page .grid-insights-top {
    margin-bottom: 20px;
    gap: 18px;
}

body.grid-page .grid-insights-copy h2 {
    font-size: 1.34rem;
    line-height: 1.16;
    letter-spacing: 0.03em;
    text-wrap: balance;
}

body.grid-page .grid-insights-copy p,
body.grid-page .sector-copy,
body.grid-page .grid-cluster-meta {
    color: var(--grid-copy);
    text-transform: none;
    letter-spacing: 0.01em;
    line-height: 1.68;
}

body.grid-page .grid-insights-actions,
body.grid-page .sector-links,
body.grid-page .grid-cluster-links {
    gap: 10px;
}

body.grid-page .grid-insights-action,
body.grid-page .grid-insight-link,
body.grid-page .grid-owner-link,
body.grid-page .sector-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    text-decoration: none;
    color: #334155;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.92));
    border: 1px solid rgba(226, 232, 240, 0.94);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
}
body.grid-page a.grid-insights-action:link,
body.grid-page a.grid-insights-action:visited,
body.grid-page a.grid-insights-action:hover,
body.grid-page a.grid-insights-action:active{
    color:#334155 !important;
    text-decoration:none !important;
    -webkit-text-decoration:none !important;
}
body.grid-page .grid-insights-action:hover,
body.grid-page .grid-insight-link:hover,
body.grid-page .grid-owner-link:hover,
body.grid-page .sector-link:hover,
body.grid-page .grid-minute-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.07);
}

body.grid-page .grid-insights-grid {
    gap: 16px;
}

body.grid-page .grid-insight-card {
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.88));
    border: 1px solid rgba(226, 232, 240, 0.94);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.05);
}

body.grid-page .grid-insight-head {
    margin-bottom: 14px;
}

body.grid-page .grid-insight-head h3 {
    font-size: 1.02rem;
    line-height: 1.24;
}

body.grid-page .grid-cluster-link {
    padding: 11px 12px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.90));
    border: 1px solid rgba(226, 232, 240, 0.94);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.84);
}

body.grid-page .grid-minute-link {
    min-width: 62px;
    border-radius: 12px;
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.12);
}

@media (max-width: 1280px) {
    .grid-stats-row {
        gap: 16px;
    }
}

@media (max-width: 980px) {
    body.grid-page {
        padding-top: 104px;
    }

    .grid-hero {
        padding: 28px;
    }

    .sector-nav {
        top: 86px;
    }
}

@media (max-width: 640px) {
    .container.grid-shell {
        padding: 0 14px;
    }

    .grid-hero,
    .sector-nav,
    body.grid-page .grid-insights,
    .hour-card {
        border-radius: 24px;
    }

    .grid-hero {
        padding: 22px 18px;
    }

    .grid-title {
        letter-spacing: 0.03em;
    }

    .sector-nav {
        padding: 10px;
    }

    .minute-matrix {
        gap: 6px;
    }

    .cell-m {
        border-radius: 9px;
    }

    .grid-sheet {
        width: 100%;
        padding: 24px 18px 20px;
        border-radius: 26px 26px 0 0;
    }

    body.grid-page .grid-insights {
        padding: 20px 18px;
    }
}

/* ==========================================================================
   GRID FINAL QUIET POLISH PASS
   Conservative premium refinement
   ========================================================================== */

body.grid-page{
    padding: 122px 0 96px;
}

.container.grid-shell{
    max-width: 1500px;
    padding: 0 20px;
}

.grid-hero{
    gap: 24px;
    padding: 34px;
    border-radius: 38px;
    margin-bottom: 22px;
}

.grid-hero.glass-panel,
.hour-card.glass-panel,
.grid-sheet.glass-panel,
.grid-insights{
    border-color: rgba(255,255,255,.92);
    box-shadow: 0 24px 56px rgba(15,23,42,.08);
}

.grid-kicker{
    min-height: 40px;
    padding: 0 17px;
}

.grid-hero h1{
    letter-spacing: .015em;
}

.grid-hero-copy p,
.grid-sheet-sub{
    max-width: 60ch;
    line-height: 1.72;
}

.hero-stats{
    gap: 14px;
}

.hero-stat{
    border-radius: 24px;
    padding: 20px 18px;
    box-shadow: 0 12px 28px rgba(15,23,42,.05);
}

.toggle-wrap{
    gap: 12px;
}

.legend-list{
    gap: 10px;
}

.legend-item{
    min-height: 42px;
    border-radius: 15px;
}

.sector-nav{
    top: 92px;
    gap: 10px;
    margin-bottom: 26px;
    padding: 10px 0;
}

.sector-pill{
    min-height: 42px;
    padding: 0 16px;
    border-radius: 15px;
    box-shadow: 0 8px 18px rgba(148,163,184,.08);
}

.matrix-sector + .matrix-sector{
    margin-top: 30px;
}

.sector-header{
    margin-bottom: 14px;
}

.sector-title{
    letter-spacing: .01em;
}

.sector-copy{
    max-width: 72ch;
    line-height: 1.62;
}

.hour-card{
    padding: 18px;
    border-radius: 26px;
}

.hour-head{
    margin-bottom: 14px;
}

.hour-pill{
    min-height: 32px;
    padding: 0 11px;
    border-radius: 999px;
}

.minute-matrix{
    gap: 6px;
}

.cell-m{
    border-radius: 11px;
    transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.cell-m:hover{
    transform: scale(1.12);
}

.grid-sheet{
    border-radius: 28px;
    box-shadow: 0 26px 64px rgba(15,23,42,.10);
}

.grid-sheet-top{
    margin-bottom: 18px;
}

.grid-sheet-value.owner-link{
    border-radius: 999px;
}

.grid-insights{
    margin: 22px 0 28px;
    border-radius: 30px;
}

.grid-insights-top{
    margin-bottom: 20px;
}

.grid-insights-copy h2{
    letter-spacing: .01em;
}

.grid-insights-copy p{
    max-width: 66ch;
    line-height: 1.66;
}

.grid-insights-action{
    min-height: 42px;
    padding: 0 14px;
    box-shadow: 0 8px 18px rgba(15,23,42,.04);
}

.grid-insights-grid{
    gap: 16px;
}

.grid-insight-card{
    padding: 18px;
    border-radius: 20px;
    box-shadow: 0 10px 24px rgba(15,23,42,.03);
}

.grid-insight-link,
.grid-owner-link,
.sector-link{
    min-height: 34px;
}

.grid-cluster-link{
    border-radius: 16px;
    padding: 11px 12px;
}

.grid-minute-link{
    min-height: 38px;
    border-radius: 12px;
}

@media (max-width: 980px){
    .grid-hero{
        padding: 24px;
        border-radius: 28px;
    }

    .hour-card{
        padding: 16px;
    }

    .grid-insights{
        border-radius: 24px;
    }
}

@media (max-width: 720px){
    body.grid-page{
        padding: 112px 0 86px;
    }

    .container.grid-shell{
        padding: 0 14px;
    }

    .grid-hero{
        padding: 20px 16px;
        gap: 18px;
    }

    .sector-nav{
        top: 84px;
    }

    .hour-card{
        border-radius: 22px;
    }

    .grid-insights{
        margin: 18px 0 24px;
        border-radius: 22px;
    }

    .grid-insight-card{
        padding: 16px;
    }
}
/* ==========================================================================
   grid.php — flagship matrix refinement pass 1
   Hero / sector nav / hour cards / sheet / insights polish
   ========================================================================== */

body.grid-page{
    padding:124px 0 98px;
}

.container.grid-shell{
    max-width:1520px;
    padding:0 20px;
}

.grid-hero{
    gap:28px;
    padding:42px;
    border-radius:40px;
    margin-bottom:24px;
}

.grid-title{
    max-width:11.5ch;
    margin:18px 0 0;
    line-height:.96;
    letter-spacing:.035em;
}

.grid-hero-copy p{
    max-width:62ch;
    margin-top:16px;
    color:var(--grid-copy-strong, #334155);
    font-size:1.02rem;
    line-height:1.76;
}

.grid-stats-row{
    gap:18px;
    margin-top:28px;
}

.hero-stat-card{
    min-height:118px;
    padding:20px 20px 18px;
    border-radius:24px;
}

.hero-stat-label{
    font-size:.72rem;
    letter-spacing:.13em;
}

.hero-stat-value{
    margin-top:10px;
    line-height:1.06;
}

.grid-hero-side{
    gap:18px;
    align-content:start;
}

.toggle-card,
.legend-card{
    border-radius:26px;
    padding:20px 22px;
}

.toggle-copy{
    min-height:74px;
}

.legend-list{
    gap:12px;
}

.legend-item{
    min-height:46px;
    padding:0 14px;
    border-radius:16px;
}

.sector-nav{
    top:92px;
    z-index:36;
    gap:12px;
    margin-bottom:30px;
    padding:14px;
    border-radius:26px;
    background:linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.84));
    border:1px solid rgba(255,255,255,.92);
    box-shadow:0 20px 36px rgba(15,23,42,.08);
}

.sector-pill{
    min-height:46px;
    padding:0 18px;
    border-radius:16px;
    font-size:.82rem;
    letter-spacing:.08em;
}

.matrix-sector + .matrix-sector{
    margin-top:38px;
}

.sector-header{
    margin-bottom:18px;
    padding:0 4px;
}

.sector-range{
    min-height:38px;
    padding:0 14px;
}

.sector-title{
    font-size:1.42rem;
    line-height:1.16;
    letter-spacing:.015em;
}

.sector-peak{
    min-height:36px;
    padding:0 12px;
    border-radius:999px;
    background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.90));
    border:1px solid rgba(226,232,240,.92);
    box-shadow:0 10px 20px rgba(15,23,42,.04);
}

.sector-copy{
    margin:8px 0 0;
    max-width:72ch;
    color:var(--grid-copy, #475569);
    line-height:1.66;
    font-size:.94rem;
}

.sector-links{
    gap:10px;
    margin-top:12px;
}

.hours-grid{
    gap:20px;
}

.hour-card{
    min-height:100%;
    padding:20px;
    border-radius:30px;
}

.hour-head{
    margin-bottom:18px;
}

.hour-head-main{
    min-width:0;
}

.hour-n{
    letter-spacing:.03em;
}

.hour-sub,
.hour-pill{
    min-height:32px;
    padding:0 11px;
}

.hour-meta{
    flex-wrap:wrap;
    justify-content:flex-end;
}

.minute-matrix{
    gap:8px;
}

.cell-m{
    border-radius:10px;
    transition:transform .14s ease, border-color .14s ease, box-shadow .14s ease, opacity .14s ease;
}

.cell-m:hover{
    transform:scale(1.12);
}

.grid-sheet{
    width:min(580px, calc(100vw - 28px));
    padding:30px;
    border-radius:32px;
}

.grid-sheet::before{
    content:"";
    position:absolute;
    left:28px;
    right:28px;
    top:0;
    height:2px;
    border-radius:0 0 999px 999px;
    background:linear-gradient(90deg, rgba(255,255,255,0), rgba(96,165,250,.42), rgba(255,255,255,0));
    pointer-events:none;
}

.grid-sheet-top{
    margin-bottom:18px;
}

.grid-sheet-close{
    width:44px;
    height:44px;
    border-radius:14px;
}

.grid-sheet-time{
    line-height:1;
    letter-spacing:.03em;
}

.grid-sheet-sub{
    max-width:60ch;
    line-height:1.72;
}

.grid-sheet-stats{
    gap:14px;
    margin-top:22px;
}

.grid-sheet-box{
    padding:17px;
    border-radius:20px;
}

.grid-sheet-action{
    min-height:50px;
    border-radius:16px;
}

body.grid-page .grid-insights{
    margin:20px 0 28px;
    padding:24px 26px;
    border-radius:30px;
}

body.grid-page .grid-insights-top{
    margin-bottom:20px;
    gap:18px;
}

body.grid-page .grid-insights-copy h2{
    font-size:1.34rem;
    line-height:1.16;
    letter-spacing:.02em;
    text-wrap:balance;
}

body.grid-page .grid-insights-copy p{
    max-width:68ch;
    line-height:1.68;
}

body.grid-page .grid-insights-actions,
body.grid-page .sector-links,
body.grid-page .grid-cluster-links{
    gap:10px;
}

body.grid-page .grid-insights-action,
body.grid-page .grid-insight-link,
body.grid-page .grid-owner-link,
body.grid-page .sector-link{
    min-height:40px;
    padding:0 14px;
    border-radius:999px;
}

body.grid-page .grid-insights-grid{
    gap:16px;
}

body.grid-page .grid-insight-card{
    padding:18px;
    border-radius:22px;
}

body.grid-page .grid-insight-head{
    margin-bottom:14px;
}

body.grid-page .grid-insight-head h3{
    font-size:1.02rem;
    line-height:1.24;
}

body.grid-page .grid-cluster-link{
    padding:11px 12px;
    border-radius:16px;
}

body.grid-page .grid-minute-link{
    min-width:62px;
    min-height:40px;
    border-radius:12px;
}

@media (max-width:1180px){
    .grid-stats-row{
        gap:16px;
    }
}

@media (max-width:980px){
    body.grid-page{
        padding-top:104px;
    }

    .grid-hero{
        padding:28px;
        border-radius:30px;
    }

    .sector-nav{
        top:86px;
    }
}

@media (max-width:640px){
    .container.grid-shell{
        padding:0 14px;
    }

    .grid-hero,
    .sector-nav,
    body.grid-page .grid-insights,
    .hour-card{
        border-radius:24px;
    }

    .grid-hero{
        padding:22px 18px;
    }

    .grid-title{
        letter-spacing:.03em;
    }

    .sector-nav{
        padding:10px;
    }

    .minute-matrix{
        gap:6px;
    }

    .cell-m{
        border-radius:9px;
    }

    .grid-sheet{
        width:100%;
        padding:24px 18px 20px;
        border-radius:26px 26px 0 0;
    }

    body.grid-page .grid-insights{
        padding:20px 18px;
    }
}
/* ==========================================================================
   grid.php — matrix interaction refinement pass 2
   Heatmap / toggle / cell polish only
   ========================================================================== */

.toggle-card{
    position:relative;
    overflow:hidden;
}

.toggle-card::before{
    content:"";
    position:absolute;
    left:22px;
    right:22px;
    top:0;
    height:2px;
    border-radius:0 0 999px 999px;
    background:linear-gradient(90deg, rgba(255,255,255,0), rgba(96,165,250,.34), rgba(255,255,255,0));
    pointer-events:none;
}

.toggle-copy{
    min-height:76px;
    gap:16px;
}

.toggle-label{
    min-width:76px;
    text-align:center;
    font-size:.8rem;
}

.toggle-slider{
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.84),
        0 10px 20px rgba(15,23,42,.05);
}

.toggle-switch input:focus-visible + .toggle-slider{
    outline:none;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.84),
        0 10px 20px rgba(15,23,42,.05),
        var(--grid-focus-ring, 0 0 0 3px rgba(96,165,250,.22));
}

.minute-matrix{
    position:relative;
    gap:8px;
}

.minute-matrix::before{
    content:"";
    position:absolute;
    inset:-6px;
    border-radius:18px;
    background:linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0));
    pointer-events:none;
    opacity:.55;
}

.cell-m{
    position:relative;
    border-radius:10px;
    border:1px solid rgba(255,255,255,.92);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.50),
        0 4px 10px rgba(148,163,184,.08);
    transform-origin:center;
    isolation:isolate;
}

.cell-m::before{
    content:"";
    position:absolute;
    inset:0;
    border-radius:inherit;
    background:linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0));
    opacity:.7;
    pointer-events:none;
}

.cell-m:hover{
    transform:scale(1.12);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.64),
        0 10px 18px rgba(15,23,42,.14);
}

.cell-m:focus-visible{
    outline:none;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.64),
        0 10px 18px rgba(15,23,42,.14),
        var(--grid-focus-ring, 0 0 0 3px rgba(96,165,250,.22));
    z-index:6;
}

.st-system{
    background:linear-gradient(180deg, #fbfdff, #f0f6fb);
    box-shadow:
        inset 0 0 0 1px rgba(215,228,239,.68),
        0 4px 10px rgba(148,163,184,.08);
}

.st-sale{
    box-shadow:
        0 0 16px rgba(47,107,255,.22),
        0 8px 14px rgba(47,107,255,.12);
}

.st-premium{
    box-shadow:
        0 0 16px rgba(217,119,6,.18),
        0 8px 14px rgba(217,119,6,.10);
}

.st-locked{
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.06),
        0 6px 12px rgba(36,49,68,.16);
}

body.heatmap-mode .minute-matrix::before{
    opacity:.38;
}

body.heatmap-mode .cell-m{
    border-color:rgba(203,213,225,.70) !important;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.34),
        0 4px 10px rgba(148,163,184,.06) !important;
}

body.heatmap-mode .cell-m[data-heat="active"]{
    box-shadow:
        0 0 18px color-mix(in srgb, var(--heat-bg) 34%, white),
        0 8px 16px rgba(15,23,42,.10) !important;
}

body.heatmap-mode .cell-m[data-owned="1"]::after{
    top:5px;
    right:5px;
    width:8px;
    height:8px;
    box-shadow:0 0 0 2px rgba(255,255,255,.64);
}

.hour-card .minute-matrix + .grid-cluster-links{
    margin-top:14px;
}

.grid-cluster-links{
    gap:10px;
}

.grid-cluster-link{
    min-height:40px;
    padding:11px 12px;
    border-radius:15px;
    box-shadow:0 10px 18px rgba(15,23,42,.04);
}

@media (max-width:640px){
    .toggle-copy{
        min-height:72px;
        gap:12px;
    }

    .toggle-label{
        min-width:64px;
        font-size:.76rem;
    }

    .minute-matrix{
        gap:6px;
    }

    .minute-matrix::before{
        inset:-4px;
        border-radius:14px;
    }

    .cell-m{
        border-radius:9px;
    }
}

/* ==========================================================================
   grid.php — final normalization cleanup
   Keeps latest grid passes stable after insights extract removal
   ========================================================================== */

body.grid-page .grid-insights-top{
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    gap:18px;
    flex-wrap:wrap;
}

body.grid-page .grid-insights-kicker{
    display:inline-block;
    margin-bottom:8px;
}

body.grid-page .grid-insights-actions{
    display:flex;
    flex-wrap:wrap;
}

body.grid-page .grid-insights-grid{
    display:grid;
    grid-template-columns:repeat(3, minmax(0, 1fr));
}

body.grid-page .grid-insight-link,
body.grid-page .grid-owner-link,
body.grid-page .sector-link,
body.grid-page .grid-minute-link{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    text-decoration:none;
}

body.grid-page .grid-cluster-links{
    display:grid;
}

body.grid-page .grid-cluster-link{
    display:grid;
    grid-template-columns:auto minmax(0, 1fr) auto;
    align-items:center;
    gap:10px;
}

body.grid-page .grid-cluster-main,
body.grid-page .hour-head-main,
body.grid-page .hour-meta,
body.grid-page .grid-sheet-stats > *,
body.grid-page .grid-sheet-stats-secondary > *{
    min-width:0;
}

body.grid-page .grid-sheet-value.owner-link.is-disabled{
    pointer-events:none;
    opacity:.78;
}

@media (max-width:1180px){
    body.grid-page .grid-insights-grid{
        grid-template-columns:1fr;
    }
}

@media (max-width:720px){
    body.grid-page .grid-insights-top{
        align-items:flex-start;
    }

    body.grid-page .grid-cluster-link{
        grid-template-columns:auto 1fr;
    }

    body.grid-page .grid-cluster-link .grid-owner-link{
        grid-column:2;
    }
}
/* ==========================================================================
   grid.php — discovery actions + mobile sheet offset hotfix
   Fixes unstyled discovery links and lifts sheet above bottom consent bar
   ========================================================================== */

body.grid-page .grid-insights-actions{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    align-items:center;
}

body.grid-page .grid-insights-action{
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    min-height:40px !important;
    padding:0 14px !important;
    border-radius:999px !important;
    text-decoration:none !important;
    color:var(--text-main) !important;
    background:linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.92)) !important;
    border:1px solid rgba(226,232,240,.94) !important;
    box-shadow:0 10px 20px rgba(15,23,42,.04) !important;
    font-size:.84rem;
    font-weight:700;
    line-height:1;
    transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

body.grid-page .grid-insights-action:hover{
    transform:translateY(-2px);
    box-shadow:0 14px 26px rgba(15,23,42,.07) !important;
    border-color:rgba(96,165,250,.26) !important;
}

@media (max-width:640px){
    .grid-sheet{
        left:8px !important;
        right:8px !important;
        width:calc(100% - 16px) !important;
        bottom:72px !important;
        max-height:calc(100dvh - 96px) !important;
        overflow-y:auto !important;
        padding-bottom:calc(20px + env(safe-area-inset-bottom, 0px)) !important;
        border-radius:24px !important;
    }

    .grid-sheet.visible{
        transform:translateY(0) !important;
    }

    .grid-sheet:not(.visible){
        transform:translateY(calc(100% + 16px)) !important;
    }
}
/* ==========================================================================
   grid.php — mobile discovery links hard override
   Fixes default blue/purple/underlined anchor states
   ========================================================================== */

body.grid-page .grid-insights-actions{
    display:flex !important;
    flex-wrap:wrap !important;
    gap:10px !important;
    align-items:center !important;
}

body.grid-page a.grid-insights-action,
body.grid-page a.grid-insights-action:link,
body.grid-page a.grid-insights-action:visited,
body.grid-page a.grid-insights-action:hover,
body.grid-page a.grid-insights-action:active{
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    min-height:40px !important;
    padding:0 14px !important;
    border-radius:999px !important;
    text-decoration:none !important;
    -webkit-text-decoration:none !important;
    color:#334155 !important;
    background:linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.92)) !important;
    border:1px solid rgba(226,232,240,.94) !important;
    box-shadow:0 10px 20px rgba(15,23,42,.04) !important;
    font-size:.84rem !important;
    font-weight:700 !important;
    line-height:1 !important;
}

body.grid-page a.grid-insights-action:hover{
    transform:translateY(-2px) !important;
    color:#1d4ed8 !important;
    border-color:rgba(96,165,250,.26) !important;
    box-shadow:0 14px 26px rgba(15,23,42,.07) !important;
}


/* ==========================================================================
   STEP 7 — BRAND POLISH PASS
   Calm collectible-catalog refinement for grid
   ========================================================================== */
.grid-hero{
    padding:24px;
    border-radius:30px;
}

.hero-stat-card,
.toggle-card,
.legend-card{
    border:1px solid rgba(255,255,255,.88);
    box-shadow:0 16px 30px rgba(148,163,184,.12);
}

.hero-stat-card{
    border-radius:22px;
    padding:16px 16px 14px;
}

.grid-stats-row{
    gap:14px;
}

.toggle-card,
.legend-card{
    border-radius:22px;
}

.sector-nav{
    gap:10px;
    margin-bottom:24px;
    padding:8px 0 2px;
}

.sector-pill{
    min-height:42px;
    padding:0 16px;
    border-radius:14px;
    box-shadow:0 8px 18px rgba(148,163,184,.08);
}

.sector-pill:hover,
.sector-pill.active{
    box-shadow:0 12px 22px rgba(47,107,255,.10);
}

.matrix-sector + .matrix-sector{
    margin-top:28px;
}

.sector-header{
    margin-bottom:14px;
}

.hours-grid{
    gap:16px;
}

.hour-card{
    border-radius:24px;
    padding:16px;
    border:1px solid rgba(255,255,255,.84);
    box-shadow:0 16px 30px rgba(148,163,184,.12);
}

.hour-card:hover{
    transform:translateY(-2px);
    box-shadow:0 22px 34px rgba(148,163,184,.15);
}

.hour-head{
    margin-bottom:14px;
}

.minute-matrix{
    gap:6px;
}

.cell-m{
    border-radius:9px;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.54);
}

.cell-m:hover{
    transform:scale(1.12);
}

.grid-sheet{
    width:min(540px, calc(100vw - 28px));
    padding:24px;
    border-radius:28px;
    border:1px solid rgba(255,255,255,.9);
    box-shadow:0 24px 52px rgba(148,163,184,.22);
}

.grid-sheet-close{
    border-radius:13px;
}

.grid-sheet-stats{
    gap:10px;
}

@media (max-width: 1024px){
    .grid-hero{
        padding:22px;
    }
}

@media (max-width: 640px){
    .grid-hero{
        padding:20px;
        border-radius:26px;
    }

    .hour-card{
        border-radius:22px;
    }

    .grid-sheet{
        padding:22px 20px;
        border-radius:24px;
    }
}


/* ==========================================================================
   GRID QUICK PATHS + STATE GUIDE
   Safe clarity pass aligned with existing FameClock grid styling
   ========================================================================== */

.grid-finder-strip{
    display:grid;
    gap:18px;
    margin:0 0 20px;
    padding:22px 24px;
    border-radius:30px;
}

.grid-finder-copy{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
    gap:12px 18px;
}

.grid-finder-kicker{
    display:inline-flex;
    align-items:center;
    min-height:34px;
    padding:0 14px;
    border-radius:999px;
    background:rgba(255,255,255,0.88);
    border:1px solid rgba(255,255,255,0.94);
    color:var(--accent);
    font-size:.74rem;
    font-weight:800;
    letter-spacing:.12em;
    text-transform:uppercase;
}

.grid-finder-copy p{
    margin:0;
    max-width:760px;
    color:var(--text-soft);
    font-size:.98rem;
    line-height:1.6;
}

.grid-finder-actions{
    display:flex;
    flex-wrap:wrap;
    gap:12px;
}

.grid-finder-chip{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:44px;
    padding:0 16px;
    border-radius:16px;
    text-decoration:none;
    background:rgba(255,255,255,0.86);
    border:1px solid rgba(255,255,255,0.96);
    box-shadow:0 14px 30px rgba(148,163,184,0.12);
    color:var(--text-main);
    font-weight:700;
    transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.grid-finder-chip:hover{
    transform:translateY(-2px);
    box-shadow:0 18px 34px rgba(148,163,184,0.16);
    border-color:rgba(47,107,255,0.24);
}

.grid-state-guide{
    display:grid;
    gap:14px;
}

.grid-state-guide-title{
    color:var(--text-soft);
    font-size:.84rem;
    font-weight:800;
    letter-spacing:.12em;
    text-transform:uppercase;
}

.grid-state-guide-list{
    display:grid;
    grid-template-columns:repeat(4, minmax(0, 1fr));
    gap:14px;
}

.grid-state-guide-card{
    display:flex;
    align-items:flex-start;
    gap:12px;
    padding:16px 16px 15px;
    border-radius:22px;
    background:rgba(255,255,255,0.82);
    border:1px solid rgba(255,255,255,0.94);
    box-shadow:0 14px 28px rgba(148,163,184,0.10);
}

.grid-state-guide-card strong{
    display:block;
    margin:0 0 5px;
    color:var(--text-main);
    font-size:.92rem;
    line-height:1.3;
}

.grid-state-guide-card p{
    margin:0;
    color:var(--text-soft);
    font-size:.85rem;
    line-height:1.5;
}

.grid-state-guide-card .legend-mark{
    margin-top:2px;
    flex:0 0 auto;
}


.grid-curated-strip{
    display:grid;
    gap:18px;
    margin:0 0 20px;
    padding:22px 24px;
    border-radius:30px;
}

.grid-curated-copy{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
    gap:12px 18px;
}

.grid-curated-kicker{
    display:inline-flex;
    align-items:center;
    min-height:34px;
    padding:0 14px;
    border-radius:999px;
    background:rgba(255,255,255,0.88);
    border:1px solid rgba(255,255,255,0.94);
    color:var(--accent);
    font-size:.74rem;
    font-weight:800;
    letter-spacing:.12em;
    text-transform:uppercase;
}

.grid-curated-copy p{
    margin:0;
    max-width:760px;
    color:var(--text-soft);
    font-size:.98rem;
    line-height:1.6;
}

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

.grid-curated-card{
    display:grid;
    gap:14px;
    padding:18px 18px 16px;
    border-radius:24px;
    background:rgba(255,255,255,0.84);
    border:1px solid rgba(255,255,255,0.96);
    box-shadow:0 14px 28px rgba(148,163,184,0.10);
}

.grid-curated-top{
    display:grid;
    gap:10px;
}

.grid-curated-time{
    font-family:'Orbitron',sans-serif;
    font-size:1.12rem;
    letter-spacing:.08em;
    color:var(--text-main);
}

.grid-curated-state{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:max-content;
    min-height:28px;
    padding:0 10px;
    border-radius:999px;
    font-size:.72rem;
    font-weight:800;
    letter-spacing:.08em;
    text-transform:uppercase;
    border:1px solid rgba(255,255,255,0.96);
    background:#fff;
    color:var(--text-main);
}

.grid-curated-state.is-system{
    background:#eff6ff;
    border-color:rgba(59,130,246,0.22);
    color:#1d4ed8;
}

.grid-curated-state.is-premium{
    background:#fff7ed;
    border-color:rgba(245,158,11,0.24);
    color:#b45309;
}

.grid-curated-state.is-sale{
    background:#f0fdf4;
    border-color:rgba(34,197,94,0.22);
    color:#15803d;
}

.grid-curated-state.is-locked{
    background:#f8fafc;
    border-color:rgba(148,163,184,0.22);
    color:#475569;
}

.grid-curated-meta{
    min-height:20px;
    color:var(--text-soft);
    font-size:.88rem;
    font-weight:700;
}

.grid-curated-link{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:44px;
    padding:0 14px;
    border-radius:16px;
    text-decoration:none;
    background:rgba(255,255,255,0.88);
    border:1px solid rgba(255,255,255,0.96);
    color:var(--text-main);
    font-weight:800;
    transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.grid-curated-link:hover{
    transform:translateY(-2px);
    box-shadow:0 18px 34px rgba(148,163,184,0.16);
    border-color:rgba(47,107,255,0.24);
}

@media (max-width: 1200px){
    .grid-curated-list{
        grid-template-columns:repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px){
    .grid-curated-strip{
        padding:18px;
        border-radius:24px;
    }

    .grid-curated-copy p{
        font-size:.92rem;
    }

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

@media (max-width: 1100px){
    .grid-state-guide-list{
        grid-template-columns:repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px){
    .grid-finder-strip{
        padding:18px;
        border-radius:24px;
    }

    .grid-finder-copy p{
        font-size:.92rem;
    }

    .grid-finder-actions{
        gap:10px;
    }

    .grid-finder-chip{
        min-height:42px;
        padding:0 14px;
        font-size:.9rem;
    }

    .grid-state-guide-list{
        grid-template-columns:1fr;
    }
}


/* ===== Step 41: grid responsive polish ===== */
body.grid-page{
    background:
        radial-gradient(circle at top left, rgba(79,124,255,.09), transparent 30%),
        radial-gradient(circle at top right, rgba(229,169,61,.08), transparent 24%),
        linear-gradient(180deg, #f5f8fd 0%, #eef4fb 46%, #f8fbff 100%);
}

body.grid-page .grid-shell{
    padding:0 18px 42px;
}

body.grid-page .grid-hero,
body.grid-page .grid-finder-strip,
body.grid-page .grid-curated-strip,
body.grid-page .grid-insights{
    border-radius:36px;
    box-shadow:
        0 22px 48px rgba(15,23,42,.06),
        0 10px 22px rgba(79,124,255,.05),
        inset 0 1px 0 rgba(255,255,255,.88);
}

body.grid-page .grid-hero{
    padding:32px;
    gap:22px;
}

body.grid-page .grid-title{
    letter-spacing:-.04em;
}

body.grid-page .hero-stat-card,
body.grid-page .legend-card,
body.grid-page .grid-state-guide-card,
body.grid-page .grid-insight-card,
body.grid-page .hour-card,
body.grid-page .grid-curated-card{
    border-radius:24px;
    box-shadow:
        0 14px 30px rgba(15,23,42,.045),
        inset 0 1px 0 rgba(255,255,255,.86);
}

body.grid-page .grid-finder-strip,
body.grid-page .grid-curated-strip{
    padding:24px;
}

body.grid-page .grid-insights{
    padding:24px;
}

body.grid-page .grid-finder-copy p,
body.grid-page .grid-curated-copy p,
body.grid-page .grid-insights-copy p,
body.grid-page .sector-copy{
    color:#61748f;
    line-height:1.68;
}

body.grid-page .grid-finder-chip,
body.grid-page .sector-pill,
body.grid-page .grid-curated-link,
body.grid-page .grid-insights-action{
    min-height:40px;
    border-radius:999px;
    box-shadow:0 10px 22px rgba(15,23,42,.04);
}

body.grid-page .minute-matrix{
    gap:7px;
}

body.grid-page .cell-m{
    border-radius:12px;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.4);
}

body.grid-page .cell-m:hover{
    transform:translateY(-2px) scale(1.06);
}

body.grid-page .grid-sheet{
    width:min(620px, calc(100vw - 28px));
    max-height:calc(100vh - 28px);
    overflow:auto;
    padding:28px;
    border-radius:32px;
    box-shadow:
        0 34px 72px rgba(15,23,42,.14),
        inset 0 1px 0 rgba(255,255,255,.86);
}

body.grid-page .grid-sheet-box,
body.grid-page .grid-sheet-copy-card{
    border-radius:22px;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.78);
}

body.grid-page .grid-sheet-action{
    min-height:48px;
    border-radius:16px;
}

body.grid-page .grid-cluster-link{
    transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

body.grid-page .grid-cluster-link:hover{
    transform:translateY(-2px);
    box-shadow:0 14px 28px rgba(15,23,42,.06);
}

body.grid-page .grid-minute-link{
    box-shadow:
        0 12px 24px rgba(15,23,42,.10),
        inset 0 1px 0 rgba(255,255,255,.34);
}

@media (max-width: 1100px){
    body.grid-page .grid-hero{
        grid-template-columns:1fr;
        padding:26px;
    }

    body.grid-page .grid-finder-strip,
    body.grid-page .grid-curated-strip,
    body.grid-page .grid-insights{
        padding:22px;
        border-radius:28px;
    }
}

@media (max-width: 760px){
    body.grid-page .grid-shell{
        padding:0 12px 30px;
    }

    body.grid-page .grid-hero,
    body.grid-page .grid-finder-strip,
    body.grid-page .grid-curated-strip,
    body.grid-page .grid-insights{
        padding:18px;
        border-radius:24px;
    }

    body.grid-page .hero-stat-card,
    body.grid-page .legend-card,
    body.grid-page .grid-state-guide-card,
    body.grid-page .grid-insight-card,
    body.grid-page .hour-card,
    body.grid-page .grid-curated-card{
        border-radius:20px;
    }

    body.grid-page .grid-finder-copy,
    body.grid-page .grid-curated-copy,
    body.grid-page .grid-insights-top{
        gap:14px;
    }

    body.grid-page .minute-matrix{
        gap:5px;
    }

    body.grid-page .cell-m{
        border-radius:10px;
    }

    body.grid-page .grid-sheet{
        width:calc(100vw - 14px);
        max-height:calc(100vh - 14px);
        padding:18px;
        border-radius:24px;
    }

    body.grid-page .grid-sheet-stats,
    body.grid-page .grid-sheet-stats-secondary{
        grid-template-columns:1fr;
    }

    body.grid-page .grid-sheet-box,
    body.grid-page .grid-sheet-copy-card{
        border-radius:18px;
    }

    body.grid-page .grid-insights-action,
    body.grid-page .grid-curated-link,
    body.grid-page .grid-finder-chip{
        width:100%;
        justify-content:center;
    }
}


/* ===== Grid modal top-offset fix ===== */
body.grid-page .grid-sheet{
    top: calc(50% + 18px);
}

body.grid-page .grid-sheet.visible{
    transform: translate(-50%, -50%);
}

@media (max-width: 1024px){
    body.grid-page .grid-sheet{
        top: calc(50% + 24px);
    }
}

@media (max-width: 760px){
    body.grid-page .grid-sheet{
        top: auto !important;
        bottom: max(18px, env(safe-area-inset-bottom, 0px) + 18px) !important;
        max-height: calc(100dvh - 92px) !important;
    }
}

@media (max-width: 640px){
    body.grid-page .grid-sheet{
        top: auto !important;
        bottom: max(18px, env(safe-area-inset-bottom, 0px) + 18px) !important;
        max-height: calc(100dvh - 92px) !important;
    }

    body.grid-page .grid-sheet-close{
        top: 14px;
        right: 14px;
    }
}
