/*
 * TXI Employee Portal & Market Model Generator --- CSS Design System
 * Light-first with full Dark Mode support via body.dark-theme
 */

/* --------- DESIGN TOKENS ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */
:root {
    /* Light Theme (default) */
    --bg-primary: #f4f6fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --border-color: rgba(15, 23, 42, 0.10);
    --border-color-active: rgba(15, 23, 42, 0.28);

    --color-primary: #0284c7;
    --color-primary-light: #0ea5e9;
    --color-text-main: #0f172a;
    --color-text-muted: #64748b;

    --btn-primary-bg: #0f172a;
    --btn-primary-color: #ffffff;
    --btn-primary-hover: #1e293b;

    --btn-secondary-bg: #f1f5f9;
    --btn-secondary-border: rgba(15, 23, 42, 0.12);
    --btn-secondary-hover: #e2e8f0;

    --login-banner-bg: #0f172a;

    --bg-th: rgba(2, 132, 199, 0.05);
    --bg-input: #ffffff;
    --bg-table: #ffffff;
    --bg-table-hover: rgba(2, 132, 199, 0.03);
    --table-cell-border: rgba(15, 23, 42, 0.06);
    --bg-scrollbar-track: #e2e8f0;

    --success-color: #10b981;
    --error-color: #dc2626;
    --info-color: #3b82f6;

    --card-shadow: 0 1px 3px rgba(15,23,42,0.06), 0 4px 16px rgba(15,23,42,0.06);

    --transition-fast: 0.18s ease;
    --transition-normal: 0.28s ease;
}

body.dark-theme {
    /* Dark Theme --- Pitch Black */
    --bg-primary: #000000;
    --bg-secondary: #000000;
    --bg-card: #0a0a0a;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-active: rgba(255, 255, 255, 0.20);

    --color-primary: #38bdf8;
    --color-primary-light: #7dd3fc;
    --color-text-main: #f1f5f9;
    --color-text-muted: #94a3b8;

    --btn-primary-bg: #0ea5e9;
    --btn-primary-color: #ffffff;
    --btn-primary-hover: #0284c7;

    --btn-secondary-bg: rgba(255, 255, 255, 0.05);
    --btn-secondary-border: rgba(255, 255, 255, 0.08);
    --btn-secondary-hover: rgba(255, 255, 255, 0.10);

    --login-banner-bg: #000000;

    --bg-th: rgba(56, 189, 248, 0.06);
    --bg-input: #0d0d0d;
    --bg-table: #050505;
    --bg-table-hover: rgba(56, 189, 248, 0.04);
    --table-cell-border: rgba(255, 255, 255, 0.05);
    --bg-scrollbar-track: #000000;

    --error-color: #f87171;

    --card-shadow: 0 2px 12px rgba(0,0,0,0.6);
}

/* --------- BASE --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--color-text-main);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--color-text-main);
    margin: 0 0 6px 0;
}

p.desc {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 0 0 20px 0;
    line-height: 1.6;
}

/* --------- SCROLLBAR ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--border-color-active); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-primary); }

/* --------- SIDEBAR LAYOUT --------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.sidebar-header p {
    color: var(--color-text-muted);
    font-size: 11px;
    margin: 6px 0 0 0;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 500;
}

/* Logo inside sidebar */
.sidebar-header .logo-img {
    height: auto;
    max-height: 48px;
    width: calc(50% - 12px);
    max-width: 160px;
    object-fit: contain;
}

/* --------- SIDEBAR MENU --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
.sidebar-menu {
    list-style: none;
    padding: 16px 10px;
    margin: 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all var(--transition-fast);
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
}

.menu-item:hover {
    color: var(--color-text-main);
    background: var(--bg-th);
    border-left-color: var(--border-color-active);
}

.menu-item.active {
    color: var(--color-primary);
    background: var(--bg-th);
    border-left-color: var(--color-primary);
    font-weight: 600;
}

.menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
    display: block;
}

.menu-item.active svg,
.menu-item:hover svg {
    opacity: 1;
}

/* --------- SIDEBAR FOOTER --------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 6px;
}

.sidebar-footer .user-email {
    font-size: 11.5px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout {
    color: var(--error-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
    transition: opacity var(--transition-fast);
}

.btn-logout:hover { opacity: 0.75; }

/* --------- MAIN CONTENT --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
.main-content {
    flex-grow: 1;
    padding: 36px 40px;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    max-height: 100vh;
}

.view-section {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.view-section.active { display: block; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 16px;
    padding-right: 60px; /* Clearance space for top-right theme toggle button */
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    font-family: 'Outfit', sans-serif;
    color: var(--color-text-main);
    font-size: 22px;
    font-weight: 700;
    margin: 0;
}

