@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Connection Banner --- */
.connection-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.connection-banner.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}
.connection-banner.disconnected {
    background: #FEF3C7;
    color: #92400E;
    border-bottom: 1px solid #F59E0B;
}
.connection-banner.error {
    background: #FEE2E2;
    color: #991B1B;
    border-bottom: 1px solid #EF4444;
}
.connection-banner.warning {
    background: #FEF3C7;
    color: #92400E;
    border-bottom: 1px solid #F59E0B;
}
.connection-banner.connected {
    background: #DCFCE7;
    color: #166534;
    border-bottom: 1px solid #22C55E;
}
.banner-btn {
    padding: 4px 14px;
    border: 1px solid currentColor;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.banner-btn:hover {
    opacity: 0.8;
}
.banner-dismiss {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.6;
}
.banner-dismiss:hover {
    opacity: 1;
}

/* --- Loading Overlay --- */
#loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #F8FAFC;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.4s ease;
}
#loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}
#loading-overlay .loading-content {
    text-align: center;
    font-family: 'Inter', sans-serif;
}
#loading-overlay .loading-content h1 {
    font-size: 1.8rem;
    color: #334155;
    margin-bottom: 24px;
    font-weight: 600;
}
#loading-overlay .loading-content p {
    color: #94A3B8;
    font-size: 0.95rem;
    margin-top: 20px;
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E2E8F0;
    border-top-color: #3B82F6;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #F8FAFC;
    --sidebar-bg: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --danger-color: #EF4444;
    --danger-hover: #DC2626;

    /* Grid colors */
    --grid-header-bg: #F1F5F9;
    --cell-bg: #FFFFFF;
    --cell-hover: #F8FAFC;
    --drag-over-bg: #EEF2FF;

    /* Task card colors */
    --task-bg: #FFFFFF;
    --task-border: #E2E8F0;
    --task-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Layout */
.top-nav {
    display: flex;
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 50px;
    align-items: center;
    gap: 20px;
}

.nav-tab {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-tab:hover {
    color: var(--primary-color);
}

.nav-tab.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.tab-view {
    display: none;
    height: calc(100vh - 50px);
}

.tab-view.active {
    display: flex;
}

.ca-log-view {
    flex-direction: column;
    overflow: hidden;
}

.app-container {
    height: 100%;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.upload-section,
.controls-section {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

/* Buttons */
.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

.upload-btn:hover {
    background-color: var(--primary-hover);
}

.secondary-btn,
.danger-btn {
    width: 100%;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background-color: white;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.secondary-btn:hover {
    background-color: #F1F5F9;
}

.custom-task-btn {
    background-color: #E0F2FE;
    color: #0369A1;
    border-color: #BAE6FD;
}

.custom-task-btn:hover {
    background-color: #BAE6FD;
    border-color: #7DD3FC;
}

.danger-btn {
    color: var(--danger-color);
    border-color: #FECACA;
}

.danger-btn:hover {
    background-color: #FEF2F2;
}

.status-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}

/* Task Log */
.task-log {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px 0;
}

.task-log h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 24px 12px;
}

.task-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 24px;
    min-height: 200px;
}

/* Task Cards */
.task-card {
    background: var(--task-bg);
    border: 1px solid var(--task-border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: var(--task-shadow);
    cursor: grab;
    transition: transform 0.1s, box-shadow 0.1s, border-color 0.2s;
    position: relative;
}

.task-card:active {
    cursor: grabbing;
}

.task-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.task-action-btns {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}

.task-delete-btn,
.task-review-btn,
.task-split-btn {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
}

.task-delete-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    color: var(--danger-color);
}

.task-review-btn,
.task-split-btn {
    font-size: 0.7rem;
    padding: 2px 6px;
    font-weight: 500;
}

.task-review-btn {
    background-color: #FDF2F8;
    color: #BE185D;
    border-color: #FBCFE8;
}

.task-review-btn:hover {
    background-color: #FCE7F3;
}

.task-split-btn {
    background-color: #ECFDF5;
    color: #059669;
    border-color: #A7F3D0;
}

.task-split-btn:hover {
    background-color: #D1FAE5;
}

.task-delete-btn:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.task-card:hover .task-delete-btn,
.task-card:hover .task-review-btn,
.task-card:hover .task-split-btn {
    display: flex;
}

.task-card.task-repetitive {
    background-color: #F1F5F9;
    border-color: #CBD5E1;
    color: #475569;
    padding: 8px 12px;
    box-shadow: none;
    font-size: 0.85rem;
}

.task-card.task-repetitive:hover {
    background-color: #E2E8F0;
}

.task-card.task-custom {
    background-color: #E0F2FE;
    border-color: #BAE6FD;
    color: #0369A1;
}

.task-card.task-custom:hover {
    background-color: #BAE6FD;
}

.task-card.task-review .task-num {
    background-color: #FCE7F3;
    color: #BE185D;
}

.task-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.task-num {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    background: #EEF2FF;
    padding: 2px 6px;
    border-radius: 4px;
}

.task-due {
    font-size: 0.75rem;
    color: var(--danger-color);
    font-weight: 500;
}

.task-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
    line-height: 1.3;
}

