:root {
    --navy-950: #07111d;
    --navy-900: #0b1b2d;
    --navy-800: #12304d;
    --blue-600: #176bff;
    --blue-700: #0e56d8;
    --green-600: #10a778;
    --red-600: #d9473f;
    --ink-900: #162433;
    --ink-700: #415365;
    --ink-500: #6c7b89;
    --line: #dbe4ec;
    --line-strong: #c7d3dd;
    --surface: #ffffff;
    --surface-soft: #f4f7fa;
    --surface-blue: #eef5ff;
    --shadow: 0 18px 46px rgba(16, 35, 55, 0.14);
}

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

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    color: var(--ink-900);
    background: #dfe7ee;
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    font-size: 16px;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
select,
input[type="range"],
.csv-upload {
    touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.csv-upload:focus-within,
a:focus-visible {
    outline: 3px solid rgba(23, 107, 255, 0.24);
    outline-offset: 2px;
}

.xy-app {
    display: grid;
    grid-template-columns: minmax(410px, 470px) minmax(0, 1fr);
    height: 100vh;
    margin-left: 60px;
    overflow: hidden;
    background: #dfe7ee;
}

.control-panel {
    position: relative;
    z-index: 4;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
    background: var(--surface-soft);
    border-right: 1px solid #cbd6df;
    box-shadow: 12px 0 36px rgba(11, 27, 45, 0.12);
}

.brand-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 22px 20px;
    color: #fff;
    background:
        radial-gradient(circle at 90% 0%, rgba(54, 153, 255, 0.28), transparent 42%),
        linear-gradient(145deg, var(--navy-950), var(--navy-800));
    border-bottom: 3px solid var(--blue-600);
}

.brand-home {
    display: inline-block;
    margin-bottom: 7px;
    color: #74b7ff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-decoration: none;
}

.brand-header h1 {
    margin: 0;
    font-size: 21px;
    line-height: 1.35;
}

.brand-header p {
    margin: 5px 0 0;
    color: rgba(255, 255, 255, 0.64);
    font-size: 13px;
}

.legacy-link {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 11px;
    color: #eff8ff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.legacy-link:hover {
    background: rgba(255, 255, 255, 0.18);
}

.header-tool-links {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 6px;
}

.header-tool-links .legacy-link {
    min-height: 30px;
    padding: 0 9px;
    font-size: 12px;
}

.panel-scroll {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-color: #b8c6d2 transparent;
    scrollbar-width: thin;
}

.panel-section {
    padding: 21px 22px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.section-heading.compact {
    margin-bottom: 14px;
}

.section-heading > div {
    display: flex;
    align-items: center;
    gap: 9px;
}

.section-heading h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.2;
}

.step-number {
    display: inline-grid;
    place-items: center;
    width: 29px;
    height: 29px;
    color: var(--blue-600);
    background: var(--surface-blue);
    border: 1px solid #cfe1ff;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 900;
}

.record-counter,
.result-counts {
    color: var(--ink-500);
    font-size: 13px;
    font-weight: 600;
}

.record-counter.is-over-limit {
    color: var(--red-600);
}

.result-counts b {
    color: var(--ink-900);
}

.field-label {
    display: block;
    margin: 0 0 7px;
    color: var(--ink-700);
    font-size: 14px;
    font-weight: 800;
}

.field-label span {
    color: var(--ink-500);
    font-size: 12px;
    font-weight: 500;
}

textarea,
input[type="text"],
select {
    width: 100%;
    color: var(--ink-900);
    background: #fbfdff;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea:hover,
input[type="text"]:hover,
select:hover {
    border-color: #9fb2c3;
}

textarea:focus,
input[type="text"]:focus,
select:focus {
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px rgba(23, 107, 255, 0.1);
    outline: none;
}

textarea {
    display: block;
    min-height: 126px;
    padding: 11px 12px;
    line-height: 1.62;
    resize: vertical;
}

#outputCoordinates {
    min-height: 112px;
    color: #26384a;
    background: #f7fafc;
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 13px;
}

.geojson-export-options {
    margin-top: 11px;
    padding: 11px 12px;
    background: #f5f8fc;
    border: 1px solid #d8e2ec;
    border-radius: 8px;
}

