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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f7f5f2;
    color: #4a4540;
    line-height: 1.6;
}

/* === Header === */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem 0;
    text-align: center;
    position: relative;
}
.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 1rem;
}
header h1 { font-size: 1.8rem; margin-bottom: 0; }
.header-logout-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 20px;
    height: 36px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    color: white;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.header-logout-btn:hover {
    background: rgba(255,255,255,0.3);
}
.header-logout-label {
    font-weight: 500;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 480px) {
    .header-logout-label { display: none; }
    .header-logout-btn { padding: 0 8px; }
}
.settings-gear-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: background 0.2s, transform 0.2s;
}
.settings-gear-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-50%) rotate(30deg);
}

nav { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; }
.tab {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
    white-space: nowrap;
}
.tab:hover { background: rgba(255,255,255,0.35); }
.tab.active { background: rgba(255,255,255,0.9); color: #333; font-weight: 600; }

@media (max-width: 480px) {
    nav { gap: 0.3rem; }
    .tab { padding: 0.5rem 0.8rem; font-size: 0.85rem; flex: 1; text-align: center; border-radius: 8px; }
}

/* === Filter Bar === */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 2rem;
    justify-content: center;
}
.filter-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.filter-btn:hover { border-color: #667eea; color: #667eea; }
.filter-btn.active { background: #667eea; color: white; border-color: #667eea; }

/* === Card Grid === */
main { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0 2rem;
}

.card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #e0e0e0;
}

.card-body { padding: 1rem; }
.card-body h3 { font-size: 1.1rem; margin-bottom: 0.3rem; }
.card-body .subtitle { color: #888; font-size: 0.9rem; margin-bottom: 0.5rem; }
.card-body p { font-size: 0.9rem; color: #555; }

.card-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }
.tag {
    background: #f0f0f0;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    color: #666;
}
.tag.rating { background: #fff3cd; color: #856404; }
.tag.cost { background: #d4edda; color: #155724; }
.tag.season { background: #d1ecf1; color: #0c5460; }

/* === Back Button === */
.back-btn {
    background: none;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    margin: 1rem 0;
    transition: all 0.2s;
}
.back-btn:hover { border-color: #667eea; color: #667eea; }

/* === Recipe Card Extra === */
.recipe-meta { display: flex; gap: 1rem; margin-top: 0.5rem; font-size: 0.8rem; color: #888; }

/* === Recipe Grid — 2-column compact cards for mobile === */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0.6rem 0 2rem;
}
@media (min-width: 600px) {
    .recipe-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}
@media (min-width: 900px) {
    .recipe-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}

.recipe-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    aspect-ratio: 9 / 14;
}
.recipe-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.12); }

.recipe-card-img {
    width: 100%;
    flex: 1 1 75%;
    object-fit: contain;
    background: #e8e8e8;
    display: block;
    min-height: 0;
}

.recipe-card-body {
    flex: 1 1 25%;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.recipe-card-body h3 {
    font-size: 0.82rem;
    margin-bottom: 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.recipe-card-subtitle {
    color: #888;
    font-size: 0.72rem;
    margin-bottom: 3px;
}
.recipe-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 2px;
}
.recipe-person-tag {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 0.65rem;
}
.recipe-cat-tag {
    background: #e3f2fd;
    color: #1565c0;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 0.65rem;
}

/* Person filter row — removed, merged into recipe-filter-scroll */

/* === My List Filter — compact summary button + modal === */
.mylist-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.8rem 0;
}
.mylist-search-input {
    flex: 1;
    min-width: 0;
    padding: 7px 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 0.85rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.mylist-search-input:focus { border-color: #667eea; }
.mylist-filter-summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 15px;
    background: #667eea;
    border: 1px solid #667eea;
    border-radius: 22px;
    cursor: pointer;
    font-size: 0.9rem;
    color: white;
    transition: all 0.2s;
    user-select: none;
}
.mylist-filter-summary:hover { background: #5a6fd6; border-color: #5a6fd6; color: white; }
.mylist-filter-icon { display: flex; align-items: center; }
.mylist-filter-arrow { font-size: 0.77rem; color: rgba(255,255,255,0.8); }
.mylist-filter-reset-inline {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    color: #999;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}
.mylist-filter-reset-inline:hover { border-color: #e74c3c; color: #e74c3c; }

/* My List Filter Modal */
.mylist-filter-modal-content {
    background: white;
    border-radius: 14px;
    max-width: 380px;
    width: 88%;
    max-height: 70vh;
    overflow-y: auto;
    position: relative;
}
.mylist-filter-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}
.mylist-filter-modal-header h3 {
    font-size: 1rem;
    margin: 0;
}
.mylist-filter-modal-body {
    padding: 0.8rem 1.2rem;
}
.mylist-filter-group {
    margin-bottom: 0.8rem;
}
.mylist-filter-group-title {
    font-size: 0.78rem;
    color: #888;
    margin-bottom: 0.4rem;
    font-weight: 500;
}
.mylist-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.mylist-filter-chips .filter-chip {
    background: #f5f5f5;
    border: 1px solid transparent;
    padding: 4px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.2s;
    white-space: nowrap;
}
.mylist-filter-chips .filter-chip:hover { border-color: #667eea; }
.mylist-filter-chips .filter-chip.active { background: #667eea; color: white; border-color: #667eea; }
.mylist-filter-modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 1.2rem 1rem;
    border-top: 1px solid #f0f0f0;
}
.mylist-filter-reset {
    background: none;
    border: 1px solid #ddd;
    padding: 6px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    color: #888;
}
.mylist-filter-reset:hover { border-color: #999; }
.mylist-filter-apply {
    background: #667eea;
    border: none;
    padding: 6px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    color: white;
    font-weight: 500;
}
.mylist-filter-apply:hover { background: #5a6fd6; }

/* === Recipe Toolbar: filter (left) + search (right) === */
.recipe-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.4rem 0 0.2rem;
}
.recipe-toolbar .recipe-filter-row { flex-shrink: 0; }
.recipe-search-input {
    flex: 1;
    min-width: 0;
    padding: 7px 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 0.85rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.recipe-search-input:focus { border-color: #667eea; }

/* === Recipe Filter — compact summary button + modal === */
.recipe-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}
.recipe-filter-summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 15px;
    background: #667eea;
    border: 1px solid #667eea;
    border-radius: 22px;
    cursor: pointer;
    font-size: 0.9rem;
    color: white;
    transition: all 0.2s;
    user-select: none;
}
.recipe-filter-summary:hover { background: #5a6fd6; border-color: #5a6fd6; color: white; }
.recipe-filter-icon { display: flex; align-items: center; }
.recipe-filter-arrow { font-size: 0.77rem; color: rgba(255,255,255,0.8); }
.recipe-filter-reset-inline {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    color: #999;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}
.recipe-filter-reset-inline:hover { border-color: #e74c3c; color: #e74c3c; }

/* Filter Modal */
.recipe-filter-modal-content {
    background: white;
    border-radius: 14px;
    max-width: 380px;
    width: 88%;
    max-height: 70vh;
    overflow-y: auto;
    position: relative;
}
.recipe-filter-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}
.recipe-filter-modal-header h3 {
    font-size: 1rem;
    margin: 0;
}
.recipe-filter-modal-body {
    padding: 0.8rem 1.2rem;
}
.recipe-filter-group {
    margin-bottom: 0.8rem;
}
.recipe-filter-group-title {
    font-size: 0.78rem;
    color: #888;
    margin-bottom: 0.4rem;
    font-weight: 500;
}
.recipe-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.recipe-filter-chips .filter-chip {
    background: #f5f5f5;
    border: 1px solid transparent;
    padding: 4px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.2s;
    white-space: nowrap;
}
.recipe-filter-chips .filter-chip:hover { border-color: #667eea; }
.recipe-filter-chips .filter-chip.active { background: #667eea; color: white; border-color: #667eea; }
.recipe-filter-modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 1.2rem 1rem;
    border-top: 1px solid #f0f0f0;
}
.recipe-filter-reset {
    background: none;
    border: 1px solid #ddd;
    padding: 6px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    color: #888;
}
.recipe-filter-reset:hover { border-color: #999; }
.recipe-filter-apply {
    background: #667eea;
    border: none;
    padding: 6px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    color: white;
    font-weight: 500;
}
.recipe-filter-apply:hover { background: #5a6fd6; }

/* === Recipe Detail Modal === */
.recipe-modal-content {
    background: white;
    border-radius: 14px;
    max-width: 480px;
    width: 92%;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    overscroll-behavior: contain;
}
.recipe-modal-hero {
    width: 100%;
    border-radius: 14px 14px 0 0;
    overflow: hidden;
}
.recipe-modal-img {
    width: 100%;
    display: block;
    max-height: 50vh;
    object-fit: cover;
}
.recipe-modal-body {
    padding: 1rem 1.2rem 1.5rem;
}
.recipe-modal-body h2 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}
.recipe-modal-section {
    margin-top: 0.8rem;
}
.recipe-modal-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.3rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.2rem;
}
.recipe-modal-section p,
.recipe-modal-section li {
    font-size: 0.88rem;
    line-height: 1.6;
    color: #444;
}
.recipe-modal-section ul {
    padding-left: 1.2rem;
    margin: 0;
}
.recipe-modal-section ul li {
    margin-bottom: 0.2rem;
}
.recipe-modal-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.recipe-ref-link {
    display: inline-block;
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid #667eea;
    border-radius: 8px;
    padding: 4px 12px;
    transition: background 0.2s;
}
.recipe-ref-link:hover {
    background: #667eea;
    color: white;
}

/* === Travel Place Cards === */
.travel-place-card { cursor: pointer; }
.travel-place-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }

/* My List: 1-column mobile-first, 2-column on tablet+ */
#my-list-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem 0 2rem;
}
#my-list-grid .travel-place-card .card-body {
    padding: 0.8rem;
}
#my-list-grid .travel-place-card .card-body h3 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}
#my-list-grid .travel-place-card .subtitle {
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}
#my-list-grid .travel-place-card .place-address {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.3rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
#my-list-grid .travel-place-card .card-tags {
    margin-top: 0.4rem;
}
@media (min-width: 768px) {
    #my-list-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Place address clickable style */
#my-list-grid .travel-place-card .place-address {
    cursor: pointer;
    transition: color 0.2s;
}
#my-list-grid .travel-place-card .place-address:hover {
    color: #667eea;
    text-decoration: underline;
}

/* Map App Selection Modal */
.map-app-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s;
}
.map-app-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 320px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.map-app-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #eee;
}
.map-app-modal-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}
.map-app-modal-header .modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}
.map-app-options {
    padding: 0.5rem 0;
}
.map-app-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    text-decoration: none;
    color: #333;
    font-size: 0.95rem;
    transition: background 0.2s;
}
.map-app-option:hover {
    background: #f5f5f5;
}
.map-app-icon {
    font-size: 1.5rem;
    width: 2rem;
    text-align: center;
}

