/* ===== Design Tokens ===== */
:root {
    --bg: #F7F8FA;
    --surface: #FFFFFF;
    --surface-2: #F1F3F5;
    --text: #1A1D21;
    --text-2: #6B7280;
    --border: #E5E7EB;
    --primary: #2563EB;
    --primary-soft: #DBEAFE;
    --primary-text: #1D4ED8;
    --accent: #0EA5E9;
    --danger: #EF4444;
    --warn: #F59E0B;
    --recording-red: #FF3B30;

    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-card: 0 2px 12px rgba(17, 24, 39, 0.06);
    --shadow-soft: 0 1px 3px rgba(17, 24, 39, 0.05);

    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --nav-height: 58px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ===== App Layout ===== */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: calc(100dvh - var(--nav-height) - var(--safe-bottom));
    background: var(--bg);
}

/* ===== Header ===== */
#header {
    background: var(--surface);
    color: var(--text);
    padding: 14px 16px;
    padding-top: max(14px, var(--safe-top));
    text-align: center;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

#header h1 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

/* ===== Messages Area ===== */
#messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 12px;
    padding-bottom: calc(var(--nav-height) + 16px + var(--safe-bottom));
}

/* ===== Message Bubbles ===== */
.message {
    display: flex;
    margin-bottom: 10px;
    max-width: 80%;
}

.message.user { justify-content: flex-end; margin-left: auto; }
.message.ai { justify-content: flex-start; }

.bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.user .bubble {
    background: var(--primary-soft);
    color: var(--primary-text);
    border-top-right-radius: 6px;
}

.message.ai .bubble {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-top-left-radius: 6px;
    box-shadow: var(--shadow-soft);
}

.bubble .timestamp {
    display: block;
    font-size: 11px;
    color: var(--text-2);
    text-align: right;
    margin-top: 4px;
    opacity: 0.8;
}

/* Destination cards inside AI bubble */
.card-area {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dest-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}
.dest-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.dest-card-city {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.dest-card-city-link {
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px dashed transparent;
    transition: color 0.2s, border-color 0.2s;
}
.dest-card-city-link:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.dest-card-city-link:active { opacity: 0.7; }
.dest-card-score {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-text);
    background: var(--primary-soft);
    padding: 2px 10px;
    border-radius: 999px;
}
.dest-card-meta {
    font-size: 12px;
    color: var(--text-2);
    margin-bottom: 6px;
}
.dest-card-reason {
    font-size: 13px;
    color: var(--text);
    line-height: 1.45;
}

/* P1.1: favorite toggle on destination card */
.dest-card {
    position: relative;
}
.dest-card-fav {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: transform 0.15s ease, background 0.15s ease;
}
.dest-card-fav:hover { background: rgba(0, 0, 0, 0.05); }
.dest-card-fav:active { transform: scale(0.9); }
.dest-card-fav.favorited { color: #e0245e; }

/* P1.1: favorites list in profile page */
.favorites-list { display: flex; flex-direction: column; gap: 8px; }
.favorites-empty {
    color: var(--text-2);
    font-size: 13px;
    text-align: center;
    padding: 16px 0;
    margin: 0;
}
.favorite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.favorite-item-info { flex: 1; min-width: 0; }
.favorite-item-city { font-size: 14px; font-weight: 600; color: var(--text); }
.favorite-item-city-link {
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px dashed transparent;
    transition: color 0.2s, border-color 0.2s;
}
.favorite-item-city-link:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.favorite-item-reason {
    font-size: 12px;
    color: var(--text-2);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.favorite-item-time { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.favorite-item-remove {
    background: transparent;
    border: none;
    color: var(--text-2);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.favorite-item-remove:hover { color: #e0245e; background: rgba(224, 36, 94, 0.08); }

/* ===== Typing Indicator ===== */
.typing-indicator { padding: 8px 12px; margin-left: 4px; margin-bottom: 8px; }

.typing-bubble {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    border-top-left-radius: 6px;
    box-shadow: var(--shadow-soft);
}

.typing-bubble span {
    width: 7px;
    height: 7px;
    background: var(--text-2);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.35; transform: scale(1); }
    30% { opacity: 1; transform: scale(1.15); }
}

/* ===== Tool Badge ===== */
.tool-badge { text-align: center; padding: 4px 12px; margin: 4px auto; }
.tool-badge span {
    display: inline-block;
    font-size: 12px;
    color: var(--primary-text);
    background: var(--primary-soft);
    border-radius: 999px;
    padding: 5px 12px;
}

/* ===== Input Area ===== */
#input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    padding-bottom: max(10px, var(--safe-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;   /* anchor for .more-menu (absolute child) */
}

#message-input {
    flex: 1;
    border: none;
    border-radius: 22px;
    padding: 11px 18px;
    font-size: 15px;
    line-height: 1.4;
    max-height: 80px;
    resize: none;
    outline: none;
    background: var(--surface-2);
    font-family: inherit;
    color: var(--text);
}
#message-input::placeholder { color: #9CA3AF; }

/* P1.4: travel date picker (WeChat-style: + menu opens it; selected date
   shows as a chip ABOVE the input bar with a × to clear) */

/* Active date chip — sits above the input bar, only visible when a date is set */
.active-date-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 12px 6px auto;     /* right-aligned above the input bar */
    padding: 4px 6px 4px 10px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary-text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    height: 28px;
}
.active-date-chip-icon { font-size: 13px; }
.active-date-chip-clear {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.12);
    color: var(--text-2);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 2px;
}
.active-date-chip-clear:hover { background: rgba(0, 0, 0, 0.22); }

