    @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

    :root {
        --orange: #F57C00;
        --red: #E53935;
        --cyan: #00ACC1;
        --bg: #F5F7FA;
        --bg-white: #FFFFFF;
        --bg-card: #FFFFFF;
        --text: #1A202C;
        --text-secondary: #4A5568;
        --text-muted: #A0AEC0;
        --accent: #3182CE;
        --accent-light: #EBF4FF;
        --border: #E2E8F0;
        --shadow: rgba(0,0,0,0.08);
        --shadow-md: rgba(0,0,0,0.12);
    }

    * { margin: 0; padding: 0; box-sizing: border-box; }

    body {
        font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
        background: var(--bg);
        color: var(--text);
        overflow: hidden;
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    /* ===== Top Navigation ===== */
    .topbar {
        height: 36px; background: var(--bg-white);
        border-bottom: 1px solid var(--border);
        display: flex; align-items: center; justify-content: space-between;
        padding: 0 16px; position: relative; z-index: 1000;
        box-shadow: 0 1px 3px var(--shadow); flex-shrink: 0;
    }
    .topbar-left { display: flex; align-items: center; gap: 6px; }
    .topbar-logo {
        width: 22px; height: 22px;
        border-radius: 6px; overflow: hidden;
        box-shadow: 0 2px 6px rgba(0,188,193,0.3);
        flex-shrink: 0;
    }
    .topbar-logo img {
        width: 100%; height: 100%; object-fit: cover;
    }
    .topbar-title { font-size: 13px; font-weight: 700; color: var(--text); }
    .topbar-right { display: flex; align-items: center; gap: 8px; }
    .legend { display: flex; gap: 8px; font-size: 11px; color: var(--text-secondary); }
    .legend-item { display: flex; align-items: center; gap: 6px; }
    .legend-dot { width: 10px; height: 10px; border-radius: 50%; }
    .btn {
        padding: 7px 12px; border-radius: 8px; border: none;
        font-family: inherit; font-size: 12px; font-weight: 500;
        cursor: pointer; transition: all 0.2s;
        display: flex; align-items: center; gap: 6px;
    }
    .btn-outline { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
    .btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
    .btn-outline.active { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

    /* ===== Map Area ===== */
    #mapWrap {
        flex: 1; display: flex; flex-direction: column; min-height: 0;
        position: relative; z-index: 1;
    }
    #map { flex: 1; z-index: 1; min-height: 0; }
    .leaflet-popup-content-wrapper {
        background: var(--bg-white) !important; color: var(--text) !important;
        border-radius: 12px !important; box-shadow: 0 4px 24px var(--shadow-md) !important;
        border: 1px solid var(--border) !important; max-width: 320px !important;
    }
    .leaflet-popup-tip { background: var(--bg-white) !important; border: 1px solid var(--border) !important; border-top: none !important; border-left: none !important; }
    .leaflet-popup-content { margin: 12px 16px !important; line-height: 1.5 !important; }
    .popup-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
    .popup-date { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
    .popup-desc { font-size: 12px; color: #718096; margin-top: 4px; }
    .popup-persons { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
    .popup-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
    .popup-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
    .popup-btn {
        font-size: 11px; padding: 4px 10px; border-radius: 6px;
        border: 1px solid var(--border); background: var(--bg-white);
        color: var(--text-secondary); cursor: pointer; font-family: inherit; transition: all 0.2s;
    }
    .popup-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
    .popup-link { font-size: 11px; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
    .popup-link:hover { text-decoration: underline; }

    /* ===== Bottom Navigation ===== */
    .bottom-nav {
        position: fixed; bottom: 0; left: 0; right: 0;
        display: flex; background: var(--bg-white);
        border-top: 1px solid var(--border);
        height: 40px; z-index: 600;
    }
    body { padding-bottom: 40px; }
    .bottom-nav-btn {
        flex: 1; display: flex; align-items: center; justify-content: center;
        gap: 4px; padding: 0 8px;
        border: none; background: transparent; color: var(--text-muted);
        cursor: pointer; font-family: inherit; font-size: 11px;
        transition: color 0.2s;
    }
    .bottom-nav-btn i { font-size: 14px; font-style: normal; }
    .bottom-nav-btn.active { color: var(--accent); font-weight: 600; }
    .bottom-nav-btn:hover { color: var(--text-secondary); }

    /* ===== Bottom Section (draggable sheet) ===== */
    .bottom-section {
        flex-shrink: 0; display: flex; flex-direction: column;
        height: 50vh; overflow: hidden;
        transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 500; position: relative;
    }
    .bottom-section.dragging { transition: none; }

    /* Drag handle */
    .bottom-panel-handle {
        width: 36px; height: 4px;
        border-radius: 3px; background: #CBD5E0;
        margin: 8px auto 6px;
        cursor: grab; flex-shrink: 0;
        touch-action: none; -webkit-user-select: none; user-select: none;
    }
    .bottom-panel-handle:active { cursor: grabbing; }

    /* ===== Bottom Panel ===== */
    .bottom-panel {
        background: var(--bg-white); border-top: 1px solid var(--border);
        display: flex; flex-direction: column;
        flex: 1; min-height: 0; overflow: hidden;
        box-shadow: 0 -2px 8px var(--shadow); z-index: 500;
    }
    .bottom-panel-content {
        flex: 1; overflow-y: auto; min-height: 0;
    }

    /* ===== Filter Tabs ===== */
    .filter-row {
        display: flex; align-items: center; justify-content: space-between;
        padding: 8px 20px; background: var(--bg);
        border-bottom: 1px solid var(--border); gap: 12px;
    }
    .filter-row .filter-tabs {
        padding: 0; border-bottom: none; background: transparent; gap: 2px;
    }
    .filter-tabs {
        display: flex; gap: 4px; padding: 12px 20px;
        border-bottom: 1px solid var(--border); background: var(--bg);
    }
    #listView, #calendarView, #checkinView, #statsView { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
    #calendarView, #statsView { display: none; }
    .filter-tab {
        padding: 4px 10px; border-radius: 20px; font-size: 11px;
        border: 1px solid transparent; background: transparent;
        color: var(--text-muted); cursor: pointer; font-family: inherit; transition: all 0.2s; font-weight: 500;
        white-space: nowrap; flex-shrink: 0;
    }
    .filter-tab.active { background: var(--accent); color: white; box-shadow: 0 2px 6px rgba(49,130,206,0.3); }
    .filter-tab:hover:not(.active) { color: var(--text-secondary); background: #EDF2F7; }

    /* ===== Trip List ===== */
    .trip-list { flex: 1; overflow-y: auto; padding: 12px; }
    .trip-list::-webkit-scrollbar { width: 4px; }
    .trip-list::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 4px; }
    .trip-card {
        background: var(--bg-white); border: 1px solid var(--border); border-radius: 8px;
        padding: 8px 10px; margin-bottom: 4px; cursor: pointer; transition: all 0.2s;
        position: relative; overflow: hidden;
    }
    .trip-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
    .trip-card.type-yunqi::before { background: var(--orange); }
    .trip-card.type-haoyiran::before { background: var(--red); }
    .trip-card.type-both::before { background: var(--cyan); }
    .trip-card:hover { box-shadow: 0 4px 12px var(--shadow-md); transform: translateY(-1px); }
    .trip-card.active { border-color: var(--accent); box-shadow: 0 4px 12px rgba(49,130,206,0.15); }
    .trip-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2px; }
    .trip-route { font-size: 12px; font-weight: 600; color: var(--text); }
    .trip-type-badge { font-size: 10px; padding: 1px 5px; border-radius: 8px; font-weight: 600; }
    .trip-card-top-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
    .trip-meta { display: flex; gap: 10px; font-size: 10px; color: var(--text-muted); margin-bottom: 1px; }
    .trip-meta i { margin-right: 3px; }
    .trip-desc { font-size: 10px; color: var(--text-muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
    .trip-card-actions { display: flex; gap: 3px; margin-top: 3px; justify-content: flex-end; }
    .trip-card-btn {
        font-size: 10px; padding: 2px 6px; border-radius: 4px;
        border: 1px solid var(--border); background: var(--bg-white);
        color: var(--text-muted); cursor: pointer; font-family: inherit;
    }
    .trip-card-btn:hover { border-color: var(--accent); color: var(--accent); }

    /* ===== Calendar ===== */
    .calendar-container { flex: 1; overflow-y: auto; padding: 16px; }
    .calendar-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
    .calendar-nav-btn {
        width: 32px; height: 32px; border-radius: 8px;
        border: 1px solid var(--border); background: var(--bg-white);
        color: var(--text-secondary); cursor: pointer;
        display: flex; align-items: center; justify-content: center; transition: all 0.2s; font-size: 13px;
    }
    .calendar-nav-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
    .calendar-month-label { font-size: 16px; font-weight: 700; color: var(--text); }
    .calendar-today-btn {
        padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border);
        background: var(--bg-white); color: var(--text-muted); font-size: 12px; cursor: pointer; font-family: inherit;
    }
    .calendar-today-btn:hover { border-color: var(--accent); color: var(--accent); }
    .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
    .calendar-weekday { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 8px 0; }
    .calendar-day {
        aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
        border-radius: 10px; cursor: pointer; transition: all 0.15s; position: relative;
        font-size: 13px; color: var(--text-secondary); min-height: 42px;
    }
    .calendar-day:hover { background: var(--accent-light); color: var(--accent); }
    .calendar-day.other-month { color: #CBD5E0; }
    .calendar-day.other-month:hover { color: #A0AEC0; background: #F7FAFC; }
    .calendar-day.today { font-weight: 700; color: var(--accent); background: var(--accent-light); }
    .calendar-day.has-trips { background: #FAFBFC; }
    .calendar-day.selected { background: var(--accent) !important; color: white !important; box-shadow: 0 2px 8px rgba(49,130,206,0.4); }
    .calendar-day.selected .trip-dots .trip-dot { box-shadow: 0 0 0 1.5px white; }
    .calendar-day.out-of-range { color: #D0D5DD; opacity: 0.4; }
    .trip-dots { display: flex; gap: 2px; margin-top: 2px; position: absolute; bottom: 4px; }
    .trip-dot { width: 5px; height: 5px; border-radius: 50%; }
    .calendar-lunar { font-size: 9px; color: var(--text-muted); line-height: 1; margin-top: 1px; position: absolute; top: 3px; }
    .calendar-day.today .calendar-lunar { color: var(--accent); }
    .calendar-day.selected .calendar-lunar { color: rgba(255,255,255,0.8); }
    .calendar-day.other-month .calendar-lunar { color: #E2E8F0; }
    .calendar-day.out-of-range .calendar-lunar { color: #D0D5DD; }
    .calendar-trip-detail { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
    .calendar-trip-detail-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; }
    .calendar-trip-item {
        display: flex; align-items: flex-start; gap: 10px; padding: 10px;
        border-radius: 8px; border: 1px solid var(--border); margin-bottom: 8px;
        cursor: pointer; transition: all 0.2s;
    }
    .calendar-trip-item:hover { border-color: var(--accent); background: var(--accent-light); }
    .calendar-trip-item-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
    .calendar-trip-item-route { font-size: 13px; font-weight: 600; color: var(--text); }
    .calendar-trip-item-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

    /* ===== Modal ===== */
    .modal-overlay {
        position: fixed; inset: 0; background: rgba(0,0,0,0.3);
        backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 2000;
    }
    .modal-overlay.active { display: flex; }
    .modal {
        background: var(--bg-white); border: 1px solid var(--border); border-radius: 16px;
        width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    }
    .modal-header { padding: 20px 24px 0; display: flex; justify-content: space-between; align-items: center; }
    .modal-header h3 { font-size: 18px; font-weight: 700; color: var(--text); }
    .modal-close {
        width: 32px; height: 32px; border-radius: 8px;
        border: 1px solid var(--border); background: var(--bg-white);
        color: var(--text-muted); cursor: pointer; font-size: 16px;
        display: flex; align-items: center; justify-content: center; transition: all 0.2s;
    }
    .modal-close:hover { border-color: #E53E3E; color: #E53E3E; background: #FFF5F5; }
    .modal-body { padding: 20px 24px 24px; }

    /* ===== Toast ===== */
    .toast-container { position: fixed; top: 72px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
    .toast {
        padding: 12px 20px; border-radius: 10px; background: var(--bg-white);
        border: 1px solid var(--border); box-shadow: 0 8px 24px var(--shadow-md);
        font-size: 13px; animation: slideIn 0.3s ease; display: flex; align-items: center; gap: 8px;
    }
    @keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

    /* ===== Stats Bar ===== */
    .stats-bar {
        padding: 8px 20px; background: var(--bg); border-bottom: 1px solid var(--border);
        display: flex; gap: 16px; font-size: 11px; color: var(--text-muted);
    }
    .filter-row .stats-bar {
        padding: 0; background: transparent; border-bottom: none;
        white-space: nowrap; flex-shrink: 0;
    }
    .stat-item i { margin-right: 4px; }

    /* ===== Time Slider Bar (flow layout) ===== */
    .time-slider-bar {
        background: var(--bg-white);
        padding: 4px 12px; display: flex; align-items: center; gap: 8px;
        flex-shrink: 0; border-bottom: 1px solid var(--border);
    }
    #statsView .time-slider-bar { border-bottom: 1px solid var(--border); border-top: none; }
    .time-slider-label {
        font-size: 11px; font-weight: 600; color: var(--text-secondary);
        white-space: nowrap; display: flex; align-items: center; gap: 4px;
    }
    .time-slider-label i { color: var(--accent); font-size: 11px; }
    .time-slider-wrap { flex: 1; display: flex; flex-direction: column; gap: 1px; }
    .time-slider-range { display: flex; align-items: center; gap: 6px; }
    .time-range-display {
        font-size: 10px; color: var(--accent); font-weight: 600;
        background: var(--accent-light); padding: 2px 7px; border-radius: 4px;
        white-space: nowrap;
    }
    input[type="range"] {
        -webkit-appearance: none; appearance: none; width: 100%; height: 3px;
        border-radius: 2px; background: var(--border); outline: none; cursor: pointer;
    }
    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none; appearance: none; width: 14px; height: 14px;
        border-radius: 50%; background: var(--accent); border: 2px solid white;
        box-shadow: 0 1px 3px rgba(0,0,0,0.2); cursor: grab; transition: transform 0.15s;
    }
    input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
    input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.25); }
    input[type="range"]::-moz-range-thumb {
        width: 14px; height: 14px; border-radius: 50%; background: var(--accent);
        border: 2px solid white; box-shadow: 0 1px 3px rgba(0,0,0,0.2); cursor: grab;
    }
    .time-slider-ticks {
        display: flex; justify-content: space-between;
        font-size: 9px; color: var(--text-muted); padding: 0 1px; line-height: 1;
    }

.stats-charts {
        flex: 1; overflow-x: auto; overflow-y: hidden;
        display: flex; gap: 20px; padding: 20px 24px;
        min-height: 280px;
    }
    .stats-charts::-webkit-scrollbar { height: 6px; }
    .stats-charts::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 3px; }
    .chart-card {
        min-width: 280px; max-width: 340px; flex: 1;
        background: var(--bg); border: 1px solid var(--border);
        border-radius: 12px; padding: 16px;
        display: flex; flex-direction: column;
    }
    .chart-card-title {
        font-size: 13px; font-weight: 600; color: var(--text);
        margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
    }
    .chart-card-title i { color: var(--accent); font-size: 12px; }
    .chart-container { flex: 1; min-height: 220px; }

    /* ===== Checkin Categories ===== */
    :root {
        --cat-love: #094FA7;
        --cat-h52: #FF5722;
        --cat-biz: #9C27B0;
        --cat-support: #FF69B4;
        --cat-shop: #4CAF50;
    }
    .category-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px 16px;
    }
    .category-tab {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 5px 12px;
        border-radius: 16px;
        border: 1px solid var(--border);
        background: var(--bg-white);
        font-size: 12px;
        color: var(--text-secondary);
        cursor: pointer;
        white-space: nowrap;
        transition: all 0.2s;
    }
    .category-tab.active {
        background: var(--accent);
        color: white;
        border-color: var(--accent);
    }
    .cat-dot {
        display: inline-block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
    }
    .cat-love { background: var(--cat-love); }
    .cat-h52 { background: var(--cat-h52); }
    .cat-biz { background: var(--cat-biz); }
    .cat-support { background: var(--cat-support); }
    .cat-shop { background: var(--cat-shop); }

    .checkin-stats {
        padding: 0 16px 8px;
        font-size: 12px;
        color: var(--text-muted);
    }
    .checkin-list {
        flex: 1;
        overflow-y: auto;
        padding: 0 16px 16px;
    }
    .checkin-card {
        background: var(--bg-white);
        border-radius: 8px;
        padding: 8px 10px;
        margin-bottom: 4px;
        box-shadow: 0 1px 3px var(--shadow);
        cursor: pointer;
        transition: transform 0.2s, box-shadow 0.2s;
        position: relative;
    }
    .checkin-card:last-child {
        margin-bottom: 0;
    }
    .checkin-card:active {
        transform: scale(0.98);
    }
    .checkin-card-actions {
        display: flex;
        gap: 3px;
        margin-top: 4px;
        justify-content: flex-end;
    }
    .checkin-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 4px;
    }
    .checkin-card-tag {
        font-size: 10px;
        padding: 1px 7px;
        border-radius: 8px;
        color: white;
        font-weight: 500;
    }
    .tag-love { background: var(--cat-love); }
    .tag-h52 { background: var(--cat-h52); }
    .tag-biz { background: var(--cat-biz); }
    .tag-support { background: var(--cat-support); }
    .tag-shop { background: var(--cat-shop); }
    .checkin-card-name {
        font-size: 13px;
        font-weight: 600;
        color: var(--text);
        margin-bottom: 1px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }
    .checkin-card-meta {
        font-size: 10px;
        color: var(--text-muted);
        margin-bottom: 1px;
        line-height: 1.3;
    }
    .checkin-card-desc {
        font-size: 11px;
        color: var(--text-secondary);
        line-height: 1.25;
    }
    .checkin-card-nav {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        padding: 2px 8px;
        border-radius: 12px;
        background: var(--accent-light);
        color: var(--accent);
        font-size: 11px;
        cursor: pointer;
        border: none;
        font-weight: 500;
        flex-shrink: 0;
    }
    .checkin-card-nav:active { opacity: 0.7; }

    .checkin-expired-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 10px;
        margin-bottom: 8px;
        border-radius: 10px;
        background: #F7FAFC;
        border: 1px dashed var(--border);
        font-size: 12px;
        color: var(--text-muted);
        cursor: pointer;
        transition: all 0.2s;
    }
    .checkin-expired-toggle:hover {
        background: var(--accent-light);
        border-color: var(--accent);
        color: var(--accent);
    }
    .checkin-card.expired {
        opacity: 0.65;
        background: #FAFAFA;
    }
    .checkin-card.expired:hover {
        opacity: 0.85;
    }

    .nav-btn {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 18px;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: var(--bg-white);
        font-size: 14px;
        color: var(--text);
        cursor: pointer;
        transition: background 0.2s;
        text-align: left;
        width: 100%;
    }
    .nav-btn:active { background: var(--bg); }

    /* ===== Responsive ===== */
    @media (max-width: 768px) {
        .legend { display: none; }
        .modal { width: 95vw; }
        .stats-charts { flex-direction: column; overflow-y: auto; }
        .chart-card { min-width: 0; max-width: 100%; }
    }