.cuisine-tag { background: #e3f2fd; color: #1565c0; display: inline-block; margin-top: 0.3rem; }
.price-tag { background: #fff3e0; color: #e65100; display: inline-block; margin-top: 0.3rem; }
.rating-tag { background: #fff9c4; color: #f57f17; display: inline-block; margin-top: 0.3rem; }

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}
.status-badge.want-to-go {
    background: #e1f5fe;
    color: #0277bd;
}
.status-badge.been-there {
    background: #e8f5e9;
    color: #2e7d32;
}

/* === Modal === */
.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #888;
    line-height: 1;
}
.modal-close:hover { color: #333; }
.modal-content h2 {
    margin-bottom: 1rem;
    padding-right: 2rem;
}
.modal-info p {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}
.modal-info strong {
    color: #667eea;
    margin-right: 0.5rem;
}
.modal-info a {
    color: #667eea;
    text-decoration: none;
}
.modal-info a:hover {
    text-decoration: underline;
}

/* === Modal Edit Form === */
.modal-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}
.btn-edit, .btn-save, .btn-cancel {
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.btn-edit {
    background: #667eea;
    color: white;
}
.btn-edit:hover { background: #5a6fd6; transform: translateY(-1px); }
.btn-save {
    background: #4caf50;
    color: white;
}
.btn-save:hover { background: #43a047; transform: translateY(-1px); }
.btn-cancel {
    background: #e0e0e0;
    color: #555;
}
.btn-cancel:hover { background: #d0d0d0; }

.edit-form {
    margin-top: 1rem;
}
.form-group {
    margin-bottom: 1rem;
    flex: 1;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 0.3rem;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}
.form-group textarea {
    resize: vertical;
    min-height: 60px;
}
.form-row {
    display: flex;
    gap: 1rem;
}

/* === Utility === */
.hidden { display: none !important; }

/* === Itinerary / Trip === */
.trip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}
.trip-header h2 { font-size: 1.4rem; }
.btn-new-trip {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-new-trip:hover { background: #5a6fd6; }

.trip-card {
    cursor: pointer;
}
.trip-card .trip-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #888;
}
.trip-card .trip-actions {
    margin-top: 0.8rem;
    display: flex;
    gap: 0.5rem;
}
.trip-card .trip-actions button {
    padding: 0.3rem 0.7rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}
.trip-card .trip-actions .btn-delete:hover {
    border-color: #e53935;
    color: #e53935;
}

.trip-setup-form {
    max-width: 600px;
    margin: 1rem auto;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* (old horizontal search bar removed) */

/* === Trip.com Style Search Card (Vertical Stacked) === */
.trip-search-card {
    max-width: 600px;
    margin: 1rem auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    overflow: visible;
    position: relative;
}
.trip-search-form {
    display: flex;
    flex-direction: column;
}
.search-row {
    display: flex;
    align-items: center;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #f0f0f0;
    gap: 0.8rem;
    position: relative;
    transition: background 0.15s;
    cursor: pointer;
}
.search-row:last-of-type {
    border-bottom: none;
}
/* Active row highlight */
.search-row.active-row {
    background: #EEF0FF;
}
.row-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.row-icon-dest {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232B65EC' stroke-width='2'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
}
.row-icon-title {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232B65EC' stroke-width='2'%3E%3Cpath d='M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z'/%3E%3Cline x1='7' y1='7' x2='7.01' y2='7'/%3E%3C/svg%3E");
}
.row-icon-transport {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232B65EC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12l2.5-5h13L21 12'/%3E%3Crect x='2' y='12' width='20' height='5' rx='1'/%3E%3Ccircle cx='7' cy='19' r='2'/%3E%3Ccircle cx='17' cy='19' r='2'/%3E%3C/svg%3E");
}
.row-icon-date {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232B65EC' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}
.row-icon-guest {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232B65EC' stroke-width='2'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
}
.row-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.row-clickable {
    cursor: pointer;
}
.row-content input.title-input {
    border: none;
    outline: none;
    font-size: 1rem;
    font-weight: 600;
    background: transparent;
    padding: 0.3rem 0;
    color: #333;
    width: 100%;
}
.row-content input.title-input::placeholder {
    color: #999;
    font-weight: 400;
}
.display-text.placeholder {
    color: #999;
}
.display-text {
    font-size: 1rem;
    color: #333;
}
.clear-btn {
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 0 0.3rem;
    line-height: 1;
}
.clear-btn:hover {
    color: #333;
}
.row-badge {
    background: #f0f0f0;
    color: #666;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.btn-search-submit {
    background: #2B65EC;
    color: white;
    border: none;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn-search-submit:hover {
    background: #1a4fd4;
}
.trip-notes-row {
    padding: 0.8rem 1.2rem;
    border-top: 1px solid #f0f0f0;
}
.trip-notes-row textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    font-family: inherit;
}
.trip-notes-row textarea:focus {
    border-color: #2B65EC;
}

/* === Destination Autocomplete Dropdown === */
.dest-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 100;
    max-height: 320px;
    overflow-y: auto;
}
.dest-search-wrap {
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid #f0f0f0;
}
.dest-search-input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    font-size: 0.95rem;
    outline: none;
}
.dest-search-input:focus {
    border-color: #2B65EC;
}

/* Hot Cities Section */
.hot-cities-section {
    padding: 0.6rem 1.2rem;
    border-bottom: 1px solid #f0f0f0;
}
.hot-cities-label {
    font-size: 0.75rem;
    color: #a09890;
    display: block;
    margin-bottom: 0.4rem;
}
.hot-cities-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.hot-city-btn {
    background: #f5f5f5;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    color: #4a4540;
    cursor: pointer;
    transition: all 0.15s;
}
.hot-city-btn:hover {
    background: #EEF0FF;
    border-color: #2B65EC;
    color: #2B65EC;
}

.dest-results {
    max-height: 250px;
    overflow-y: auto;
}

/* Transport Options */
.transport-options {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
}
.transport-option {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.95rem;
}
.transport-option:hover {
    background: #f5f5f5;
}
.transport-icon {
    font-size: 1.2rem;
    width: 1.5rem;
    text-align: center;
}
.dest-result-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1.2rem;
    cursor: pointer;
    transition: background 0.15s;
}
.dest-result-item:hover {
    background: #EEF0FF;
}
.dest-result-item .result-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #2B65EC;
}
.dest-result-item .result-info {
    flex: 1;
}
.dest-result-item .result-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
}
.dest-result-item .result-sub {
    font-size: 0.8rem;
    color: #888;
}
.dest-result-item .result-tag {
    background: #f0f0f0;
    color: #666;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
}

/* === Destination Tags (Multiple) === */
.dest-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    flex: 1;
}
.dest-tag {
    background: #EEF0FF;
    color: #2B65EC;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.dest-tag .remove-tag {
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.7;
}
.dest-tag .remove-tag:hover {
    opacity: 1;
}

/* === Calendar Panel === */
.calendar-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 100;
    padding: 1rem;
}
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}
.cal-nav {
    background: none;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: all 0.2s;
}
.cal-nav:hover {
    border-color: #2B65EC;
    color: #2B65EC;
}
.cal-months-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
}
.calendar-body {
    display: flex;
    gap: 1.5rem;
}
.cal-month {
    flex: 1;
}
.cal-month-title {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 0.3rem;
}
.cal-weekdays span:last-child {
    color: #2B65EC;
}
.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.cal-day {
    text-align: center;
    padding: 0.4rem 0;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    color: #333;
}
.cal-day:hover {
    background: #EEF0FF;
}
.cal-day.disabled {
    color: #ccc;
    cursor: default;
    pointer-events: none;
}
.cal-day.empty {
    cursor: default;
    pointer-events: none;
}
.cal-day.in-range {
    background: #E8EEFB;
    border-radius: 0;
}
.cal-day.range-start {
    background: #2B65EC;
    color: white;
    border-radius: 6px 0 0 6px;
}
.cal-day.range-end {
    background: #2B65EC;
    color: white;
    border-radius: 0 6px 6px 0;
}
.cal-day.range-start.range-end {
    border-radius: 6px;
}
.cal-day.today {
    font-weight: 700;
}
.calendar-footer {
    text-align: center;
    padding-top: 0.8rem;
    border-top: 1px solid #f0f0f0;
    margin-top: 0.8rem;
    font-size: 0.85rem;
    color: #666;
}

