:root {
    --primary-color: #1a2332;
    --primary-light: #2d3a4d;
    --accent-color: #00a8e8;
    --accent-hover: #0096d1;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #c53030;
    --text-dark: #1a202c;
    --text-medium: #4a5568;
    --text-light: #718096;
    --border-color: #e2e8f0;
    --bg-light: #f7fafc;
    --bg-white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-md: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 25px rgba(0,0,0,0.15);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background:
        linear-gradient(to bottom, rgba(214,238,248,0.45) 0%, rgba(245,240,232,0.45) 100%),
        url('tsk_tripcostplanner_background.webp') center center / cover no-repeat fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ============================
   HEADER
   ============================ */
.header {
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header-left { display: flex; align-items: center; gap: 1rem; }
.header-logo-link { display: flex; align-items: center; text-decoration: none; transition: opacity 0.2s; }
.header-logo-link:hover { opacity: 0.85; }
.logo-image { height: 36px; width: auto; display: block; flex-shrink: 0; }
.tool-name-btn {
    font-size: 1.5rem; font-weight: 600; color: #1a2332;
    white-space: nowrap; background: none; border: none; padding: 0;
    cursor: pointer; font-family: inherit; transition: color 0.15s;
}
.tool-name-btn:hover { color: var(--accent-color); }

.header-icons { display: flex; align-items: center; gap: 8px; flex-shrink: 0; position: relative; }
.header-icon-btn {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0;
    background: #ffffff; border: 1px solid var(--border-color); border-radius: 0.5rem;
    cursor: pointer; transition: all 0.2s; color: #4a5568; font-family: inherit;
}
.header-icon-btn:hover { border-color: var(--accent-color); background: #f7fafc; color: var(--accent-color); }
.header-icon-btn svg { width: 20px; height: 20px; }
.lang-short { font-size: 0.875rem; font-weight: 600; color: #1a202c; letter-spacing: 0.02em; }
.header-icon-btn:hover .lang-short { color: var(--accent-color); }

.language-selector { position: relative; }
.language-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 6px);
    background: #ffffff; border: 1px solid var(--border-color); border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); min-width: 140px; z-index: 1001; overflow: hidden;
}
.language-dropdown.active { display: block; animation: langSlideDown 0.2s ease; }
@keyframes langSlideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.lang-option {
    display: flex; align-items: center; gap: 0.5rem; width: 100%;
    padding: 0.6rem 1rem; background: none; border: none;
    font-size: 0.875rem; cursor: pointer; color: #1a202c; transition: background 0.15s; font-family: inherit;
}
.lang-option:hover { background: #f7fafc; }
.lang-option.active { background: rgba(0,168,232,0.08); color: var(--accent-color); }
.lang-check { font-size: 0.75rem; opacity: 0; transition: opacity 0.15s; }
.lang-option.active .lang-check { opacity: 1; }

@media (max-width: 768px) {
    .header-inner { padding: 0.4rem 1rem; }
    .logo-image { height: 34px; }
    .tool-name-btn {
        display: flex; flex-direction: column;
        align-items: flex-start; line-height: 1.15; white-space: normal;
    }
    .tool-name-eyebrow {
        font-size: 0.85rem; font-weight: 600;
        color: #1a2332; line-height: 1.3; transition: color 0.15s;
    }
    .tool-name-btn:hover .tool-name-eyebrow { color: var(--accent-color); }
    .header-icons { gap: 6px; }
    .header-icon-btn { width: 36px; height: 36px; }
    .header-icon-btn svg { width: 18px; height: 18px; }
}
@media (max-width: 480px) {
    .header-inner { padding: 0.35rem 0.75rem; }
    .logo-image { height: 30px; }
    .tool-name-btn { font-size: 1.2rem; }

    /* Planner header on mobile — two-part structure with scrollable icons */
    .planner-header {
        padding: 0 !important;
        border-radius: 8px;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        overflow: hidden !important;
    }
    .planner-header-left {
        padding: 8px 14px;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 2px;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
        min-width: 0;
    }
    .planner-trip-name {
        text-align: left;
        max-width: 100%;
    }
    .planner-total-range {
        text-align: left;
    }
    .planner-header-actions {
        padding: 8px 14px;
        display: flex !important;
        gap: 6px;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        touch-action: pan-x;
        overscroll-behavior-x: contain;
        flex-wrap: nowrap !important;
        flex-shrink: 0;
    }
    .planner-header-actions::-webkit-scrollbar {
        display: none;
    }
    .planner-header-actions .btn-icon-label {
        flex-shrink: 0 !important;
        min-width: 64px;
        touch-action: pan-x;
        -webkit-user-select: none;
        user-select: none;
    }

}


/* ============================
   CONTAINER
   ============================ */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 4px 1.5rem 2rem;
    flex: 1;
}
@media (max-width: 768px) { .container { padding: 4px 1rem 2rem; } }
@media (max-width: 480px) { .container { padding: 4px 0.75rem 2rem; } }

/* ============================
   INFO BANNER
   ============================ */
.info-banner {
    background: linear-gradient(135deg, #e3f2fd 0%, #e1f5fe 100%);
    border: 1.5px solid #4fc3f7;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(79, 195, 247, 0.1);
}
.info-icon { font-size: 1.3rem; flex-shrink: 0; }
.info-text { flex: 1; color: #01579b; font-size: 0.9rem; line-height: 1.5; }
.info-text strong { color: #004d7a; font-weight: 600; }
.info-close {
    background: none;
    border: none;
    color: #01579b;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
    margin-left: auto;
}
.info-close:hover { background: rgba(1, 87, 155, 0.1); color: #004d7a; }

/* ============================
   CARDS
   ============================ */
.card {
    background: var(--bg-white); border-radius: 8px;
    padding: 24px; box-shadow: var(--shadow);
    margin-bottom: 16px; border: 1px solid var(--border-color);
}
.card:last-child { margin-bottom: 0; }

/* Draft / Report Cards */
.draft-card, .report-card {
    background: var(--bg-light); border: 1.5px solid var(--border-color);
    border-radius: 8px; padding: 14px 18px;
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; transition: all 0.2s;
}
.draft-card { border-left: 4px solid var(--accent-color); }
.report-card { border-left: 4px solid var(--success-color); }
.draft-card:hover, .report-card:hover { box-shadow: var(--shadow); }
.draft-info, .report-info { flex: 1; }
.draft-name, .report-name { font-weight: 600; color: var(--text-dark); font-size: 0.95rem; margin-bottom: 2px; }
.draft-meta, .report-meta { font-size: 0.78rem; color: var(--text-light); }
.draft-card-actions, .report-card-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ============================
   FORMS
   ============================ */
.form-group { margin-bottom: 12px; }
.form-group label {
    display: block; margin-bottom: 8px; font-weight: 500;
    color: var(--text-dark); font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%; padding: 12px 16px;
    border: 1.5px solid var(--border-color); border-radius: 6px;
    font-size: 0.95rem; background: var(--bg-white);
    color: var(--text-dark); font-family: inherit;
    transition: all 0.2s ease;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none; border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26,54,93,0.1);
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { margin-bottom: 0; }
.flex-2 { flex: 2; }
.flex-1 { flex: 1; }

.field-error { color: var(--danger-color); font-size: 0.78rem; margin-top: 4px; min-height: 1em; }
.field-error:empty { min-height: 0; margin-top: 0; }
.sample-hint { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--text-light); margin-top: 0.4rem; }
.sample-link { color: var(--accent-color); text-decoration: none; font-weight: 500; transition: opacity 0.15s; }
.sample-link:hover { opacity: 0.75; text-decoration: underline; }

/* ============================
   BUTTONS
   ============================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 18px; border: none; border-radius: 6px;
    font-size: 0.82rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s; font-family: inherit;
    text-transform: uppercase; letter-spacing: 0.04em;
    min-height: 38px; white-space: nowrap;
}
.btn-sm { padding: 6px 12px; font-size: 0.75rem; min-height: 32px; }
.btn-primary { background: var(--primary-color); color: white; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-light); box-shadow: var(--shadow); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--accent-color); color: var(--primary-color); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--accent-hover); box-shadow: var(--shadow); transform: translateY(-1px); }
.btn-outline { background: var(--bg-white); color: var(--primary-color); border: 1.5px solid var(--primary-color); }
.btn-outline:hover { background: var(--primary-color); color: white; }
.btn-danger { background: var(--danger-color); color: white; }
.btn-danger:hover { background: #a02020; }
.btn-ghost { background: transparent; color: var(--text-medium); border: 1px solid var(--border-color); }
.btn-ghost:hover { background: var(--bg-light); }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; min-height: 26px; padding: 0;
    border-radius: 4px; font-size: 0.8rem; border: 1px solid var(--border-color);
    background: var(--bg-white); color: var(--text-medium); cursor: pointer;
    transition: all 0.15s; font-family: inherit;
}
.btn-icon:hover { border-color: var(--accent-color); color: var(--accent-color); background: #e6f7ff; }
.btn-icon.btn-danger:hover { border-color: var(--danger-color); color: var(--danger-color); background: #fdecea; }

/* Compact planner card header button */
.btn-ph {
    display: inline-flex; align-items: center; gap: 2px;
    padding: 2px 7px; border: 1.5px solid var(--accent-color); border-radius: 4px;
    background: transparent; color: var(--accent-color);
    font-size: 0.68rem; font-weight: 700; font-family: inherit;
    cursor: pointer; transition: all 0.15s; white-space: nowrap; line-height: 1.6;
}
.btn-ph:hover { background: #e6f7ff; }

/* ============================
   SETUP SECTION — Two-card grid
   ============================ */
.setup-grid {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 20px;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}
.setup-form-card,
.setup-actions-card {
    margin-bottom: 0;
}
.setup-form-card {
    flex: 1 1 0;
    min-width: 0;
}
.setup-actions-card {
    flex: 0 0 300px;
    width: 300px;
}
@media (max-width: 768px) {
    .setup-grid { flex-direction: column; gap: 16px; }
    .setup-form-card,
    .setup-actions-card { flex: none; width: 100%; }
    #btn-start-planning { width: 100%; }
}

#btn-start-planning { margin-top: 14px; }

.setup-form-card h1 {
    color: var(--primary-color); font-size: 1.25rem; font-weight: 600;
    border-bottom: 2px solid var(--accent-color); padding-bottom: 6px; margin-bottom: 16px;
}

/* Right actions card */
.setup-actions-label {
    font-size: 0.72rem; font-weight: 700; color: var(--text-light);
    text-transform: uppercase; letter-spacing: 0.07em;
    margin: 0 0 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* Planner action icon-label tiles (matches trip-planner style) */
.btn-icon-label {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 64px; min-height: 52px; padding: 0.35rem 0.2rem; gap: 3px;
    border: 1.5px solid var(--border-color); border-radius: 12px;
    background: var(--bg-white); cursor: pointer;
    transition: background 0.15s, border-color 0.15s; flex-shrink: 0; font-family: inherit;
}
.btn-icon-label:hover { background: #f0f4f8; border-color: var(--accent-color); }
.bil-icon { font-size: 1.2rem; line-height: 1; }
.bil-label {
    font-size: 0.6rem; font-weight: 600; color: var(--text-light);
    text-align: center; line-height: 1.2; word-break: break-word;
}

/* Cloud save dirty indicator — shown as amber dot when unsaved cloud changes exist */
#cloud-save-btn { position: relative; }
#cloud-save-btn[data-dirty="true"]::after {
    content: '';
    position: absolute;
    top: 5px; right: 5px;
    width: 7px; height: 7px;
    background: #f59e0b;
    border-radius: 50%;
    border: 1.5px solid #fff;
}

/* Entry screen full-width buttons */
.setup-actions-card .btn { width: 100%; }
.setup-actions-card .button-with-hint { display: flex; width: 100%; }

/* Button with hint text below */
.button-with-hint {
    display: inline-flex; flex-direction: column; align-items: center; gap: 4px; vertical-align: top;
}
.button-with-hint .file-type-hint { margin: 0; }
@media (max-width: 768px) {
    .button-with-hint { display: flex; width: 100%; align-items: center; }
}

/* Radio button group — exact copy of trip-planner */
.radio-group { display: flex; gap: 20px; }
.radio-group label {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    font-weight: normal; text-transform: none; font-size: 0.9rem;
}

/* Form group with label + action icon on right */
.form-group-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;
    border-bottom: 1px solid var(--border-color); padding-bottom: 5px;
}
.form-group-header label { margin-bottom: 0; }
.btn-add-icon {
    width: 22px; height: 22px; border-radius: 50%; border: none;
    background: var(--accent-color); color: #fff;
    font-size: 1.1rem; font-weight: 700; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background 0.15s; padding: 0;
}
.btn-add-icon:hover { background: var(--primary-color); }

.file-type-hint {
    font-size: 0.7rem; color: var(--text-light);
    font-style: italic;
}

/* Draft/Report sections in right card */
.draft-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}
.draft-label {
    font-size: 0.82rem; color: var(--text-medium);
    margin-bottom: 10px; font-weight: 500;
}

/* Inline draft/report mini-cards (inside right column) */
.draft-mini-card {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-light); border: 1.5px solid var(--border-color);
    border-radius: 6px; padding: 10px 14px;
    cursor: pointer; transition: all 0.2s;
}
.draft-mini-card.is-draft { border-left: 3px solid var(--accent-color); }
.draft-mini-card.is-report { border-left: 3px solid var(--success-color); }
.draft-mini-card:hover { border-color: var(--accent-color); background: #e6f7ff; box-shadow: var(--shadow-sm); }
.draft-mini-card.is-report:hover { border-color: var(--success-color); background: #e6fff5; }
.draft-mini-info { flex: 1; min-width: 0; }
.draft-mini-name { font-weight: 600; color: var(--text-dark); font-size: 0.9rem; margin-bottom: 2px; }
.draft-mini-meta { font-size: 0.75rem; color: var(--text-light); }
.draft-mini-delete {
    flex-shrink: 0; background: var(--danger-color); color: white; border: none;
    border-radius: 50%; width: 28px; height: 28px; font-size: 1.2rem; cursor: pointer;
    opacity: 0; transition: all 0.2s ease; display: flex; align-items: center;
    justify-content: center; padding: 0; line-height: 1;
}
.draft-mini-card:hover .draft-mini-delete { opacity: 1; }
.draft-mini-delete:hover { background: #a02020; transform: scale(1.1); }

/* Date toggle */
.toggle-group { display: flex; gap: 0; border: 1.5px solid var(--border-color); border-radius: 6px; overflow: hidden; }
.toggle-btn {
    flex: 1; padding: 9px 10px; background: var(--bg-white); border: none;
    font-size: 0.82rem; font-family: inherit; cursor: pointer;
    color: var(--text-medium); transition: all 0.2s; text-align: center;
    border-right: 1px solid var(--border-color);
}
.toggle-btn:last-child { border-right: none; }
.toggle-btn.active { background: var(--primary-color); color: white; font-weight: 600; }
.toggle-btn:not(.active):hover { background: var(--bg-light); }

/* Currency rows */
.trip-currencies-list { margin-bottom: 10px; }
.currency-row {
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
    padding: 6px 8px; background: var(--bg-light);
    border: 1px solid var(--border-color); border-radius: 6px;
}
.currency-row-rate-label { font-size: 0.88rem; color: var(--text-dark); white-space: nowrap; font-weight: 500; }
.currency-row-home-label { font-size: 0.88rem; color: var(--primary-color); font-weight: 600; white-space: nowrap; flex: 1; }
.currency-row-rate {
    width: 62px; padding: 3px 6px; border: 1.5px solid var(--border-color);
    border-radius: 4px; font-size: 0.88rem; font-family: inherit; background: var(--bg-white);
    transition: border-color 0.2s;
}
.currency-row-rate:focus { outline: none; border-color: var(--accent-color); }
.currency-row-remove {
    margin-left: auto; background: none; border: none; color: var(--text-light);
    font-size: 1.1rem; cursor: pointer; padding: 4px 8px; border-radius: 4px;
    transition: all 0.15s; min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.currency-row-remove:hover { color: var(--danger-color); background: #fdecea; }

.currency-add-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.currency-add-input {
    flex: 1; padding: 5px 10px; border: 1.5px solid var(--border-color);
    border-radius: 6px; font-size: 0.9rem; font-family: inherit; background: var(--bg-white);
}
.currency-add-input:focus { outline: none; border-color: var(--accent-color); }
.currency-add-confirm, .currency-add-cancel {
    width: 28px; height: 28px; border-radius: 50%; border: none;
    font-size: 1rem; font-weight: 700; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: background 0.15s; padding: 0;
}
.currency-add-confirm { background: var(--success-color); color: #fff; }
.currency-add-confirm:hover { background: #15803d; }
.currency-add-cancel { background: #f1f5f9; color: var(--text-medium); }
.currency-add-cancel:hover { background: #fdecea; color: var(--danger-color); }

/* ============================
   PLANNER SECTION
   ============================ */
.planner-header {
    background: var(--bg-white); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 8px 14px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
    position: sticky; top: 62px; z-index: 100;
    box-shadow: var(--shadow);
}
.planner-header-left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.planner-trip-name {
    font-size: 1rem; font-weight: 700; color: var(--primary-color);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px;
}
.planner-total-range { font-size: 0.82rem; color: var(--text-medium); white-space: nowrap; }
.planner-total-range strong { color: var(--accent-color); font-size: 0.9rem; }
.planner-header-actions { display: flex; gap: 6px; flex-shrink: 0; overflow-x: auto; scrollbar-width: none; }
.planner-header-actions::-webkit-scrollbar { display: none; }
.planner-header-actions .btn-icon-label { flex-shrink: 0; }

/* Mobile tabs */
.planner-tabs {
    display: none; gap: 0; margin-bottom: 12px;
    background: var(--bg-white); border: 1px solid var(--border-color);
    border-radius: 8px; overflow: hidden;
}
.planner-tab {
    flex: 1; padding: 10px 16px; background: var(--bg-white);
    border: none; font-size: 0.9rem; font-weight: 600; font-family: inherit;
    cursor: pointer; color: var(--text-medium); transition: all 0.2s;
    border-right: 1px solid var(--border-color);
}
.planner-tab:last-child { border-right: none; }
.planner-tab.active { background: var(--primary-color); color: white; }

/* Two-column layout */
.planner-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: flex-start;
}
.planner-card {
    background: var(--bg-white); border-radius: 8px;
    border: 1px solid var(--border-color); box-shadow: var(--shadow);
    overflow: hidden;
}
.planner-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 14px; border-bottom: 2px solid var(--accent-color);
    background: var(--bg-light); flex-wrap: wrap; gap: 6px;
}
.planner-card-header h2 {
    font-size: 0.78rem; font-weight: 700; color: var(--primary-color); margin: 0;
    text-transform: uppercase; letter-spacing: 0.07em;
}
.trunk-actions { display: flex; gap: 5px; flex-wrap: wrap; }

/* ============================
   ESTIMATES (TRUNK)
   ============================ */
.trunk-container { padding: 4px 14px 0; }

.trunk-group { margin-bottom: 16px; }
.trunk-group:last-child { margin-bottom: 0; }
.trunk-group-header {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 8px;
    font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    border-radius: 5px;
    margin-bottom: 4px;
}
.trunk-group-header.global {
    background: rgba(26,35,50,0.07);
    color: var(--primary-light);
    border: 1px solid rgba(26,35,50,0.1);
}
.trunk-group-header.day-group,
.trunk-group-header.date-group {
    background: rgba(0,168,232,0.07);
    color: #0080b0;
    border: 1px solid rgba(0,168,232,0.15);
}
/* Inline date picker (first date selection) */
.trunk-pick-date {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0; border-bottom: 1px dashed var(--border-color);
    margin-bottom: 6px;
}
.trunk-pick-date-label { font-size: 0.75rem; color: var(--text-medium); white-space: nowrap; }
.trunk-pick-date-input {
    padding: 4px 8px; border: 1.5px solid var(--border-color); border-radius: 4px;
    font-size: 0.82rem; font-family: inherit; color: var(--text-dark); background: var(--bg-white);
    flex: 1; min-width: 0;
}
.trunk-pick-date-input:focus {
    outline: none; border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(26,54,93,0.1);
}

.trunk-group-label-wrap { flex: 1; display: flex; align-items: center; gap: 4px; }
.trunk-group-label { }
.trunk-group-cal-btn {
    background: none; border: none; cursor: pointer; padding: 0;
    font-size: 0.85rem; line-height: 1; opacity: 0.65; transition: opacity 0.15s;
    flex-shrink: 0;
}
.trunk-group-cal-btn:hover { opacity: 1; }
.trunk-group-actions { display: flex; gap: 10px; }
.trunk-group-action-btn {
    background: none; border: none; cursor: pointer; padding: 0;
    font-family: inherit; font-size: 0.68rem; font-weight: 600;
    color: inherit; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.05em;
    transition: opacity 0.15s;
}
.trunk-group-action-btn:hover { opacity: 1; text-decoration: underline; }
.trunk-group-drop-zone {
    min-height: 32px; border: 2px dashed transparent;
    border-radius: 4px; transition: all 0.2s; padding: 2px;
}
.trunk-group-drop-zone.drag-over {
    border-color: var(--accent-color); background: #e6f7ff;
}

/* Cost item row — table-row style */
.trunk-row {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 0; background: none; border: none;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0; transition: background 0.15s;
}
.trunk-row:hover { background: var(--bg-light); }
.trunk-row-body { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 5px; }
.trunk-row-desc { flex: 1; min-width: 0; font-size: 0.82rem; color: var(--text-dark); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trunk-row-amount { font-size: 0.71rem; color: var(--text-medium); white-space: nowrap; flex-shrink: 0; }
.trunk-row-amount .original { color: var(--text-medium); font-weight: 400; }
.trunk-row-amount .converted { color: var(--text-light); margin-left: 3px; }
.trunk-row-actions { display: flex; gap: 3px; flex-shrink: 0; position: relative; }
.trunk-kebab-btn { font-size: 1rem; letter-spacing: 0; }
.trunk-kebab-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 4px);
    background: #fff; border: 1px solid var(--border-color);
    border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 300; min-width: 140px; padding: 4px 0;
}
.trunk-kebab-menu.open { display: block; }
.trunk-kebab-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 7px 12px; background: none; border: none;
    font-size: 0.82rem; color: var(--text-dark); cursor: pointer;
    text-align: left; font-family: inherit; white-space: nowrap;
}
.trunk-kebab-item:hover { background: var(--bg-light); }
.trunk-kebab-item.danger { color: var(--danger-color); }
.trunk-kebab-item.danger:hover { background: #fff5f5; }

/* Scenario attachment row — table-row style */
.trunk-scenario-row {
    background: none;
    border-bottom: 1px solid var(--border-color);
    border-left: 2px solid var(--accent-color);
    margin-bottom: 0; padding: 7px 0 7px 7px;
    transition: background 0.15s;
}
.trunk-scenario-row:hover { background: #f0f8ff; }
.trunk-scenario-header {
    display: flex; align-items: center; gap: 6px;
}
.trunk-scenario-name { flex: 1; min-width: 0; font-size: 0.82rem; font-weight: 400; color: var(--text-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trunk-scenario-range { font-size: 0.71rem; color: var(--text-medium); white-space: nowrap; flex-shrink: 0; }
.trunk-scenario-options { margin-top: 6px; padding-left: 14px; display: none; }
.trunk-scenario-row.expanded .trunk-scenario-options { display: block; }
.trunk-scenario-toggle {
    background: none; border: none; cursor: pointer; padding: 0 2px;
    color: var(--text-light); font-size: 0.65rem; flex-shrink: 0;
    transition: transform 0.18s; line-height: 1; font-family: inherit;
}
.trunk-scenario-row.expanded .trunk-scenario-toggle { transform: rotate(90deg); }
.trunk-scenario-option {
    display: flex; align-items: center; gap: 6px;
    padding: 3px 0; font-size: 0.78rem; color: var(--text-medium);
    border-bottom: 1px solid #e8f4fd;
}
.trunk-scenario-option:last-child { border-bottom: none; }
.trunk-scenario-option label {
    display: flex; align-items: center; gap: 5px; cursor: pointer;
    text-transform: none; letter-spacing: 0; font-size: 0.78rem; font-weight: normal;
}
.trunk-scenario-option input[type="checkbox"] {
    width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent-color);
}
.trunk-scenario-actions { display: flex; gap: 3px; }

/* Empty group hint */
.trunk-group-empty {
    padding: 8px 0 4px; color: var(--text-light);
    font-size: 0.75rem; font-style: italic;
}
.trunk-empty {
    text-align: center; padding: 12px; color: var(--text-light);
    font-size: 0.82rem; font-style: italic;
}
.trunk-drop-hint {
    text-align: center; padding: 6px; color: var(--text-light);
    font-size: 0.72rem; font-style: italic; opacity: 0.7;
    display: none;
}
@media (hover: hover) { .trunk-drop-hint { display: block; } }

/* ============================
   SCENARIO LIBRARY
   ============================ */
.library-container { padding: 8px; }

.scenario-card {
    background: var(--bg-light); border: 1.5px solid var(--border-color);
    border-radius: 6px; margin-bottom: 8px; transition: box-shadow 0.2s;
    overflow: hidden;
}
.scenario-card:hover { box-shadow: var(--shadow); }
.scenario-card.dragging { opacity: 0.5; }
.scenario-card-header {
    display: flex; align-items: center; gap: 6px; padding: 7px 10px;
    background: #edf1f7;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
}
.scenario-drag-handle {
    cursor: grab; opacity: 0.4; font-size: 0.9rem; flex-shrink: 0;
    user-select: none; touch-action: none;
}
.scenario-drag-handle:active { cursor: grabbing; }
.scenario-name-display {
    flex: 1; font-weight: 600; font-size: 0.78rem; cursor: pointer; color: var(--primary-color);
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.scenario-name-display:hover { text-decoration: underline; }
.scenario-name-input {
    flex: 1; background: var(--bg-white); border: 1px solid var(--border-color);
    border-radius: 3px; color: var(--text-dark); font-size: 0.85rem; font-family: inherit;
    padding: 2px 6px; outline: none;
}
.scenario-name-input::placeholder { color: var(--text-light); }
.scenario-name-input:focus { border-color: var(--accent-color); }

.scenario-card-range {
    font-size: 0.68rem; color: var(--text-light); flex-shrink: 0; white-space: nowrap;
}
.scenario-card-range strong { color: var(--text-medium); }

.scenario-card-body { padding: 8px 10px; display: none; }
.scenario-card.expanded .scenario-card-body { display: block; }
.scenario-toggle {
    background: none; border: none; cursor: pointer; padding: 0 2px;
    color: var(--text-light); font-size: 0.65rem; flex-shrink: 0;
    transition: transform 0.18s; line-height: 1; font-family: inherit;
}
.scenario-card.expanded .scenario-toggle { transform: rotate(90deg); }
.scenario-card-actions { display: none; }

.scenario-option-block {
    background: var(--bg-white); border: 1px solid var(--border-color);
    border-radius: 5px; margin-bottom: 5px; overflow: hidden;
}
.scenario-option-header {
    display: flex; align-items: center; gap: 6px; padding: 5px 10px;
    background: #f0f4f8; border-bottom: 1px solid var(--border-color);
}
.option-name-display {
    flex: 1; font-weight: 600; font-size: 0.8rem; color: var(--primary-color);
    cursor: pointer;
}
.option-name-display:hover { text-decoration: underline; }
.option-name-input {
    flex: 1; border: 1.5px solid var(--border-color); border-radius: 3px;
    padding: 2px 6px; font-size: 0.8rem; font-family: inherit;
}
.option-name-input:focus { outline: none; border-color: var(--accent-color); }
.option-total { font-size: 0.7rem; color: var(--text-light); margin-left: auto; flex-shrink: 0; }
.option-suggestion-bar {
    padding: 3px 10px 4px; font-size: 0.7rem; color: var(--text-light);
    display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
}
.option-suggestion-btn {
    background: var(--bg-light); border: 1px solid var(--border-color);
    border-radius: 3px; padding: 1px 5px; font-size: 0.7rem;
    cursor: pointer; color: var(--accent-color); font-family: inherit;
}
.option-suggestion-btn:hover { background: #e6f7ff; }

.option-items { padding: 4px 10px 6px; }
.option-item {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 6px; border-radius: 3px; margin-bottom: 2px;
    background: var(--bg-light); border: 1px solid transparent;
    transition: border-color 0.15s;
}
.option-item:hover { border-color: var(--border-color); }
.option-item-desc { flex: 1; font-size: 0.78rem; color: var(--text-dark); word-break: break-word; }
.option-item-amount { font-size: 0.72rem; color: var(--text-medium); white-space: nowrap; }
.option-item-actions { display: flex; gap: 2px; flex-shrink: 0; }

/* Inline item form inside scenario option — compact overrides */
.option-item-form {
    padding: 6px 10px 8px; background: #fffbf0; border-top: 1px solid var(--border-color);
}
.option-item-form .form-row { margin-bottom: 4px; gap: 6px; }
.option-item-form .form-group { margin-bottom: 4px; }
.option-item-form .form-group label {
    font-size: 0.68rem; margin-bottom: 3px;
}
.option-item-form .form-group input[type="text"],
.option-item-form .form-group input[type="number"],
.option-item-form .form-group select {
    padding: 5px 8px; font-size: 0.82rem; border-radius: 4px;
}
.option-item-form-actions { display: flex; gap: 5px; margin-top: 6px; }
.option-item-form-actions .btn {
    padding: 4px 10px; font-size: 0.75rem; min-height: 28px;
}

.scenario-no-options { text-align: center; padding: 10px; color: var(--text-light); font-size: 0.8rem; font-style: italic; }
.scenario-empty-lib { text-align: center; padding: 16px 10px; color: var(--text-light); font-size: 0.82rem; font-style: italic; }

/* ============================
   MODALS
   ============================ */
.modal {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(26,32,44,0.7); backdrop-filter: blur(4px);
    z-index: 1100; align-items: center; justify-content: center;
    padding: 20px; overflow-y: auto;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--bg-white); padding: 28px; border-radius: 8px;
    max-width: 520px; width: 100%; box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color); max-height: 90vh; overflow-y: auto; margin: auto;
}
.modal-content-sm { max-width: 380px; }
.modal-content h3 {
    margin-bottom: 18px; color: var(--primary-color); font-size: 1.1rem; font-weight: 600;
    border-bottom: 2px solid var(--accent-color); padding-bottom: 10px;
    position: sticky; top: 0; background: var(--bg-white); z-index: 1;
}
.modal-actions {
    display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px;
    position: sticky; bottom: 0; background: var(--bg-white); padding-top: 14px;
}
.modal-actions .btn { flex: 1; min-width: 100px; }

/* Compact overrides for Add/Edit Item modal */
#modal-trunk-item .modal-content {
    max-width: 400px; padding: 20px;
}
#modal-trunk-item .modal-content h3 {
    font-size: 0.95rem; margin-bottom: 12px; padding-bottom: 8px;
}
#modal-trunk-item .form-group {
    margin-bottom: 8px;
}
#modal-trunk-item .form-group label {
    font-size: 0.68rem; margin-bottom: 3px;
}
#modal-trunk-item .form-group input[type="text"],
#modal-trunk-item .form-group input[type="number"],
#modal-trunk-item .form-group input[type="date"],
#modal-trunk-item .form-group select {
    padding: 6px 10px; font-size: 0.85rem; border-radius: 4px;
}
#modal-trunk-item .form-row { gap: 8px; }
#modal-trunk-item .modal-actions {
    margin-top: 12px; padding-top: 10px; gap: 8px;
}
#modal-trunk-item .modal-actions .btn {
    padding: 7px 14px; font-size: 0.82rem; min-height: 32px;
}

/* Scope selector in modal */
.scope-selector { display: flex; gap: 0; border: 1.5px solid var(--border-color); border-radius: 6px; overflow: hidden; }
.scope-btn {
    flex: 1; padding: 6px 8px; background: var(--bg-white); border: none;
    font-size: 0.78rem; font-family: inherit; cursor: pointer;
    color: var(--text-medium); transition: all 0.2s; text-align: center;
    border-right: 1px solid var(--border-color);
}
.scope-btn:last-child { border-right: none; }
.scope-btn.active { background: var(--primary-color); color: white; font-weight: 600; }
.scope-btn:not(.active):hover { background: var(--bg-light); }

/* Attach scenario list */
#modal-attach-scenario .modal-content { max-width: 420px; padding: 16px; }
#modal-attach-scenario .modal-content h3 { font-size: 0.95rem; margin-bottom: 10px; padding-bottom: 8px; }
#modal-attach-scenario .modal-actions { margin-top: 12px; padding-top: 10px; }

.attach-scenario-list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; }
.attach-scenario-item {
    padding: 8px 10px; border: 1.5px solid var(--border-color);
    border-radius: 5px; transition: all 0.2s; background: var(--bg-light);
}
.attach-scenario-item:hover { border-color: var(--accent-color); background: #e6f7ff; }
.attach-scenario-item.already-attached { opacity: 0.55; }
.attach-scenario-item.already-attached:hover { border-color: var(--border-color); background: var(--bg-light); }
.attach-item-name-row { display: flex; align-items: center; gap: 8px; }
.attach-item-name { font-weight: 600; color: var(--primary-color); font-size: 0.82rem; flex: 1; }
.attach-item-already { font-size: 0.72rem; color: var(--text-light); font-style: italic; }
.attach-item-options { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.attach-item-option-chip {
    display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
    font-size: 0.72rem; color: var(--text-medium); font-weight: normal;
    background: var(--bg-white); border: 1px solid var(--border-color);
    border-radius: 3px; padding: 2px 6px;
}
.attach-item-option-chip input[type="checkbox"] {
    width: 11px; height: 11px; accent-color: var(--accent-color); margin: 0;
}

/* ============================
   TOAST
   ============================ */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--primary-color); color: white; padding: 10px 20px;
    border-radius: 6px; font-size: 0.88rem; font-weight: 500;
    box-shadow: var(--shadow-md); z-index: 9999;
    opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none;
    max-width: 90vw; text-align: center;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================
   FOOTER
   ============================ */
.app-footer {
    background: var(--bg-white); border-top: 1px solid var(--border-color);
    padding: 20px; text-align: center; margin-top: 20px; border-radius: 8px 8px 0 0;
}
.app-footer p { margin: 0; color: var(--text-medium); font-size: 0.9rem; }
.app-footer p + p { margin-top: 6px; }
.footer-link { color: var(--accent-color); text-decoration: none; font-weight: 500; transition: color 0.2s; }
.footer-link:hover { color: var(--accent-hover); text-decoration: underline; }
.footer-separator { margin: 0 8px; color: var(--text-light); }

/* ============================
   ABOUT SECTION
   ============================ */
.about-section {
    max-width: 1400px;
    margin: 0 auto;
    margin-bottom: 0;
}

.about-toggle {
    width: 100%;
    background: transparent;
    border: none;
    border-top: 1px solid #e2e8f0;
    padding: 9px 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
    font-size: 0.8rem;
    font-weight: 500;
    color: #94a3b8;
    text-align: left;
    font-family: inherit;
}

.about-toggle:hover {
    color: #64748b;
}

.about-icon {
    font-size: 0.8rem;
    flex-shrink: 0;
}

.about-title {
    flex: 1;
}

.toggle-icon {
    font-size: 0.65rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.about-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.about-content {
    background: var(--bg-white);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 30px;
    margin-top: 4px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.about-content h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 25px;
    line-height: 1.4;
}

.about-content h3 {
    color: var(--primary-color);
    font-size: 1.125rem;
    margin-top: 25px;
    margin-bottom: 15px;
    font-weight: 600;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.about-column ul,
.about-column ol {
    margin: 15px 0;
    padding-left: 25px;
}

.about-column li {
    margin-bottom: 10px;
    line-height: 1.6;
    color: var(--text-dark);
}

.about-column li strong {
    color: var(--primary-color);
}

.how-to-steps {
    counter-reset: step-counter;
    list-style: none;
    padding-left: 0;
}

.how-to-steps li {
    counter-increment: step-counter;
    margin-bottom: 20px;
    padding-left: 45px;
    position: relative;
}

.how-to-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: var(--accent-color);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
}

.how-to-steps li strong {
    display: block;
    margin-bottom: 6px;
    color: var(--primary-color);
}

.how-to-steps li p {
    margin: 0;
    line-height: 1.6;
    color: var(--text-medium);
}

.features-section {
    background: var(--bg-light);
    padding: 25px;
    border-radius: 10px;
    margin-top: 25px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.feature-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
}

.feature-item strong {
    display: block;
    color: var(--primary-color);
    margin-bottom: 6px;
    font-size: 0.9375rem;
}

.feature-item p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-medium);
}

.use-cases-section {
    margin-top: 25px;
}

.use-cases-section ul {
    margin-top: 15px;
    padding-left: 25px;
}

.use-cases-section li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.use-cases-section li strong {
    color: var(--primary-color);
}

.keywords-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.keywords-section p {
    margin: 0;
    line-height: 1.6;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 900px) {
    .planner-layout {
        grid-template-columns: 1fr;
    }
    .planner-tabs { display: flex; }
    #panel-trunk.panel-hidden,
    #panel-library.panel-hidden { display: none; }
}

@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .about-content {
        padding: 20px;
    }

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

    .about-toggle {
        font-size: 0.8rem;
        padding: 9px 1.5rem;
    }
}

@media (max-width: 600px) {
    .planner-header { top: 56px; }
    .card { padding: 16px; }
    .form-row { flex-direction: column; }
    .setup-actions { flex-direction: column; }
    .modal-content { padding: 20px; }
}

/* Desktop: Restore original single-row layout */
@media (min-width: 901px) {
    .planner-header {
        padding: 8px 14px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        overflow-x: visible;
    }
    .planner-header-left {
        padding: 0;
        border-bottom: none;
        flex-shrink: 0;
        display: flex;
        align-items: baseline;
        gap: 10px;
    }
    .planner-header-actions {
        padding: 0;
        overflow-x: visible;
        white-space: normal;
        flex: 0 0 auto;
    }
    .planner-header-actions .btn-icon-label {
        min-width: auto;
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    .toggle-group { flex-direction: column; }
    .toggle-btn { border-right: none; border-bottom: 1px solid var(--border-color); }
    .toggle-btn:last-child { border-bottom: none; }
}
