/* ── Grey Waypoint ─ Warm Travel Theme ── */

:root {
    --bg: #F4F4F5;
    --bg-card: #FFFFFF;
    --bg-hover: #EBEBED;
    --bg-modal: rgba(20, 20, 25, 0.45);

    --text: #111113;
    --text-secondary: #4A4A55;
    --text-muted: #888894;

    --accent: #3D3D48;
    --accent-hover: #22222A;
    --accent-light: #E4E4E8;

    --border: #DADADF;
    --border-focus: #3D3D48;

    --success: #3A7A57;
    --warning: #B08A2A;
    --danger: #B84040;
    --info: #3A6090;

    --shadow: 0 2px 8px rgba(20, 20, 25, 0.07);
    --shadow-lg: 0 8px 24px rgba(20, 20, 25, 0.11);
    --radius: 10px;
    --radius-sm: 6px;

    --font: 'Georgia', 'Times New Roman', serif;
    --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

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

h1, h2, h3 { font-family: var(--font); font-weight: 600; color: var(--text); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Buttons ── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--accent-light); color: var(--accent); }
.btn-secondary:hover { background: #D8D8DE; }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #A84040; }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
}
.btn-icon:hover { background: var(--bg-hover); }

/* ── Forms ── */

.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--text);
    background: white;
    transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(61, 61, 72, 0.1);
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-row {
    display: flex;
    gap: 12px;
}
.form-row > .form-group { flex: 1; }

/* ── Cards ── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card-hover:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-light);
    cursor: pointer;
}

/* ── Modal ── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.modal-body { padding: 20px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
}

/* ── Badges ── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-idea { background: #E4E4E8; color: var(--text-secondary); }
.badge-confirmed { background: #D4E8D4; color: #3A6B3A; }
.badge-booked { background: #C8DCF0; color: #2A5A8A; }
.badge-cancelled { background: #F0D4D4; color: #8A3030; }

.badge-unverified {
    background: var(--warning);
    color: white;
    padding: 4px 12px;
    font-size: 0.8rem;
}

/* ── Type Icons ── */

