/* Externalized from grid/index.html for CSP. */
:root {
            --bg: #081425;
            --panel: rgba(8, 21, 39, 0.76);
            --panel2: rgba(3, 12, 26, 0.90);
            --text: #e5ecf5;
            --muted: rgba(170, 184, 207, 0.90);
            --border: rgba(116, 153, 205, 0.26);
            --accent: #0ea5e9;
            --accentHover: #0284c7;
            --good: rgba(34, 197, 94, 0.95);
            --warn: rgba(251, 191, 36, 0.95);
            --chipBg: rgba(14, 26, 46, 0.78);
            --shadow: 0 22px 44px rgba(2, 7, 18, 0.40);

            --top-nav-h: calc(56px + env(safe-area-inset-top));
            --bottom-nav-h: 92px;
        }

        * {
            box-sizing: border-box;
        }

        html {
            height: 100%;
        }

        body {
            margin: 0;
            background:
                radial-gradient(circle at 12% -8%, rgba(14, 165, 233, 0.18), transparent 38%),
                radial-gradient(circle at 86% -10%, rgba(56, 189, 248, 0.14), transparent 34%),
                linear-gradient(165deg, #041224 0%, #081a2f 45%, #0a1729 100%);
            color: var(--text);
            font-family: var(--seen-font);
            min-height: 100vh;
            overflow-x: hidden;
            overflow-y: scroll;
            --scrollbar-w: 0px;
        }

        body::before,
        body::after {
            content: "";
            position: fixed;
            inset: auto;
            pointer-events: none;
            z-index: -1;
        }

        body::before {
            top: -110px;
            left: -70px;
            width: 360px;
            height: 360px;
            border-radius: 999px;
            background: radial-gradient(circle, rgba(56, 189, 248, 0.18), transparent 66%);
        }

        body::after {
            right: -90px;
            bottom: 70px;
            width: 340px;
            height: 340px;
            border-radius: 999px;
            background: radial-gradient(circle, rgba(14, 116, 144, 0.22), transparent 68%);
        }

        .nav-links {
            flex: 0 1 auto;
            margin-left: auto;
            min-width: 0;
            justify-content: flex-end;
            flex-wrap: nowrap;
            white-space: nowrap;
        }

        main {
            max-width: 1320px;
            margin: 0 auto;
            padding: 18px 14px 28px;
        }

        .grid-hero {
            margin-bottom: 12px;
            padding: 16px 18px;
            border: 1px solid var(--border);
            border-radius: 18px;
            background:
                linear-gradient(145deg, rgba(10, 30, 55, 0.88), rgba(5, 16, 31, 0.90));
            box-shadow: var(--shadow);
        }

        .grid-kicker {
            margin: 0 0 6px;
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.16em;
            text-transform: uppercase;
            color: rgba(125, 211, 252, 0.92);
        }

        .grid-title {
            margin: 0;
            font-size: clamp(24px, 3vw, 34px);
            line-height: 1;
            letter-spacing: -0.03em;
        }

        .grid-sub {
            margin: 7px 0 0;
            font-size: 13px;
            color: var(--muted);
        }

        .grid-summary-bar {
            display: grid;
            gap: 12px;
            margin-bottom: 14px;
        }

        .grid-summary-cards {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 10px;
        }

        .grid-summary-card {
            display: grid;
            gap: 6px;
            padding: 14px 15px;
            border-radius: 16px;
            border: 1px solid var(--border);
            background: rgba(5, 18, 34, 0.76);
            box-shadow: var(--shadow);
            min-height: 92px;
        }

        .grid-summary-label {
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: rgba(125, 211, 252, 0.86);
        }

        .grid-summary-value {
            font-size: clamp(20px, 2.6vw, 28px);
            font-weight: 900;
            letter-spacing: -0.03em;
            line-height: 1;
            color: #f8fbff;
        }

        .grid-summary-meta {
            font-size: 12px;
            line-height: 1.45;
            color: var(--muted);
        }

        .grid-discovery-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 12px;
            padding: 10px 12px;
            border: 1px solid rgba(125, 211, 252, 0.26);
            border-radius: 18px;
            background:
                linear-gradient(135deg, rgba(8, 31, 55, 0.94), rgba(5, 17, 33, 0.92));
            box-shadow: 0 16px 32px rgba(2, 8, 20, 0.30);
        }

        .grid-discovery-copy {
            min-width: 0;
        }

        .grid-discovery-title {
            display: block;
            font-size: 12px;
            font-weight: 900;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: rgba(224, 242, 254, 0.96);
        }

        .grid-discovery-note {
            display: block;
            margin-top: 3px;
            font-size: 11px;
            line-height: 1.35;
            color: rgba(191, 210, 236, 0.78);
        }

        .grid-discovery-actions {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            flex: 0 0 auto;
            padding: 4px;
            border: 1px solid rgba(125, 211, 252, 0.20);
            border-radius: 999px;
            background: rgba(2, 10, 24, 0.66);
        }

        .grid-discovery-btn {
            min-height: 38px;
            border: 1px solid transparent;
            border-radius: 999px;
            padding: 8px 13px;
            background: transparent;
            color: rgba(191, 210, 236, 0.90);
            font-size: 11px;
            font-weight: 900;
            letter-spacing: 0.04em;
            cursor: pointer;
            white-space: nowrap;
            transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
        }

        .grid-discovery-btn:hover {
            color: #f8fafc;
            background: rgba(30, 64, 101, 0.64);
        }

        .grid-discovery-btn.is-active {
            color: #f0fdf4;
            border-color: rgba(74, 222, 128, 0.54);
            background: linear-gradient(135deg, rgba(22, 163, 74, 0.86), rgba(5, 150, 105, 0.82));
            box-shadow: 0 7px 18px rgba(16, 185, 129, 0.24);
        }

        .grid-discovery-btn:focus-visible {
            outline: 2px solid rgba(125, 211, 252, 0.78);
            outline-offset: 2px;
        }

        .toolbar {
            display: grid;
            gap: 12px;
            margin-bottom: 14px;
            padding: 14px;
            border-radius: 18px;
            border: 1px solid var(--border);
            background: rgba(5, 18, 34, 0.78);
            box-shadow: var(--shadow);
        }

        .toolbar-top {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 14px;
            flex-wrap: wrap;
        }

        .toolbar-filter-row {
            display: grid;
            gap: 9px;
            min-width: 0;
            padding-top: 10px;
            border-top: 1px solid rgba(116, 153, 205, 0.16);
        }

        .toolbar-availability-row {
            display: grid;
            gap: 9px;
            min-width: 0;
            padding-top: 10px;
            border-top: 1px solid rgba(116, 153, 205, 0.16);
        }

        .toolbar-filter-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            flex-wrap: wrap;
        }

        .toolbar-availability-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            flex-wrap: wrap;
        }

        .toolbar-filter-label {
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: rgba(125, 211, 252, 0.8);
            white-space: nowrap;
        }

        .toolbar-filter-note {
            font-size: 12px;
            color: rgba(191, 210, 236, 0.72);
            line-height: 1.35;
        }

        .toolbar-availability-note {
            font-size: 12px;
            color: rgba(191, 210, 236, 0.72);
            line-height: 1.35;
        }

        .toolbar-availability-toggles {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            min-width: 0;
        }

        .grid-looking-toggle {
            border: 1px solid rgba(148, 163, 184, 0.34);
            border-radius: 999px;
            background: rgba(71, 85, 105, 0.26);
            color: rgba(226, 232, 240, 0.92);
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.03em;
            min-height: 34px;
            padding: 8px 12px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            white-space: nowrap;
            transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
        }

        .grid-looking-toggle:hover {
            background: rgba(100, 116, 139, 0.3);
        }

        .grid-looking-toggle.is-on {
            border-color: rgba(74, 222, 128, 0.68);
            background: rgba(34, 197, 94, 0.24);
            color: #dcfce7;
            box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.2) inset;
        }

        .grid-looking-toggle:disabled {
            opacity: 0.65;
            cursor: not-allowed;
        }

        .toolbar-availability-state {
            font-size: 12px;
            color: rgba(191, 210, 236, 0.86);
            line-height: 1.35;
            min-height: 16px;
        }

        .grid-quick-filters {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            min-width: 0;
        }

        .grid-filter-chip {
            border: 1px solid rgba(124, 164, 219, 0.22);
            border-radius: 999px;
            background: rgba(9, 25, 45, 0.72);
            color: rgba(226, 232, 240, 0.92);
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.03em;
            min-height: 34px;
            padding: 8px 12px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            white-space: nowrap;
        }

        .grid-filter-chip:hover {
            background: rgba(28, 51, 79, 0.92);
        }

        .grid-filter-chip.is-active {
            border-color: rgba(56, 189, 248, 0.48);
            background: rgba(14, 165, 233, 0.18);
            color: #e0f2fe;
        }

        .grid-filter-chip.is-reset {
            border-color: rgba(251, 191, 36, 0.26);
            color: rgba(254, 243, 199, 0.92);
        }

        .toolbar-left {
            flex: 1 1 360px;
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px;
            align-items: stretch;
            min-width: min(100%, 360px);
        }

        .pill {
            display: inline-flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            width: 100%;
            min-height: 50px;
            padding: 10px 14px;
            border-radius: 14px;
            border: 1px solid var(--border);
            background: rgba(9, 25, 45, 0.70);
            font-size: 12px;
            font-weight: 700;
            color: var(--muted);
        }

        .pill strong {
            min-width: 0;
            color: var(--text);
        }

        #locPill strong {
            flex: 1 1 auto;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            text-align: right;
        }

        .pill-sub {
            color: rgba(191, 210, 236, 0.76);
            font-size: 11px;
            font-weight: 700;
        }

        .pill.is-loading {
            border-color: rgba(148, 163, 184, 0.45);
            color: rgba(226, 232, 240, 0.75);
        }

        .pill.is-error {
            border-color: rgba(248, 113, 113, 0.5);
            color: rgba(254, 202, 202, 0.95);
        }

        .btn {
            border: 1px solid transparent;
            cursor: pointer;
            border-radius: 999px;
            padding: 9px 13px;
            font-weight: 800;
            background: var(--accent);
            color: #fff;
            font-size: 12px;
            letter-spacing: 0.02em;
            text-transform: uppercase;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .btn:hover {
            background: var(--accentHover);
        }

        .btn-ghost {
            background: rgba(148, 163, 184, 0.12);
            border: 1px solid rgba(148, 163, 184, 0.18);
            color: var(--text);
        }

        .btn-ghost:hover {
            background: rgba(148, 163, 184, 0.18);
        }

        .controls {
            flex: 1 1 420px;
            display: flex;
            gap: 10px;
            align-items: stretch;
            justify-content: flex-end;
            flex-wrap: wrap;
        }

        .control {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            min-height: 50px;
            padding: 10px 12px;
            border-radius: 14px;
            border: 1px solid var(--border);
            background: rgba(8, 22, 40, 0.70);
            font-size: 12px;
            font-weight: 700;
            color: rgba(191, 210, 236, 0.92);
        }

        .control input,
        .control select {
            background: rgba(3, 12, 26, 0.80);
            border: 1px solid rgba(99, 148, 211, 0.28);
            color: var(--text);
            border-radius: 10px;
            padding: 6px 9px;
            font-size: 12px;
            outline: none;
            min-width: 86px;
        }

        .toolbar-actions {
            display: flex;
            gap: 10px;
            align-items: stretch;
            flex-wrap: wrap;
        }

        .toolbar-actions .btn {
            min-height: 50px;
            padding: 0 16px;
        }

        .toolbar-btn-primary {
            background: linear-gradient(135deg, rgba(14, 165, 233, 0.96), rgba(2, 132, 199, 0.96));
            box-shadow: 0 12px 24px rgba(2, 132, 199, 0.22);
        }

        .toolbar-btn-primary:hover {
            background: linear-gradient(135deg, rgba(8, 145, 178, 0.98), rgba(3, 105, 161, 0.98));
        }

        .status {
            display: inline-flex;
            align-items: center;
            margin: 2px 0 14px;
            padding: 9px 12px;
            border-radius: 14px;
            border: 1px solid rgba(116, 153, 205, 0.2);
            background: rgba(8, 22, 40, 0.54);
            color: rgba(191, 210, 236, 0.9);
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.03em;
        }

        .status strong {
            color: var(--text);
        }

        .grid-error-surface {
            display: none;
            margin: 0 0 12px;
            padding: 12px 13px;
            border-radius: 14px;
            border: 1px solid rgba(248, 113, 113, 0.36);
            background: rgba(69, 10, 10, 0.34);
            box-shadow: 0 12px 30px rgba(2, 8, 20, 0.24);
        }

        .grid-error-surface.is-warning {
            border-color: rgba(251, 191, 36, 0.36);
            background: rgba(69, 48, 6, 0.34);
        }

        .grid-error-topline {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 6px;
        }

        .grid-error-title {
            font-size: 13px;
            font-weight: 900;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: #fecaca;
        }

        .grid-error-surface.is-warning .grid-error-title {
            color: #fde68a;
        }

        .grid-error-code {
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: rgba(254, 226, 226, 0.9);
            border: 1px solid rgba(248, 113, 113, 0.35);
            border-radius: 999px;
            padding: 3px 7px;
            background: rgba(127, 29, 29, 0.32);
            white-space: nowrap;
        }

        .grid-error-surface.is-warning .grid-error-code {
            color: rgba(254, 243, 199, 0.94);
            border-color: rgba(251, 191, 36, 0.42);
            background: rgba(113, 63, 18, 0.32);
        }

        .grid-error-message {
            font-size: 13px;
            line-height: 1.45;
            color: rgba(254, 226, 226, 0.95);
            margin-bottom: 10px;
        }

        .grid-error-surface.is-warning .grid-error-message {
            color: rgba(254, 243, 199, 0.95);
        }

        .grid-error-actions {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .grid-error-actions .btn {
            min-height: 34px;
        }

        .profile-basics-modal {
            position: fixed;
            inset: 0;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 24px;
            background: rgba(2, 6, 23, 0.72);
            backdrop-filter: blur(10px);
            z-index: 1800;
        }

        .profile-basics-modal.open {
            display: flex;
        }

        .profile-basics-card {
            width: min(100%, 420px);
            border-radius: 24px;
            border: 1px solid rgba(148, 163, 184, 0.24);
            background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.96));
            box-shadow: 0 28px 64px rgba(2, 6, 23, 0.48);
            padding: 24px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .profile-basics-title {
            margin: 0;
            font-size: 24px;
            font-weight: 900;
            color: #f8fafc;
        }

        .profile-basics-copy {
            margin: 0;
            color: #cbd5e1;
            line-height: 1.55;
        }

        .profile-basics-actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 8px;
            flex-wrap: wrap;
        }

        .profile-basics-btn {
            border: 1px solid rgba(148, 163, 184, 0.28);
            background: rgba(15, 23, 42, 0.82);
            color: #e2e8f0;
            border-radius: 999px;
            padding: 11px 16px;
            font-weight: 800;
            cursor: pointer;
        }

        .profile-basics-btn.primary {
            background: linear-gradient(135deg, #2563eb, #06b6d4);
            border-color: transparent;
            color: #eff6ff;
        }

        .location-picker-modal {
            position: fixed;
            inset: 0;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 24px;
            background: rgba(2, 6, 23, 0.76);
            backdrop-filter: blur(12px);
            z-index: 1810;
        }

        .location-picker-modal.open {
            display: flex;
        }

        .location-picker-card {
            width: min(100%, 460px);
            max-height: min(82vh, 760px);
            overflow: auto;
            border-radius: 24px;
            border: 1px solid rgba(148, 163, 184, 0.24);
            background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.97));
            box-shadow: 0 28px 64px rgba(2, 6, 23, 0.48);
            padding: 22px;
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        .location-picker-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
        }

        .location-picker-title {
            margin: 0;
            font-size: 23px;
            font-weight: 900;
            color: #f8fafc;
        }

        .location-picker-copy {
            margin: 6px 0 0;
            color: #cbd5e1;
            line-height: 1.5;
            font-size: 14px;
        }

        .location-picker-close {
            border: 1px solid rgba(148, 163, 184, 0.28);
            background: rgba(15, 23, 42, 0.82);
            color: #e2e8f0;
            border-radius: 999px;
            min-width: 40px;
            min-height: 40px;
            padding: 0 14px;
            font-size: 18px;
            font-weight: 800;
            cursor: pointer;
            line-height: 1;
        }

        .location-picker-close:hover {
            background: rgba(30, 41, 59, 0.92);
        }

        .location-picker-form {
            display: grid;
            gap: 10px;
        }

        .location-picker-label {
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: rgba(125, 211, 252, 0.82);
        }

        .location-picker-input {
            width: 100%;
            min-height: 46px;
            border-radius: 14px;
            border: 1px solid rgba(99, 148, 211, 0.28);
            background: rgba(8, 22, 40, 0.82);
            color: #eff6ff;
            padding: 12px 14px;
            font-size: 14px;
            outline: none;
        }

        .location-picker-input:focus {
            border-color: rgba(56, 189, 248, 0.56);
            box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
        }

        .location-picker-status {
            min-height: 18px;
            font-size: 12px;
            color: rgba(191, 210, 236, 0.78);
        }

        .location-picker-status.is-error {
            color: rgba(254, 202, 202, 0.95);
        }

        .location-picker-status.is-success {
            color: rgba(187, 247, 208, 0.96);
        }

        .location-picker-actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            flex-wrap: wrap;
        }

        .location-picker-btn {
            border: 1px solid rgba(148, 163, 184, 0.28);
            background: rgba(15, 23, 42, 0.82);
            color: #e2e8f0;
            border-radius: 999px;
            min-height: 42px;
            padding: 10px 16px;
            font-size: 13px;
            font-weight: 800;
            cursor: pointer;
        }

        .location-picker-btn.primary {
            background: linear-gradient(135deg, #2563eb, #06b6d4);
            border-color: transparent;
            color: #eff6ff;
        }

        .location-picker-btn:disabled,
        .location-picker-close:disabled,
        .location-picker-input:disabled,
        .location-picker-chip:disabled {
            opacity: 0.64;
            cursor: wait;
        }

        .location-picker-quick {
            display: grid;
            gap: 10px;
        }

        .location-picker-grid {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 10px;
        }

        .location-picker-chip {
            width: 100%;
            min-height: 42px;
            border-radius: 14px;
            border: 1px solid rgba(124, 164, 219, 0.24);
            background: rgba(9, 25, 45, 0.74);
            color: rgba(226, 232, 240, 0.94);
            padding: 10px 12px;
            font-size: 12px;
            font-weight: 800;
            cursor: pointer;
            text-align: center;
        }

        .location-picker-chip:hover {
            background: rgba(28, 51, 79, 0.92);
            border-color: rgba(125, 211, 252, 0.36);
        }

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

        .position-filter-option {
            min-height: 46px;
            border-radius: 16px;
            border: 1px solid rgba(99, 148, 211, 0.28);
            background: rgba(8, 22, 40, 0.82);
            color: #eff6ff;
            font-size: 14px;
            font-weight: 800;
            letter-spacing: 0.02em;
            cursor: pointer;
            transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
        }

        .position-filter-option:hover {
            transform: translateY(-1px);
            border-color: rgba(56, 189, 248, 0.42);
            background: rgba(17, 44, 76, 0.88);
        }

        .position-filter-option.is-active {
            border-color: rgba(56, 189, 248, 0.58);
            background: rgba(14, 165, 233, 0.18);
            color: #e0f2fe;
            box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.16);
        }

        .basics-disabled-banner {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin: 0 0 14px;
            padding: 12px 14px;
            border-radius: 16px;
            border: 1px solid rgba(96, 165, 250, 0.28);
            background: rgba(2, 6, 23, 0.84);
            color: #dbeafe;
            box-shadow: 0 14px 28px rgba(2, 6, 23, 0.22);
        }

        .basics-disabled-banner[hidden] {
            display: none;
        }

        .basics-disabled-banner-copy {
            margin: 0;
            font-size: 13px;
            line-height: 1.45;
        }

        .basics-disabled-banner-btn {
            border: 1px solid rgba(37, 99, 235, 0.78);
            background: linear-gradient(135deg, #2563eb, #06b6d4);
            color: #eff6ff;
            border-radius: 999px;
            min-height: 40px;
            padding: 9px 14px;
            font-size: 13px;
            font-weight: 800;
            cursor: pointer;
            white-space: nowrap;
        }

        .grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
            gap: 14px;
        }

        .grid-conveyor-stage {
            position: relative;
            margin: -8px;
            padding: 18px 8px 8px;
            overflow: hidden;
            border-radius: 34px 34px 0 0;
            isolation: isolate;
        }

        .grid-conveyor-sentinel {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 2px;
            pointer-events: none;
        }

        .grid-conveyor-stage::before {
            content: "";
            position: absolute;
            z-index: 4;
            top: 0;
            left: 7%;
            right: 7%;
            height: 24px;
            border-radius: 0 0 50% 50% / 0 0 100% 100%;
            border-bottom: 1px solid rgba(125, 211, 252, 0.15);
            background: linear-gradient(to bottom, rgba(4, 17, 34, 0.98), rgba(7, 24, 43, 0.36), transparent);
            box-shadow: 0 7px 18px rgba(2, 8, 20, 0.34);
            opacity: 0.58;
            pointer-events: none;
            transition: opacity 0.2s ease, transform 0.2s ease;
        }

        .grid-conveyor-stage.is-conveying::before {
            opacity: 1;
            transform: scaleX(0.92);
        }

        .grid-conveyor-stage.is-conveying .card.is-conveyor-exit {
            z-index: 3;
            pointer-events: none;
            animation: gridConveyorRollOff 0.62s cubic-bezier(0.42, 0, 0.2, 1) both;
        }

        .grid-conveyor-stage.is-conveying .card.is-conveyor-follow {
            pointer-events: none;
            animation: gridConveyorFollow 0.62s cubic-bezier(0.42, 0, 0.2, 1) both;
        }

        .grid-conveyor-stage.is-arriving .card {
            animation: gridConveyorArrive 0.48s cubic-bezier(0.22, 0.78, 0.24, 1) both;
            animation-delay: calc(min(var(--grid-card-index, 0), 8) * 26ms);
        }

        .grid-conveyor-stage.is-paused::before {
            opacity: 0.34;
        }

        @keyframes gridConveyorRollOff {
            0% {
                opacity: 1;
                transform: translate3d(0, 0, 0) rotateX(0) scale(1);
                border-radius: 16px;
                filter: saturate(1);
            }
            48% {
                opacity: 0.92;
                transform: translate3d(0, -44px, 0) rotateX(12deg) scale(0.96);
                border-radius: 24px 24px 38px 38px;
            }
            100% {
                opacity: 0;
                transform: translate3d(0, -132px, 0) rotateX(34deg) scale(0.74);
                border-radius: 48% 48% 38px 38px / 34% 34% 38px 38px;
                filter: saturate(0.74);
            }
        }

        @keyframes gridConveyorFollow {
            0% {
                transform: translate3d(0, 0, 0);
            }
            100% {
                transform: translate3d(0, -18px, 0);
            }
        }

        @keyframes gridConveyorArrive {
            from {
                opacity: 0;
                transform: translate3d(0, 34px, 0) scale(0.965);
            }
            to {
                opacity: 1;
                transform: translate3d(0, 0, 0) scale(1);
            }
        }

        .grid-load-more {
            margin: 14px auto 4px;
            display: none;
            align-items: center;
            justify-content: center;
            border: 1px solid rgba(125, 211, 252, 0.30);
            background: rgba(8, 24, 43, 0.78);
            color: rgba(191, 210, 236, 0.94);
            border-radius: 999px;
            padding: 8px 14px;
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            cursor: pointer;
        }

        .grid-load-more:hover {
            background: rgba(15, 36, 61, 0.92);
            border-color: rgba(125, 211, 252, 0.42);
        }

        .grid-load-more:disabled {
            opacity: 0.7;
            cursor: wait;
        }

        .grid-load-more:focus-visible {
            outline: 2px solid rgba(125, 211, 252, 0.64);
            outline-offset: 2px;
        }

        .grid-back-top {
            position: fixed;
            right: 16px;
            bottom: 96px;
            z-index: 75;
            display: none;
            align-items: center;
            justify-content: center;
            border-radius: 999px;
            border: 1px solid rgba(125, 211, 252, 0.34);
            background: rgba(8, 24, 43, 0.86);
            color: rgba(226, 232, 240, 0.96);
            padding: 10px 12px;
            min-width: 44px;
            min-height: 44px;
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            box-shadow: 0 10px 20px rgba(2, 8, 20, 0.42);
            cursor: pointer;
        }

        .grid-back-top:hover {
            background: rgba(15, 36, 61, 0.96);
            border-color: rgba(125, 211, 252, 0.5);
        }

        .grid-back-top:focus-visible {
            outline: 2px solid rgba(125, 211, 252, 0.70);
            outline-offset: 2px;
        }

        .card {
            border: 1px solid var(--border);
            border-radius: 16px;
            overflow: hidden;
            background:
                linear-gradient(165deg, rgba(9, 27, 49, 0.93), rgba(4, 13, 26, 0.96));
            position: relative;
            min-height: 236px;
            cursor: pointer;
            box-shadow: 0 18px 36px rgba(2, 8, 20, 0.36);
            transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
            animation: gridCardIn 0.34s ease both;
            touch-action: manipulation;
        }

        .card.no-animate {
            animation: none;
        }

        @media (hover: hover) and (pointer: fine) {
            .card:hover {
                transform: translateY(-3px);
                border-color: rgba(125, 211, 252, 0.45);
                box-shadow: 0 24px 42px rgba(2, 8, 20, 0.48);
            }
        }

        .card:active {
            transform: translateY(-1px) scale(0.988);
            border-color: rgba(125, 211, 252, 0.42);
            box-shadow: 0 14px 28px rgba(2, 8, 20, 0.40);
        }

        .photo {
            width: 100%;
            aspect-ratio: 4 / 5;
            background: rgba(9, 22, 39, 0.8);
            display: grid;
            place-items: center;
            overflow: hidden;
            position: relative;
        }

        .photo::after {
            content: "";
            position: absolute;
            inset: auto 0 0;
            height: 46%;
            background: linear-gradient(to top, rgba(2, 9, 20, 0.7), transparent);
            pointer-events: none;
        }

        .photo-topline {
            position: absolute;
            top: 10px;
            left: 10px;
            right: 10px;
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 8px;
            z-index: 2;
        }

        .photo-pills {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            min-width: 0;
        }

        .photo-pill {
            display: inline-flex;
            align-items: center;
            min-height: 24px;
            padding: 4px 8px;
            border-radius: 999px;
            background: rgba(2, 9, 20, 0.72);
            border: 1px solid rgba(148, 163, 184, 0.18);
            color: rgba(239, 246, 255, 0.96);
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            backdrop-filter: blur(8px);
            white-space: nowrap;
        }

        .photo-pill.distance {
            color: rgba(224, 242, 254, 0.95);
            border-color: rgba(56, 189, 248, 0.28);
        }

        .photo-pill.online {
            color: rgba(220, 252, 231, 0.96);
            border-color: rgba(34, 197, 94, 0.32);
            background: rgba(6, 78, 59, 0.68);
        }

        .photo-pill.recent {
            color: rgba(254, 243, 199, 0.96);
            border-color: rgba(251, 191, 36, 0.3);
            background: rgba(120, 53, 15, 0.56);
        }

        .photo img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .photo img.is-default {
            object-fit: contain;
            padding: 18px;
            opacity: 0.95;
        }

        .card-body {
            padding: 11px 11px 12px;
            display: flex;
            flex-direction: column;
            gap: 7px;
            min-height: 118px;
        }

        .topline {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            min-width: 0;
        }

        .handle {
            font-weight: 800;
            font-size: 14px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            min-width: 0;
            flex: 1 1 auto;
            letter-spacing: 0.01em;
        }

        .meta {
            font-size: 11px;
            color: var(--muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 0;
            flex: 0 1 auto;
            max-width: 58%;
        }

        .card-context {
            color: rgba(226, 232, 240, 0.96);
            font-size: 12px;
            font-weight: 700;
            line-height: 1.42;
            min-height: 17px;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .card-context.is-muted {
            color: rgba(170, 184, 207, 0.82);
            font-weight: 600;
        }

        .card-foot {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            min-height: 18px;
            font-size: 11px;
            color: rgba(191, 210, 236, 0.82);
        }

        .card-foot-status {
            font-weight: 700;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .card-foot-status.online {
            color: rgba(187, 247, 208, 0.96);
        }

        .card-foot-status.recent {
            color: rgba(254, 243, 199, 0.96);
        }

        .card-foot-detail {
            color: rgba(148, 163, 184, 0.95);
            white-space: nowrap;
        }

        .chips {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
            min-height: 18px;
        }

        .chip {
            font-size: 10px;
            padding: 4px 9px;
            border-radius: 999px;
            border: 1px solid rgba(124, 164, 219, 0.24);
            background: var(--chipBg);
            color: rgba(229, 231, 235, 0.92);
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .chip.good {
            border-color: rgba(34, 197, 94, 0.35);
            color: rgba(187, 247, 208, 0.95);
        }

        .chip.warn {
            border-color: rgba(251, 191, 36, 0.35);
            color: rgba(254, 243, 199, 0.95);
        }

        .chip.plus {
            border-color: rgba(96, 165, 250, 0.45);
            color: rgba(219, 234, 254, 0.95);
        }

        .chip.new {
            border-color: rgba(251, 191, 36, 0.4);
            background: rgba(120, 53, 15, 0.22);
            color: rgba(254, 240, 138, 0.96);
        }

        .actions {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 6px;
            margin-top: auto;
            align-items: center;
        }

        .a-btn {
            flex: 1;
            width: 100%;
            min-height: 34px;
            border: 1px solid rgba(124, 164, 219, 0.24);
            background: rgba(9, 25, 45, 0.75);
            color: var(--text);
            border-radius: 12px;
            padding: 7px 9px;
            font-size: 11px;
            font-weight: 800;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        .a-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .a-btn:hover {
            background: rgba(28, 51, 79, 0.92);
        }

        .a-btn.primary {
            background: rgba(14, 165, 233, 0.28);
            border-color: rgba(56, 189, 248, 0.4);
        }

        .a-btn.primary:hover {
            background: rgba(14, 165, 233, 0.42);
        }

        .a-btn.seen {
            flex: 1;
        }

        .a-btn.seen.is-added {
            background: rgba(34, 197, 94, 0.18);
            border-color: rgba(34, 197, 94, 0.4);
            color: #dcfce7;
        }

        .a-btn.seen.is-pending {
            background: rgba(245, 158, 11, 0.32);
            border-color: rgba(245, 158, 11, 0.62);
            color: #fff7d6;
        }

        .a-btn.match.is-pending {
            background: rgba(34, 197, 94, 0.2);
            border-color: rgba(34, 197, 94, 0.46);
            color: #dcfce7;
        }

        .a-btn.match.is-added {
            background: rgba(34, 197, 94, 0.18);
            border-color: rgba(34, 197, 94, 0.4);
            color: #dcfce7;
        }

        .grid-chat-unread-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 18px;
            height: 18px;
            padding: 0 6px;
            border-radius: 999px;
            font-size: 10px;
            font-weight: 900;
            background: rgba(239, 68, 68, 0.9);
            color: #fff;
            border: 1px solid rgba(248, 113, 113, 0.65);
        }

        .grid-chat-unread-badge.is-zero {
            opacity: 0.45;
            background: rgba(71, 85, 105, 0.65);
            border-color: rgba(148, 163, 184, 0.32);
        }

        .empty {
            border: 1px dashed rgba(125, 211, 252, 0.3);
            border-radius: 16px;
            padding: 24px;
            color: rgba(191, 210, 236, 0.95);
            background: rgba(7, 20, 37, 0.82);
        }

        @keyframes gridCardIn {
            from {
                opacity: 0;
                transform: translateY(10px) scale(0.98);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

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

            .grid-summary-card:last-child {
                grid-column: 1 / -1;
            }

            .grid {
                grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
            }

            .toolbar {
                gap: 10px;
            }
        }

        @media (max-width: 560px) {
            .grid-hero {
                padding: 14px 14px;
                border-radius: 16px;
            }

            .location-picker-modal {
                padding: 16px;
            }

            .location-picker-card {
                padding: 18px;
                border-radius: 22px;
            }

            .location-picker-title {
                font-size: 21px;
            }

            .location-picker-copy {
                font-size: 13px;
            }

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

            .grid-summary-bar {
                display: none;
            }

            .grid-summary-cards {
                grid-template-columns: 1fr;
            }

            .grid-summary-card:last-child {
                grid-column: auto;
            }

            .grid-sub {
                font-size: 12px;
            }

            .grid-discovery-bar {
                align-items: stretch;
                padding: 10px;
                border-radius: 16px;
            }

            .grid-discovery-note {
                display: none;
            }

            .grid-discovery-actions {
                align-self: center;
            }

            .grid-discovery-btn {
                min-height: 36px;
                padding: 7px 10px;
                font-size: 10px;
            }

            .toolbar {
                gap: 12px;
                padding: 12px;
            }

            .toolbar-top {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 8px;
                align-items: stretch;
            }

            .toolbar-left,
            .controls {
                display: contents;
            }

            .toolbar-left {
                width: auto;
                min-width: 0;
            }

            #locPill,
            #countPill,
            #radiusControl,
            #sortControl {
                min-width: 0;
            }

            #locPill {
                grid-row: 1;
                grid-column: 1;
            }

            #radiusControl {
                grid-row: 1;
                grid-column: 2;
            }

            #countPill {
                grid-row: 2;
                grid-column: 1;
            }

            #sortControl {
                grid-row: 2;
                grid-column: 2;
            }

            .pill {
                min-height: 42px;
                height: 42px;
                padding: 8px 12px;
                border-radius: 12px;
                font-size: 11px;
            }

            .control {
                width: 100%;
                justify-content: space-between;
                min-width: 0;
                min-height: 42px;
                height: 42px;
                padding: 8px 10px;
                border-radius: 12px;
                gap: 6px;
                font-size: 11px;
            }

            .control span {
                white-space: nowrap;
            }

            .control select {
                min-width: 72px;
                padding: 5px 8px;
                font-size: 11px;
            }

            .toolbar-actions {
                grid-row: 3;
                grid-column: 1 / -1;
                display: grid;
                grid-template-columns: repeat(3, minmax(0, 1fr));
                gap: 8px;
                margin-top: 2px;
            }

            .toolbar-actions .btn {
                width: 100%;
                min-height: 40px;
                padding: 0 12px;
                font-size: 11px;
                letter-spacing: 0.05em;
                white-space: nowrap;
            }

            .pill-sub {
                font-size: 10px;
            }

            .toolbar-filter-row {
                display: grid;
                gap: 8px;
            }

            .toolbar-availability-row {
                display: grid;
                gap: 8px;
            }

            .toolbar-filter-head {
                gap: 6px;
            }

            .toolbar-availability-head {
                gap: 6px;
            }

            .toolbar-filter-label {
                font-size: 10px;
            }

            .toolbar-filter-note {
                font-size: 11px;
            }

            .toolbar-availability-note {
                font-size: 11px;
            }

            .toolbar-availability-toggles {
                flex-wrap: nowrap;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                padding-bottom: 2px;
                scrollbar-width: none;
            }

            .toolbar-availability-toggles::-webkit-scrollbar {
                display: none;
            }

            .grid-quick-filters {
                flex-wrap: nowrap;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                padding-bottom: 2px;
                scrollbar-width: none;
            }

            .grid-quick-filters::-webkit-scrollbar {
                display: none;
            }

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

            .grid-conveyor-stage {
                border-radius: 28px 28px 0 0;
            }

            .card {
                min-height: 212px;
            }

            .card-body {
                padding: 10px 10px 11px;
                gap: 6px;
            }

            .meta {
                max-width: 48%;
            }

            .card-context {
                font-size: 11px;
            }

            .card-foot {
                font-size: 10px;
            }

            .grid-back-top {
                bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 10px);
                right: 12px;
            }
        }

        @media (prefers-reduced-motion: reduce) {
            .grid-conveyor-stage .card {
                animation: none !important;
                transition: none !important;
            }

            .grid-conveyor-stage.is-conveying .card.is-conveyor-exit,
            .grid-conveyor-stage.is-conveying .card.is-conveyor-follow,
            .grid-conveyor-stage.is-arriving .card {
                animation: none !important;
            }

            .grid-conveyor-stage::before {
                transition: none;
            }
        }

        /* Simple modal for "Profile" quick view */
        .modal {
            position: fixed;
            inset: 0;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 16px;
            background: rgba(0, 0, 0, 0.65);
            backdrop-filter: blur(6px);
            z-index: 999;
        }

        .modal.open {
            display: flex;
        }

        .modal-card {
            width: min(720px, 96vw);
            max-height: 90vh;
            overflow: visible;
            border-radius: 14px;
            padding: 0;
            border: none;
            background: transparent;
        }

        .modal-card.profile-pop-wrap {
            width: min(560px, 96vw);
        }

        .modal-card.gallery-wrap {
            width: min(720px, 96vw);
            max-height: 88vh;
            overflow: auto;
            border-radius: 14px;
            border: 1px solid rgba(148, 163, 184, 0.25);
            background: rgba(15, 23, 42, 0.98);
            padding: 14px;
        }

        .modal-top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 10px;
        }

        .modal-title {
            font-weight: 700;
            font-size: 14px;
        }

        .modal-close {
            border: 0;
            background: rgba(148, 163, 184, 0.18);
            color: #e5e7eb;
            padding: 6px 10px;
            border-radius: 10px;
            cursor: pointer;
        }

        .modal-close:hover {
            background: rgba(148, 163, 184, 0.28);
        }

        .profile-pop {
            background:
                radial-gradient(105% 74% at 16% 0%, rgba(96, 165, 250, 0.34), transparent 58%),
                linear-gradient(160deg, rgba(10, 18, 40, 0.98), rgba(15, 23, 42, 0.96));
            border-radius: 26px;
            border: 1px solid rgba(96, 165, 250, 0.28);
            padding: 14px;
            display: grid;
            gap: 12px;
            box-shadow: 0 30px 70px rgba(3, 7, 18, 0.66);
        }

        .profile-pop-top {
            display: flex;
            justify-content: flex-end;
        }

        .profile-pop-close {
            font-weight: 700;
            line-height: 1;
        }

        .profile-pop-media {
            display: grid;
            grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
            gap: 10px;
        }

        .profile-pop-main {
            position: relative;
            border-radius: 16px;
            overflow: hidden;
            background: rgba(2, 6, 23, 0.42);
            border: 1px solid rgba(148, 163, 184, 0.26);
            min-height: 190px;
            display: grid;
            place-items: center;
            cursor: zoom-in;
        }

        .profile-pop-main::after {
            content: '';
            position: absolute;
            inset: auto 0 0 0;
            height: 42%;
            background: linear-gradient(180deg, transparent, rgba(2, 6, 23, 0.52));
            pointer-events: none;
        }

        .profile-pop-main img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .profile-pop-main img.is-default {
            object-fit: contain;
            padding: 18px;
            opacity: 0.9;
        }

        .profile-pop-thumbs {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
            align-content: start;
        }

        .profile-pop-thumb {
            border-radius: 12px;
            background: rgba(2, 6, 23, 0.38);
            border: 1px solid rgba(148, 163, 184, 0.24);
            min-height: 88px;
            display: grid;
            place-items: center;
            overflow: hidden;
            cursor: pointer;
            transition: transform 0.16s ease, border-color 0.16s ease;
        }

        .profile-pop-thumb:hover {
            transform: translateY(-1px);
            border-color: rgba(96, 165, 250, 0.6);
        }

        .profile-pop-thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .profile-pop-thumb.is-empty {
            opacity: 0.45;
            cursor: default;
        }

        .profile-pop-thumb.is-empty img {
            display: none;
        }

        .gallery-main {
            width: 100%;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, 0.25);
            background: rgba(2, 6, 23, 0.6);
            object-fit: contain;
            max-height: 60vh;
            touch-action: pan-y pinch-zoom;
            -webkit-user-drag: none;
            user-select: none;
        }

        .gallery-controls {
            display: flex;
            gap: 8px;
            margin-top: 10px;
        }

        .gallery-btn {
            border: 0;
            background: rgba(37, 99, 235, 0.2);
            color: #e5e7eb;
            padding: 8px 12px;
            border-radius: 10px;
            cursor: pointer;
            font-weight: 600;
        }

        .gallery-btn:hover {
            background: rgba(37, 99, 235, 0.3);
        }

        .thumbs {
            display: flex;
            gap: 8px;
            overflow-x: auto;
            padding: 10px 2px 2px;
            margin-top: 8px;
        }

        .thumbs img {
            width: 56px;
            height: 56px;
            border-radius: 10px;
            object-fit: cover;
            border: 1px solid rgba(148, 163, 184, 0.25);
            cursor: pointer;
            opacity: 0.85;
        }

        .thumbs img.active {
            border-color: rgba(37, 99, 235, 0.9);
            opacity: 1;
        }

        .profile-pop-info {
            display: grid;
            gap: 8px;
        }

        .profile-pop-name {
            display: flex;
            align-items: baseline;
            gap: 8px;
            flex-wrap: wrap;
            font-weight: 900;
            font-size: clamp(20px, 2.8vw, 28px);
            letter-spacing: -0.01em;
            line-height: 1.06;
        }

        .profile-pop-age {
            color: rgba(191, 219, 254, 0.86);
            font-size: 14px;
            font-weight: 700;
        }

        .profile-pop-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            min-height: 24px;
        }

        .profile-pop-chip {
            display: inline-flex;
            align-items: center;
            padding: 5px 9px;
            border-radius: 999px;
            border: 1px solid rgba(96, 165, 250, 0.3);
            background: rgba(30, 58, 138, 0.24);
            color: rgba(219, 234, 254, 0.96);
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.03em;
            text-transform: uppercase;
        }

        .profile-pop-bio {
            color: rgba(226, 232, 240, 0.9);
            font-size: 13px;
            line-height: 1.42;
            white-space: pre-wrap;
            max-height: 78px;
            overflow: auto;
            padding: 9px 10px;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, 0.18);
            background: rgba(2, 6, 23, 0.3);
        }

        .profile-pop-actions {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
            align-items: center;
        }

        .profile-pop-gear {
            width: 100%;
            min-height: 40px;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, 0.24);
            background: rgba(2, 6, 23, 0.66);
            color: rgba(191, 219, 254, 0.95);
            font-size: 13px;
            font-weight: 800;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
        }

        .profile-pop-gear:hover {
            transform: translateY(-1px);
            border-color: rgba(96, 165, 250, 0.58);
            background: rgba(15, 23, 42, 0.92);
        }

        .profile-pop-btn {
            border: 1px solid rgba(148, 163, 184, 0.24);
            border-radius: 12px;
            padding: 10px 10px;
            font-weight: 800;
            font-size: 13px;
            cursor: pointer;
            min-height: 40px;
            transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
        }

        .profile-pop-btn:hover {
            transform: translateY(-1px);
            border-color: rgba(96, 165, 250, 0.58);
        }

        .profile-pop-btn.profile {
            background: rgba(2, 6, 23, 0.88);
            color: rgba(229, 231, 235, 0.95);
        }

        .profile-pop-btn.chat {
            background: rgba(37, 99, 235, 0.95);
            color: #fff;
        }

        .profile-pop-btn.seen {
            background: rgba(148, 163, 184, 0.16);
            color: rgba(229, 231, 235, 0.95);
            border-color: rgba(148, 163, 184, 0.36);
        }

        .profile-pop-btn.seen.is-added {
            background: rgba(34, 197, 94, 0.2);
            border-color: rgba(34, 197, 94, 0.46);
            color: #dcfce7;
        }

        .profile-pop-btn.seen.is-pending {
            background: rgba(245, 158, 11, 0.34);
            border-color: rgba(245, 158, 11, 0.62);
            color: #fff7d6;
        }

        .profile-pop-menu-btn.is-added {
            background: rgba(34, 197, 94, 0.2);
            color: #dcfce7;
            box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.35);
        }

        .profile-pop-menu-btn.is-pending {
            background: rgba(34, 197, 94, 0.2);
            color: #dcfce7;
            box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.46);
        }

        .profile-pop-btn[disabled] {
            opacity: 0.55;
            cursor: not-allowed;
        }

        .profile-pop-menu {
            display: none;
            background: rgba(15, 23, 42, 0.78);
            border-radius: 20px;
            padding: 12px;
            border: 1px solid rgba(148, 163, 184, 0.26);
            gap: 10px;
        }

        .profile-pop-menu.open {
            display: grid;
        }

        .profile-pop-menu-title {
            font-size: 12px;
            font-weight: 800;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            text-align: center;
        }

        .profile-pop-menu-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
        }

        .profile-pop-menu-btn {
            border-radius: 12px;
            border: 0;
            padding: 10px 8px;
            font-weight: 800;
            font-size: 13px;
            background: rgba(2, 6, 23, 0.85);
            color: rgba(229, 231, 235, 0.95);
            cursor: pointer;
            box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
        }

        .profile-pop-menu-btn[disabled] {
            opacity: 0.55;
            cursor: not-allowed;
        }

        .profile-pop-menu-btn.danger {
            color: #fca5a5;
        }

        @media (max-width: 640px) {
            .profile-pop-media {
                grid-template-columns: 1fr;
            }

            .profile-pop-thumbs {
                grid-template-columns: repeat(4, 1fr);
            }

            .profile-pop-main {
                min-height: 200px;
            }

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

            .profile-pop-gear {
                width: 100%;
                border-radius: 12px;
            }
        }

        @media (max-width: 720px) {
            body.is-browser-mode #modal,
            #modal.profile-menu-open {
                align-items: flex-start;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
                overscroll-behavior: contain;
                touch-action: pan-y;
                min-height: 100vh;
                min-height: 100dvh;
                height: 100vh;
                height: 100dvh;
                padding-top: calc(env(safe-area-inset-top) + 8px);
                padding-bottom: calc(env(safe-area-inset-bottom) + 8px);
                padding-left: max(10px, env(safe-area-inset-left));
                padding-right: max(10px, env(safe-area-inset-right));
                scroll-padding-top: calc(env(safe-area-inset-top) + 12px);
                scroll-padding-bottom: calc(env(safe-area-inset-bottom) + 18px);
            }

            body.is-browser-mode #modal .modal-card.profile-pop-wrap,
            #modal.profile-menu-open .modal-card.profile-pop-wrap {
                width: min(560px, 100%);
                margin: 0 auto;
                margin-bottom: calc(env(safe-area-inset-bottom) + 4px);
                max-height: none;
                overflow: visible;
                touch-action: pan-y;
            }

            body.is-browser-mode #modal .profile-pop,
            #modal.profile-menu-open .profile-pop {
                border-radius: 22px;
                padding: 12px;
                gap: 10px;
            }

            body.is-browser-mode #modal .profile-pop-main,
            #modal.profile-menu-open .profile-pop-main {
                min-height: clamp(150px, 34vh, 185px);
            }

            body.is-browser-mode #modal .profile-pop-thumbs,
            #modal.profile-menu-open .profile-pop-thumbs {
                gap: 6px;
            }

            body.is-browser-mode #modal .profile-pop-thumb,
            #modal.profile-menu-open .profile-pop-thumb {
                min-height: 72px;
            }

            body.is-browser-mode #modal .profile-pop-name,
            #modal.profile-menu-open .profile-pop-name {
                font-size: clamp(18px, 5.4vw, 24px);
                gap: 6px;
            }

            body.is-browser-mode #modal .profile-pop-actions,
            #modal.profile-menu-open .profile-pop-actions {
                gap: 6px;
            }

            body.is-browser-mode #modal .profile-pop-btn,
            #modal.profile-menu-open .profile-pop-btn {
                min-height: 36px;
                font-size: 12px;
                padding: 8px 9px;
            }

            body.is-browser-mode #modal .profile-pop-gear,
            #modal.profile-menu-open .profile-pop-gear {
                min-height: 36px;
                height: 36px;
                font-size: 12px;
            }

            body.is-browser-mode #modal .profile-pop-menu,
            #modal.profile-menu-open .profile-pop-menu {
                border-radius: 16px;
                padding: 10px;
                gap: 8px;
            }

            body.is-browser-mode #modal .profile-pop-menu-grid,
            #modal.profile-menu-open .profile-pop-menu-grid {
                gap: 8px;
            }

            body.is-browser-mode #modal .profile-pop-menu-btn,
            #modal.profile-menu-open .profile-pop-menu-btn {
                min-height: 36px;
                font-size: 12px;
                padding: 8px 7px;
            }
        }

        @media (max-width: 720px) and (max-height: 780px) {
            body.is-browser-mode #modal .profile-pop,
            #modal.profile-menu-open .profile-pop {
                border-radius: 20px;
                padding: 10px;
                gap: 8px;
            }

            body.is-browser-mode #modal .profile-pop-main,
            #modal.profile-menu-open .profile-pop-main {
                min-height: clamp(132px, 30vh, 165px);
            }

            body.is-browser-mode #modal .profile-pop-thumb,
            #modal.profile-menu-open .profile-pop-thumb {
                min-height: 64px;
            }

            body.is-browser-mode #modal .profile-pop-actions,
            #modal.profile-menu-open .profile-pop-actions {
                gap: 5px;
            }

            body.is-browser-mode #modal .profile-pop-btn,
            #modal.profile-menu-open .profile-pop-btn {
                min-height: 34px;
                font-size: 11px;
                padding: 7px 8px;
            }

            body.is-browser-mode #modal .profile-pop-gear,
            #modal.profile-menu-open .profile-pop-gear {
                min-height: 34px;
                height: 34px;
                font-size: 11px;
            }

            body.is-browser-mode #modal .profile-pop-menu,
            #modal.profile-menu-open .profile-pop-menu {
                padding: 8px;
                gap: 6px;
            }

            body.is-browser-mode #modal .profile-pop-menu-grid,
            #modal.profile-menu-open .profile-pop-menu-grid {
                gap: 6px;
            }

            body.is-browser-mode #modal .profile-pop-menu-btn,
            #modal.profile-menu-open .profile-pop-menu-btn {
                min-height: 32px;
                font-size: 11px;
                padding: 7px 6px;
            }
        }

        @media (min-width: 721px) and (max-width: 1180px) and (hover: none) and (pointer: coarse) {
            body.is-browser-mode #modal,
            #modal.profile-menu-open {
                align-items: flex-start;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
                overscroll-behavior: contain;
                touch-action: pan-y;
                min-height: 100vh;
                min-height: 100dvh;
                height: 100vh;
                height: 100dvh;
                padding-top: calc(env(safe-area-inset-top) + 16px);
                padding-bottom: calc(env(safe-area-inset-bottom) + 16px);
                padding-left: max(14px, env(safe-area-inset-left));
                padding-right: max(14px, env(safe-area-inset-right));
                scroll-padding-top: calc(env(safe-area-inset-top) + 20px);
                scroll-padding-bottom: calc(env(safe-area-inset-bottom) + 20px);
            }

            body.is-browser-mode #modal .modal-card.profile-pop-wrap,
            #modal.profile-menu-open .modal-card.profile-pop-wrap {
                width: min(620px, 100%);
                margin: 0 auto;
                max-height: none;
                overflow: visible;
                touch-action: pan-y;
            }

            body.is-browser-mode #modal .profile-pop,
            #modal.profile-menu-open .profile-pop {
                border-radius: 22px;
                padding: 12px;
                gap: 10px;
            }

            body.is-browser-mode #modal .profile-pop-main,
            #modal.profile-menu-open .profile-pop-main {
                min-height: clamp(180px, 34vh, 250px);
            }
        }

        .no-scroll {
            overflow: hidden;
            padding-right: var(--scrollbar-w);
        }

        /* -----------------------------
   SEEN MOBILE NAV v1 (LOCKED)
   - Same CSS on map/grid/chat
   - No per-page offsets
------------------------------*/

        .bottom-nav {
            display: none;
            position: fixed;
            left: 0;
            right: 0;
            bottom: 0;

            height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
            padding: 8px 12px calc(env(safe-area-inset-bottom) + 10px);

            background: linear-gradient(to top,
                    rgba(15, 23, 42, 1),
                    rgba(15, 23, 42, 0.95),
                    rgba(15, 23, 42, 0.80));

            border-top: 1px solid rgba(148, 163, 184, 0.25);
            backdrop-filter: blur(10px);
            z-index: 60;

            flex-direction: column;
            justify-content: center;
            gap: 6px;
        }

        .bottom-nav-row {
            display: flex;
            gap: 10px;
            align-items: center;
            justify-content: space-around;
        }

        .bn-link {
            flex: 1 1 0;
            text-align: center;
            padding: 10px 12px;
            border-radius: 999px;
            text-decoration: none;
            color: rgba(229, 231, 235, 0.92);
            font-weight: 800;
            font-size: 13px;
            border: 1px solid transparent;
            background: rgba(148, 163, 184, 0.10);
        }

        .bn-link:hover {
            background: rgba(148, 163, 184, 0.18);
        }

        .bn-link.active {
            background: rgba(37, 99, 235, 0.28);
            border-color: rgba(37, 99, 235, 0.38);
        }

        /* Optional status line (map uses it, others can omit it) */
        .bottom-nav-status {
            text-align: center;
            color: rgba(156, 163, 175, 0.95);
            font-size: 12px;
            font-weight: 750;
            text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
            line-height: 1.1;
            /* keeps layout stable even when empty */
            min-height: 14px;
        }

        @media (max-width: 720px) {
            :root {
                --bottom-nav-h: 64px;
            }

            body {
                padding-bottom: 0;
                height: 100dvh;
                overflow: hidden;
            }

            body:not(.is-admin) .top-nav {
                height: auto;
                padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
                gap: 8px;
                flex-wrap: nowrap;
            }

            body:not(.is-admin) .nav-links {
                flex: 1 1 auto;
                min-width: 0;
                margin-left: auto;
                justify-content: flex-end;
                flex-wrap: nowrap;
                overflow: hidden;
                gap: 6px;
                padding-bottom: 0;
            }

            body:not(.is-admin) .nav-link {
                flex: 0 0 auto;
                padding: 8px 8px;
                font-size: 13px;
                white-space: nowrap;
            }

            .nav-mobile-hide {
                display: none !important;
            }

            .bottom-only-hide {
                display: none !important;
            }

            .bottom-nav {
                display: flex;
                padding: 6px 10px calc(env(safe-area-inset-bottom) + 6px);
                gap: 4px;
            }

            .bn-link {
                padding: 8px 10px;
                font-size: 12px;
            }

            .bottom-nav-status {
                font-size: 11px;
                min-height: 11px;
            }

            main {
                height: calc(100dvh - var(--top-nav-h));
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
                padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 24px);
            }

            /* Chat page: keep bottom bar from covering layout */
            .chat-shell {
                height: calc(100dvh - var(--top-nav-h) - var(--bottom-nav-h));
            }

            .basics-disabled-banner {
                align-items: flex-start;
                flex-direction: column;
            }

            .basics-disabled-banner-btn {
                width: 100%;
            }
        }
