/* /courses/assets/css/job-tracker.css */

/* ─── Shared easing token ─────────────────────────────── */
:root {
    --jt-ease: cubic-bezier(.4,0,.2,1);
    --jt-dur: .32s;
}

.job-tracker-main {
    min-height: 100vh;
    background: #f0f2f5;
    padding: 2rem 0;
}

.job-tracker-main .container {
    max-width: none;
}

/* ─── Two-column layout ───────────────────────────────── */
.jt-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.jt-sidebar {
    flex: 0 0 280px;
    width: 280px;
    background: var(--white, #fff);
    border: 1px solid var(--border, #E5E7EB);
    border-radius: 8px;
    padding: 14px;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.jt-sidebar-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
    color: #1F2937;
}

.jt-rec-card {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.jt-rec-card:last-child {
    margin-bottom: 0;
}

.jt-rec-card:hover {
    border-color: #2563EB;
    box-shadow: 0 2px 8px rgba(37,99,235,.12);
    transform: translateY(-1px);
}

.jt-rec-title {
    font-size: 12px;
    font-weight: 700;
    color: #1F2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.jt-rec-company {
    font-size: 11px;
    color: #6B7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.jt-rec-score {
    font-size: 11px;
    color: #2563EB;
    font-weight: 600;
}

.jt-main {
    flex: 1;
    min-width: 0;
}

@media (max-width: 900px) {
    /* Safety net: never let the page itself scroll sideways on mobile.
       (Scoped to mobile so it can't break the desktop sticky sidebar.) */
    .job-tracker-main {
        overflow-x: hidden;
    }
    .jt-layout {
        flex-direction: column;
        align-items: stretch;   /* fill width, don't size to widest child */
    }
    /* Main column must be exactly viewport-wide so the board scrolls INSIDE it */
    .jt-main {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .jt-sidebar {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: none;
        position: static;
        max-height: none;
        overflow-y: visible;
    }
    .jt-sidebar-inner {
        display: flex;
        gap: 10px;
        max-width: 100%;        /* contains the rec carousel's own scroll */
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .jt-rec-card {
        min-width: 180px;
        flex-shrink: 0;
        margin-bottom: 0;
    }
}

/* ─── Kanban card hover ───────────────────────────────── */
.kanban-card {
    transition: box-shadow .15s ease, transform .15s ease;
}
.kanban-card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,.10);
    transform: translateY(-1px);
}

/* ─── Header ──────────────────────────────────────────── */
.tracker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tracker-title h1 {
    font-size: 2rem;
    color: #2d3748;
    margin-bottom: 0.25rem;
}

.tracker-title p {
    color: #718096;
    font-size: 0.95rem;
}

/* ─── Stats Strip ─────────────────────────────────────── */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #4299e1;
}

.stat-label {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 0.25rem;
}

/* ─── Reminder Banner ─────────────────────────────────── */
.reminder-banner {
    background: #fffbeb;
    border: 1px solid #f6e05e;
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    color: #744210;
    font-weight: 500;
}

.reminder-banner i {
    color: #d69e2e;
    font-size: 1.25rem;
}

.reminder-banner span {
    flex: 1;
}

/* ─── View Toggle ─────────────────────────────────────── */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.view-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    color: #718096;
    font-size: 0.875rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-btn.active {
    background: #4299e1;
    color: white;
    border-color: #4299e1;
}

/* ─── Kanban Board ────────────────────────────────────── */
.kanban-board {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    min-height: 500px;
}

.kanban-column {
    min-width: 220px;
    max-width: 260px;
    flex: 1;
    background: #e8ecf1;
    border-radius: 10px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
}

.kanban-column.column-rejected {
    opacity: 0.7;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.25rem;
    margin-bottom: 0.5rem;
}

.column-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.column-count {
    background: #cbd5e0;
    color: #4a5568;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.column-cards {
    flex: 1;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.25rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.column-cards.drag-over {
    background: rgba(66, 153, 225, 0.1);
    border: 2px dashed #4299e1;
}

/* ─── Kanban Cards ────────────────────────────────────── */
.kanban-card {
    background: white;
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: grab;
    transition: transform 0.15s, box-shadow 0.15s;
    border-left: 3px solid #4299e1;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.kanban-card.priority-high {
    border-left-color: #e53e3e;
}

.kanban-card.priority-low {
    border-left-color: #a0aec0;
}

.card-company {
    font-weight: 600;
    font-size: 0.85rem;
    color: #2d3748;
    margin-bottom: 0.25rem;
}

.card-position {
    font-size: 0.8rem;
    color: #718096;
    margin-bottom: 0.5rem;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #a0aec0;
}

.card-follow-up {
    background: #feebc8;
    color: #744210;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.4rem;
    font-weight: 500;
    text-align: center;
}

/* ─── List View ───────────────────────────────────────── */
.list-view {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tracker-table {
    width: 100%;
    border-collapse: collapse;
}

.tracker-table th {
    background: #f7fafc;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
}

.tracker-table td {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: #4a5568;
    border-bottom: 1px solid #f0f0f0;
}

.tracker-table tr:hover {
    background: #f7fafc;
}

.status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-saved { background: #e2e8f0; color: #4a5568; }
.status-applied { background: #bee3f8; color: #2a4365; }
.status-phone_screen { background: #c6f6d5; color: #22543d; }
.status-interview { background: #fefcbf; color: #744210; }
.status-offer { background: #fed7e2; color: #702459; }
.status-accepted { background: #c6f6d5; color: #22543d; }
.status-rejected { background: #fed7d7; color: #742a2a; }

.priority-badge {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.priority-high { background: #fed7d7; color: #e53e3e; }
.priority-medium { background: #feebc8; color: #d69e2e; }
.priority-low { background: #e2e8f0; color: #718096; }

/* ─── Modal ───────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-dialog {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    font-size: 1.25rem;
    color: #2d3748;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #a0aec0;
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body .form-group label {
    display: block;
    font-size: 0.85rem;
    color: #4a5568;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.modal-body .form-group .required {
    color: #e53e3e;
}

.modal-body .form-group input,
.modal-body .form-group select,
.modal-body .form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.modal-body .form-group input:focus,
.modal-body .form-group select:focus,
.modal-body .form-group textarea:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

/* ─── Alerts (reuse) ──────────────────────────────────── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.alert-error { background: #fed7d7; color: #742a2a; border: 1px solid #feb2b2; }
.alert-success { background: #c6f6d5; color: #22543d; border: 1px solid #9ae6b4; }
.alert-warning { background: #feebc8; color: #744210; border: 1px solid #f6e05e; }
.alert-info { background: #bee3f8; color: #2a4365; border: 1px solid #90cdf4; }

.fade-in { animation: fadeIn 0.3s ease-in; }

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

/* ─── Buttons — design-system.css is authoritative (no overrides here) ─── */

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
    .tracker-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    /* ── Controls row: stack the view-toggle above the stats strip ── */
    .jt-controls-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    /* Toggle buttons span the row, evenly split, larger tap targets */
    .jt-controls-row > div:first-child {
        display: flex;
    }
    .jt-controls-row .view-btn {
        flex: 1;
        padding: 9px 8px !important;
        font-size: 12px !important;
    }
    /* Stats strip: full width, scroll horizontally if it can't fit */
    #statsStrip {
        width: 100%;
        justify-content: space-between;
        overflow-x: auto;
        gap: 12px !important;
        padding: 8px 4px;
        background: var(--white);
        border: 1px solid var(--border);
        border-radius: var(--radius, 8px);
    }

    /* ── Kanban: the ONLY horizontally-scrolling section on mobile ── */
    .kanban-board {
        flex-direction: row;
        max-width: 100%;        /* stay within the viewport; scroll inside */
        scroll-snap-type: x mandatory;
        scroll-padding-left: 4px;
    }
    .kanban-column {
        min-width: 80vw !important;
        max-width: 80vw !important;
        flex: 0 0 80vw !important;
        scroll-snap-align: start;
    }

    /* ── List view: let the 6-col table scroll horizontally ── */
    #listView > div {
        overflow-x: auto !important;
    }
    #listView table {
        min-width: 620px;
    }
    #listView th,
    #listView td {
        padding: 8px 10px !important;
    }

    /* Let the notification label ellipsize instead of forcing row width */
    .notif-row > span {
        min-width: 0;
    }
    /* ── Roomier tap targets for inline action buttons ── */
    .notif-row .btn.btn-sm {
        padding: 7px 12px !important;
        font-size: 12px !important;
    }
}

/* ── Edit-drawer form: collapse 2-up field pairs to single column ── */
@media (max-width: 600px) {
    #appFormScroll div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* ─── Sankey Chart View ───────────────────────────────── */
#chartView > div {
    min-height: 420px;
}

#sankeyChart {
    min-height: 400px;
}

@media (max-width: 768px) {
    #sankeyChart {
        height: 300px !important;
        min-height: 300px;
    }

    #chartView > div {
        min-height: 320px;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .tracker-title h1 {
        font-size: 1.5rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    #sankeyChart {
        height: 250px !important;
        min-height: 250px;
    }
}

/* ─── Prep Report Drawer ─────────────────────────────── */
#prepDrawer {
    position: fixed;
    top: var(--header-height, 56px);
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 500;
    display: none;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform var(--jt-dur) var(--jt-ease);
    box-shadow: 0 -4px 32px rgba(0,0,0,0.14);
}

#prepDrawer.prep-drawer-open {
    display: flex;
    transform: translateY(0);
}

#prepDrawerBackdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 499;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

#prepDrawerBackdrop.prep-drawer-open {
    opacity: 1;
    pointer-events: auto;
}

.prep-drawer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
    background: #fff;
}

.prep-drawer-title {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.prep-drawer-subtitle {
    font-size: 12px;
    color: #6B7280;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prep-drawer-close {
    background: none;
    border: none;
    color: #6B7280;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
}

.prep-drawer-close:hover {
    background: #F3F4F6;
    color: #111827;
}

.prep-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Paste form state */
.prep-paste-form .prep-form-group {
    margin-bottom: 14px;
}

.prep-paste-form label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #4B5563;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.prep-paste-form textarea,
.prep-paste-form input[type="text"],
.prep-paste-form input[type="number"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.prep-paste-form textarea:focus,
.prep-paste-form input:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

.prep-paste-form .prep-optional-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Loading state */
.prep-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 14px;
}

.prep-loading i {
    font-size: 32px;
    color: #2563EB;
}

.prep-loading span {
    font-size: 14px;
    color: #6B7280;
}

/* Report state */
.prep-report {
    display: none;
}

/* Match band */
.prep-match-band {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 20px;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 10px;
    margin-bottom: 20px;
}

.prep-match-ring {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #2563EB;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.prep-match-pct {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.prep-match-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.85;
}

.prep-match-info {
    flex: 1;
    min-width: 0;
}

.prep-match-role {
    font-size: 15px;
    font-weight: 700;
    color: #1E40AF;
    margin-bottom: 4px;
}

.prep-match-narrative {
    font-size: 12px;
    color: #3B82F6;
    line-height: 1.5;
    margin-bottom: 6px;
}

.prep-salary-row {
    display: flex;
    gap: 14px;
    font-size: 11px;
    color: #4B5563;
    flex-wrap: wrap;
}

.prep-salary-chip {
    background: #fff;
    border: 1px solid #BFDBFE;
    border-radius: 9999px;
    padding: 2px 10px;
    font-weight: 600;
    color: #2563EB;
}

/* Section headings */
.prep-section {
    margin-bottom: 22px;
}

.prep-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #111827;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid #2563EB;
    padding-bottom: 5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prep-section-title i {
    color: #2563EB;
    font-size: 11px;
}

/* Strengths chips */
.prep-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.prep-chip {
    background: #D1FAE5;
    color: #065F46;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
    border: 1px solid #A7F3D0;
}

/* Gaps list */
.prep-gap-item {
    padding: 10px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #FAFAFA;
}

.prep-gap-skill {
    font-size: 13px;
    font-weight: 600;
    color: #DC2626;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prep-gap-skill i {
    color: #DC2626;
    font-size: 10px;
}

.prep-gap-resource {
    font-size: 11px;
    color: #374151;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.prep-gap-resource a {
    color: #2563EB;
    text-decoration: underline;
}

.prep-gap-lessons {
    font-size: 10px;
    color: #6B7280;
    margin-top: 4px;
}

/* Questions list */
.prep-question-item {
    padding: 10px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #FAFAFA;
}

.prep-question-text {
    font-size: 13px;
    color: #1F2937;
    line-height: 1.5;
    margin-bottom: 6px;
}

.prep-question-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.prep-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 4px;
}

.prep-badge-bank {
    background: #DBEAFE;
    color: #1E40AF;
}

.prep-badge-jd {
    background: #FEF3C7;
    color: #92400E;
}

.prep-badge-cat {
    background: #F3F4F6;
    color: #4B5563;
}

/* Checklist */
.prep-checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid #F3F4F6;
    cursor: pointer;
}

.prep-checklist-item:last-child {
    border-bottom: none;
}

.prep-checklist-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #2563EB;
    flex-shrink: 0;
    margin-top: 2px;
    cursor: pointer;
}

.prep-checklist-label {
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
    flex: 1;
}

.prep-checklist-item.done .prep-checklist-label {
    text-decoration: line-through;
    color: #9CA3AF;
}

/* Company & market */
.prep-narrative-block {
    font-size: 13px;
    color: #374151;
    line-height: 1.7;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 14px 16px;
}

/* AI-off note */
.prep-ai-off-note {
    font-size: 11px;
    color: #6B7280;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 16px;
    display: none;
}

/* Footer actions */
.prep-footer {
    padding: 14px 20px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
    flex-shrink: 0;
    background: #fff;
}

/* Progress bar */
.prep-match-bar-wrap {
    margin-top: 8px;
    background: #BFDBFE;
    border-radius: 9999px;
    height: 6px;
    width: 100%;
    overflow: hidden;
}

.prep-match-bar {
    height: 6px;
    border-radius: 9999px;
    background: #2563EB;
    transition: width 0.6s ease;
}

/* body scroll lock */
body.prep-drawer-lock {
    overflow: hidden;
}

@media (max-width: 768px) {
    #prepDrawer {
        top: 56px;
    }

    .prep-paste-form .prep-optional-row {
        grid-template-columns: 1fr;
    }

    .prep-match-band {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .prep-footer {
        justify-content: stretch;
    }

    .prep-footer button {
        flex: 1;
        justify-content: center;
    }
}

/* ─── App Modal → Full-height Two-Pane Drawer ────────── */
/*
 * #appModal keeps its id so openModal/closeModal keep working.
 * Old bottom-sheet styles (jt-sheet-panel / jt-sheet-open) removed;
 * replaced with a full-height drawer matching #prepDrawer's pattern.
 */

/* Backdrop: covers everything, fades in/out */
#appModal {
    position: fixed;
    inset: 0;
    top: var(--header-height, 56px);   /* below site header */
    background: rgba(0,0,0,0.45);
    z-index: 400;
    display: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    /* no flex here — the drawer panel sits inside */
}

/* When open: fade backdrop in, allow interaction */
#appModal.jt-app-open {
    opacity: 1;
    pointer-events: auto;
}

