/* ===== Dashboard Visual Refresh ===== */
:root {
    --brand-1: #4db896;   /* indigo */
    --brand-2: #6dd4a8;   /* violet */
    --accent-1: #6dd4a8;  /* blue */
    --success: #4db896;   /* emerald */
    --warning: #f59e0b;   /* amber */
    --danger:  #ef4444;   /* red */
    --text:    #1a1a1a;   /* slate-800 */
    --muted:   #718096;   /* slate-500 */
    --card-bg: #ffffff;
    --shadow-1: 0 4px 6px rgba(77, 184, 150, 0.1);
    --shadow-2: 0 10px 15px rgba(77, 184, 150, 0.15);
    --radius: 16px;
}

/* Header */
.welcome-section {
    padding: 20px 0 16px;
    border-bottom: 1px solid #d4f1e8;
}
.welcome-title {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 6px;
}
.welcome-subtitle {
    color: var(--muted);
    font-size: 1rem;
    margin: 0;
}

.tenant-switcher--dashboard {
    display: grid;
    gap: 18px;
    margin-bottom: 24px;
    padding: 22px 24px;
    background:
        radial-gradient(circle at bottom left, rgba(109, 212, 168, 0.14), transparent 35%),
        radial-gradient(circle at top right, rgba(77, 184, 150, 0.14), transparent 30%),
        linear-gradient(135deg, #ffffff 0%, #f8fdfb 100%);
    border: 1px solid #d4f1e8;
    border-radius: 20px;
    box-shadow: var(--shadow-1), 0 14px 26px rgba(77, 184, 150, 0.07);
}

.tenant-switcher__intro {
    display: grid;
    align-content: start;
    gap: 10px;
}

.tenant-switcher__intro-body {
    display: grid;
    grid-template-columns: minmax(280px, 1.2fr) minmax(280px, 0.9fr);
    gap: 18px;
    align-items: end;
}

.tenant-switcher__copy {
    display: grid;
    gap: 8px;
}

.tenant-switcher__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-1);
    margin-bottom: 10px;
}

.tenant-switcher__title {
    font-size: clamp(1.35rem, 2.2vw, 1.9rem);
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
    margin: 0;
}

.tenant-switcher__subtitle {
    color: var(--muted);
    margin: 0;
    max-width: 60ch;
    font-size: 0.98rem;
}

.tenant-switcher__subtitle strong {
    color: var(--text);
}

.tenant-switcher__highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.tenant-switcher__pill {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(212, 241, 232, 0.95);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.tenant-switcher__pill-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.tenant-switcher__pill strong {
    color: var(--text);
    line-height: 1.35;
}

.tenant-switcher__toolbar {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.tenant-switcher__form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tenant-switcher__form--dashboard {
    min-width: 0;
}

.tenant-switcher__label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.tenant-switcher__select-shell {
    display: grid;
    gap: 8px;
}

.tenant-switcher__select-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
}

.tenant-switcher__hint {
    color: var(--muted);
    font-size: 0.84rem;
}

.tenant-switcher__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    justify-content: flex-end;
}

.tenant-switcher__select {
    border-radius: 14px;
    border-color: #d4f1e8;
    min-height: 50px;
    box-shadow: none;
    background-color: #ffffff;
}

.tenant-switcher__submit,
.tenant-switcher__secondary {
    min-height: 50px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tenant-switcher__preview {
    display: grid;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(248, 253, 251, 0.95) 0%, #ffffff 100%);
    border: 1px solid #d4f1e8;
}

.tenant-switcher__preview--compact {
    grid-template-columns: minmax(220px, 1.1fr) minmax(320px, 1.4fr);
    align-items: center;
}

.tenant-switcher__preview-main {
    display: grid;
    gap: 2px;
}

.tenant-switcher__preview-eyebrow {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-1);
}

.tenant-switcher__preview-main strong {
    font-size: 1.05rem;
    color: var(--text);
}

.tenant-switcher__preview-subtitle {
    color: var(--muted);
    line-height: 1.4;
    font-size: 0.92rem;
}

.tenant-switcher__preview-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.tenant-switcher__preview-item {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e5f6ef;
}

.tenant-switcher__preview-item span {
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.tenant-switcher__preview-item strong {
    color: var(--text);
    line-height: 1.35;
}

/* Grid */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

/* Cards */
.stat-card {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-1);
    transition: transform .25s ease, box-shadow .25s ease;
    overflow: hidden;
}
.stat-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(600px 200px at 10% -10%, rgba(77, 184, 150, 0.08), transparent 60%);
    pointer-events: none;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }

