:root {
    --bg: #050c15;
    --bg-soft: #0b1524;
    --bg-panel: rgba(10, 19, 31, 0.92);
    --bg-panel-strong: rgba(12, 22, 36, 0.98);
    --bg-elevated: rgba(17, 29, 46, 0.95);
    --stroke: rgba(149, 172, 201, 0.16);
    --stroke-strong: rgba(90, 132, 178, 0.35);
    --text: #edf4ff;
    --muted: #98acc4;
    --accent: #4db1ff;
    --accent-soft: #7dc7ff;
    --green: #2ecea1;
    --warning: #ffc857;
    --danger: #ff7f7f;
    --shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 18px;
    --sidebar-width: 276px;
}

html,
body {
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: "IBM Plex Sans", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(77, 177, 255, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(46, 206, 161, 0.08), transparent 22%),
        linear-gradient(180deg, #040912 0%, #09111c 46%, #050b13 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 75%);
    opacity: 0.22;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    padding: 1.35rem 1rem;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 28%),
        linear-gradient(180deg, #0a131f 0%, #08111c 100%);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.app-main {
    flex: 1;
    padding: 1.5rem;
    position: relative;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.4rem 0.5rem 1.2rem;
}

.brand-mark {
    width: 3rem;
    height: 3rem;
    display: grid;
    place-items: center;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(77, 177, 255, 0.22), rgba(46, 206, 161, 0.2));
    color: #b9e2ff;
    font-size: 1.2rem;
}

.sidebar-brand h1 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: 2.1rem;
    line-height: 1;
}

.sidebar-brand p {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.sidebar-nav {
    display: grid;
    gap: 0.45rem;
    padding: 1rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1rem;
    border: 1px solid transparent;
    border-radius: 16px;
    color: #d9e8fb;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.03);
    transition: 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.is-active {
    color: #fff;
    border-color: rgba(77, 177, 255, 0.2);
    background: linear-gradient(135deg, rgba(77, 177, 255, 0.14), rgba(255, 255, 255, 0.04));
}

.sidebar-status,
.sidebar-footer {
    margin-top: 1.3rem;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-title,
.section-kicker,
.summary-label,
.muted-note {
    color: var(--muted);
}

.sidebar-title,
.section-kicker {
    margin: 0 0 0.8rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.sidebar-status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.45rem 0;
}

.sidebar-story {
    display: grid;
    gap: 0.85rem;
}

.sidebar-story p {
    margin: 0;
    color: #d7e4f4;
    line-height: 1.7;
}

.status-dot {
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 50%;
}

.status-dot.ok {
    background: var(--green);
    box-shadow: 0 0 0 6px rgba(46, 206, 161, 0.12);
}

.status-dot.bad {
    background: var(--danger);
    box-shadow: 0 0 0 6px rgba(255, 127, 127, 0.12);
}

.sidebar-footer p {
    margin: 0;
    color: var(--muted);
    font-size: 0.93rem;
    line-height: 1.6;
}

.panel {
    position: relative;
    padding: 1.5rem;
    border: 1px solid var(--stroke);
    border-radius: var(--radius-xl);
    background:
        radial-gradient(circle at top right, rgba(77, 177, 255, 0.08), transparent 26%),
        linear-gradient(180deg, rgba(12, 21, 34, 0.98), rgba(8, 16, 27, 0.96));
    box-shadow: var(--shadow);
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 45%);
    pointer-events: none;
}

.hero-section::before {
    content: "";
    position: absolute;
    top: -4rem;
    right: -5rem;
    width: 18rem;
    height: 18rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(77, 177, 255, 0.18), transparent 68%);
    pointer-events: none;
}

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

.hero-section {
    padding: 1.8rem;
}

.hero-topline,
.upload-footer,
.section-header,
.builder-card-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.eyebrow-pill,
.hero-mode-label,
.mode-chip,
.status-pill,
.mode-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    font-weight: 700;
}

.eyebrow-pill {
    padding: 0.45rem 0.8rem;
    background: rgba(77, 177, 255, 0.14);
    color: #bee3ff;
    font-size: 0.82rem;
}

.hero-mode-label {
    padding: 0.45rem 0.8rem;
    background: rgba(255, 255, 255, 0.06);
    color: #d7e4f6;
    font-size: 0.82rem;
}

.hero-title,
.section-title,
.sidebar-brand h1 {
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: -0.04em;
}

.section-title {
    margin: 0;
    font-size: clamp(1.35rem, 2vw, 1.95rem);
}

.hero-title {
    margin: 1rem 0 0.8rem;
    max-width: 20ch;
    font-size: clamp(2.15rem, 4vw, 3.9rem);
    line-height: 1.03;
}

.hero-subtitle {
    max-width: 68rem;
    margin: 0 0 1.4rem;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.workflow-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.4rem;
}

.workflow-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
}