/* --------- THEME TOGGLE BUTTON --------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
.theme-toggle-btn {
    position: fixed;
    top: 24px;
    right: 32px;
    z-index: 1000;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    color: var(--color-text-main);
}

.theme-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    border-color: var(--color-primary);
}

.theme-toggle-btn .sun-icon { display: none; }
.theme-toggle-btn .moon-icon { display: flex; align-items: center; justify-content: center; }

body.dark-theme .theme-toggle-btn .sun-icon { display: flex; align-items: center; justify-content: center; }
body.dark-theme .theme-toggle-btn .moon-icon { display: none; }

.section-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* --------- BUTTONS ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */
.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-color);
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.16);
}

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--color-text-main);
    border: 1px solid var(--btn-secondary-border);
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
}

.btn-secondary:hover {
    background: var(--btn-secondary-hover);
    border-color: var(--border-color-active);
}

.btn-danger {
    background: rgba(220, 38, 38, 0.08);
    color: var(--error-color);
    border: 1px solid rgba(220, 38, 38, 0.18);
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.btn-danger:hover { background: rgba(220, 38, 38, 0.15); }

/* --------- CARDS ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--card-shadow);
}

/* --------- FORMS ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */
.form-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}
.form-grid > .form-group {
    flex: 0 0 200px;
    margin-bottom: 0;
}

.form-group { margin-bottom: 16px; }

label {
    display: block;
    color: var(--color-text-muted);
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 9px 13px;
    border-radius: 7px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--color-text-main);
    box-sizing: border-box;
    font-size: 13.5px;
    font-family: inherit;
    transition: all var(--transition-fast);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.13);
}

/* --------- DATA TABLES ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */
.data-table-wrapper {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    background: var(--bg-table);
}

.data-table th,
.data-table td {
    padding: 11px 16px;
    text-align: left;
    border-bottom: 1px solid var(--table-cell-border);
}

.data-table th {
    background: var(--bg-th);
    color: var(--color-primary);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: var(--bg-table-hover); }

.data-table td input[type="number"],
.data-table td input[type="text"] {
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--color-text-main);
    font-size: 13px;
    font-family: inherit;
    max-width: 100%;
    box-sizing: border-box;
    transition: border-color var(--transition-fast);
}

.data-table td input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* --- DIMENSION TABLES (SEGMENTS SETUP & REPORTS) --- */
.dim-table-wrapper {
    background: var(--bg-secondary);
    border-radius: 10px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    max-width: 100%;
    box-sizing: border-box;
}

.segment-setup-wrapper {
    width: 100%;
    max-width: 100%;
    margin-bottom: 24px;
    box-sizing: border-box;
}

/* Level 2 Sub-tables */
.segment-setup-wrapper[data-level="2"] {
    margin-left: 30px;
    width: calc(100% - 30px);
    max-width: calc(100% - 30px);
    margin-top: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #3b82f6; /* Blue indicator */
    box-sizing: border-box;
}
.segment-setup-wrapper[data-level="2"] .dim-table th {
    background: var(--bg-th) !important;
    color: var(--color-primary) !important;
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11.5px;
    font-weight: 700;
}

/* Level 3 Sub-tables */
.segment-setup-wrapper[data-level="3"] {
    margin-left: 60px;
    width: calc(100% - 60px);
    max-width: calc(100% - 60px);
    margin-top: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #10b981; /* Emerald indicator */
    box-sizing: border-box;
}
.segment-setup-wrapper[data-level="3"] .dim-table th {
    background: var(--bg-th) !important;
    color: var(--color-primary) !important;
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11.5px;
    font-weight: 700;
}

/* Level 4 Sub-tables */
.segment-setup-wrapper[data-level="4"] {
    margin-left: 90px;
    width: calc(100% - 90px);
    max-width: calc(100% - 90px);
    margin-top: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #f59e0b; /* Amber indicator */
    box-sizing: border-box;
}
.segment-setup-wrapper[data-level="4"] .dim-table th {
    background: var(--bg-th) !important;
    color: var(--color-primary) !important;
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11.5px;
    font-weight: 700;
}