/* Accent strips */
.stat-card.primary { box-shadow: var(--shadow-1), inset 0 0 0 3px rgba(77, 184, 150, 0.15); }
.stat-card.success { box-shadow: var(--shadow-1), inset 0 0 0 3px rgba(77, 184, 150, 0.15); }
.stat-card.warning { box-shadow: var(--shadow-1), inset 0 0 0 3px rgba(245,158,11,0.18); }
.stat-card.danger  { box-shadow: var(--shadow-1), inset 0 0 0 3px rgba(239,68,68,0.18); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    color: #fff;
    font-size: 26px;
}
.icon-purple { background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); }
.icon-green  { background: linear-gradient(135deg, #6dd4a8, var(--success)); }
.icon-orange { background: linear-gradient(135deg, #f59e0b, #f59e0b); }
.icon-red    { background: linear-gradient(135deg, #ef4444, #ef4444); }

.stat-number {
    font-size: 2.1rem;
    font-weight: 800;
    display: block;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
    color: var(--text);
}
.stat-label {
    color: var(--muted);
    font-size: .92rem;
    font-weight: 600;
}

.dashboard-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-1);
}
.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 18px;
    color: var(--text);
}

/* Quick actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    color: var(--text);
    padding: 16px 18px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid #d4f1e8;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.action-btn i { font-size: 22px; color: var(--brand-1); }
.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
    border-color: #b8e6d5;
    background: linear-gradient(135deg, #ffffff 0%, #f8fdfb 100%);
}

/* Recent activity timeline */
.recent-activity { list-style: none; padding: 0; margin: 0; position: relative; }
.recent-activity::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 20px;
    width: 2px; background: #d4f1e8;
}
.activity-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 0 14px 16px;
    position: relative;
}
.activity-item::before {
    content: "";
    position: absolute; left: 12px; top: 24px;
    width: 10px; height: 10px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    box-shadow: 0 0 0 4px rgba(77, 184, 150, 0.12);
}
.activity-icon {
    width: 40px; height: 40px; border-radius: 12px;
    background: #f8fdfb; color: var(--brand-1);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.activity-content { flex: 1; min-width: 0; }
.activity-title { font-weight: 700; margin-bottom: 2px; color: var(--text); }
.activity-summary {
    font-size: .84rem;
    color: var(--muted);
    margin-bottom: 2px;
    line-height: 1.35;
}
.activity-time { font-size: .85rem; color: var(--muted); }
.activity-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    min-width: 130px;
}
.activity-link {
    color: var(--brand-1);
    font-weight: 700;
    text-decoration: none;
    font-size: .82rem;
}
.activity-link:hover {
    text-decoration: underline;
}
.empty-activity {
    color: var(--muted);
    text-align: center;
    padding: 14px 8px;
}
.empty-activity i {
    display: block;
    font-size: 1.4rem;
    margin-bottom: 8px;
}
.dashboard-kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.stat-meta {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 600;
}

.dashboard-shell {
    display: grid;
    gap: 24px;
}

.tenant-selection-page {
    display: grid;
    gap: 24px;
}

.tenant-selection-page__hero {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 8px 0 0;
}

.tenant-selection-page__eyebrow,
.tenant-selection-card__eyebrow,
.tenant-selection-details__eyebrow {
    display: inline-flex;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-1);
    margin-bottom: 10px;
}

.tenant-selection-page__title {
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    font-weight: 800;
    line-height: 1.05;
    margin: 0 0 10px;
    color: var(--text);
}

.tenant-selection-page__subtitle {
    color: var(--muted);
    max-width: 780px;
    margin: 0;
    font-size: 1rem;
}

.tenant-selection-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 24px;
}

.tenant-selection-card,
.tenant-selection-details {
    margin-bottom: 0;
}

.tenant-selection-card__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.tenant-selection-card__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: #f8fdfb;
    border: 1px solid #d4f1e8;
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
}

.tenant-selection-form {
    display: grid;
    gap: 16px;
}

.tenant-selection-form__label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.tenant-selection-form__select {
    min-height: 58px;
    border-radius: 16px;
}

.tenant-selection-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.tenant-selection-details {
    background:
        radial-gradient(circle at top left, rgba(77, 184, 150, 0.12), transparent 34%),
        #ffffff;
}

.tenant-selection-details__header {
    margin-bottom: 18px;
}

.tenant-selection-details__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.tenant-selection-details__item {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: 16px;
    background: #f8fdfb;
    border: 1px solid #d4f1e8;
}

.tenant-selection-details__label {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.tenant-selection-details__item strong {
    color: var(--text);
    line-height: 1.35;
}

.tenant-selection-details__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #d4f1e8;
    color: var(--brand-1);
    font-weight: 700;
    text-decoration: none;
}