.geojson-export-options label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    color: var(--ink-700);
    font-size: 13px;
    font-weight: 750;
}

.geojson-export-options select {
    width: 100%;
    height: 36px;
    background: #fff;
}

.geojson-export-options p {
    margin: 7px 0 0;
    color: var(--ink-500);
    font-size: 11px;
    line-height: 1.55;
}

input[type="text"],
select {
    height: 42px;
    padding: 0 11px;
}

.field-help {
    margin: 7px 0 0;
    color: var(--ink-500);
    font-size: 12px;
    line-height: 1.55;
}

.divider-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0 13px;
    color: #93a1ae;
    font-size: 12px;
}

.divider-label::before,
.divider-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.csv-upload {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    min-height: 68px;
    padding: 11px 13px;
    background: #f9fbfd;
    border: 1px dashed #9eb1c2;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.csv-upload:hover,
.csv-upload.is-dragging {
    background: var(--surface-blue);
    border-color: var(--blue-600);
}

.csv-upload.has-file {
    background: #effaf6;
    border-color: var(--green-600);
}

.upload-icon {
    display: grid;
    place-items: center;
    flex: 0 0 43px;
    height: 43px;
    color: #fff;
    background: var(--blue-600);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.csv-upload strong,
.csv-upload small {
    display: block;
}

.csv-upload strong {
    color: var(--ink-900);
    font-size: 14px;
}

.csv-upload small {
    margin-top: 4px;
    color: var(--ink-500);
    font-size: 12px;
}

.spaced-label {
    margin-top: 15px;
}

.range-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 16px 0;
    padding: 13px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.range-grid label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--ink-700);
    font-size: 13px;
}

.range-grid label:nth-of-type(2) {
    margin-top: 5px;
}

.range-grid input[type="range"] {
    width: 100%;
    accent-color: var(--blue-600);
}

.route-options {
    display: grid;
    gap: 11px;
    margin-top: 16px;
    padding: 13px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.route-toggle {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.route-toggle input {
    width: 17px;
    height: 17px;
    margin: 2px 0 0;
    accent-color: var(--blue-600);
    flex: 0 0 auto;
}

.route-toggle span {
    display: grid;
    gap: 3px;
}

.route-toggle strong {
    color: var(--ink-800);
    font-size: 13px;
}

.route-toggle small,
.route-status {
    color: var(--ink-500);
    font-size: 11px;
    line-height: 1.5;
}

.route-mode-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    color: var(--ink-700);
    font-size: 13px;
    font-weight: 750;
}

.route-mode-row select {
    width: 100%;
    height: 36px;
    background: #fff;
}

.route-status {
    margin: 0;
}

.route-status.is-error {
    color: var(--red-600);
}

.route-status.is-success {
    color: var(--green-600);
}

.export-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 11px;
}

.panel-actions {
    position: relative;
    padding: 13px 18px 16px;
    background: #fff;
    border-top: 1px solid var(--line-strong);
    box-shadow: 0 -12px 28px rgba(22, 36, 51, 0.07);
}

.progress-track {
    position: absolute;
    top: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    overflow: hidden;
    background: #e4ebf1;
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--blue-600), #42a6ff);
    transition: width 0.18s ease;
}

.parse-status {
    min-height: 19px;
    margin: 0 0 9px;
    overflow: hidden;
    color: var(--ink-500);
    font-size: 13px;
    line-height: 19px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.parse-status.is-error {
    color: var(--red-600);
}

.parse-status.is-success {
    color: var(--green-600);
}

.action-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 10px;
}

button,
.primary-button,
.secondary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

button:active,
.primary-button:active {
    transform: translateY(1px);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.primary-button {
    color: #fff;
    background: var(--blue-600);
    border: 1px solid var(--blue-600);
}

.primary-button:hover:not(:disabled) {
    background: var(--blue-700);
    border-color: var(--blue-700);
}

.secondary-button {
    min-height: 38px;
    padding: 0 8px;
    color: #23415e;
    background: #f6f9fc;
    border: 1px solid var(--line-strong);
    font-size: 12px;
}

.secondary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled) {
    color: var(--blue-700);
    background: var(--surface-blue);
    border-color: #a8c9ff;
}