/* === Guest Selector Popup === */
.guest-popup {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 100;
    padding: 0.5rem 1.2rem 1rem;
}
.guest-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.guest-row:last-of-type {
    border-bottom: none;
}
.guest-label {
    display: flex;
    flex-direction: column;
}
.guest-label-main {
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
}
.guest-label-sub {
    font-size: 0.8rem;
    color: #999;
}
.guest-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.guest-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid #2B65EC;
    background: white;
    color: #2B65EC;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}
.guest-btn:hover {
    background: #2B65EC;
    color: white;
}
.guest-btn:disabled {
    border-color: #ddd;
    color: #ccc;
    cursor: default;
    background: white;
}
.guest-val {
    font-size: 1rem;
    font-weight: 600;
    min-width: 1.5rem;
    text-align: center;
    color: #333;
}
.guest-done-btn {
    width: 100%;
    background: #2B65EC;
    color: white;
    border: none;
    padding: 0.6rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.2s;
}
.guest-done-btn:hover {
    background: #1a4fd4;
}

/* === Muji Timeline — Day Cards === */
.muji-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 0;
}

.day-card {
    background: #fff;
    border: 1px solid #e8e5e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.day-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.day-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid #f0ede8;
}
.day-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #4a4540;
    letter-spacing: 0.02em;
}
.day-card-date {
    font-size: 0.8rem;
    color: #a09890;
    margin-left: 0.6rem;
    font-weight: 400;
}

