/* ============================================================
   华住会酒店价格监控 - 样式
   ============================================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --bg: #f5f7fb;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar: #111827;
    --sidebar-muted: #9ca3af;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ---- App Shell ---- */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
}
.sidebar {
    background: var(--sidebar);
    color: #fff;
    min-height: 100vh;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    align-self: start;
}
.side-brand a {
    color: #fff;
    text-decoration: none;
    font-size: 17px;
    font-weight: 700;
}
.side-brand span {
    display: block;
    color: var(--sidebar-muted);
    font-size: 11px;
    margin-top: 3px;
}
.side-nav {
    display: grid;
    gap: 6px;
    margin-top: 28px;
}
.side-nav a {
    color: #d1d5db;
    text-decoration: none;
    font-size: 14px;
    padding: 9px 10px;
    border-radius: 6px;
    transition: background .15s, color .15s;
}
.side-nav a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.main-shell { min-width: 0; }
.topbar {
    height: 58px;
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
}
.topbar strong {
    display: block;
    font-size: 15px;
}
.topbar span {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
}
.topbar-action { margin-left: auto; }
.badge {
    background: var(--danger);
    color: #fff;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 4px;
}

/* ---- Container ---- */
.container { max-width: 1320px; margin: 0 auto; padding: 22px 28px; }

/* ---- Sections ---- */
.section { margin-bottom: 24px; }
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
}
.card h2 { font-size: 16px; margin-bottom: 16px; color: var(--text); }
.empty-state {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
}

/* ---- Forms ---- */
.inline-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.inline-form label { font-size: 14px; color: var(--text-muted); }
.inline-form select,
.inline-form input[type="text"] {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: #fff;
}

/* ---- Buttons ---- */
.btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all .15s;
}
.btn:hover { background: #f8fafc; }
.btn:disabled {
    cursor: not-allowed;
    opacity: .55;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn.disabled {
    color: var(--text-muted);
    background: #f8fafc;
    pointer-events: none;
    opacity: .6;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.section-title-row h2 { margin: 0 0 4px; }
.section-title-row p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}
.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
}
.pagination-bottom { margin-top: 18px; }

/* ---- PIN Gate ---- */
.pin-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #eef2f7;
}
.pin-shell {
    width: min(100%, 390px);
}
.pin-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 14px 40px rgba(15, 23, 42, .12);
    padding: 28px;
}
.pin-kicker {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.pin-card h1 {
    font-size: 24px;
    line-height: 1.2;
    margin-bottom: 6px;
}
.pin-card p {
    color: var(--text-muted);
    font-size: 14px;
}
.pin-form {
    display: grid;
    gap: 10px;
    margin-top: 22px;
}
.pin-form label {
    color: var(--text-muted);
    font-size: 13px;
}
.pin-form input[type="password"] {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 12px;
    font-size: 18px;
    letter-spacing: 0;
}
.pin-form button {
    width: 100%;
    margin-top: 4px;
}
.pin-error {
    color: var(--danger) !important;
    font-size: 13px !important;
}

/* ---- Hotel Grid ---- */
.hotel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.hotel-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    border-left: 4px solid var(--primary);
    transition: transform .15s;
}
.hotel-card:hover { transform: translateY(-1px); }
.hotel-card-header { display: flex; gap: 8px; margin-bottom: 8px; }
.hotel-card h3 { font-size: 15px; margin-bottom: 4px; }
.hotel-card h3 a { color: var(--text); text-decoration: none; }
.hotel-card h3 a:hover { color: var(--primary); }
.hotel-card .address { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.hotel-card-footer { display: flex; justify-content: space-between; align-items: flex-end; }
.card-actions { display: flex; gap: 8px; align-items: center; }
.price-label { font-size: 12px; color: var(--text-muted); display: block; }
.price-value { font-size: 22px; font-weight: 700; color: var(--danger); }
.price-room { font-size: 12px; color: var(--text-muted); margin-left: 6px; }
.member-price-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-muted);
}
.member-price-row span { white-space: nowrap; }
.member-price-row .primary { color: var(--primary); font-weight: 700; }

/* ---- Tags ---- */
.brand-tag {
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}
.city-tag {
    background: #f0fdf4;
    color: #166534;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}
.tag-disabled {
    color: var(--text-muted);
    font-size: 13px;
}

.fetch-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
    margin: 0 0 12px;
}
.fetch-status.compact { margin: 0; }
.fetch-status small { color: var(--text-muted); }
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
    background: #94a3b8;
}
.status-ok { background: var(--success); }
.status-warn { background: var(--warning); }
.status-error { background: var(--danger); }
.status-muted { background: #94a3b8; }

/* ---- Search Results ---- */
.search-results { border-top: 1px solid var(--border); padding-top: 12px; }
.search-results h3 { font-size: 14px; margin-bottom: 8px; }
.search-meta {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 8px;
}
.search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.search-item:last-child { border-bottom: none; }
.search-item .brand-tag,
.search-item .city-tag { margin-left: 6px; }
.search-item small { display: block; color: var(--text-muted); font-size: 12px; }

/* ---- Hotel Detail ---- */
.hotel-detail-header { margin-bottom: 20px; }
.back-link { color: var(--primary); text-decoration: none; font-size: 14px; }
.back-link:hover { text-decoration: underline; }
.hotel-detail-header h1 { font-size: 22px; margin: 8px 0; }
.hotel-meta { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--text-muted); }

/* ---- Chart ---- */
.chart-container { height: 400px; position: relative; }
.chart-container.compact { height: 260px; }