.ghost-button {
    color: var(--ink-700);
    background: #fff;
    border: 1px solid var(--line-strong);
}

.map-panel {
    position: relative;
    display: grid;
    grid-template-rows: 58px minmax(0, 1fr) 36px;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
    background: #d8e1e8;
}

.map-toolbar {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 18px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line-strong);
    box-shadow: 0 6px 18px rgba(22, 36, 51, 0.08);
}

.map-toolbar > div:first-child {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.map-toolbar strong {
    font-size: 16px;
}

.map-toolbar span {
    color: var(--ink-500);
    font-size: 13px;
}

.map-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-actions button {
    min-height: 34px;
    color: var(--ink-700);
    background: #fff;
    border: 1px solid var(--line-strong);
    font-size: 13px;
}

.map-actions button:hover {
    color: var(--blue-700);
    border-color: #9bbfff;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #dbe5ec;
}

.map-legend {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 17px;
    color: var(--ink-500);
    background: #fff;
    border-top: 1px solid var(--line);
    font-size: 12px;
}

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

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.success {
    background: var(--green-600);
    box-shadow: 0 0 0 3px rgba(16, 167, 120, 0.15);
}

.map-legend [hidden] {
    display: none !important;
}

.legend-line {
    width: 24px;
    height: 4px;
    border-radius: 999px;
    background: #d94a4a;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.map-legend b {
    font-weight: 700;
}

.map-panel.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 999999;
    width: 100vw;
    height: 100vh;
}

.xy-marker-icon {
    display: block;
    object-fit: contain;
    pointer-events: none;
}

.xy-info-window {
    min-width: 250px;
    max-width: 360px;
    color: var(--ink-900);
    font-size: 13px;
    line-height: 1.65;
}

.xy-info-window strong {
    display: block;
    margin-bottom: 5px;
    font-size: 15px;
}

.xy-info-window span {
    color: var(--ink-500);
}

.gate-page {
    min-height: 100vh;
    height: 100vh;
    padding: 24px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 14% 16%, rgba(34, 199, 232, 0.18), transparent 27%),
        radial-gradient(circle at 82% 22%, rgba(40, 120, 255, 0.22), transparent 31%),
        linear-gradient(145deg, var(--navy-950), var(--navy-800) 54%, #10233e);
}

.gate-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
}

.gate-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 54px;
}

.gate-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
}

.gate-brand img {
    display: block;
    width: 116px;
    max-height: 34px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.gate-brand span {
    padding-left: 12px;
    color: #bcd0e8;
    border-left: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 12px;
}

.gate-nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gate-nav-links a {
    padding: 9px 13px;
    color: #d9e7f7;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.gate-nav-links a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.gate-main {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
    gap: 34px;
    align-items: center;
    padding: 54px 0 44px;
}

.gate-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    color: #b9ebff;
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(125, 211, 252, 0.28);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.7px;
}

.gate-eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    background: #38d4f4;
    border-radius: 50%;
    box-shadow: 0 0 0 5px rgba(56, 212, 244, 0.1);
}

.gate-copy h1 {
    max-width: 720px;
    margin: 19px 0 14px;
    color: #fff;
    font-size: clamp(38px, 5vw, 66px);
    line-height: 1.06;
    letter-spacing: -2.4px;
}

.gate-lead {
    max-width: 710px;
    margin: 0;
    color: #c4d4e8;
    font-size: 16px;
    line-height: 1.85;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 28px;
}

.feature-item {
    min-height: 112px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    backdrop-filter: blur(12px);
}

.feature-num {
    color: #59d8f2;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1px;
}

.feature-item strong {
    display: block;
    margin-top: 8px;
    color: #fff;
    font-size: 14px;
}

.feature-item span:last-child {
    display: block;
    margin-top: 5px;
    color: #aabdd2;
    font-size: 12px;
    line-height: 1.55;
}

.gate-note {
    margin-top: 18px;
    padding: 12px 14px;
    color: #b8c8da;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid #f97316;
    font-size: 12px;
    line-height: 1.65;
}

.access-card {
    overflow: hidden;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 22px;
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.34);
}

