:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --green: #16a34a;
    --red: #dc2626;
    --blue: #2563eb;
    --radius: 20px;
    --panel-width: 420px;

    font-family: Inter, system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 30%),
    linear-gradient(135deg, #f8fbff 0%, #f3f6fb 100%);
    color: var(--text);
}

.app-shell {
    position: relative;
    display: grid;
    grid-template-columns: var(--panel-width) 1fr;
    min-height: 100vh;
    padding: 16px;
    transition: grid-template-columns 0.25s ease;
}

.app-shell.panel-collapsed {
    grid-template-columns: 0 1fr;
}

.panel,
.map-card {
    background: rgba(255, 255, 255, 0.88);
    border-radius: var(--radius);
    overflow: hidden;
    backdrop-filter: blur(18px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08),
    0 2px 10px rgba(0, 0, 0, 0.04);
}

.panel {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.7);
    transition: transform 0.25s ease,
    opacity 0.2s ease;
}

.app-shell.panel-collapsed .panel {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

.header,
.content {
    padding: 20px;
}

.header {
    padding-top: 18px;
}

.eyebrow {
    display: inline-block;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.header h1 {
    margin: 10px 0 8px;
    font-size: 38px;
    line-height: 1;
    letter-spacing: -0.04em;
}

.subline {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 20px 0;
}

.stat {
    background: rgba(249, 250, 251, 0.9);
    border: 1px solid rgba(229, 231, 235, 0.7);
    border-radius: 16px;
    padding: 14px;
}

.stat strong {
    display: block;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.stat span {
    color: var(--muted);
    font-size: 13px;
}

.form-grid,
.place-list {
    display: grid;
    gap: 12px;
}

.two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
    font-size: 14px;
}

.leaflet-control-layers label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    font-weight: 600;
    font-size: 13px;
}

.leaflet-control-layers input {
    width: auto;
    margin: 0;
}

.leaflet-control-menu-toggle button {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    background: #ffffff;
    color: #000000;
    cursor: pointer;
}

.leaflet-control-menu-toggle button:hover,
.leaflet-control-menu-toggle button:focus-visible {
    background: #f4f4f4;
}

.leaflet-control-menu-toggle button:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.45);
    outline-offset: -2px;
}

.map-menu-toggle-icon::before {
    content: "☰";
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.leaflet-left {
    z-index: 1300;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.95);
    transition: border-color 0.2s ease,
    box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.button-row,
.toolbar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar {
    flex-direction: column;
    align-items: stretch;
    margin: 10px 0;
}

.toolbar .btn {
    align-self: flex-start;
}

.btn {
    border: 0;
    border-radius: 14px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.15s ease,
    opacity 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--text);
    color: white;
}

.btn-secondary {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.btn-ghost {
    background: #f3f4f6;
}

.btn-danger {
    background: #fee2e2;
    color: #991b1b;
}

.place-card {
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 16px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.96);
    transition: transform 0.15s ease,
    box-shadow 0.15s ease;
}

.place-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}

.place-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.place-card p {
    margin: 4px 0;
    line-height: 1.45;
}

.place-url {
    overflow-wrap: anywhere;
}

.place-url a {
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.visited {
    color: var(--green);
    font-weight: 700;
}

.todo {
    color: var(--red);
    font-weight: 700;
}

.map-card {
    position: relative;
    min-width: 0;
}

#map {
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 32px);
}

.custom-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.marker-visited {
    background: var(--green);
}

.marker-todo {
    background: var(--red);
}

.empty {
    color: var(--muted);
}

.mobile-panel-close {
    display: none;
}

.panel-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
        min-height: 100dvh;
        padding: 0;
        gap: 0;
    }

    .app-shell.panel-collapsed {
        grid-template-columns: 1fr;
    }

    .panel {
        position: absolute;
        top: 12px;
        left: 12px;
        bottom: 12px;
        width: min(420px, calc(100vw - 24px));
        z-index: 1200;
        display: flex;
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-panel-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 0;
        background: transparent;
        color: var(--blue);
        cursor: pointer;
        font-weight: 800;
        font-size: 14px;
    }

    .header {
        padding-top: 18px;
    }

    .app-shell.panel-collapsed .panel {
        transform: translateX(calc(-100% - 24px));
        opacity: 0;
        pointer-events: none;
    }

    .map-card {
        height: 100dvh;
        min-height: 100dvh;
        border-radius: 0;
    }

    #map {
        height: 100dvh;
        min-height: 100dvh;
    }

    .two-cols {
        grid-template-columns: 1fr;
    }
}