/* The drawer panel itself */
#appModal > .jt-app-drawer {
    position: absolute;
    inset: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform var(--jt-dur) var(--jt-ease);
    box-shadow: 0 -4px 32px rgba(0,0,0,.14);
    overflow: hidden;
}

#appModal.jt-app-open > .jt-app-drawer {
    transform: translateY(0);
}

/* Drawer header bar */
.jt-app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
    background: #fff;
}

.jt-app-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

.jt-app-close {
    background: none;
    border: none;
    color: #6B7280;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
}
.jt-app-close:hover {
    background: #F3F4F6;
    color: #111827;
}

/* Two-pane body */
.jt-edit-layout {
    flex: 1;
    display: flex;
    overflow: hidden;   /* each pane scrolls independently */
    min-height: 0;
}

/* LEFT: analysis pane (~56%) */
#appAnalysisPane {
    flex: 0 0 56%;
    width: 56%;
    overflow-y: auto;
    padding: 20px 24px;
    border-right: 1px solid #E5E7EB;
    background: #F8FAFF;
    box-sizing: border-box;
}

/* RIGHT: form pane (~44%) */
#appFormPane {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Form scroll area */
#appFormPane > #appFormScroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Footer inside the form pane */
#appFormPane > .jt-app-footer,
#appDetailPane > .jt-app-footer,
#appDetailFooter {
    border-top: 1px solid #E5E7EB;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: #fff;
    flex-shrink: 0;
}

