:root {
    /* Paleta base tomada del verde del logo */
    --esp-primary: #226151;        /* verde principal */
    --esp-primary-dark: #173d33;  /* verde más oscuro */
    --esp-primary-light: #3b8a74; /* verde claro */

    --esp-accent: #f2b34a;        /* acento cálido para botones/detalles */
    --esp-accent-soft: #ffedd1;

    --esp-bg: #f5f7f8;            /* fondo general */
    --esp-surface: #ffffff;       /* tarjetas / panels */
    --esp-border: #dde4e4;

    --esp-text-main: #1f2a2a;
    --esp-text-muted: #6b7a7a;

    --esp-radius: 10px;
    --esp-shadow-soft: 0 6px 16px rgba(0, 0, 0, 0.06);
    --esp-transition: 0.18s ease-in-out;
}

/* Reset ligero */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body.esp-body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--esp-bg);
    color: var(--esp-text-main);
}

/* Estructura general */
.esp-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER */
.esp-header {
    height: 64px;
    background: var(--esp-primary-dark);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    z-index: 20;
}

.esp-btn-toggle {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    margin-right: 1rem;
    cursor: pointer;
    display: none; /* se muestra en móvil */
}

.esp-header-brand {
    display: flex;
    align-items: center;
    flex: 1;
}

.esp-brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.esp-logo {
    height: 64px;
    margin-right: 0.75rem;
}

.esp-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.esp-brand-title {
    font-weight: 600;
    letter-spacing: 0.16em;
    font-size: 0.9rem;
}

.esp-brand-subtitle {
    font-size: 0.7rem;
    text-transform: uppercase;
    opacity: 0.85;
}

.esp-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.esp-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.esp-user-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.esp-user-role {
    font-size: 0.7rem;
    color: var(--esp-accent-soft);
}

/* Botones */
.esp-btn {
    border-radius: 999px;
    padding: 0.35rem 1rem;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--esp-transition);
}

.esp-btn-outline {
    background: transparent;
    color: #11eb23;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.esp-btn-outline:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* MAIN LAYOUT */
.esp-main {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* SIDEBAR */
.esp-sidebar {
    width: 240px;
    background: var(--esp-primary);
    color: #e3f2ef;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.12);
}

.esp-nav {
    flex: 1;
    overflow-y: auto;
}

.esp-nav-section + .esp-nav-section {
    margin-top: 1.5rem;
}

.esp-nav-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #b3d7cf;
    margin-bottom: 0.35rem;
    padding: 0 0.25rem;
}

.esp-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.esp-nav-list li {
    margin-bottom: 0.15rem;
}

.esp-nav-list a {
    display: block;
    padding: 0.45rem 0.6rem;
    border-radius: var(--esp-radius);
    text-decoration: none;
    font-size: 0.85rem;
    color: #e3f2ef;
    transition: var(--esp-transition);
}

.esp-nav-list a:hover {
    background: var(--esp-primary-light);
}

.esp-nav-list a.active {
    background: #ffffff;
    color: var(--esp-primary-dark);
}

/* CONTENIDO */
.esp-content {
    flex: 1;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.esp-content-header {
    margin-bottom: 0.75rem;
}

.esp-page-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.esp-page-subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: var(--esp-text-muted);
}

.esp-content-body {
    flex: 1;
    background: var(--esp-surface);
    border-radius: var(--esp-radius);
    box-shadow: var(--esp-shadow-soft);
    padding: 1rem 1.25rem;
    border: 1px solid var(--esp-border);
    overflow: auto;
}

/* Componentes: tarjetas y formularios */
.esp-card {
    background: var(--esp-surface);
    border: 1px solid var(--esp-border);
    border-radius: var(--esp-radius);
    box-shadow: var(--esp-shadow-soft);
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.esp-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.35rem;
}

.esp-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.esp-label {
    font-size: 0.9rem;
    color: var(--esp-text-main);
}

.esp-input {
    padding: 6px 8px;
    border: 1px solid var(--esp-border);
    border-radius: 6px;
    background: transparent;
    font-size: 0.95rem;
    min-height: 2.2rem;
    box-sizing: border-box;
}

.esp-alert {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
    display: block;
}

.esp-alert-danger {
    background: #fdecea;
    color: #8a1f1f;
    border: 1px solid #f5c6cb;
}

.esp-muted {
    color: var(--esp-text-muted);
    font-size: 0.95rem;
}

.table-responsive {
    overflow: auto;
}

.center-col { text-align: center; }

/* FOOTER */
.esp-footer {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--esp-text-muted);
    background: #ffffff;
    border-top: 1px solid var(--esp-border);
}

/* UTILIDADES */
.esp-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: var(--esp-accent-soft);
    color: var(--esp-primary-dark);
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .esp-btn-toggle {
        display: inline-block;
    }

    .esp-sidebar {
        position: fixed;
        top: 64px;
        left: -260px;
        height: calc(100vh - 64px);
        z-index: 30;
        transition: var(--esp-transition);
    }

    .esp-sidebar.esp-sidebar-open {
        left: 0;
    }

    .esp-main {
        flex-direction: column;
    }

    .esp-content {
        padding: 1rem;
    }
    .esp-flex {
        flex-direction: column;
    }
}