.day-card-actions {
    display: flex;
    gap: 0.4rem;
}

.day-card-thinking {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    background: #f0f4ff;
    border-radius: 8px;
    border: 1px solid #e0e8ff;
}

.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.thinking-dots {
    display: flex;
    gap: 6px;
}

.thinking-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2B65EC;
    animation: thinkingBounce 1.2s infinite ease-in-out both;
}

.thinking-dots span:nth-child(1) { animation-delay: -0.3s; }
.thinking-dots span:nth-child(2) { animation-delay: -0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes thinkingBounce {
    0%, 100% { transform: scale(0.4); opacity: 0.3; }
    50% { transform: scale(1.2); opacity: 1; }
}

.thinking-text {
    font-size: 0.9rem;
    color: #2B65EC;
    font-weight: 500;
}

.muji-icon-btn {
    background: none;
    border: 1px solid #e8e5e0;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a09890;
    transition: all 0.2s;
}
.muji-icon-btn:hover {
    border-color: #c0b8b0;
    color: #6a6560;
    background: #faf9f7;
}
.muji-icon-btn svg {
    width: 14px;
    height: 14px;
}

.day-card-body {
    padding: 0.6rem 1.2rem;
}

.muji-item {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid #f7f5f2;
    font-size: 0.88rem;
    color: #5a5550;
    line-height: 1.5;
}
.muji-item:last-child {
    border-bottom: none;
}
.muji-item-time {
    font-size: 0.82rem;
    font-weight: 600;
    color: #8a7e72;
    white-space: nowrap;
    min-width: 3.5rem;
    flex-shrink: 0;
}
.muji-item-text {
    flex: 1;
}

/* Edit Mode */
.day-card-edit {
    padding: 1rem 1.2rem;
}
.day-card-edit textarea {
    width: 100%;
    min-height: 180px;
    border: 1px solid #e8e5e0;
    border-radius: 6px;
    padding: 0.8rem;
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #4a4540;
    resize: vertical;
    outline: none;
    background: #faf9f7;
}
.day-card-edit textarea:focus {
    border-color: #c0b8b0;
}

.day-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0.7rem 1.2rem;
    border-top: 1px solid #f0ede8;
    background: #faf9f7;
}