/* ── Left pane: paste prompt ── */
.jt-ap-paste-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
    padding: 24px 16px;
}

.jt-ap-paste-prompt .jt-ap-prompt-icon {
    font-size: 32px;
    color: #2563EB;
    margin-bottom: 12px;
    opacity: 0.7;
}

.jt-ap-paste-prompt h4 {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px;
}

.jt-ap-paste-prompt p {
    font-size: 12px;
    color: #6B7280;
    margin: 0 0 16px;
    line-height: 1.6;
}

/* JD textarea + button inside the left pane prompt */
#appAnalysisPane #jdPasteText {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.15s;
    background: #fff;
    text-align: left;
}
#appAnalysisPane #jdPasteText:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}

/* ── Left pane: loading ── */
.jt-ap-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    gap: 12px;
    color: #6B7280;
    font-size: 13px;
}
.jt-ap-loading i {
    font-size: 28px;
    color: #2563EB;
}

/* ── Left pane: error note ── */
.jt-ap-error {
    font-size: 12px;
    color: #6B7280;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 10px 14px;
    margin-top: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* ── Left pane: analysis report wrapper ── */
#appAnalysisReport {
    /* report fills pane; _prepRenderReport will populate this */
}

/* body scroll-lock when app drawer is open */
body.jt-app-lock {
    overflow: hidden;
}