/* Voice button (left) — same icon-btn style as before */
.voice-btn { color: var(--text-2); }

/* + more button (right) */
.more-btn { color: var(--text-2); }
.more-btn[aria-expanded="true"] { background: var(--primary-soft); color: var(--primary-text); }

/* More menu popup — grid of items above the + button */
.more-menu {
    position: absolute;
    right: 12px;
    bottom: calc(100% + 8px);    /* above the input bar */
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(3, 64px);
    gap: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 10;
}
.more-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 64px;
    height: 64px;
    border: none;
    background: transparent;
    color: var(--text-2);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.more-menu-item:hover { background: var(--surface-2); }
.more-menu-item:active { background: var(--primary-soft); color: var(--primary-text); }
.more-menu-icon { font-size: 22px; line-height: 1; }
.more-menu-label { font-size: 11px; line-height: 1; }

/* Hide the native date input (we trigger it via the + menu) */
.travel-date-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.1s;
}
.send-btn:active { opacity: 0.8; transform: scale(0.95); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    flex-shrink: 0;
    transition: background 0.2s;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn.recording { color: var(--recording-red); animation: pulse 2s infinite; }

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ===== Auth Screen (full-screen login) ===== */
#auth-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(180deg, #EFF6FF 0%, var(--bg) 55%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    padding-top: max(48px, var(--safe-top));
}
.auth-hero {
    text-align: center;
    margin-bottom: 24px;
}
.auth-hero-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
}
.auth-hero h2 {
    font-size: 22px;
    color: var(--text);
    margin: 0 0 8px;
    font-weight: 700;
}
.auth-hero p {
    color: var(--text-2);
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    box-shadow: var(--shadow-card);
}
.auth-card h3 {
    text-align: center;
    margin: 0 0 20px;
    font-size: 17px;
    color: var(--text);
    font-weight: 600;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 6px;
    font-weight: 500;
}
.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--surface);
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box;
    outline: none;
    color: var(--text);
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    background: var(--surface);
}
.form-group input::placeholder { color: #9CA3AF; }

.btn-primary {
    width: 100%;
    padding: 13px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    font-family: inherit;
}
.btn-primary:hover { opacity: 0.92; }
.btn-primary:active { opacity: 0.85; transform: scale(0.99); }
.btn-primary.btn-lg { padding: 14px; font-size: 16px; }

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-2);
}
.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* ===== Bottom Navigation ===== */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 0;
    padding-bottom: max(6px, var(--safe-bottom));
    z-index: 100;
}
#bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 10px;
    color: var(--text-2);
    text-decoration: none;
    padding: 4px 16px;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
}
#bottom-nav .nav-item svg { width: 22px; height: 22px; margin-bottom: 2px; }
#bottom-nav .nav-item.active { color: var(--primary); }
#bottom-nav .nav-item:hover { color: var(--primary); }