.muji-btn {
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    border: none;
}
.muji-btn svg {
    width: 13px;
    height: 13px;
}
.muji-btn-save {
    background: #6b8f71;
    color: white;
}
.muji-btn-save:hover {
    background: #5a7d60;
}
.muji-btn-cancel {
    background: none;
    color: #a09890;
    border: 1px solid #e0ddd8;
}
.muji-btn-cancel:hover {
    color: #6a6560;
    border-color: #c0b8b0;
}

/* === Chat History (Collapsible) === */
.chat-history {
    margin: 0.5rem 0;
    border: 1px solid #e8e5e0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}
.chat-history-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1.2rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.chat-history-toggle:hover {
    background: #faf9f7;
}
.chat-history-label {
    font-size: 0.85rem;
    color: #a09890;
    letter-spacing: 0.02em;
}
.chat-history-arrow {
    font-size: 0.75rem;
    color: #c0b8b0;
    transition: transform 0.2s;
}
.chat-history.expanded .chat-history-arrow {
    transform: rotate(90deg);
}
.chat-history-body {
    display: none;
    max-height: 350px;
    overflow-y: auto;
    padding: 0 1.2rem 0.8rem;
}
.chat-history.expanded .chat-history-body {
    display: block;
}

.chat-bubble {
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}
.chat-bubble.user {
    background: #f5f2ee;
    color: #4a4540;
    margin-left: 2rem;
}
.chat-bubble.assistant {
    background: transparent;
    color: #7a756f;
    margin-right: 2rem;
    border-left: 2px solid #e8e5e0;
    padding-left: 0.8rem;
}
.chat-bubble.thinking {
    color: #a09890;
    font-style: italic;
    animation: thinking-pulse 1.5s ease-in-out infinite;
}
@keyframes thinking-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.chat-thinking-indicator {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0;
}

.chat-thinking-indicator .thinking-dots {
    display: flex;
    gap: 5px;
}

.chat-thinking-indicator .thinking-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2B65EC;
    animation: thinkingBounce 1.2s infinite ease-in-out both;
}

