:root {
    --sp-turquoise: #19AFC2;
    --sp-turquoise-dark: #148697;
    --sp-gold: #D9B46F;
    --sp-gold-dark: #B8905A;
    --sp-text-dark: #2A2118;
    --sp-soft-neutral: #EEF4F5;
    --sp-soft-turquoise: #E1F5F8;
    --sp-soft-amber: #FDF1DC;
    --sp-soft-green: #E3F6EA;
    --sp-soft-red: #FBE7E7;
    --sp-red: #B3392C;
}

/* Force Filament's primary-600 shade (used by solid buttons/active states)
   to match the exact institutional gold, rather than the auto-generated shade. */
:root {
    --primary-600: 217, 180, 111 !important;
}

/* ---------- Sidebar shell ---------- */
.fi-sidebar {
    background-color: var(--sp-turquoise) !important;
}

.fi-sidebar-header {
    display: none !important;
}

.fi-sidebar-nav {
    padding-top: 0 !important;
}

/* ---------- Custom brand block (injected via render hook) ---------- */
.sp-fi-brand {
    display: block;
    padding: 1.75rem 1.25rem 1.5rem;
}

.sp-fi-brand-title {
    display: block;
    color: #fff;
    font-weight: 800;
    font-size: 1.5rem;
    line-height: 1.2;
    letter-spacing: 0.6px;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
}

.sp-fi-brand-divider {
    height: 3px;
    border-radius: 2px;
    background-color: rgba(255, 255, 255, 0.3);
    margin: 1.25rem 0;
}

/* ---------- Client card (swappable via config/sistrapro.php) ---------- */
.sp-client-card {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border-radius: 0.65rem;
    padding: 0.65rem 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.sp-client-card-logo {
    max-width: 100%;
    height: 32px;
    width: auto;
    object-fit: contain;
}

/* ---------- Sidebar nav item colors (readable on turquoise) ----------
   Solid white text/icons for every item, active or not — Filament's
   default active-state text color (primary/gold) had poor contrast
   against the turquoise background, so the active item is highlighted
   with a solid gold pill instead, keeping the institutional gold as an
   accent without using it as low-contrast body text. */
.fi-sidebar-item .fi-sidebar-item-label {
    color: #fff !important;
}

.fi-sidebar-item .fi-sidebar-item-icon {
    color: rgba(255, 255, 255, 0.92) !important;
}

.fi-sidebar-item-button:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-button {
    background-color: var(--sp-gold) !important;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-label,
.fi-sidebar-item.fi-active .fi-sidebar-item-icon {
    color: var(--sp-text-dark) !important;
    font-weight: 700;
}

.fi-sidebar-nav-groups .fi-sidebar-group-label,
.fi-sidebar-nav-groups .fi-sidebar-group-button {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* ---------- Dashboard stat cards ---------- */
.sp-stat-card {
    border: none;
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.sp-stat-card .sp-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.sp-stat-card .sp-stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    color: #1f2937;
}

.sp-stat-card .sp-stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.15rem;
}

.sp-stat-total {
    background-color: var(--sp-soft-neutral);
}

.sp-stat-total .sp-stat-icon {
    background-color: rgba(25, 175, 194, 0.18);
    color: var(--sp-turquoise-dark);
}

.sp-stat-recibido {
    background-color: var(--sp-soft-turquoise);
}

.sp-stat-recibido .sp-stat-icon {
    background-color: rgba(25, 175, 194, 0.22);
    color: var(--sp-turquoise-dark);
}

.sp-stat-en_proceso {
    background-color: var(--sp-soft-amber);
}

.sp-stat-en_proceso .sp-stat-icon {
    background-color: rgba(217, 180, 111, 0.35);
    color: #8A5A16;
}

.sp-stat-resuelto {
    background-color: var(--sp-soft-green);
}

.sp-stat-resuelto .sp-stat-icon {
    background-color: rgba(40, 167, 69, 0.2);
    color: #1E7E34;
}

/* ---------- Anulado banner (view page) ---------- */
.sp-anulado-banner {
    background-color: var(--sp-soft-red);
    color: var(--sp-red);
    border-radius: 0.75rem;
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

/* ---------- Status stepper (view page) ---------- */
.sp-stepper {
    display: flex;
    align-items: flex-start;
    padding: 0.5rem 0.5rem 1rem;
}

.sp-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 120px;
    flex-shrink: 0;
}

.sp-step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid #d7dee0;
    background-color: #fff;
    color: #9aa5a8;
}

.sp-step-label {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #9aa5a8;
}

.sp-step-line {
    flex: 1;
    height: 2px;
    background-color: #d7dee0;
    margin-top: 22px;
}

.sp-step.is-done .sp-step-circle {
    background-color: var(--sp-turquoise);
    border-color: var(--sp-turquoise);
    color: #fff;
}

.sp-step.is-done .sp-step-label {
    color: var(--sp-turquoise-dark);
}

.sp-step.is-current .sp-step-circle {
    background-color: #fff;
    border-color: var(--sp-gold);
    color: var(--sp-gold-dark);
    box-shadow: 0 0 0 4px rgba(217, 180, 111, 0.25);
}

.sp-step.is-current .sp-step-label {
    color: var(--sp-gold-dark);
}

.sp-step-line.is-done {
    background-color: var(--sp-turquoise);
}

.sp-stepper.is-anulado .sp-step-circle {
    background-color: #f1f3f4;
    border-color: #e2e6e7;
    color: #b8c0c2;
}

.sp-stepper.is-anulado .sp-step-label {
    color: #b8c0c2;
}

.sp-stepper.is-anulado .sp-step-line {
    background-color: #e2e6e7;
}

/* Vertical stepper on narrow screens (phones/small tablets) */
@media (max-width: 767px) {
    .sp-stepper {
        flex-direction: column;
        align-items: stretch;
        padding: 0.5rem 0.25rem 0.5rem;
    }

    .sp-step {
        flex-direction: row;
        width: auto;
        text-align: left;
        gap: 0.85rem;
    }

    .sp-step-label {
        margin-top: 0;
        display: flex;
        align-items: center;
    }

    .sp-step-line {
        flex: none;
        width: 2px;
        height: 22px;
        margin-top: 0;
        margin-left: 21px;
    }
}

/* ---------- Historial timeline ---------- */
.sp-timeline {
    position: relative;
    padding-left: 0.5rem;
}

.sp-timeline-item {
    position: relative;
    display: flex;
    gap: 0.9rem;
    padding-bottom: 1.5rem;
}

.sp-timeline-item:last-child {
    padding-bottom: 0;
}

.sp-timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    top: 30px;
    left: 15px;
    bottom: -6px;
    width: 2px;
    background-color: #e5e7eb;
}

