/* --- CARD STYLING --- */
.branch-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: clamp(300px, 70vh, 600px);
    aspect-ratio: 4 / 5.5;
    background: white;
    border-radius: 1.5vh;
    overflow: hidden;
    text-decoration: none;
    border: 0.1vh solid #e2e8f0;
    box-shadow: 0 0.5vh 2vh rgba(0,0,0,0.05);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.branch-card:hover { transform: translateY(-1.5vh); box-shadow: 0 2vh 4vh rgba(0,0,0,0.1); }

.card-image-container {
    width: 100%;
    aspect-ratio: 1 / 1; 
    background-color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5vh; 
    flex-shrink: 0;
}

.branch-img { max-width: 100%; max-height: 100%; object-fit: contain; }

.card-content {
    background: white;
    padding: 1.5vh 1.5vw; 
    border-top: 0.1vh solid #f1f5f9;
    display: flex;
    flex-direction: column;
    justify-content: space-around; 
    align-items: center; 
    flex-grow: 1;
}

.card-content h3 {
    font-size: clamp(1rem, 2.2vh, 1.4rem); 
    color: #0f172a;
    margin: 0;
    font-weight: 700;
    text-align: center;
}

.card-description, .subtitle-secondary, .subtitle-extra {
    font-size: clamp(0.75rem, 1.6vh, 0.95rem); 
    color: #64748b;
    line-height: 1.4;
    text-align: center;
}

.subtitle-main {
    font-size: clamp(0.9rem, 1.8vh, 1.1rem);
    color: #1e293b;
    font-weight: 600;
}

/* --- TOOL DRAWER --- */
.tool-drawer {
    width: 100%;
    background: white;
    border: 0.1vh solid #e2e8f0;
    border-radius: 1vh;
    overflow: hidden;
}

.drawer-header {
    padding: 2.5vh 2vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
}

.drawer-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    width: 100%; 
    display: block; 
    visibility: hidden;
}

.tool-drawer.expanded > .drawer-content {
    max-height: 1000px; 
    padding: 2vh 2vw;
    border-top: 0.1vh solid #f1f5f9;
    visibility: visible;
}

/* --- SUB-DRAWER & INTERFACE --- */
.sub-drawer {
    width: 100%;
    margin-bottom: 1.5vh;
    border: 0.1vh solid #f1f5f9;
    border-radius: 0.8vh;
    background: #fbfcfe;
}

.sub-drawer-header {
    padding: 1.5vh 1.5vw;
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 600;
}

.sub-drawer-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    width: 100%; 
    display: block; 
    visibility: hidden;
}

.sub-drawer.expanded > .sub-drawer-content {
    max-height: 800px;
    padding: 2vh 1.5vw;
    visibility: visible;
}

.extractor-interface {
    display: flex;
    flex-direction: column;
    gap: 2vh;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5vh;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.input-group input {
    padding: 1vh 1vw;
    border: 1px solid #cbd5e1;
    border-radius: 0.5vh;
    outline: none;
}

.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 1vh;
    padding: 2.5vh;
    text-align: center;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5vh;
}