.chat-thinking-indicator .thinking-dots span:nth-child(1) { animation-delay: -0.3s; }
.chat-thinking-indicator .thinking-dots span:nth-child(2) { animation-delay: -0.15s; }
.chat-thinking-indicator .thinking-dots span:nth-child(3) { animation-delay: 0s; }

.chat-thinking-indicator .thinking-text {
    font-size: 0.85rem;
    color: #2B65EC;
    font-style: normal;
    font-weight: 500;
}

/* === AI Chat Bar === */
.ai-chat-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #e8e5e0;
    padding: 0.8rem 1rem;
    display: flex;
    gap: 0.5rem;
    margin: 0 -1rem;
    border-radius: 0 0 12px 12px;
}
.ai-chat-bar input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid #e8e5e0;
    border-radius: 20px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    background: #faf9f7;
}
.ai-chat-bar input:focus {
    border-color: #c0b8b0;
}
.ai-chat-bar button {
    background: #6b8f71;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}
.ai-chat-bar button:hover { background: #5a7d60; }

.ai-message {
    background: white;
    border-radius: 12px;
    padding: 1rem 1.2rem;
    margin: 0.8rem 0;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
}
.ai-message.user {
    background: #667eea;
    color: white;
    margin-left: 2rem;
}
.ai-message.assistant {
    background: #f8f9ff;
    border-left: 3px solid #667eea;
    margin-right: 2rem;
}
.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #8a7e72;
    animation: blink 0.8s infinite;
    vertical-align: text-bottom;
    margin-left: 2px;
}
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* === Login Modal === */
.login-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 380px;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.login-modal-header {
    text-align: center;
    padding: 2rem 1.5rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}
.login-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}
.login-modal-subtitle {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    opacity: 0.85;
}
.login-form {
    padding: 1.5rem;
}
.login-form-group {
    margin-bottom: 1rem;
}
.login-form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.3rem;
}
.login-form-group input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.login-form-group input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}
.login-error {
    background: #fff0f0;
    color: #e53935;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    text-align: center;
}
.login-submit-btn {
    width: 100%;
    padding: 0.8rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.login-submit-btn:hover {
    background: #5a6fd6;
}

/* === Settings Section === */
.settings-container {
    max-width: 700px;
    margin: 1rem auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
}
.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}
.settings-header h2 {
    margin: 0;
    font-size: 1.3rem;
}
.settings-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.settings-close-btn:hover {
    color: #333;
}
.settings-tabs {
    display: flex;
    border-bottom: 1px solid #f0f0f0;
    padding: 0 1.5rem;
}
.settings-tab {
    background: none;
    border: none;
    padding: 0.8rem 1.2rem;
    font-size: 0.95rem;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.settings-tab:hover {
    color: #667eea;
}
.settings-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}
.settings-panel {
    padding: 1.5rem;
}