.sp-timeline-dot {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 1;
}

.sp-timeline-dot-turquoise {
    background-color: var(--sp-turquoise);
}

.sp-timeline-dot-gold {
    background-color: var(--sp-gold);
    color: var(--sp-text-dark);
}

.sp-timeline-dot-red {
    background-color: var(--sp-red);
}

.sp-timeline-content {
    flex: 1;
    padding-top: 0.15rem;
}

.sp-timeline-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sp-timeline-action {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1f2937;
}

.sp-timeline-date {
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
}

.sp-timeline-user {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.1rem;
}

.sp-timeline-detail {
    font-size: 0.85rem;
    color: #374151;
    margin-top: 0.35rem;
}

.sp-timeline-comment {
    font-size: 0.85rem;
    color: #4b5563;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
}

/* ---------- Topbar section heading ---------- */
.fi-topbar nav {
    min-height: 4.5rem;
    height: auto;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* The heading is injected first (TOPBAR_START), before the mobile sidebar
   toggle buttons in the DOM. Demoting those buttons to order:-1 puts them
   first visually without pulling the heading in front of the theme
   switcher / user menu that follow later in the topbar. */
.fi-topbar-open-sidebar-btn,
.fi-topbar-close-sidebar-btn {
    order: -1;
}

.sp-topbar-heading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.15;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.sp-topbar-heading-eyebrow {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--sp-turquoise-dark);
}

.sp-topbar-heading-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sp-text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    .sp-topbar-heading-title {
        font-size: 1.05rem;
    }
}

/* ---------- "En desarrollo" placeholder page ---------- */
.sp-en-desarrollo {
    max-width: 26rem;
    margin: 2rem auto;
    text-align: center;
    background-color: #fff;
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sp-en-desarrollo-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--sp-soft-turquoise);
    color: var(--sp-turquoise-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.sp-en-desarrollo-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.sp-en-desarrollo-text {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.55;
    margin-bottom: 1.5rem;
}

/* ---------- Dashboard greeting ---------- */
.sp-saludo {
    font-size: 1.35rem;
    font-weight: 600;
    color: #1f2937;
    padding: 0.25rem 0 0.5rem;
}

.sp-saludo-name {
    color: var(--sp-turquoise-dark);
    font-weight: 800;
}

/* ---------- User name next to the topbar avatar ---------- */
.sp-topbar-user-info {
    display: flex;
    align-items: center;
    margin-right: 0.65rem;
}

.sp-topbar-user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--sp-text-dark);
    white-space: nowrap;
}

@media (max-width: 640px) {
    .sp-topbar-user-info {
        display: none;
    }
}