/* Responsive ≤900px: stack panes (form first, analysis below) */
@media (max-width: 900px) {
    .jt-edit-layout {
        flex-direction: column;
        overflow: visible;
    }

    #appModal > .jt-app-drawer {
        overflow-y: auto;
    }

    #appAnalysisPane {
        flex: none;
        width: 100%;
        border-right: none;
        border-top: 1px solid #E5E7EB;
        order: 2;       /* analysis goes below form */
        max-height: none;
    }

    #appFormPane {
        order: 1;       /* form on top */
        flex: none;
    }

    #appFormPane > #appFormScroll {
        overflow: visible;
    }
}

/* ─── Job detail pane (inside #appModal) — shared pill/label/text helpers ─── */
/* #jobDetailDrawer and #jobDetailBackdrop removed — detail now uses #appDetailPane */
#appDetailPane {
    flex-direction: column;
    overflow: hidden;
}
.jd-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.jd-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 9999px;
    background: #F3F4F6;
    color: #374151;
}
.jd-meta-pill.match {
    background: #DBEAFE;
    color: #1D4ED8;
    font-weight: 700;
}
.jd-section-label {
    font-size: 10px;
    font-weight: 700;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 14px 0 6px;
}
.jd-section-text {
    font-size: 13px;
    color: #374151;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}
.jd-req-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.jd-req-list li {
    font-size: 12px;
    color: #374151;
    padding: 4px 0;
    display: flex;
    align-items: flex-start;
    gap: 7px;
    border-bottom: 1px solid #F3F4F6;
}
.jd-req-list li:last-child {
    border-bottom: none;
}
.jd-req-list li::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #2563EB;
    flex-shrink: 0;
    margin-top: 5px;
}
/* #appDetailPane footer reuses .jt-app-footer — no separate .jd-drawer-footer needed */