.tenant-selection-details__link.disabled {
    pointer-events: none;
    opacity: 0.55;
}

.dashboard-shell__welcome,
.dashboard-shell__panel,
.dashboard-shell__card,
.dashboard-shell__error {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
}

.dashboard-shell__welcome,
.dashboard-shell__panel,
.dashboard-shell__error {
    padding: 24px;
}

.dashboard-shell__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.dashboard-shell__card {
    padding: 24px;
    display: grid;
    gap: 14px;
}

.dashboard-shell__actions {
    display: grid;
    gap: 14px;
}

.dashboard-skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(90deg, #eef4f1 25%, #ffffff 50%, #eef4f1 75%);
    background-size: 200% 100%;
    animation: dashboardShimmer 1.3s ease-in-out infinite;
}

.dashboard-skeleton--title {
    width: min(320px, 72%);
    height: 28px;
    margin-bottom: 12px;
}

.dashboard-skeleton--subtitle {
    width: min(460px, 92%);
    height: 16px;
}

.dashboard-skeleton--icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
}

.dashboard-skeleton--stat {
    width: 40%;
    height: 34px;
}

.dashboard-skeleton--label {
    width: 68%;
    height: 16px;
}

.dashboard-skeleton--section {
    width: 52%;
    height: 24px;
    margin-bottom: 18px;
}

.dashboard-skeleton--action,
.dashboard-skeleton--list {
    width: 100%;
    height: 58px;
}

.dashboard-shell__error {
    text-align: center;
}

.dashboard-shell__error h3 {
    margin-bottom: 8px;
    color: var(--text);
}

.dashboard-shell__error p {
    margin-bottom: 16px;
    color: var(--muted);
}

@keyframes dashboardShimmer {
    from {
        background-position: 100% 0;
    }
    to {
        background-position: -100% 0;
    }
}

/* Entrance animation (staggered) */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px);} to { opacity: 1; transform: translateY(0);} }
.stats-cards .stat-card { opacity: 0; animation: fadeUp .6s ease forwards; }
.stats-cards .stat-card:nth-child(1){ animation-delay: .05s; }
.stats-cards .stat-card:nth-child(2){ animation-delay: .15s; }
.stats-cards .stat-card:nth-child(3){ animation-delay: .25s; }
.stats-cards .stat-card:nth-child(4){ animation-delay: .35s; }
.quick-actions .action-btn { opacity: 0; animation: fadeUp .6s ease forwards; }
.quick-actions .action-btn:nth-child(1){ animation-delay: .05s; }
.quick-actions .action-btn:nth-child(2){ animation-delay: .10s; }
.quick-actions .action-btn:nth-child(3){ animation-delay: .15s; }
.quick-actions .action-btn:nth-child(4){ animation-delay: .20s; }
.quick-actions .action-btn:nth-child(5){ animation-delay: .25s; }
.quick-actions .action-btn:nth-child(6){ animation-delay: .30s; }
.recent-activity .activity-item { opacity: 0; animation: fadeUp .6s ease forwards; }
.recent-activity .activity-item:nth-child(1){ animation-delay: .05s; }
.recent-activity .activity-item:nth-child(2){ animation-delay: .15s; }
.recent-activity .activity-item:nth-child(3){ animation-delay: .25s; }
.recent-activity .activity-item:nth-child(4){ animation-delay: .35s; }

/* Responsive */
@media (max-width: 768px) {
    .tenant-switcher--dashboard {
        padding: 18px;
    }

    .tenant-switcher__intro-body,
    .tenant-switcher__toolbar,
    .tenant-switcher__preview--compact {
        grid-template-columns: 1fr;
    }

    .tenant-switcher__select-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tenant-switcher__controls {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }

    .tenant-switcher__submit,
    .tenant-switcher__secondary {
        width: 100%;
    }

    .tenant-selection-grid {
        grid-template-columns: 1fr;
    }

    .tenant-switcher__preview-metrics,
    .tenant-selection-details__grid {
        grid-template-columns: 1fr;
    }

    .tenant-selection-form__actions {
        flex-direction: column;
    }

    .stats-cards { grid-template-columns: 1fr; gap: 16px; }
    .quick-actions { grid-template-columns: 1fr; }
    .dashboard-shell__stats { grid-template-columns: 1fr; }
    .action-btn { padding: 14px; }
    .welcome-title { font-size: 1.6rem; }
    .dashboard-section { padding: 20px; }
    .activity-item { align-items: flex-start; }
    .activity-meta {
        align-items: flex-start;
        min-width: 0;
        margin-left: 8px;
    }
}