/* Level 5 Sub-tables */
.segment-setup-wrapper[data-level="5"] {
    margin-left: 120px;
    width: calc(100% - 120px);
    max-width: calc(100% - 120px);
    margin-top: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #a855f7; /* Purple indicator */
    box-sizing: border-box;
}
.segment-setup-wrapper[data-level="5"] .dim-table th {
    background: var(--bg-th) !important;
    color: var(--color-primary) !important;
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11.5px;
    font-weight: 700;
}
.dim-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    background: var(--bg-table);
}
.dim-table th {
    background: var(--bg-th) !important;
    color: var(--color-primary) !important;
    padding: 11px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11.5px;
    font-weight: 700;
}
.dim-table th:last-child {
    border-right: none;
}
.dim-table th input.dim-header-input {
    background: transparent;
    border: none;
    color: var(--color-primary);
    font-weight: 700;
    font-family: inherit;
    font-size: inherit;
    width: 100%;
    padding: 2px 0;
}
.dim-table th input.dim-header-input::placeholder {
    color: var(--color-primary);
    opacity: 0.6;
}
.dim-table th input.dim-header-input:focus {
    outline: none;
    border-bottom: 1px dashed var(--color-primary);
}
.dim-table tbody td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--table-cell-border);
}

.dim-table tbody tr:hover { background: var(--bg-table-hover); }
.dim-table tfoot td {
    padding: 10px 12px;
    background: var(--bg-th);
    font-weight: 700;
    border-top: 2px solid var(--border-color);
    color: var(--color-text-main);
}
.dark-theme .dim-table tfoot td {
    background: var(--bg-th);
    color: var(--color-text-main);
}
.dim-table input.seg-input {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--color-text-main);
    font-size: 13px;
    font-family: inherit;
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}
.dim-table input.seg-input:focus,
.dim-table input.seg-input:hover {
    background: var(--bg-input);
    border-color: var(--border-color);
    outline: none;
}

.numeric { text-align: right !important; }

/* --------- REPORT TABS ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */
.report-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    overflow-x: auto;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.report-tab-btn {
    background: var(--btn-secondary-bg);
    border: 1px solid var(--btn-secondary-border);
    color: var(--color-text-muted);
    padding: 7px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.report-tab-btn:hover,
.report-tab-btn.active {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--bg-th);
}

/* Segment hierarchy indents */
.level-indent-1 { padding-left: 20px !important; font-weight: 500; }
.level-indent-2 { padding-left: 40px !important; color: var(--color-text-muted); }
.level-indent-3 { padding-left: 60px !important; font-style: italic; color: var(--color-text-muted); }

/* --------- DASHBOARD GRID --------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.market-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--card-shadow);
}

.market-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.12);
}

.market-card-title {
    font-family: 'Outfit', sans-serif;
    color: var(--color-primary);
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.market-card-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.market-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* --------- ANIMATIONS --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --------- CAGR LADDER ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */
.tuning-container { display: flex; gap: 28px; flex-wrap: wrap; }
.tuning-controls  { flex: 1 1 280px; }
.tuning-preview   { flex: 2 1 480px; }

.ladder-preview {
}

.ladder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.ladder-item:last-child { border-bottom: none; }

.tag-rank {
    background: var(--bg-th);
    color: var(--color-primary);
    border: 1px solid var(--border-color-active);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

/* --------- THEME TOGGLE --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
.theme-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--color-text-main);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.10);
    z-index: 9999;
    transition: all var(--transition-fast);
    padding: 0;
    font-size: 17px;
    line-height: 1;
}

.theme-toggle-btn:hover {
    transform: scale(1.08);
    border-color: var(--border-color-active);
    box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}

.theme-toggle-btn .sun-icon  { display: none; }
.theme-toggle-btn .moon-icon { display: block; }

body.dark-theme .theme-toggle-btn .sun-icon  { display: block; }
body.dark-theme .theme-toggle-btn .moon-icon { display: none; }

/* --------- LOGO RULES --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
.logo-img {
    display: block;
    transition: filter var(--transition-fast);
}

/* In dark mode: invert the black logo to white (monochrome) */
body.dark-theme .logo-img {
    filter: invert(1);
}

/* --------- LOGIN PAGE --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
}

.decor-blob {
    position: absolute;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    filter: blur(110px);
    z-index: 1;
    pointer-events: none;
    opacity: 0.5;
}

.decor-blob-1 {
    top: -80px; left: -80px;
    background: rgba(14, 165, 233, 0.18);
}

.decor-blob-2 {
    bottom: -120px; right: -80px;
    background: rgba(37, 99, 235, 0.14);
}

body.dark-theme .decor-blob {
    display: none;
}

.login-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    padding: 16px;
    box-sizing: border-box;
    animation: fadeIn 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0 0 36px;
    box-shadow: var(--card-shadow);
    text-align: center;
    overflow: hidden;
}

.login-banner {
    background: var(--login-banner-bg);
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 14px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.logo-area {
    padding: 28px 28px 0;
    margin-bottom: 20px;
}

.logo-area .logo-img {
    width: 160px;
    height: auto;
    max-height: 80px;
    object-fit: contain;
    display: block;
    margin: 0 auto 20px;
}

.logo-area p {
    color: var(--color-text-muted); /* Used to be hardcoded, now uses robust variables */
    font-size: 13.5px;
    margin: 0;
    line-height: 1.5;
}