.upload-zone p { font-weight: 500; color: #64748b; font-size: 0.9rem;}

/* --- BUTTONS --- */
.back-btn, .launch-btn, .secondary-btn {
    padding: 1vh 2vw;
    border-radius: 0.5vh;
    cursor: pointer;
    border: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.back-btn { background: #0f172a; color: white; }

.launch-btn {
    background: #10b981;
    color: white;
    width: 100%;
    padding: 1.2vh;
    font-size: 0.9rem;
}

.launch-btn:hover { background: #059669; }

.secondary-btn {
    background: #e2e8f0;
    color: #475569;
    font-size: 0.8rem;
    padding: 0.6vh 1.5vw;
}

.arrow-icon { font-size: 0.7rem; transition: transform 0.3s; }
.expanded > .drawer-header .arrow-icon, .expanded > .sub-drawer-header .arrow-icon { transform: rotate(180deg); }

/* --- STATUS & RESULTS STYLING --- */
.status-display {
    margin-top: 2vh;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
}

.results-table-wrapper {
    margin-top: 1vh;
    width: 100%;
    overflow-x: auto;
    border-radius: 1vh;
    border: 0.1vh solid #e2e8f0;
}


.financial-table th, .financial-table td {
    padding: 1.2vh 1vw;
    border-bottom: 0.1vh solid #f1f5f9;
    text-align: left;
}

.action-group {
    display: flex;
    gap: 0.75rem; 
    margin-top: 1rem;
}

.abort-btn {
    background: transparent;
    border: 1px solid #ff4444;
    color: #ff4444;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
}

.abort-btn:hover {
    background-color: #ff4444 !important; /* Force the color change */
    color: white !important;
    cursor: pointer;
}

.file-queue-container {
    margin: 1rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.file-chip {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 0.3rem 0.8rem;
    border-radius: 2rem;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.remove-file-btn {
    margin-left: 0.6rem;
    cursor: pointer;
    color: #ff4444;
    border: none;
    background: none;
}

/* ============================================================
   SAFE UNLOCK: TOOL VIEW ONLY
   These rules ONLY trigger when NOT on the main dashboard.
   ============================================================ */

/* 1. Unlock the page scroll */
body.view-scrollable {
    overflow-y: auto !important; 
    height: auto !important;
}

/* 2. Transition the container from fixed-height (Dashboard) 
      to auto-height (Tools) without breaking the main page */
body.view-scrollable .container {
    height: auto !important;
    min-height: 92vh;
    display: block !important; /* Changes from flex to block for natural scrolling */
    overflow: visible !important;
}

/* 3. Ensure the active tool view expands to fit the table */
body.view-scrollable .view-section.active {
    height: auto !important;
    display: block !important;
}

/* 4. Increase drawer capacity for large tables */
body.view-scrollable .tool-drawer.expanded > .drawer-content,
body.view-scrollable .sub-drawer.expanded > .sub-drawer-content {
    max-height: none !important; /* Removes the 1000px cap for data tables */
}

/* 5. Add breathing room at the bottom so the last table row isn't cut off */
body.view-scrollable .tool-accordion-container {
    padding-bottom: 15vh;
}

body.view-scrollable .financial-table {
    display: table !important; /* Force it back to table behavior inside the block view */
    width: 100%;
    border-collapse: collapse;
}


/* --- DOWNLOAD DROPDOWN STYLING --- */

.fe-export-header {
    display: flex;
    justify-content: flex-end; 
    margin-top: 1.5vh;
    margin-bottom: 1.5vh;
    padding-right: 0.5vw;
}

.fe-export-dropdown {
    position: relative;
    display: inline-block;
}

.fe-export-dropdown:hover .fe-export-menu {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.fe-export-trigger-btn {
    background: #10b981;
    color: white;
    padding: 1vh 1.5vw;
    border-radius: 0.6vh;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.fe-export-trigger-btn:hover {
    background: #059669;
}

.fe-export-menu {
    display: none; 
    position: absolute;
    right: 0;
    top: 110%; /* Spacing below button */
    background: white;
    min-width: 12rem;
    box-shadow: 0 1vh 3vh rgba(0,0,0,0.15);
    border-radius: 0.8vh;
    z-index: 1000;
    border: 0.1vh solid #e2e8f0;
    overflow: hidden;
}

/* Toggle via JS */
.fe-export-menu.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.fe-export-menu a {
    color: #1e293b;
    padding: 1.5vh 1.5vw;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
    border-bottom: 0.1vh solid #f1f5f9;
    transition: background 0.2s;
}

.fe-export-menu a:last-child { border-bottom: none; }

.fe-export-menu a:hover {
    background-color: #f8fafc;
    color: #10b981;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-1vh); }
    to { opacity: 1; transform: translateY(0); }
}

/* FORMAT FINANCIALS TABLE */

.financial-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem; /* Smaller, more elegant font */
    color: #334155;
    background: white;
}

.financial-table thead th {
    background-color: #f8fafc;
    color: #64748b;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1.5vh 1vw;
    border-bottom: 2px solid #e2e8f0;
}

.financial-table td {
    padding: 1vh 1vw;
    border-bottom: 1px solid #f1f5f9;
}

/* Subtle Zebra Striping */
.financial-table tbody tr:nth-child(even) {
    background-color: #fbfcfe;
}

.financial-table tbody tr:hover {
    background-color: #f1f5f9;
}

/* Bold the item names */
.financial-table td:first-child {
    font-weight: 600;
    color: #0f172a;
    width: 30%; /* Give labels more room */

}