.workflow-item span {
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(77, 177, 255, 0.18), rgba(46, 206, 161, 0.14));
    color: #d8efff;
    font-weight: 700;
}

.upload-slab {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.section-header {
    margin-bottom: 1.25rem;
}

.upload-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 1.4rem;
    border: 1.5px dashed rgba(255, 255, 255, 0.16);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(77, 177, 255, 0.06), rgba(255, 255, 255, 0.02));
    cursor: pointer;
    transition: 0.18s ease;
}

.upload-dropzone:focus-visible {
    outline: 0;
    border-color: rgba(77, 177, 255, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(77, 177, 255, 0.14);
}

.upload-dropzone-wide {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.upload-dropzone.is-dragover {
    border-color: rgba(77, 177, 255, 0.5);
    background: linear-gradient(180deg, rgba(77, 177, 255, 0.14), rgba(255, 255, 255, 0.04));
    transform: translateY(-1px);
}

.upload-input-hidden {
    display: none !important;
}

.upload-chip {
    padding: 0.7rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #d6e7fb;
    font-weight: 600;
    white-space: nowrap;
}

.upload-icon {
    width: 4rem;
    height: 4rem;
    display: grid;
    place-items: center;
    border-radius: 1.15rem;
    background: linear-gradient(135deg, rgba(77, 177, 255, 0.16), rgba(46, 206, 161, 0.16));
    color: #d7efff;
    font-size: 1.7rem;
    flex-shrink: 0;
}

.upload-text {
    display: grid;
    gap: 0.2rem;
    flex: 1;
    margin: 0 1rem;
}

.upload-text strong {
    font-size: 1.35rem;
}

.upload-text span {
    color: var(--muted);
}

.tool-inline-status {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.status-pill {
    padding: 0.45rem 0.8rem;
    font-size: 0.82rem;
}

.status-pill.ready {
    background: rgba(46, 206, 161, 0.14);
    color: #9aefd5;
}

.status-pill.missing {
    background: rgba(255, 127, 127, 0.14);
    color: #ffb5b5;
}

.landing-card,
.guidance-card,
.builder-card,
.viewer-side-panel,
.clean-box {
    height: 100%;
    padding: 1.3rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.page-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.page-card-link:hover .landing-card,
.builder-card:hover,
.viewer-side-panel:hover,
.clean-box:hover {
    transform: translateY(-2px);
    border-color: rgba(77, 177, 255, 0.2);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
    background: rgba(255, 255, 255, 0.045);
}

.route-empty-panel {
    padding: 1.5rem;
}

.route-empty-copy {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.7;
}

.workspace-banner {
    padding: 1.2rem 1.35rem;
}

.workspace-banner-inner {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr) auto;
    gap: 1.2rem;
    align-items: center;
}

.workspace-banner-media {
    width: 132px;
    height: 110px;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.workspace-banner-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.workspace-banner-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 1.75rem;
}

.workspace-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.85rem;
}

.summary-pill {
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #d8e8fb;
    font-size: 0.86rem;
}

.workspace-banner-actions {
    display: grid;
    justify-items: end;
    gap: 0.8rem;
}

.landing-card h3,
.guidance-card strong,
.builder-card-head h3,
.viewer-side-panel h3 {
    margin-bottom: 0.55rem;
    font-size: 1.18rem;
}

.landing-card p,
.guidance-card p,
.builder-card-head p,
.clean-copy p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.mode-chip {
    padding: 0.35rem 0.7rem;
    margin-bottom: 1rem;
    background: rgba(77, 177, 255, 0.12);
    color: #bfe4ff;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.process-grid,
.guidance-grid {
    display: grid;
    gap: 1rem;
}

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

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

.process-step {
    padding: 1rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.process-step span {
    display: inline-block;
    margin-bottom: 0.55rem;
    color: var(--accent-soft);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.mode-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.mode-switch {
    padding: 0.7rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: #dce8f8;
    text-decoration: none;
}

.mode-switch.active,
.mode-switch.is-active,
.mode-switch:hover {
    border-color: rgba(77, 177, 255, 0.3);
    background: linear-gradient(135deg, rgba(77, 177, 255, 0.12), rgba(255, 255, 255, 0.03));
    color: #fff;
}

.builder-hint,
.builder-note {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(77, 177, 255, 0.18);
    background: rgba(77, 177, 255, 0.08);
    color: #d7e8fa;
}

.builder-note.success {
    border-color: rgba(46, 206, 161, 0.18);
    background: rgba(46, 206, 161, 0.08);
}

.builder-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1.35rem;
    padding: 1.1rem 1.2rem;
    border-radius: 20px;
    border: 1px solid rgba(77, 177, 255, 0.2);
    background: linear-gradient(135deg, rgba(77, 177, 255, 0.12), rgba(46, 206, 161, 0.08));
}

.builder-action-bar p {
    color: var(--muted);
}

.builder-final-button {
    white-space: nowrap;
}

.builder-card-head {
    align-items: flex-start;
    justify-content: flex-start;
    margin-bottom: 1rem;
}

.card-icon {
    width: 2.85rem;
    height: 2.85rem;
    display: grid;
    place-items: center;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(77, 177, 255, 0.16), rgba(46, 206, 161, 0.16));
    color: #d7efff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.preset-meta {
    display: grid;
    gap: 0.25rem;
    margin-top: 0.9rem;
    padding: 1rem 1.05rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--muted);
}

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

.preview-shell {
    min-height: 19rem;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
}

.preview-image {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 19rem;
    object-fit: cover;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.summary-tile {
    padding: 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.summary-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.preview-table {
    display: grid;
    gap: 0.55rem;
}

.preview-row {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 0.75rem;
    align-items: center;
    padding: 0.7rem 0.85rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-row span {
    color: var(--muted);
    font-size: 0.94rem;
}

.preview-row strong {
    text-align: right;
    word-break: break-word;
}

.viewer-side-cta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.viewer-side-cta strong {
    display: block;
    margin-bottom: 0.35rem;
}

.viewer-side-cta p {
    color: var(--muted);
    line-height: 1.6;
}

.viewer-panel,
.clean-panel,
.builder-panel {
    scroll-margin-top: 1rem;
}

.metadata-tabs .nav-link {
    border-radius: 999px;
    color: #d0def0;
    background: rgba(255, 255, 255, 0.04);
}

.metadata-tabs .nav-link.active {
    color: #031522;
    background: linear-gradient(135deg, var(--accent), #8ad1ff);
}

.metadata-accordion .accordion-item,
.metadata-accordion .accordion-button,
.metadata-accordion .accordion-body {
    background: transparent;
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.07);
}

.metadata-accordion .accordion-item {
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.metadata-accordion .accordion-button:not(.collapsed) {
    box-shadow: none;
    background: rgba(255, 255, 255, 0.04);
}

.metadata-table {
    margin-bottom: 0;
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.06);
    --bs-table-color: var(--text);
    --bs-table-border-color: rgba(255, 255, 255, 0.08);
}

.map-shell {
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.map-frame {
    min-height: 320px;
}

.leaflet-container {
    background: #152538;
}

.empty-state,
.map-empty {
    display: grid;
    place-items: center;
    min-height: 14rem;
    text-align: center;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.14);
    color: var(--muted);
    padding: 1.5rem;
}

.clean-list {
    margin: 1rem 0 0;
    padding-left: 1.1rem;
    color: var(--muted);
}

.clean-list li + li {
    margin-top: 0.55rem;
}

.btn-accent {
    border: 0;
    color: #051523;
    background: linear-gradient(135deg, var(--accent), #9bd9ff);
    box-shadow: 0 14px 40px rgba(77, 177, 255, 0.24);
}

.btn-accent:hover,
.btn-accent:focus {
    color: #051523;
    background: linear-gradient(135deg, #63bcff, #b0e2ff);
}

.form-control,
.form-select {
    border-color: rgba(255, 255, 255, 0.12);
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    color: var(--text);
    background-color: rgba(255, 255, 255, 0.07);
    border-color: rgba(77, 177, 255, 0.45);
    box-shadow: 0 0 0 0.2rem rgba(77, 177, 255, 0.16);
}

.form-control::placeholder {
    color: rgba(237, 244, 255, 0.38);
}

select.form-select,
select.form-select option,
select.form-select optgroup {
    color: var(--text);
    background: #08111d;
}

select.form-select {
    color-scheme: dark;
}

.form-check-input {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

code {
    color: #cbe9ff;
}

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

    .app-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    }

    .guidance-grid,
    .process-grid,
    .workflow-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workspace-banner-inner {
        grid-template-columns: 110px minmax(0, 1fr);
    }

    .workspace-banner-actions {
        grid-column: 1 / -1;
        justify-items: start;
    }
}

@media (max-width: 991.98px) {
    .app-main {
        padding: 1rem;
    }

    .hero-section,
    .panel {
        padding: 1.2rem;
    }

    .upload-dropzone-wide,
    .upload-footer,
    .hero-topline {
        flex-direction: column;
        align-items: stretch;
    }

    .upload-text {
        margin: 0;
    }

    .upload-chip {
        align-self: flex-start;
    }

    .summary-grid,
    .guidance-grid,
    .process-grid,
    .workflow-strip {
        grid-template-columns: 1fr;
    }

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

    .preview-row strong {
        text-align: left;
    }

    .builder-action-bar,
    .workspace-banner-inner {
        grid-template-columns: 1fr;
        display: grid;
    }

    .builder-final-button {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .sidebar-nav {
        grid-template-columns: 1fr 1fr;
    }

    .sidebar-link span {
        font-size: 0.92rem;
    }
}