.access-visual {
    display: flex;
    align-items: flex-end;
    height: 190px;
    overflow: hidden;
    padding: 24px;
    background:
        radial-gradient(circle at 76% 24%, rgba(70, 205, 255, 0.34), transparent 26%),
        linear-gradient(145deg, #0c2340, #176bff);
}

.access-visual-copy {
    color: #fff;
}

.access-visual-copy span,
.access-visual-copy small {
    display: block;
}

.access-visual-copy span {
    color: #8de5ff;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.14em;
}

.access-visual-copy strong {
    display: block;
    margin-top: 7px;
    font-size: 23px;
    line-height: 1.3;
}

.access-visual-copy small {
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.access-body {
    padding: 24px;
}

.access-status {
    display: inline-flex;
    padding: 5px 8px;
    color: #be123c;
    background: #fff1f2;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
}

.access-status.logged {
    color: #c2410c;
    background: #fff7ed;
}

.access-body h2 {
    margin: 13px 0 7px;
    color: var(--ink-900);
    font-size: 22px;
    letter-spacing: -0.4px;
}

.access-body p {
    margin: 0;
    color: var(--ink-500);
    font-size: 13px;
    line-height: 1.7;
}

.member-name {
    margin-top: 12px;
    padding: 10px 12px;
    color: #9a3412;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    font-size: 12px;
}

.member-name strong {
    color: #7c2d12;
}

.access-actions {
    display: grid;
    gap: 9px;
    margin-top: 19px;
}

.gate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 43px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 850;
    text-decoration: none;
}

.gate-btn.primary {
    color: #fff;
    background: linear-gradient(180deg, #3284ff, #1767e8);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}

.gate-btn.vip {
    color: #fff;
    background: linear-gradient(180deg, #ff8a35, #ed6414);
    box-shadow: 0 10px 22px rgba(234, 88, 12, 0.22);
}

.gate-btn.secondary {
    color: #334155;
    background: #f8fafc;
    border: 1px solid var(--line);
}

.gate-btn:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
}

.plan-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.access-foot {
    margin-top: 15px;
    padding-top: 14px;
    color: #94a3b8;
    border-top: 1px solid #e7edf4;
    font-size: 10px;
    line-height: 1.6;
    text-align: center;
}

body.csv-dialog-open {
    overflow: hidden;
}

.csv-dialog[hidden] {
    display: none;
}

.csv-dialog {
    position: fixed;
    z-index: 12000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.16s ease;
}

.csv-dialog.is-open {
    opacity: 1;
}

.csv-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 17, 29, 0.68);
    backdrop-filter: blur(3px);
}

.csv-dialog-card {
    position: relative;
    display: grid;
    grid-template-rows: auto auto auto minmax(150px, 1fr) auto auto;
    width: min(980px, 100%);
    max-height: min(760px, calc(100vh - 48px));
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 14px;
    box-shadow: 0 28px 80px rgba(4, 18, 32, 0.34);
    transform: translateY(8px);
    transition: transform 0.16s ease;
}

.csv-dialog.is-open .csv-dialog-card {
    transform: translateY(0);
}

.csv-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 24px 18px;
    color: #fff;
    background:
        radial-gradient(circle at 88% 0%, rgba(62, 151, 255, 0.28), transparent 42%),
        linear-gradient(145deg, var(--navy-950), var(--navy-800));
    border-bottom: 3px solid var(--blue-600);
}

.csv-dialog-eyebrow {
    color: #79baff;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.18em;
}

.csv-dialog-header h2 {
    margin: 5px 0 4px;
    font-size: 21px;
}

.csv-dialog-header p {
    margin: 0;
    color: rgba(255, 255, 255, 0.68);
    font-size: 13px;
}

.csv-dialog-close {
    flex: 0 0 36px;
    min-height: 36px;
    padding: 0;
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
}

.csv-dialog-close:hover {
    background: rgba(255, 255, 255, 0.17);
}

.csv-dialog-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 14px;
    padding: 18px 24px 14px;
    background: #f7f9fc;
    border-bottom: 1px solid var(--line);
}

.csv-dialog-controls label > span {
    display: block;
    margin-bottom: 7px;
    color: var(--ink-700);
    font-size: 13px;
    font-weight: 800;
}