/* ---- Table ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.data-table tr:hover td { background: #f8fafc; }
.price-cell { font-weight: 600; }
.price-cell.original { color: var(--text-muted); text-decoration: line-through; font-weight: 400; }
.price-cell.primary { color: var(--primary); font-weight: 700; }

/* ---- Alerts ---- */
.alert-guide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.alert-guide > div {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}
.alert-guide strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}
.alert-guide span {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}
.alert-filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(130px, 1fr)) auto auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
}
.alert-filter-bar label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--text-muted);
    font-size: 12px;
}
.alert-filter-bar select {
    width: 100%;
}
.alert-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.alert-counts,
.alert-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.alert-counts span {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 9px;
    background: #fff;
    color: var(--text-muted);
    font-size: 12px;
}
.alert-up td { background: #fff7ed; }
.alert-down td { background: #f0fdf4; }
.alert-critical td { box-shadow: inset 3px 0 0 var(--danger); }
.alert-warning td { box-shadow: inset 3px 0 0 var(--warning); }
.alert-info td { box-shadow: inset 3px 0 0 var(--primary); }
.severity-pill {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}
.severity-critical { background: var(--danger); }
.severity-warning { background: var(--warning); }
.severity-info { background: var(--primary); }

@media (max-width: 900px) {
    .alert-filter-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .alert-filter-bar {
        grid-template-columns: 1fr;
    }
    .alert-actions .btn {
        flex: 1 1 auto;
    }
}

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ---- Dashboard ---- */
.dashboard-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}
.dashboard-hero h1 {
    font-size: 26px;
    line-height: 1.2;
    margin-bottom: 7px;
}
.dashboard-hero p {
    color: var(--text-muted);
    max-width: 720px;
    font-size: 14px;
}
.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.dashboard-actions span {
    min-width: 90px;
    color: var(--text-muted);
    font-size: 12px;
}
.ops-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, .85fr);
    gap: 14px;
}
.ops-card {
    display: grid;
    gap: 14px;
}
.ops-primary {
    border-left: 4px solid var(--primary);
}
.ops-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.ops-summary.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ops-summary > div,
.task-meta-grid > div {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    background: #f8fafc;
    min-width: 0;
}
.ops-summary span,
.task-meta-grid span {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
}
.ops-summary strong,
.task-meta-grid strong {
    display: block;
    margin-top: 4px;
    font-size: 17px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.ops-summary small {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}
.control-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.control-note {
    color: var(--text-muted);
    font-size: 12px;
}
.state-pill {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #075985;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.state-pill.ok {
    background: #dcfce7;
    color: #166534;
}
.state-pill.warning {
    background: #fef3c7;
    color: #92400e;
}
.state-pill.muted {
    background: #f1f5f9;
    color: var(--text-muted);
}
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.kpi-card,
.panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.kpi-card {
    padding: 15px 16px;
}
.kpi-card span {
    color: var(--text-muted);
    display: block;
    font-size: 12px;
}
.kpi-card strong {
    display: block;
    font-size: 27px;
    line-height: 1.1;
    margin-top: 8px;
}
.kpi-card small {
    color: var(--text-muted);
    font-size: 12px;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.4fr .9fr .8fr;
    gap: 14px;
    align-items: start;
}
.panel {
    padding: 16px;
    min-width: 0;
}
.panel-wide { grid-column: span 2; }
.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    margin-bottom: 12px;
}
.panel-header h2 {
    font-size: 15px;
    line-height: 1.2;
}
.panel-header span {
    color: var(--text-muted);
    font-size: 12px;
}
.dense-table th,
.dense-table td {
    padding: 8px 10px;
}
.status-stack {
    display: grid;
    gap: 10px;
}
.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 9px;
    font-size: 14px;
}
.status-row:last-child { border-bottom: none; padding-bottom: 0; }
.status-row span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}
.status-row strong { font-size: 18px; }
.crawl-monitor-body {
    display: grid;
    gap: 12px;
}
.crawl-state {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.crawl-state strong { font-size: 15px; }
.crawl-state span {
    color: var(--text-muted);
    font-size: 13px;
}
.crawl-progress {
    display: grid;
    gap: 6px;
}
.progress-track {
    height: 8px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--primary);
    transition: width .2s ease;
}
.crawl-progress small {
    color: var(--text-muted);
    font-size: 12px;
}
.task-meta-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}
.run-list {
    display: grid;
    gap: 10px;
}
.run-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    display: grid;
    gap: 4px;
}
.run-item div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}
.run-item strong { font-size: 13px; }
.run-item span,
.run-item small {
    color: var(--text-muted);
    font-size: 12px;
}
.city-queue {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}
.queue-row {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 12px;
    align-items: center;
}
.queue-row strong { font-size: 13px; }
.queue-row span,
.queue-row small {
    color: var(--text-muted);
    font-size: 12px;
}
.empty-state.slim { padding: 18px 0; }

@media (max-width: 720px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        min-height: auto;
        position: static;
        padding: 14px 16px;
    }
    .side-nav { display: flex; overflow-x: auto; margin-top: 12px; }
    .side-nav a { white-space: nowrap; }
    .topbar { padding: 0 16px; }
    .container { padding: 16px; }
    .hotel-grid { grid-template-columns: 1fr; }
    .dashboard-hero { flex-direction: column; }
    .dashboard-actions { justify-content: flex-start; }
    .ops-grid,
    .ops-summary,
    .ops-summary.compact,
    .task-meta-grid {
        grid-template-columns: 1fr;
    }
    .kpi-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .panel-wide { grid-column: auto; }
    .hotel-card-footer,
    .search-item,
    .hotel-meta,
    .section-title-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }
    .pagination { justify-content: flex-start; }
    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