/* ===== Itinerary Page ===== */
#itinerary-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(var(--nav-height) + var(--safe-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 50;
    background: var(--bg);
    padding: 0 0 24px;
}
.itinerary-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 16px 10px;
}
.itinerary-page-header h2 { margin: 0; font-size: 20px; color: var(--text); }
.itinerary-create-btn { padding: 9px 14px; border-radius: 999px; font-size: 13px; }
.itineraries-list { padding: 0 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.itineraries-empty {
    margin: 18px 0;
    padding: 18px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text-2);
    text-align: center;
    box-shadow: var(--shadow-card);
}
.itinerary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: var(--shadow-card);
}
.itinerary-item-info { min-width: 0; flex: 1; }
.itinerary-item-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.itinerary-item-dest { font-weight: 700; color: var(--text); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.itinerary-item-meta { color: var(--text-2); font-size: 12px; line-height: 1.5; }
.itinerary-item-note { margin-top: 5px; color: var(--text-2); font-size: 12px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.itinerary-item-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.itinerary-item-btn {
    border: none;
    border-radius: 10px;
    padding: 7px 10px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.itinerary-item-btn-danger { color: var(--danger); background: #FEF2F2; }
.it-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 7px;
    font-size: 11px;
    line-height: 1;
    color: var(--primary-text);
    background: var(--primary-soft);
    white-space: nowrap;
}
.it-status-booked { color: #047857; background: #D1FAE5; }
.it-status-completed { color: #475569; background: #E2E8F0; }
.it-status-cancelled { color: var(--danger); background: #FEE2E2; }
.itinerary-dialog-mask {
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.42);
}
.itinerary-dialog {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: 0 22px 70px rgba(15, 23, 42, 0.28);
    padding: 16px;
}
.itinerary-dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.itinerary-dialog-head h3 { margin: 0; font-size: 17px; color: var(--text); }
.itinerary-dialog-close { width: 30px; height: 30px; border: none; border-radius: 50%; background: var(--surface-2); color: var(--text-2); font-size: 20px; cursor: pointer; }
.itinerary-form { display: flex; flex-direction: column; gap: 10px; }
.itinerary-form label { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 12px; }
.itinerary-form input, .itinerary-form textarea {
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}
.itinerary-form input:focus, .itinerary-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.itinerary-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.itinerary-save-btn { margin-top: 4px; padding: 12px; }

.itinerary-list-view,
.itinerary-detail-view { min-height: 100%; }
.itinerary-item { cursor: pointer; }
.itinerary-item:active { transform: scale(0.995); }
.itinerary-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 8px;
}
.itinerary-back-btn {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-card);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
}
.itinerary-detail-title-wrap { min-width: 0; }
.itinerary-detail-title-wrap h2 {
    margin: 0;
    color: var(--text);
    font-size: 20px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.itinerary-detail-title-wrap p {
    margin: 4px 0 0;
    color: var(--text-2);
    font-size: 12px;
}
.itinerary-detail-body {
    padding: 0 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.itinerary-detail-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: var(--shadow-card);
}
.itinerary-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.itinerary-summary-item {
    border-radius: 14px;
    background: var(--surface-2);
    padding: 10px;
    min-width: 0;
}
.itinerary-summary-label {
    display: block;
    color: var(--text-2);
    font-size: 11px;
    margin-bottom: 4px;
}
.itinerary-summary-item strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.itinerary-detail-note {
    margin-top: 12px;
    padding: 10px 12px;
    border-left: 3px solid var(--primary);
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--text);
    font-size: 13px;
    line-height: 1.6;
}
.itinerary-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}
.itinerary-section-head h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text);
}
.itinerary-section-head span {
    color: var(--text-2);
    font-size: 12px;
    white-space: nowrap;
}
.itinerary-ai-hint {
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    background: #F8FAFC;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.6;
}
.weather-day-plan {
    margin-top: 12px;
    border-top: 1px dashed var(--border);
    padding-top: 10px;
}
.weather-day-plan-title {
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}
.ai-plan-slot {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 8px;
    margin-top: 7px;
    align-items: start;
}
.ai-plan-slot span {
    color: var(--primary-text);
    background: var(--primary-soft);
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.ai-plan-slot p {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.55;
}
.ai-plan-weather-tip {
    margin: 9px 0 0;
    color: #B45309;
    background: #FEF3C7;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.5;
}
.weather-timeline {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.weather-day-card {
    position: relative;
    padding: 12px;
    border-radius: 15px;
    background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
    border: 1px solid var(--border);
}
.weather-day-card::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 16px;
    bottom: 16px;
    width: 3px;
    border-radius: 999px;
    background: var(--primary);
}
.weather-day-head,
.weather-day-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.weather-day-date {
    color: var(--text);
    font-weight: 700;
    font-size: 14px;
}
.weather-score {
    flex-shrink: 0;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
}
.weather-score-good { color: #047857; background: #D1FAE5; }
.weather-score-medium { color: #B45309; background: #FEF3C7; }
.weather-score-bad { color: #B91C1C; background: #FEE2E2; }
.weather-day-main { margin-top: 9px; }
.weather-day-main strong { color: var(--text); font-size: 15px; }
.weather-day-main span { color: var(--primary); font-size: 14px; font-weight: 700; }
.weather-day-meta {
    margin-top: 7px;
    color: var(--text-2);
    font-size: 12px;
}
.weather-day-advice {
    margin: 8px 0 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.55;
}
.weather-empty {
    margin: 8px 0;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}
.itinerary-detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.itinerary-detail-actions .itinerary-detail-btn-primary { grid-column: 1 / -1; }
.itinerary-detail-btn {
    border: none;
    border-radius: 14px;
    padding: 12px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-card);
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
}
.itinerary-detail-btn-danger { color: var(--danger); background: #FEF2F2; }
.itinerary-detail-btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}
.itinerary-detail-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ===== Profile Page ===== */
#profile-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(var(--nav-height) + var(--safe-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 50;
    background: var(--bg);
    padding: 0 0 24px;
}

.profile-header-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 16px;
    color: #fff;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.18);
}
.profile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}
.profile-info h3 { margin: 0; font-size: 18px; }
.profile-info p { margin: 4px 0 0; font-size: 13px; opacity: 0.9; }