.csv-preview-summary {
    padding: 11px 24px;
    color: #285171;
    background: #edf6ff;
    border-bottom: 1px solid #d3e7fb;
    font-size: 13px;
    line-height: 1.5;
}

.csv-preview-summary.is-error {
    color: #9f312c;
    background: #fff1f0;
    border-color: #f2cac7;
}

.csv-preview-wrap {
    min-height: 150px;
    overflow: auto;
    margin: 0;
    background: #fff;
    scrollbar-color: #b8c6d2 transparent;
    scrollbar-width: thin;
}

.csv-preview-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--ink-700);
    font-size: 13px;
}

.csv-preview-table th,
.csv-preview-table td {
    min-width: 145px;
    max-width: 280px;
    padding: 10px 12px;
    overflow: hidden;
    border-right: 1px solid #e6edf3;
    border-bottom: 1px solid #e6edf3;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.csv-preview-table th {
    position: sticky;
    z-index: 2;
    top: 0;
    color: #2a4055;
    background: #eef2f6;
    font-weight: 900;
}

.csv-preview-table .is-address-column {
    background: #eaf3ff;
    box-shadow: inset 2px 0 #6fa8ff, inset -2px 0 #6fa8ff;
}

.csv-preview-table th.is-address-column {
    color: #0e56d8;
    background: #dceaff;
}

.csv-dialog-note {
    margin: 0;
    padding: 12px 24px;
    color: var(--ink-500);
    background: #f8fafc;
    border-top: 1px solid var(--line);
    font-size: 12px;
    line-height: 1.55;
}

.csv-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px 18px;
    background: #fff;
    border-top: 1px solid var(--line);
}

.csv-dialog-actions button {
    min-width: 116px;
}

@media (max-width: 1100px) {
    .xy-app {
        grid-template-columns: minmax(370px, 420px) minmax(0, 1fr);
    }

    .map-legend span:last-child {
        display: none;
    }
}

@media (max-width: 900px) {
    .gate-main {
        grid-template-columns: 1fr;
        padding-top: 34px;
    }

    .access-card {
        width: min(520px, 100%);
    }

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

@media (max-width: 820px) {
    body {
        overflow: auto;
    }

    .xy-app {
        display: block;
        height: auto;
        min-height: 100vh;
        margin-left: 0;
        overflow: visible;
    }

    .control-panel {
        height: auto;
        overflow: visible;
    }

    .panel-scroll {
        overflow: visible;
    }

    .panel-actions {
        position: sticky;
        bottom: 0;
        z-index: 20;
    }

    .map-panel {
        height: 72vh;
        min-height: 520px;
    }

}

@media (max-width: 560px) {
    .gate-page {
        padding: 15px;
    }

    .gate-brand span,
    .gate-nav-links a:first-child {
        display: none;
    }

    .gate-nav-links {
        gap: 6px;
    }

    .gate-nav-links a {
        padding: 8px 9px;
    }

    .gate-main {
        gap: 26px;
    }

    .gate-copy h1 {
        font-size: 38px;
        letter-spacing: -1.5px;
    }

    .gate-lead {
        font-size: 14px;
    }

    .feature-item {
        min-height: 118px;
    }

    .access-visual {
        height: 160px;
    }

    .plan-row {
        grid-template-columns: 1fr;
    }

    .csv-dialog {
        padding: 10px;
    }

    .csv-dialog-card {
        max-height: calc(100vh - 20px);
        border-radius: 10px;
    }

    .csv-dialog-header,
    .csv-dialog-controls,
    .csv-dialog-note,
    .csv-dialog-actions {
        padding-left: 15px;
        padding-right: 15px;
    }

    .csv-dialog-controls {
        grid-template-columns: 1fr;
    }

    .csv-preview-summary {
        padding-left: 15px;
        padding-right: 15px;
    }
}

@media (max-width: 520px) {
    .brand-header,
    .panel-section {
        padding-left: 16px;
        padding-right: 16px;
    }

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

    .geojson-export-options label {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .map-toolbar {
        height: auto;
        min-height: 72px;
        align-items: flex-start;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .map-toolbar > div:first-child {
        display: block;
    }

    .map-toolbar span {
        display: block;
        margin-top: 3px;
    }

    .map-actions button {
        padding: 0 9px;
    }
}