.type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.type-flight { background: #DDE8F2; }
.type-lodging { background: #E8E8EE; }
.type-activity { background: #DDF0E5; }
.type-transport { background: #E5E0EE; }
.type-restaurant { background: #EEE0E0; }
.type-task { background: #E4E4E8; }
.type-note { background: #EEEAE0; }

/* ── Layout ── */

.page-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
}

.page-container-wide {
    max-width: 1200px;
}

/* ── Login Page ── */

.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-logo {
    font-family: var(--font);
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.login-error {
    background: #F5DEDE;
    color: var(--danger);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.login-success {
    background: #D8EAD8;
    color: var(--success);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.login-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── Top Bar ── */

.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    display: flex;
    align-items: center;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-brand {
    font-family: var(--font);
    font-size: 1.15rem;
    color: var(--accent);
    margin-right: 24px;
    white-space: nowrap;
}

.topbar-trip-name {
    font-family: var(--font);
    font-size: 1.05rem;
    color: var(--text);
    margin-right: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-nav {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.topbar-nav .nav-tab {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}
.topbar-nav .nav-tab:hover { background: var(--bg-hover); }
.topbar-nav .nav-tab.active {
    background: var(--accent-light);
    color: var(--accent);
}

/* ── FAB (old single button - replaced by FAB Menu below) ── */

/* ── Trip Cards Grid ── */

.trip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.trip-card-new {
    border: 2px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.trip-card-new:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.trip-card-new span { font-size: 2rem; margin-bottom: 4px; }

.trip-card-dates { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }
.trip-card-stats { display: flex; gap: 16px; margin-top: 12px; font-size: 0.85rem; color: var(--text-secondary); }

/* ── Entity List ── */

.entity-list { display: flex; flex-direction: column; gap: 8px; }

.entity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.entity-row:hover {
    border-color: var(--accent-light);
    box-shadow: var(--shadow);
}

.entity-row-info { flex: 1; min-width: 0; }
.entity-row-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entity-row-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.entity-row-time { font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; }

/* ── Day Sections (Calendar) ── */

.day-section { margin-bottom: 24px; }

.day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 2px solid var(--accent-light);
    margin-bottom: 8px;
}

.day-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.day-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.day-date {
    font-family: var(--font);
    font-size: 1.1rem;
    color: var(--accent);
}

.day-weekday {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.day-annotation {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-light);
    padding: 2px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

.day-add-btn {
    font-size: 0.8rem;
}

/* ── Narrative Itinerary Entries ── */

.itin-entries {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.itin-empty-day {
    padding: 8px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.itin-entry {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}

.itin-entry:hover {
    background: var(--bg-hover);
}

.itin-entry-time {
    flex: 0 0 72px;
    text-align: right;
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding-top: 2px;
    white-space: nowrap;
}

.itin-entry-icon {
    flex: 0 0 24px;
    font-size: 1rem;
    text-align: center;
    padding-top: 1px;
}

.itin-entry-content {
    flex: 1;
    min-width: 0;
}

.itin-entry-label {
    font-weight: 500;
    font-size: 0.92rem;
    line-height: 1.4;
}

.itin-entry-sublabel {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.itin-entry-location {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.itin-entry-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 0.78rem;
}

.itin-entry-cost {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Staying-at context (subtle) */
.itin-staying {
    opacity: 0.55;
    padding: 4px 8px;
}

.itin-staying .itin-entry-label {
    font-weight: 400;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.itin-staying:hover {
    opacity: 0.85;
}

/* Arrive/depart subtle indicators */
.itin-arrive .itin-entry-label,
.itin-checkin .itin-entry-label {
    color: var(--success);
}

.itin-depart .itin-entry-label,
.itin-checkout .itin-entry-label {
    color: var(--text-secondary);
}

/* ── Collapsible Section ── */

.section-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.section-toggle:hover { color: var(--text); }

/* ── Budget ── */

.budget-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.budget-tab {
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.budget-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.budget-tab:hover:not(.active) { color: var(--text); }

.settle-table { width: 100%; border-collapse: collapse; }
.settle-table th, .settle-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.settle-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.settle-positive { color: var(--success); font-weight: 600; }
.settle-negative { color: var(--danger); font-weight: 600; }

.settlement-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-weight: 500;
}

/* ── Research Board ── */

.board-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.board-column {
    background: var(--bg-hover);
    border-radius: var(--radius);
    padding: 12px;
    min-height: 200px;
}

.board-column-header {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.board-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: box-shadow 0.15s;
}
.board-card:hover { box-shadow: var(--shadow); }

.board-card-title { font-weight: 500; font-size: 0.9rem; }
.board-card-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ── Wallet Color Dot ── */

.wallet-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Splits Row ── */

.split-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.split-row .wallet-name {
    flex: 1;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.split-row .form-input {
    width: 120px;
    flex: none;
}

/* ── Empty State ── */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state-title { font-family: var(--font); font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 4px; }

/* ── Loading Spinner ── */

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ── */

.hidden { display: none !important; }

/* ── FAB Menu ── */

.fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 50;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 12px;
}

.fab-main {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(20, 20, 25, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.15s, background 0.15s;
}
.fab-main:hover { box-shadow: 0 6px 16px rgba(20, 20, 25, 0.3); }
.fab-main.open { transform: rotate(45deg); background: var(--text-secondary); }

.fab-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
}
.fab-container.open .fab-sub {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.fab-container.open .fab-sub:nth-child(2) { transition-delay: 0.03s; }
.fab-container.open .fab-sub:nth-child(1) { transition-delay: 0.06s; }

.fab-sub-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: transform 0.1s;
}
.fab-sub-btn:active { transform: scale(0.95); }
.fab-sub-btn.manual { background: var(--success); color: white; }
.fab-sub-btn.ai { background: var(--info); color: white; }

.fab-sub-label {
    background: var(--text);
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: var(--shadow);
}

/* ── FAB Backdrop ── */

.fab-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.1);
    z-index: 49;
}

/* ── Ingest Modal ── */

.ingest-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.ingest-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.ingest-tab:first-child { border-right: 1.5px solid var(--border); }
.ingest-tab.active {
    background: var(--accent-light);
    color: var(--accent);
}
.ingest-tab:hover:not(.active) { background: var(--bg-hover); }

.ingest-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text);
    background: white;
    resize: vertical;
}
.ingest-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(61, 61, 72, 0.1);
}

.ingest-textarea::placeholder { color: var(--text-muted); }

/* ── Ingest Results ── */

.ingest-results-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--success);
}

.ingest-result {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.ingest-result-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.ingest-result-info { flex: 1; min-width: 0; }

.ingest-result-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.ingest-result-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ingest-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.ingest-error {
    background: #F5DEDE;
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* ── Topbar Icons (Notifications + Settings) ── */

.topbar-icons {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 8px;
}

.topbar-icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.15rem;
    color: var(--text-secondary);
    transition: background 0.15s;
}
.topbar-icon-btn:hover { background: var(--bg-hover); }

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: white;
    border-radius: 9px;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}

/* ── Dropdown (shared by notifications + settings) ── */

.topbar-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 340px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
}

.dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
}

.dropdown-body {
    max-height: 360px;
    overflow-y: auto;
}

.dropdown-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

/* ── Notification Items ── */

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-hover); }

.notif-item-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 2px; }
.notif-item-info { flex: 1; min-width: 0; }
.notif-item-title { font-weight: 500; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }

/* ── Settings Dropdown ── */

.settings-dropdown {
    width: 320px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }

.settings-label {
    font-size: 0.88rem;
    font-weight: 500;
}
.settings-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 12px;
    transition: background 0.2s;
}
.toggle-slider:before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    left: 3px;
    bottom: 3px;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--success);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Settings Select */
.settings-select {
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: var(--font-ui);
    color: var(--text);
    background: white;
    max-width: 160px;
}
.settings-select:focus {
    outline: none;
    border-color: var(--border-focus);
}

.settings-info {
    padding: 12px 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-hover);
    border-top: 1px solid var(--border);
}

/* ── Attachment Section ── */

.attachment-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.attachment-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.attachment-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.attachment-row:last-child { border-bottom: none; }

.attachment-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.attachment-name {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.attachment-name:hover { color: var(--accent-hover); text-decoration: underline; }

.attachment-size {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.attachment-delete {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s, color 0.15s;
}
.attachment-delete:hover { background: #F5DEDE; color: var(--danger); }

.attachment-upload-area {
    margin-top: 8px;
}

.attachment-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.attachment-upload-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-hover);
}

.attachment-uploading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.attachment-empty {
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Attachment Viewer Modal ── */

.viewer-modal {
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.viewer-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.1rem;
    min-width: 0;
}

.viewer-body {
    flex: 1;
    min-height: 300px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.viewer-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
    background: var(--bg-card);
    z-index: 2;
}

.viewer-iframe {
    width: 100%;
    flex: 1;
    min-height: 500px;
    border: none;
    background: white;
}

.viewer-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #EBEBED;
    flex: 1;
    min-height: 300px;
}

.viewer-unsupported {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    flex: 1;
}

.viewer-error {
    background: #F5DEDE;
    color: var(--danger);
    padding: 12px 16px;
    margin: 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* ── Dropdown Backdrop (click-away) ── */

.dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 150;
}

/* ── Calendar View ── */

.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.cal-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cal-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.cal-nav-label {
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--text);
    min-width: 130px;
    text-align: center;
}

/* Progress bar */
.cal-progress {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    position: relative;
    margin-bottom: 12px;
}

.cal-progress-fill {
    position: absolute;
    top: 0;
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: left 0.3s, width 0.3s;
}

/* Grid wrapper */
.cal-grid-wrapper {
    overflow: auto;
    max-height: calc(100vh - 170px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.cal-grid {
    display: flex;
    min-width: 0;
}

/* Time axis (left column) */
.cal-time-axis {
    flex: 0 0 56px;
    position: sticky;
    left: 0;
    z-index: 10;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
}

.cal-time-axis-header {
    height: 48px;
    border-bottom: 1px solid var(--border);
}

.cal-time-axis-allday {
    min-height: 32px;
    border-bottom: 1px solid var(--border);
}

.cal-time-axis-track {
    position: relative;
}

.cal-hour-label {
    position: absolute;
    right: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
    transform: translateY(-50%);
    white-space: nowrap;
    pointer-events: none;
}

/* Day columns */
.cal-day-column {
    flex: 1;
    min-width: 120px;
    border-right: 1px solid var(--border);
}
.cal-day-column:last-child {
    border-right: none;
}

/* Day header */
.cal-day-header {
    height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 5;
}

.cal-day-weekday {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.cal-day-num {
    font-family: var(--font);
    font-size: 1.05rem;
    color: var(--text);
    line-height: 1.2;
}

.cal-today {
    background: var(--accent-light) !important;
}

.cal-today-num {
    color: var(--accent);
    font-weight: 700;
}

/* All-day row */
.cal-allday-row {
    min-height: 32px;
    padding: 3px 4px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    cursor: pointer;
    background: var(--bg-card);
}

.cal-allday-row:hover {
    background: var(--bg-hover);
}

.cal-allday-empty {
    min-height: 24px;
}

.cal-allday-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
    transition: opacity 0.15s;
}

.cal-allday-chip:hover {
    opacity: 0.8;
}

.cal-chip-icon {
    font-size: 0.72rem;
    flex-shrink: 0;
}

.cal-chip-title {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Day time track */
.cal-day-track {
    position: relative;
    cursor: pointer;
}

.cal-day-track:hover {
    background: rgba(61, 61, 72, 0.02);
}

/* Hour gridlines */
.cal-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 1px solid var(--border);
    pointer-events: none;
}

.cal-half-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 1px dashed rgba(200, 200, 208, 0.5);
    pointer-events: none;
}

/* Time blocks */
.cal-block {
    position: absolute;
    border-radius: 4px;
    padding: 3px 5px;
    overflow: hidden;
    cursor: pointer;
    z-index: 2;
    transition: opacity 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.cal-block:hover {
    opacity: 0.85;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    z-index: 3;
}

.cal-block-inner {
    overflow: hidden;
}

.cal-block-title {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.cal-block-time {
    font-size: 0.65rem;
    color: var(--text-secondary);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Multi-day continuation indicators */
.cal-block-continues-down {
    border-bottom: 2px dashed rgba(0,0,0,0.2);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.cal-block-continues-up {
    border-top: 2px dashed rgba(0,0,0,0.2);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Now line */
.cal-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 2px solid var(--danger);
    z-index: 4;
    pointer-events: none;
}

.cal-now-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    position: absolute;
    top: -5px;
    left: -4px;
}

/* ── Admin Panel ── */

.admin-section {
    margin-bottom: 20px;
}

.admin-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.admin-user-row:last-child { border-bottom: none; }

.admin-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.admin-user-name {
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.admin-user-email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.admin-user-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.admin-user-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.admin-empty {
    padding: 16px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

/* ── Settings Page ── */

.settings-page-section {
    margin-bottom: 20px;
}

.settings-page-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.settings-page-row:last-child { border-bottom: none; }

.settings-page-label {
    flex: 0 0 120px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.settings-page-value {
    font-size: 0.95rem;
    color: var(--text);
}

.settings-page-message {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.settings-page-error {
    background: #F5DEDE;
    color: var(--danger);
}

.settings-page-success {
    background: #D8EAD8;
    color: var(--success);
}

/* ── Responsive ── */

@media (max-width: 640px) {
    .topbar-brand { display: none; }
    .topbar-nav .nav-tab { padding: 8px 10px; font-size: 0.8rem; }

    .form-row { flex-direction: column; gap: 0; }

    .modal { max-width: 100%; border-radius: var(--radius) var(--radius) 0 0; align-self: flex-end; max-height: 95vh; }
    .viewer-modal { max-width: 100%; }
    .viewer-iframe { min-height: 400px; }

    .board-columns { grid-template-columns: 1fr; }

    .trip-grid { grid-template-columns: 1fr; }

    h1 { font-size: 1.4rem; }

    .itin-entry-time { flex: 0 0 56px; font-size: 0.75rem; }
    .day-annotation { font-size: 0.72rem; padding: 2px 6px; }

    /* Calendar responsive */
    .cal-time-axis { flex: 0 0 44px; }
    .cal-day-column { min-width: 100px; }
    .cal-nav-label { font-size: 0.82rem; min-width: 100px; }
    .cal-block-title { font-size: 0.65rem; }
    .cal-block-time { font-size: 0.6rem; }

    /* Admin responsive */
    .admin-user-row { flex-direction: column; align-items: flex-start; }
    .admin-user-actions { width: 100%; }
}