/* Token usage card */
.usage-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin: 12px 16px;
    box-shadow: var(--shadow-card);
}
.usage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}
.usage-pct { font-size: 13px; color: var(--text-2); font-weight: 400; }
.usage-bar {
    height: 8px;
    background: var(--surface-2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 14px;
}
.usage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 0.5s ease;
}
.usage-bar-fill.warn { background: linear-gradient(90deg, var(--warn), var(--danger)); }
.usage-bar-fill.danger { background: linear-gradient(90deg, var(--danger), #DC2626); }
.usage-stats { display: flex; justify-content: space-around; text-align: center; }
.stat-label { font-size: 11px; color: var(--text-2); }
.stat-num { font-size: 16px; font-weight: 600; color: var(--text); }

/* Preference card */
.pref-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 12px 16px;
    box-shadow: var(--shadow-card);
}
.pref-card h3 { margin: 0 0 16px; font-size: 16px; color: var(--text); }

/* Tag-style checkbox/radio group */
.tag-group { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-check { display: inline-flex; align-items: center; cursor: pointer; }
.tag-check input { display: none; }
.tag-check span {
    display: inline-block;
    padding: 7px 14px;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text-2);
    background: var(--surface);
    transition: all 0.2s;
    user-select: none;
}
.tag-check input:checked + span {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

/* Logout button */
.btn-logout {
    display: block;
    width: calc(100% - 32px);
    margin: 8px 16px 24px;
    padding: 13px;
    background: var(--surface);
    color: var(--danger);
    border: 1.5px solid #FECACA;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
    font-family: inherit;
}
.btn-logout:hover { background: #FEF2F2; }

/* ===== Responsive ===== */
@media (min-width: 600px) {
    #app, #auth-card-wrap {
        max-width: 480px;
        margin: 0 auto;
    }
    #bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); }
    #profile-page { max-width: 480px; left: 50%; transform: translateX(-50%); }
    #itinerary-page { max-width: 480px; left: 50%; transform: translateX(-50%); }
}

/* ===== Admin (legacy) ===== */
.admin-login { max-width: 400px; margin: 80px auto; padding: 20px; }
.admin-login input { width: 100%; padding: 12px; margin: 8px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.admin-login button { width: 100%; padding: 12px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 16px; cursor: pointer; }
.admin-dashboard table { width: 100%; border-collapse: collapse; margin: 12px; }
.admin-dashboard th, .admin-dashboard td { padding: 8px; border: 1px solid var(--border); font-size: 13px; }
.admin-dashboard th { background: var(--surface-2); }