/* === User Management === */
.users-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}
.btn-add-user {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-add-user:hover {
    background: #5a6fd6;
}
.add-user-form {
    background: #f8f9ff;
    border: 1px solid #e0e4ff;
    border-radius: 10px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
}
.add-user-form h3 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: #333;
}
.add-user-fields {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.add-user-fields input,
.add-user-fields select {
    flex: 1;
    min-width: 120px;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
}
.add-user-fields input:focus,
.add-user-fields select:focus {
    border-color: #667eea;
}
.add-user-perms {
    margin-bottom: 1rem;
}
.add-user-perms > label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.4rem;
}
.perm-checks {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.perm-checks label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: #555;
    cursor: pointer;
}
.perm-checks input[type="checkbox"] {
    accent-color: #667eea;
}
.add-user-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
}
.btn-save-user {
    background: #4caf50;
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-save-user:hover {
    background: #43a047;
}
.btn-cancel-user {
    background: #e0e0e0;
    color: #555;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-cancel-user:hover {
    background: #d0d0d0;
}

/* Users List */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: box-shadow 0.2s;
}
.user-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}
.user-details {
    display: flex;
    flex-direction: column;
}
.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
}
.user-role {
    font-size: 0.78rem;
    color: #888;
}
.user-role-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
}
.user-role-badge.admin {
    background: #fff3e0;
    color: #e65100;
}
.user-role-badge.user {
    background: #e3f2fd;
    color: #1565c0;
}
.user-actions {
    display: flex;
    gap: 0.4rem;
}
.user-actions button {
    padding: 0.3rem 0.7rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}