.login-error {
    background: rgba(220, 38, 38, 0.06);
    border: 1px solid rgba(220, 38, 38, 0.18);
    color: var(--error-color);
    padding: 11px 15px;
    border-radius: 9px;
    font-size: 13px;
    margin: 0 28px 16px;
    text-align: left;
    line-height: 1.4;
    animation: shake .3s ease-in-out;
}

form.login-form {
    padding: 0 28px;
}

.login-form .input-group {
    margin-bottom: 16px;
    text-align: left;
}

.login-form .input-group label {
    display: block;
    color: var(--color-text-main);
    font-size: 12.5px;
    margin-bottom: 7px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.login-form .input-group input {
    width: 100%;
    padding: 11px 18px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--color-text-main);
    font-size: 14px;
    box-sizing: border-box;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.login-form .input-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.13);
}

.login-form .btn-login {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-color);
    border: none;
    width: 100%;
    padding: 13px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(15,23,42,0.14);
    margin-top: 8px;
}

.login-form .btn-login:hover {
    background: var(--btn-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(15,23,42,0.20);
}

.login-form .btn-login:active {
    transform: translateY(1px);
}

.login-footer {
    margin-top: 24px;
    padding: 0 28px;
    color: var(--color-text-muted);
    font-size: 11.5px;
    line-height: 1.5;
}

/* Excel Selection Engine */
.excel-selected {
    background-color: #e0f2fe !important;
    outline: 1px solid #0ea5e9 !important;
    outline-offset: -1px;
}
.data-table-wrapper table {
}
.data-table-wrapper table .editable-cell:focus {
    user-select: text; /* Re-enable text selection when actively typing */
    outline: 2px solid #0ea5e9 !important;
    background-color: #fff !important;
}

/* --- VARIATION FACTORS MATRIX TABLES --- */
.variation-table-wrapper {
    background: var(--bg-secondary);
    border-radius: 10px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    overflow: hidden;
    width: max-content;
    min-width: 60%;
    margin-bottom: 24px;
}

.variation-table-wrapper[data-level="2"] {
    margin-left: 60px;
    margin-top: 5px;
    margin-bottom: 5px;
    border-left: 4px solid #3b82f6;
    width: max-content;
}
.variation-table-wrapper[data-level="2"] .data-table th { background: var(--bg-th) !important; color: var(--color-primary) !important; }

.variation-table-wrapper[data-level="3"] {
    margin-left: 120px;
    margin-top: 5px;
    margin-bottom: 5px;
    border-left: 4px solid #10b981;
    width: max-content;
}
.variation-table-wrapper[data-level="3"] .data-table th { background: var(--bg-th) !important; color: var(--color-primary) !important; }

.variation-table-wrapper[data-level="4"] {
    margin-left: 180px;
    margin-top: 5px;
    margin-bottom: 5px;
    border-left: 4px solid #f59e0b;
    width: max-content;
}
.variation-table-wrapper[data-level="4"] .data-table th { background: var(--bg-th) !important; color: var(--color-primary) !important; }

.variation-table-wrapper[data-level="5"] {
    margin-left: 240px;
    margin-top: 5px;
    margin-bottom: 5px;
    border-left: 4px solid #a855f7;
    width: max-content;
}
.variation-table-wrapper[data-level="5"] .data-table th { background: var(--bg-th) !important; color: var(--color-primary) !important; }


/* --- NAVIGATION WIZARD LOCK --- */
.menu-item.locked {
    color: var(--color-text-muted);
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
    background: transparent !important;
}

#btn-create-new {
    margin-right: 0;
}

/* --- DUMMY DATA AUTO-FILL BUTTONS --- */
.btn-dummy-data {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.10), rgba(14, 165, 233, 0.18)) !important;
    color: var(--color-primary) !important;
    border: 1px solid rgba(2, 132, 199, 0.30) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 8px 18px !important;
    height: 36px !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.08) !important;
}

.btn-dummy-data:hover {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.20), rgba(14, 165, 233, 0.30)) !important;
    border-color: var(--color-primary) !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(2, 132, 199, 0.18) !important;
}

body.dark-theme .btn-dummy-data {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(56, 189, 248, 0.22)) !important;
    color: #38bdf8 !important;
    border-color: rgba(56, 189, 248, 0.35) !important;
}

body.dark-theme .btn-dummy-data:hover {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(56, 189, 248, 0.40)) !important;
    border-color: #38bdf8 !important;
}


