:root {
    --bg: #0f0f14;
    --sidebar-bg: #18181f;
    --card-bg: #1c1c26;
    --card-hover: #22222e;
    --border: #2a2a3a;
    --text: #e0e0e0;
    --text-dim: #8888a0;
    --accent: #0FEDF5;
    --accent-dim: rgba(15, 237, 245, 0.15);
    --danger: #ff4757;
    --warning: #ffa502;
    --success: #2ed573;
    --radius: 10px;
    --font: 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    min-height: 100vh;
}

.header {
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 28px; }
.brand-title { font-size: 18px; font-weight: 700; color: var(--accent); }
.brand-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.status-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--warning);
}
.status-dot.ok { background: var(--success); }
.status-dot.error { background: var(--danger); }
.status-text { font-size: 12px; color: var(--text-dim); }

.main {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 24px;
    padding: 20px 24px;
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 80px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.filter-section { display: flex; flex-direction: column; gap: 6px; }
.filter-title {
    font-size: 13px; font-weight: 600; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.5px;
    display: flex; justify-content: space-between; align-items: center;
}
.select-all { font-size: 11px; color: var(--accent); cursor: pointer; text-transform: none; }
.select-all:hover { opacity: 0.7; }
.range-hint { font-size: 11px; font-weight: 400; color: var(--accent); opacity: 0.7; text-transform: none; }

.origin-toggle {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.origin-btn {
    flex: 1;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-dim);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.origin-btn.active {
    background: var(--accent-dim);
    color: var(--accent);
}
.origin-btn:hover:not(.active) { color: var(--text); }

.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chip {
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 12px;
    background: var(--bg);
    color: var(--text-dim);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.check-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 220px;
    overflow-y: auto;
}
.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: background 0.15s;
}
.check-item:hover { background: var(--card-hover); }
.check-item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px; height: 15px;
    flex-shrink: 0;
}
.check-item.checked { color: var(--accent); }
.check-item .code { color: var(--accent); font-size: 11px; margin-left: auto; opacity: 0.6; }

.calendar {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    user-select: none;
}
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.calendar-nav-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 8px;
    border-radius: 4px;
}
.calendar-nav-btn:hover { background: var(--border); color: var(--text); }
.calendar-month {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
}
.calendar-dow {
    font-size: 10px;
    color: var(--text-dim);
    padding: 3px 0;
}
.calendar-day {
    font-size: 12px;
    padding: 5px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-dim);
}
.calendar-day:hover { background: var(--border); color: var(--text); }
.calendar-day.selected {
    background: var(--accent);
    color: #0f0f14;
    font-weight: 700;
}
.calendar-day.in-range {
    background: var(--accent-dim);
    color: var(--accent);
}
.calendar-day.other-month { opacity: 0.2; }
.calendar-day.today { border: 1px solid var(--text-dim); }

.btn-search {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--accent);
    color: #0f0f14;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 4px;
}
.btn-search:hover { opacity: 0.85; }

.results-area { flex: 1; min-width: 0; }
.results-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 20px;
}
.results-title { font-size: 18px; font-weight: 700; }
.results-count { color: var(--text-dim); font-size: 14px; }
.results-range { color: var(--accent); font-size: 12px; opacity: 0.7; }

.section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}
.outbound-title { color: var(--accent); }
.inbound-title { color: var(--warning); }

.results-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.seat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background 0.2s, border-color 0.2s;
}
.seat-card:hover { background: var(--card-hover); border-color: #444; }

.seat-route {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}
.seat-airport { text-align: center; min-width: 60px; }
.seat-code { font-size: 18px; font-weight: 700; color: var(--accent); }
.seat-country { font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.seat-city { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.seat-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-dim);
    font-size: 11px;
    min-width: 30px;
}
.seat-arrow-icon { font-size: 18px; }

.seat-date {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    min-width: 90px;
    text-align: center;
}

.seat-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.seat-cabin {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.seat-cabin.economy { background: #2a2a3a; color: var(--text-dim); }
.seat-cabin.business { background: #2a2a20; color: #ffd700; }
.seat-cabin.first { background: #2a2020; color: #ff6b9d; }

.seat-miles {
    font-size: 18px;
    font-weight: 700;
    color: var(--warning);
    text-align: center;
    min-width: 80px;
}
.seat-miles small { display: block; font-size: 11px; font-weight: 400; color: var(--text-dim); }

.seat-count {
    text-align: center;
    min-width: 50px;
}
.seat-count-num { font-size: 20px; font-weight: 700; color: var(--success); }
.seat-count-label { font-size: 11px; color: var(--text-dim); }

.seat-source {
    font-size: 11px;
    color: var(--text-dim);
    min-width: 80px;
    text-align: center;
    word-break: break-word;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-text { font-size: 16px; color: var(--text-dim); margin-bottom: 8px; }
.empty-sub { font-size: 13px; color: var(--text-dim); opacity: 0.6; }

.hidden { display: none !important; }

.loading {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-dim);
}
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
    .main { flex-direction: column; }
    .sidebar {
        width: 100%;
        position: static;
        max-height: none;
    }
    .seat-card { flex-wrap: wrap; }
}