.user-actions .btn-edit-user:hover {
    border-color: #667eea;
    color: #667eea;
}
.user-actions .btn-delete-user:hover {
    border-color: #e53935;
    color: #e53935;
}

/* Edit User Modal */
.edit-user-modal-content {
    background: white;
    border-radius: 14px;
    max-width: 420px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}
.edit-user-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #f0f0f0;
}
.edit-user-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}
.edit-user-modal-body {
    padding: 1.2rem;
}
.edit-user-field {
    margin-bottom: 1rem;
}
.edit-user-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.3rem;
}
.edit-user-field input,
.edit-user-field select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
}
.edit-user-field input:focus,
.edit-user-field select:focus {
    border-color: #667eea;
}
.edit-user-field input:disabled {
    background: #f5f5f5;
    color: #999;
}
.edit-user-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0.8rem 1.2rem;
    border-top: 1px solid #f0f0f0;
}
.btn-cancel-edit {
    background: #e0e0e0;
    color: #555;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}
.btn-cancel-edit:hover {
    background: #d0d0d0;
}
.btn-save-edit {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}
.btn-save-edit:hover {
    background: #5a6fd6;
}

/* === Auth gate overlay === */
.auth-gate {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #aaa;
    font-size: 0.85rem;
}

/* === Responsive === */
@media (max-width: 600px) {
    .card-grid { grid-template-columns: 1fr; }
    header h1 { font-size: 1.4rem; }
}
