/* ==========================================================================
   Dashboard Home — Estilos portables para ERP Totalex
   ========================================================================== */

:root {
    /* Brand & Accent */
    --brand-primary: #2450D6;
    --brand-primary-hover: #1A3EB8;
    --brand-primary-light: #6F93FF;
    --brand-soft: #E6ECFB;
    --brand-glow: rgba(36, 80, 214, 0.25);

    /* Theme Surfaces (Light mode default, dark auto) */
    --bg-dark: #F2F4F7;
    --bg-navbar: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-border: #E1E5EB;
    --bg-card-hover: #F7F8FA;

    /* Typography & Inks */
    --text-main: #10233F;
    --text-muted: #5B6B80;
    --text-dim: #8B98A9;

    /* Semantic Status */
    --success: #17845B;
    --success-bg: #DFF3EA;
    --danger: #C43D3D;
    --danger-bg: #F9E1E1;
    --warn: #B87A00;
    --warn-bg: #FBEFD2;
    --info: #3B6FA8;
    --info-bg: #E2ECF6;

    /* Radii & Effects */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 99px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-card: 0 1px 3px rgba(16, 35, 63, 0.05), 0 0 0 1px var(--bg-card-border);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --brand-primary: #6F93FF;
        --brand-primary-hover: #8EAAFF;
        --brand-soft: #1E2F57;
        --brand-glow: rgba(111, 147, 255, 0.3);

        --bg-dark: #0C1524;
        --bg-navbar: #131F33;
        --bg-card: #131F33;
        --bg-card-border: #243652;
        --bg-card-hover: #182740;

        --text-main: #E8EDF5;
        --text-muted: #93A3BA;
        --text-dim: #5B6B80;

        --success: #4CC593;
        --success-bg: #12362B;
        --danger: #F07A7A;
        --danger-bg: #3F1D1F;
        --warn: #E8B23A;
        --warn-bg: #3A2F12;
        --info: #7FB1E6;
        --info-bg: #1A2E45;

        --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--bg-card-border);
    }
}

/* Preloader */
.app-preloader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    background: transparent;
    gap: 20px;
}

.preloader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--bg-card-border);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* App Navbar */
.app-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--bg-card-border);
    margin-bottom: 20px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-logo {
    width: 32px;
    height: 32px;
}

.navbar-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text-main);
    line-height: 1.2;
    margin: 0;
}

.brand-title-accent {
    color: var(--brand-primary);
}

.tenant-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--brand-primary);
    background: var(--brand-soft);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    border: 1px solid var(--bg-card-border);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    background: var(--bg-card-hover);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-full);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.2;
}

.user-role {
    font-size: 10.5px;
    color: var(--text-muted);
}

/* Dashboard Body */
.dashboard-screen {
    min-height: 100vh;
    background: var(--bg-dark);
}

.dashboard-body {
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.welcome-banner {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow-card);
}

.welcome-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.welcome-text-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.welcome-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.3px;
    margin: 0;
}

.welcome-tenant-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-primary);
    background: var(--brand-soft);
    border: 1px solid var(--bg-card-border);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    align-self: flex-start;
}

.welcome-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.role-badge-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-card-hover);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    min-width: 90px;
}

.role-badge-icon {
    color: var(--brand-primary);
    margin-bottom: 4px;
}

.role-box-label {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

.role-box-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 10px;
    border-top: 1px solid var(--bg-card-border);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
    box-shadow: 0 0 0 2px var(--success-bg);
}

/* Modules Grid */
.modules-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

.module-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

.module-card:hover:not(.module-card-disabled) {
    background: var(--bg-card-hover);
    border-color: var(--brand-primary);
    transform: translateY(-1px);
}

.module-card-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.module-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-soft);
    color: var(--brand-primary);
    flex-shrink: 0;
}

.module-icon-wrapper.orange {
    background: var(--brand-soft);
    color: var(--brand-primary);
}

.module-icon-wrapper.blue {
    background: var(--info-bg);
    color: var(--info);
}

.module-icon-wrapper.purple {
    background: var(--brand-soft);
    color: var(--brand-primary);
}

.module-icon-wrapper svg {
    width: 22px;
    height: 22px;
}

.module-info {
    flex: 1;
}

.module-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 2px 0;
}

.module-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0;
}

.module-arrow {
    color: var(--text-dim);
}

.badge-soon {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-card-hover);
    color: var(--text-muted);
    border: 1px solid var(--bg-card-border);
}

/* Dashboard Footer */
.dashboard-footer {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--danger-bg);
}