.task-company {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 0.9rem;
    font-style: italic;
}

/* Main Content / Grid */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-header {
    padding: 24px 32px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.week-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.week-label {
    font-size: 1rem;
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

.icon-btn {
    padding: 6px 12px;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-main);
    transition: all 0.2s;
}

.icon-btn:hover {
    background-color: var(--cell-hover);
    border-color: var(--text-muted);
}

.icon-btn.secondary {
    background-color: var(--cell-hover);
}

.schedule-grid-container {
    flex: 1;
    overflow: auto;
    padding: 32px;
}

.schedule-grid {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.schedule-grid th,
.schedule-grid td {
    border: 1px solid var(--border-color);
    padding: 16px;
    vertical-align: top;
}

.schedule-grid th {
    background-color: var(--grid-header-bg);
    font-weight: 600;
    text-align: left;
    color: var(--text-muted);
    font-size: 0.9rem;
    width: 16%;
}

.schedule-grid th.person-col {
    width: 20%;
}

.schedule-grid td {
    min-height: 150px;
    background-color: var(--cell-bg);
    transition: background-color 0.2s;
}

.schedule-grid td.day-cell {
    min-height: 150px;
}

.schedule-grid td.drag-over {
    background-color: var(--drag-over-bg);
    border: 2px dashed var(--primary-color);
}

.person-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.person-name {
    font-weight: 500;
    font-size: 1rem;
}

.remove-person {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}

.remove-person:hover {
    color: var(--danger-color);
}

/* Smaller task card for grid view */
.schedule-grid td .task-card {
    padding: 8px;
    margin-bottom: 8px;
}

.schedule-grid td .task-card:hover .task-delete-btn,
.schedule-grid td .task-card:hover .task-review-btn,
.sidebar .task-card.task-custom:hover .task-delete-btn,
.sidebar .task-card.task-review:hover .task-delete-btn {
    display: flex;
    /* Show only when hovering a card inside the grid or custom/review sidebar items */
}

.schedule-grid td .task-card .task-title {
    font-size: 0.85rem;
}

/* Complete button */
.task-complete-btn {
    background: white;
    border: 1px solid #86EFAC;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    font-size: 12px;
    font-weight: bold;
    color: #16A34A;
    transition: all 0.15s;
}

.task-complete-btn:hover {
    background: #16A34A;
    color: white;
    border-color: #16A34A;
}

.task-card:hover .task-complete-btn {
    display: flex;
}

/* Completed task state */
.task-card.task-completed {
    background: #DCFCE7 !important;
    border-color: #86EFAC !important;
    color: #15803D;
}

.task-card.task-completed .task-title,
.task-card.task-completed .task-due {
    display: none;
}

.task-card.task-completed .task-header {
    margin-bottom: 0;
}

.task-card.task-completed .task-num {
    background: #BBF7D0;
    color: #15803D;
}

/* Returned task state */
.task-card.task-returned {
    background: #555555 !important;
    border-color: #444444 !important;
    color: #EEEEEE !important;
}

.task-card.task-returned .task-title,
.task-card.task-returned .task-due {
    display: none;
}

.task-card.task-returned .task-header {
    margin-bottom: 0;
}

.task-card.task-returned .task-num {
    background: #666666;
    color: #EEEEEE;
}

.task-card.task-completed .task-complete-btn {
    display: flex;
    background: #16A34A;
    color: white;
    border-color: #16A34A;
}

/* --- Print Styles --- */
@media print {
    @page {
        size: landscape;
        margin: 0.5cm;
    }

    body {
        margin: 0;
        padding: 0;
        height: auto !important;
        overflow: visible !important;
        background-color: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .app-container {
        height: auto !important;
        display: block !important;
    }

    .print-page {
        page-break-after: always;
        page-break-inside: avoid;
        width: 100%;
    }

    .print-page:last-child {
        page-break-after: auto;
    }

    .sidebar {
        display: none !important;
    }

    .main-content {
        overflow: visible !important;
        display: block !important;
    }

    .main-header {
        padding: 0 0 10px 0 !important;
        border-bottom: none !important;
    }

    /* If we are using the printContainer, the original main-header inside app-container is hidden by hiding appContainer */
    /* but if we print 1 week, we keep it but hide controls */
    .week-controls {
        display: none !important;
    }

    .schedule-grid-container {
        padding: 0 !important;
        overflow: visible !important;
    }

    .schedule-grid {
        box-shadow: none !important;
        border: 1px solid var(--border-color) !important;
        table-layout: fixed;
        width: 100%;
    }

    .schedule-grid th,
    .schedule-grid td {
        padding: 4px !important;
    }

    .task-action-btns {
        display: none !important;
    }

    .remove-person,
    #add-person-grid-btn {
        display: none !important;
    }

    .task-card {
        box-shadow: none !important;
        break-inside: avoid;
        padding: 4px !important;
        margin-bottom: 4px !important;
    }

    .task-title {
        font-size: 0.75rem !important;
        line-height: 1.1 !important;
        margin-bottom: 0 !important;
    }

    .task-header {
        margin-bottom: 2px !important;
    }

    .task-num,
    .task-due {
        font-size: 0.65rem !important;
    }
}

/* --- CA Log Styles --- */
.ca-log-view {
    display: flex;
    flex-direction: column;
    padding: 0;
    background-color: var(--bg-color);
    width: 100%;
}

.ca-sticky-top {
    flex-shrink: 0;
    padding: 24px 32px 0 32px;
    background-color: var(--bg-color);
    z-index: 20;
}

.ca-scroll-area {
    flex: 1;
    overflow: auto;
    padding: 0 32px 32px 32px;
}

.ca-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.ca-header h2 {
    font-size: 1.5rem;
    color: var(--text-main);
}

.ca-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: visible;
}

.ca-table {
    width: 100%;
    border-collapse: collapse;
}

.ca-table th, .ca-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.ca-table th {
    background-color: var(--grid-header-bg);
    font-weight: 600;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 10;
}

.ca-table tr:hover {
    background-color: var(--cell-hover);
}

.sub-nav {
    display: flex;
    margin-bottom: 16px;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.sub-tab {
    padding: 8px 16px;
    background: #E2E8F0;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.sub-tab.active, .sub-tab:hover {
    background: var(--primary-color);
    color: white;
}

.text-sm {
    font-size: 0.85rem;
}

.ca-table th input.filter-input {
    width: 100%;
    box-sizing: border-box;
    margin-top: 4px;
    padding: 3px 4px;
    font-size: 0.8rem;
    font-weight: normal;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
}

.ca-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.ca-table th.sortable:hover {
    background-color: #e2e8f0;
}

.sort-icon {
    font-size: 0.7em;
    margin-left: 5px;
    color: #64748b;
}

.filter-row th {
    top: 41px;
    background-color: var(--grid-header-bg);
    position: sticky;
    z-index: 9;
    padding: 6px 16px;
    border-bottom: 2px solid var(--border-color);
}

/* ── Excel-style Filter Icon ── */
.filter-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    vertical-align: middle;
    cursor: pointer;
    opacity: 0.45;
    transition: opacity 0.2s;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23475569'%3E%3Cpath d='M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.filter-icon:hover {
    opacity: 1;
}

.filter-icon.active {
    opacity: 1;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232563eb'%3E%3Cpath d='M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ── Filter Dropdown Panel ── */
.filter-dropdown {
    position: absolute;
    z-index: 9999;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    padding: 12px;
    min-width: 190px;
    max-width: 280px;
    font-size: 0.85rem;
}

.filter-dropdown label {
    display: block;
    padding: 4px 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-dropdown label:hover {
    background: #f1f5f9;
    border-radius: 4px;
}

.filter-dropdown label input[type="checkbox"] {
    margin-right: 6px;
    vertical-align: middle;
}

/* ── OK / Cancel buttons ── */
.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

.filter-actions button {
    padding: 5px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: 0.82rem;
    cursor: pointer;
    background: #f8fafc;
    transition: all 0.15s;
}

.filter-actions button:first-child {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-actions button:hover {
    filter: brightness(0.92);
}

/* ── Quick Filter Toolbar ── */
.ca-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 6px 8px;
    gap: 8px;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
}

/* Compact buttons when inside the CA table toolbar */
.ca-table-toolbar .secondary-btn {
    width: auto;
    padding: 4px 12px;
    font-size: 0.8rem;
    margin-bottom: 0;
    border-radius: 14px;
}

.quick-filter-btn {
    padding: 4px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-white);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.quick-filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.quick-filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ── Inline Editing ── */
.ca-table td {
    cursor: default;
}

.ca-table td:hover {
    outline: 1px dashed var(--border-color);
    outline-offset: -1px;
}

.inline-edit-input {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    font-size: inherit;
    font-family: inherit;
    border: 2px solid var(--primary-color);
    border-radius: 3px;
    background: #fefffe;
    outline: none;
}

/* ── CA Log Bridge Tasks ── */
/* CA Task Cards — shared */
.task-ca {
    background-color: #FFFFFF !important;
}
.task-ca:hover {
    background-color: #F8FAFC !important;
}

/* RFIs — blue text */
.task-ca-rfi .task-title,
.task-ca-rfi .task-num,
.task-ca-rfi .task-due {
    color: #2563EB;
}

/* Submittals — amber text */
.task-ca-sub .task-title,
.task-ca-sub .task-num,
.task-ca-sub .task-due {
    color: #B45309;
}

/* CA Badges */
.ca-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    text-transform: uppercase;
    vertical-align: middle;
    display: inline-block;
}
.ca-badge-rfi {
    background: #DBEAFE;
    color: #1E40AF;
}
.ca-badge-sub {
    background: #FEF3C7;
    color: #92400E;
}

/* --- RFI Folder Icons --- */
.folder-cell {
    text-align: center;
    padding: 2px 4px !important;
    width: 36px;
}
.rfi-folder-icon {
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.8;
    transition: opacity 0.15s, transform 0.15s;
    user-select: none;
}
.rfi-folder-icon:hover {
    opacity: 1;
    transform: scale(1.15);
}
.rfi-folder-icon.disabled {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

/* --- RFI Folder Connect Button --- */
.rfi-folder-connect-btn {
    font-size: 0.8rem;
    padding: 4px 10px;
}
.rfi-folder-connect-btn.connected {
    background: #D1FAE5;
    color: #065F46;
    border-color: #6EE7B7;
}

/* --- Toast Notifications --- */
#toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: #1F2937;
    color: #F9FAFB;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* --- Rename Modal --- */
.rename-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.rename-modal-overlay.hidden { display: none; }
.rename-modal {
    background: #fff;
    border-radius: 8px;
    width: 720px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.rename-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
}
.rename-modal-header h3 { margin: 0; font-size: 16px; }
.rename-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #666;
    padding: 0 4px;
}
.rename-modal-summary {
    padding: 12px 20px;
    font-size: 13px;
    color: #555;
    border-bottom: 1px solid #f0f0f0;
}
.rename-modal-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px;
}
.rename-item {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12.5px;
}
.rename-item:last-child { border-bottom: none; }
.rename-item .old-name { color: #999; }
.rename-item .arrow { color: #2196F3; margin: 2px 0; }
.rename-item .new-name { color: #333; font-weight: 500; }
.rename-item.skipped .old-name { color: #c0c0c0; }
.rename-item.skipped .skip-reason { color: #e67e22; font-style: italic; font-size: 11.5px; }
.rename-item.already-correct .old-name { color: #4caf50; }
.rename-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
}