/* ==========================================================================
   Endurance · Sistema de diseño
   Bootstrap 5 actúa como base; este archivo define la identidad visual.
   ========================================================================== */

:root {
    /* Superficies */
    --hs-bg: #eef1f5;
    --hs-surface: #ffffff;
    --hs-surface-2: #f7f9fb;
    --hs-surface-3: #eef2f6;

    /* Texto */
    --hs-ink: #0f1b2d;
    --hs-ink-2: #334155;
    --hs-ink-muted: #64748b;
    --hs-ink-soft: #94a3b8;

    /* Marca: azul acero */
    --hs-brand: #1e3a5f;
    --hs-brand-600: #162c49;
    --hs-brand-700: #101f36;
    --hs-brand-soft: #e7eef7;
    --hs-brand-ink: #0d1b2e;

    /* Acento: ámbar soldadura */
    --hs-accent: #e07a1f;
    --hs-accent-600: #b85f12;
    --hs-accent-soft: #fdf0e2;

    /* Semánticos */
    --hs-success: #157f40;
    --hs-success-soft: #e5f4ea;
    --hs-warning: #a97b00;
    --hs-warning-soft: #fbf3d9;
    --hs-danger: #c2272d;
    --hs-danger-soft: #fbe7e8;
    --hs-info: #205ea6;
    --hs-info-soft: #e6eef9;

    /* Bordes, radios y sombras */
    --hs-border: #e1e7ef;
    --hs-border-strong: #cbd5e1;
    --hs-radius: 14px;
    --hs-radius-sm: 10px;
    --hs-radius-pill: 999px;
    --hs-shadow-xs: 0 1px 2px rgba(15, 27, 45, 0.05);
    --hs-shadow-sm: 0 2px 6px rgba(15, 27, 45, 0.06);
    --hs-shadow: 0 10px 30px rgba(15, 27, 45, 0.08);
    --hs-shadow-lg: 0 24px 60px rgba(15, 27, 45, 0.16);

    /* Tipografía */
    --hs-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    --hs-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
        "Liberation Mono", monospace;

    /* Layout */
    --hs-sidebar-w: 264px;
    --hs-topbar-h: 68px;

    /* Bootstrap overrides */
    --bs-primary: var(--hs-brand);
    --bs-primary-rgb: 30, 58, 95;
    --bs-body-font-family: var(--hs-font);
    --bs-body-color: var(--hs-ink);
    --bs-body-bg: var(--hs-bg);
    --bs-border-color: var(--hs-border);
    --bs-link-color: var(--hs-brand);
    --bs-link-hover-color: var(--hs-accent-600);
    --bs-border-radius: var(--hs-radius-sm);
    --bs-border-radius-lg: var(--hs-radius);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--hs-bg);
    color: var(--hs-ink);
    font-family: var(--hs-font);
    font-size: 0.9375rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--hs-ink);
    font-weight: 700;
    letter-spacing: -0.015em;
}

a {
    color: var(--hs-brand);
    text-decoration: none;
}

a:hover {
    color: var(--hs-accent-600);
}

code, kbd, samp, pre, .font-mono {
    font-family: var(--hs-font-mono);
    font-size: 0.85em;
}

::selection {
    background: var(--hs-brand);
    color: #fff;
}

:focus-visible {
    outline: 3px solid rgba(224, 122, 31, 0.45);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Layout general
   -------------------------------------------------------------------------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: var(--hs-sidebar-w);
    background: linear-gradient(180deg, #14273f 0%, #0d1b2e 100%);
    color: #c6d2e2;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.25s ease;
}

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--hs-topbar-h);
    padding: 0 1.25rem;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar__brand:hover {
    color: #fff;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 11px;
    background: linear-gradient(140deg, var(--hs-accent) 0%, #c45f0e 100%);
    box-shadow: 0 4px 14px rgba(224, 122, 31, 0.4);
}

.brand-logo svg {
    width: 22px;
    height: 22px;
}

.brand-name {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.1;
}

.brand-sub {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8fa3bd;
}

.app-sidebar__nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1rem 0.75rem 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.app-sidebar__nav::-webkit-scrollbar {
    width: 6px;
}

.app-sidebar__nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.nav-group {
    margin-bottom: 1.35rem;
}

.nav-group__title {
    padding: 0 0.75rem;
    margin-bottom: 0.4rem;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #7c90aa;
}

.nav-item-hs {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.15rem;
    border-radius: 9px;
    color: #c6d2e2;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item-hs svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    opacity: 0.85;
}

.nav-item-hs:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.nav-item-hs.active {
    background: rgba(224, 122, 31, 0.16);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--hs-accent);
}

.nav-item-hs.active svg {
    opacity: 1;
    color: var(--hs-accent);
}

.nav-item-hs .nav-count {
    margin-left: auto;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(224, 122, 31, 0.24);
    color: #ffd9b5;
    font-size: 0.7rem;
    font-weight: 700;
}

.app-sidebar__footer {
    padding: 0.9rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.16);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.7rem;
}

.user-chip__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    background: rgba(224, 122, 31, 0.2);
    color: #ffd9b5;
    font-size: 0.78rem;
    font-weight: 700;
}

.user-chip__meta {
    min-width: 0;
    line-height: 1.25;
}

.user-chip__name {
    display: block;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip__role {
    display: block;
    color: #8fa3bd;
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: var(--hs-sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: var(--hs-topbar-h);
    padding: 0.65rem 1.75rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--hs-border);
}

.topbar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--hs-border);
    border-radius: 10px;
    background: var(--hs-surface);
    color: var(--hs-ink);
}

.topbar-toggle svg {
    width: 20px;
    height: 20px;
}

.topbar-search {
    position: relative;
    flex: 1 1 420px;
    max-width: 460px;
}

.topbar-search svg {
    position: absolute;
    top: 50%;
    left: 0.85rem;
    width: 17px;
    height: 17px;
    transform: translateY(-50%);
    color: var(--hs-ink-soft);
    pointer-events: none;
}

.topbar-search input {
    width: 100%;
    height: 40px;
    padding: 0 0.9rem 0 2.5rem;
    border: 1px solid var(--hs-border);
    border-radius: var(--hs-radius-pill);
    background: var(--hs-surface-2);
    color: var(--hs-ink);
    font-size: 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--hs-brand);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.1);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: auto;
}

.topbar-company {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.7rem;
    border-radius: var(--hs-radius-pill);
    background: var(--hs-surface-2);
    border: 1px solid var(--hs-border);
    color: var(--hs-ink-2);
    font-size: 0.78rem;
    font-weight: 600;
}

.topbar-company svg {
    width: 15px;
    height: 15px;
    color: var(--hs-ink-muted);
}

.app-content {
    flex: 1 1 auto;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.75rem;
}

.app-footer {
    padding: 1rem 1.75rem 1.5rem;
    color: var(--hs-ink-soft);
    font-size: 0.75rem;
}

.app-footer .container-fluid {
    max-width: 1440px;
}

/* Overlay móvil */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(9, 18, 32, 0.5);
    backdrop-filter: blur(2px);
}

/* --------------------------------------------------------------------------
   Cabeceras de página
   -------------------------------------------------------------------------- */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header__eyebrow {
    margin: 0 0 0.3rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hs-accent-600);
}

.page-header h1 {
    margin: 0;
    font-size: 1.6rem;
    line-height: 1.2;
}

.page-header__subtitle {
    margin: 0.3rem 0 0;
    color: var(--hs-ink-muted);
    font-size: 0.9rem;
}

.page-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-hs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 0.75rem;
    padding: 0;
    list-style: none;
    font-size: 0.78rem;
    color: var(--hs-ink-soft);
}

.breadcrumb-hs li {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.breadcrumb-hs li + li::before {
    content: "/";
    color: var(--hs-border-strong);
}

.breadcrumb-hs a {
    color: var(--hs-ink-muted);
}

.breadcrumb-hs a:hover {
    color: var(--hs-accent-600);
}

/* --------------------------------------------------------------------------
   Tarjetas
   -------------------------------------------------------------------------- */

.card {
    border: 1px solid var(--hs-border);
    border-radius: var(--hs-radius);
    background: var(--hs-surface);
    box-shadow: var(--hs-shadow-xs);
}

.card.shadow-sm,
.card.shadow {
    box-shadow: var(--hs-shadow-sm) !important;
}

.card.border-0 {
    border: 1px solid var(--hs-border) !important;
}

.card-header {
    padding: 1rem 1.25rem;
    background: transparent;
    border-bottom: 1px solid var(--hs-border);
    font-weight: 700;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 0.9rem 1.25rem;
    background: var(--hs-surface-2);
    border-top: 1px solid var(--hs-border);
}

.hs-panel {
    border: 1px solid var(--hs-border);
    border-radius: var(--hs-radius);
    background: var(--hs-surface);
    box-shadow: var(--hs-shadow-xs);
    overflow: hidden;
}

.hs-panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--hs-border);
}

.hs-panel__head h2,
.hs-panel__head h3 {
    margin: 0;
    font-size: 1rem;
}

.hs-panel__body {
    padding: 1.25rem;
}

.hs-panel__body--flush {
    padding: 0;
}

/* --------------------------------------------------------------------------
   KPI cards
   -------------------------------------------------------------------------- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--hs-border);
    border-radius: var(--hs-radius);
    background: var(--hs-surface);
    box-shadow: var(--hs-shadow-xs);
    overflow: hidden;
}

.kpi::after {
    content: "";
    position: absolute;
    inset: 0 0 auto auto;
    width: 4px;
    height: 100%;
    background: transparent;
}

.kpi--brand::after { background: var(--hs-brand); }
.kpi--success::after { background: var(--hs-success); }
.kpi--warning::after { background: var(--hs-warning); }
.kpi--danger::after { background: var(--hs-danger); }
.kpi--accent::after { background: var(--hs-accent); }
.kpi--muted::after { background: var(--hs-ink-soft); }

.kpi__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.kpi__label {
    margin: 0;
    color: var(--hs-ink-muted);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.kpi__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--hs-surface-3);
    color: var(--hs-ink-muted);
}

.kpi__icon svg {
    width: 18px;
    height: 18px;
}

.kpi--brand .kpi__icon { background: var(--hs-brand-soft); color: var(--hs-brand); }
.kpi--success .kpi__icon { background: var(--hs-success-soft); color: var(--hs-success); }
.kpi--warning .kpi__icon { background: var(--hs-warning-soft); color: var(--hs-warning); }
.kpi--danger .kpi__icon { background: var(--hs-danger-soft); color: var(--hs-danger); }
.kpi--accent .kpi__icon { background: var(--hs-accent-soft); color: var(--hs-accent-600); }

.kpi__value {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--hs-ink);
}

.kpi__hint {
    margin: 0;
    color: var(--hs-ink-soft);
    font-size: 0.75rem;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75rem;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--hs-border);
    border-radius: var(--hs-radius-sm);
    background: var(--hs-surface);
    color: var(--hs-ink);
    font-size: 0.875rem;
    font-weight: 600;
    transition: border-color 0.15s ease, box-shadow 0.15s ease,
        transform 0.15s ease;
}

.quick-link:hover {
    color: var(--hs-brand);
    border-color: var(--hs-brand);
    box-shadow: var(--hs-shadow-sm);
    transform: translateY(-1px);
}

.quick-link__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
    background: var(--hs-brand-soft);
    color: var(--hs-brand);
}

.quick-link--accent .quick-link__icon {
    background: var(--hs-accent-soft);
    color: var(--hs-accent-600);
}

.quick-link__arrow {
    margin-left: auto;
    color: var(--hs-ink-soft);
}

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */

.btn {
    --bs-btn-font-size: 0.875rem;
    --bs-btn-font-weight: 600;
    --bs-btn-padding-y: 0.5rem;
    --bs-btn-padding-x: 0.95rem;
    --bs-btn-border-radius: var(--hs-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    line-height: 1.3;
    transition: background-color 0.15s ease, border-color 0.15s ease,
        color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.btn:active {
    transform: translateY(1px);
}

.btn-brand,
.btn-primary {
    --bs-btn-bg: var(--hs-brand);
    --bs-btn-border-color: var(--hs-brand);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--hs-brand-600);
    --bs-btn-hover-border-color: var(--hs-brand-600);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--hs-brand-700);
    --bs-btn-active-border-color: var(--hs-brand-700);
    --bs-btn-focus-shadow-rgb: 30, 58, 95;
}

.btn-accent {
    --bs-btn-bg: var(--hs-accent);
    --bs-btn-border-color: var(--hs-accent);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--hs-accent-600);
    --bs-btn-hover-border-color: var(--hs-accent-600);
    --bs-btn-hover-color: #fff;
}

.btn-outline-brand {
    --bs-btn-color: var(--hs-brand);
    --bs-btn-border-color: var(--hs-brand);
    --bs-btn-hover-bg: var(--hs-brand);
    --bs-btn-hover-border-color: var(--hs-brand);
    --bs-btn-hover-color: #fff;
}

.btn-outline-secondary {
    --bs-btn-color: var(--hs-ink-2);
    --bs-btn-border-color: var(--hs-border-strong);
    --bs-btn-hover-bg: var(--hs-surface-3);
    --bs-btn-hover-border-color: var(--hs-border-strong);
    --bs-btn-hover-color: var(--hs-ink);
}

.btn-outline-primary {
    --bs-btn-color: var(--hs-brand);
    --bs-btn-border-color: var(--hs-brand);
    --bs-btn-hover-bg: var(--hs-brand);
    --bs-btn-hover-border-color: var(--hs-brand);
    --bs-btn-hover-color: #fff;
}

.btn-outline-success {
    --bs-btn-color: var(--hs-success);
    --bs-btn-border-color: #9fd3b4;
    --bs-btn-hover-bg: var(--hs-success-soft);
    --bs-btn-hover-border-color: #7cc39a;
    --bs-btn-hover-color: #0f5c2e;
    --bs-btn-active-bg: #d7eddf;
    --bs-btn-active-color: #0f5c2e;
}

.btn-outline-warning {
    --bs-btn-color: #8a6200;
    --bs-btn-border-color: #e3c76b;
    --bs-btn-hover-bg: var(--hs-warning-soft);
    --bs-btn-hover-border-color: #d4b64f;
    --bs-btn-hover-color: #6d4d00;
    --bs-btn-active-bg: #f3e6b8;
    --bs-btn-active-color: #6d4d00;
}

.btn-outline-danger {
    --bs-btn-color: var(--hs-danger);
    --bs-btn-border-color: #e4a6a9;
    --bs-btn-hover-bg: var(--hs-danger-soft);
    --bs-btn-hover-border-color: #d98b8f;
    --bs-btn-hover-color: #8f1b20;
    --bs-btn-active-bg: #f7d7d9;
    --bs-btn-active-color: #8f1b20;
}

.btn-sm {
    --bs-btn-padding-y: 0.32rem;
    --bs-btn-padding-x: 0.65rem;
    --bs-btn-font-size: 0.78rem;
}

.btn-lg {
    --bs-btn-padding-y: 0.7rem;
    --bs-btn-padding-x: 1.25rem;
    --bs-btn-font-size: 0.95rem;
}

.btn-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--hs-ink-muted);
}

.btn-ghost:hover {
    background: var(--hs-surface-3);
    color: var(--hs-ink);
}

/* --------------------------------------------------------------------------
   Badges y estados
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3em 0.62em;
    border-radius: var(--hs-radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.text-bg-success { background-color: var(--hs-success-soft) !important; color: var(--hs-success) !important; }
.text-bg-warning { background-color: var(--hs-warning-soft) !important; color: var(--hs-warning) !important; }
.text-bg-danger { background-color: var(--hs-danger-soft) !important; color: var(--hs-danger) !important; }
.text-bg-info { background-color: var(--hs-info-soft) !important; color: var(--hs-info) !important; }
.text-bg-secondary { background-color: var(--hs-surface-3) !important; color: var(--hs-ink-muted) !important; }
.text-bg-light { background-color: var(--hs-surface-2) !important; color: var(--hs-ink-2) !important; }
.text-bg-primary { background-color: var(--hs-brand-soft) !important; color: var(--hs-brand) !important; }
.text-bg-dark { background-color: var(--hs-ink) !important; color: #fff !important; }

.badge-dot::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* --------------------------------------------------------------------------
   Tablas
   -------------------------------------------------------------------------- */

.table-responsive {
    border-radius: var(--hs-radius);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--hs-ink);
    --bs-table-border-color: var(--hs-border);
    margin-bottom: 0;
    font-size: 0.875rem;
    vertical-align: middle;
}

.table > thead th {
    padding: 0.7rem 1rem;
    background: var(--hs-surface-2) !important;
    border-bottom: 1px solid var(--hs-border);
    color: var(--hs-ink-muted) !important;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table > tbody > tr > td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--hs-border);
    vertical-align: middle;
}

.table > tbody > tr:last-child > td {
    border-bottom: 0;
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--hs-surface-2);
    --bs-table-accent-bg: var(--hs-surface-2);
}

.table > tbody > tr > td .btn-sm {
    padding: 0.25rem 0.55rem;
}

.table .code-chip {
    display: inline-block;
    padding: 0.18rem 0.5rem;
    border: 1px solid var(--hs-border);
    border-radius: 6px;
    background: var(--hs-surface-2);
    color: var(--hs-ink-2);
    font-family: var(--hs-font-mono);
    font-size: 0.76rem;
    font-weight: 600;
}

.table .row-title {
    font-weight: 600;
    color: var(--hs-ink);
}

.table .row-title:hover {
    color: var(--hs-accent-600);
}

.table-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   Formularios
   -------------------------------------------------------------------------- */

.form-label {
    margin-bottom: 0.35rem;
    color: var(--hs-ink-2);
    font-size: 0.8rem;
    font-weight: 600;
}

.form-text {
    color: var(--hs-ink-muted);
    font-size: 0.75rem;
}

.form-control,
.form-select {
    min-height: 42px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--hs-border-strong);
    border-radius: var(--hs-radius-sm);
    background-color: #fff;
    color: var(--hs-ink);
    font-size: 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--hs-brand);
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.1);
}

.form-control::placeholder {
    color: var(--hs-ink-soft);
}

.form-control:disabled,
.form-control[readonly] {
    background-color: var(--hs-surface-2);
    color: var(--hs-ink-muted);
}

.form-check-input:checked {
    background-color: var(--hs-brand);
    border-color: var(--hs-brand);
}

.form-check-input:focus {
    border-color: var(--hs-brand);
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.1);
}

.form-section {
    padding: 1.25rem;
    border: 1px solid var(--hs-border);
    border-radius: var(--hs-radius);
    background: var(--hs-surface);
    box-shadow: var(--hs-shadow-xs);
    margin-bottom: 1rem;
}

.form-section__head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--hs-border);
}

.form-section__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 50%;
    background: var(--hs-brand-soft);
    color: var(--hs-brand);
    font-size: 0.72rem;
    font-weight: 800;
}

.form-section__head h2 {
    margin: 0;
    font-size: 0.95rem;
}

.form-section__head p {
    margin: 0.1rem 0 0;
    color: var(--hs-ink-muted);
    font-size: 0.78rem;
}

.invalid-feedback,
.form-error {
    color: var(--hs-danger);
    font-size: 0.75rem;
}

.is-invalid {
    border-color: var(--hs-danger) !important;
}

/* --------------------------------------------------------------------------
   Alertas
   -------------------------------------------------------------------------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.85rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--hs-radius-sm);
    font-size: 0.875rem;
}

.alert svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin-top: 1px;
}

.alert-success { background: var(--hs-success-soft); border-color: #bfe3cb; color: #0f5c2e; }
.alert-warning { background: var(--hs-warning-soft); border-color: #ecd898; color: #7a5900; }
.alert-danger  { background: var(--hs-danger-soft); border-color: #f0c2c4; color: #8f1b20; }
.alert-info    { background: var(--hs-info-soft); border-color: #c3d7f0; color: #174a80; }
.alert-secondary { background: var(--hs-surface-2); border-color: var(--hs-border); color: var(--hs-ink-2); }

.alert-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-radius: var(--hs-radius);
    border: 1px solid #f0d49b;
    background: linear-gradient(90deg, #fff8e8 0%, #fdf0e2 100%);
    color: #7a4d00;
    margin-bottom: 1.25rem;
}

.alert-banner strong {
    color: #5f3b00;
}

/* --------------------------------------------------------------------------
   Estados vacíos
   -------------------------------------------------------------------------- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2.75rem 1.5rem;
    text-align: center;
}

.empty-state__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    margin-bottom: 0.35rem;
    border-radius: 16px;
    background: var(--hs-surface-3);
    color: var(--hs-ink-soft);
}

.empty-state__icon svg {
    width: 26px;
    height: 26px;
}

.empty-state h3 {
    margin: 0;
    font-size: 1rem;
}

.empty-state p {
    max-width: 360px;
    margin: 0;
    color: var(--hs-ink-muted);
    font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   Filtros y barra de herramientas
   -------------------------------------------------------------------------- */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--hs-border);
    background: var(--hs-surface);
}

.toolbar .form-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--hs-ink-muted);
}

.toolbar__search {
    flex: 1 1 260px;
    min-width: 220px;
}

.toolbar__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--hs-radius-pill);
    background: var(--hs-brand-soft);
    color: var(--hs-brand);
    font-size: 0.72rem;
    font-weight: 600;
}

.filter-chip a {
    color: inherit;
    opacity: 0.7;
}

.filter-chip a:hover {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Paginación
   -------------------------------------------------------------------------- */

.pagination {
    gap: 0.25rem;
}

.page-link {
    min-width: 36px;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--hs-border);
    border-radius: var(--hs-radius-sm) !important;
    color: var(--hs-ink-2);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.page-link:hover {
    background: var(--hs-surface-3);
    border-color: var(--hs-border-strong);
    color: var(--hs-ink);
}

.page-item.active .page-link {
    background: var(--hs-brand);
    border-color: var(--hs-brand);
    color: #fff;
}

.page-item.disabled .page-link {
    color: var(--hs-ink-soft);
    background: var(--hs-surface-2);
}

/* --------------------------------------------------------------------------
   Login / autenticación
   -------------------------------------------------------------------------- */

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-height: 100vh;
    background: var(--hs-surface);
}

.auth-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
    color: #dbe6f4;
    background:
        radial-gradient(circle at 15% 20%, rgba(224, 122, 31, 0.28) 0%, transparent 42%),
        radial-gradient(circle at 85% 80%, rgba(32, 94, 166, 0.35) 0%, transparent 45%),
        linear-gradient(160deg, #14273f 0%, #0d1b2e 100%);
    overflow: hidden;
}

.auth-aside::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}

.auth-aside > * {
    position: relative;
    z-index: 1;
}

.auth-aside__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
}

.auth-aside__brand:hover {
    color: #fff;
}

.auth-aside__title {
    max-width: 460px;
    margin: 2.5rem 0 1rem;
    font-size: 2.15rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: #fff;
}

.auth-aside__text {
    max-width: 440px;
    margin: 0;
    color: #a9bdd6;
    font-size: 0.95rem;
}

.auth-features {
    display: grid;
    gap: 0.9rem;
    margin: 2rem 0 0;
    padding: 0;
    list-style: none;
}

.auth-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    font-size: 0.875rem;
    color: #c6d2e2;
}

.auth-features svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin-top: 2px;
    color: var(--hs-accent);
}

.auth-aside__footer {
    color: #7c90aa;
    font-size: 0.75rem;
}

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    background: var(--hs-surface-2);
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-card__mobile-brand {
    display: none;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.75rem;
    color: var(--hs-ink);
    font-weight: 700;
}

.auth-card h1 {
    margin: 0;
    font-size: 1.55rem;
}

.auth-card__subtitle {
    margin: 0.35rem 0 1.75rem;
    color: var(--hs-ink-muted);
    font-size: 0.875rem;
}

.auth-card__help {
    margin-top: 1.25rem;
    color: var(--hs-ink-muted);
    font-size: 0.78rem;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Landing pública
   -------------------------------------------------------------------------- */

.landing {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 0%, rgba(224, 122, 31, 0.12) 0%, transparent 34%),
        radial-gradient(circle at 88% 8%, rgba(30, 58, 95, 0.1) 0%, transparent 36%),
        var(--hs-bg);
}

.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1160px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
}

.landing-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--hs-ink);
    font-size: 1.05rem;
    font-weight: 800;
}

.landing-brand:hover {
    color: var(--hs-ink);
}

.landing-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    align-items: center;
    gap: 3rem;
    max-width: 1160px;
    margin: 0 auto;
    padding: 3.5rem 1.5rem 4rem;
}

.landing-hero h1 {
    margin: 0 0 1rem;
    font-size: clamp(2rem, 4vw, 3.1rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.04em;
}

.landing-hero h1 span {
    color: var(--hs-accent-600);
}

.landing-hero p {
    max-width: 540px;
    margin: 0 0 1.75rem;
    color: var(--hs-ink-muted);
    font-size: 1.05rem;
}

.landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.landing-visual {
    position: relative;
    padding: 1.25rem;
    border: 1px solid var(--hs-border);
    border-radius: 20px;
    background: var(--hs-surface);
    box-shadow: var(--hs-shadow-lg);
}

.landing-visual__bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-bottom: 0.9rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid var(--hs-border);
}

.landing-visual__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--hs-border-strong);
}

.landing-visual__row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem;
    border-radius: 10px;
    background: var(--hs-surface-2);
    margin-bottom: 0.5rem;
}

.landing-visual__row strong {
    display: block;
    font-size: 0.82rem;
}

.landing-visual__row small {
    color: var(--hs-ink-muted);
    font-size: 0.72rem;
}

.landing-visual__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 9px;
    background: var(--hs-brand-soft);
    color: var(--hs-brand);
}

.landing-visual__icon svg {
    width: 17px;
    height: 17px;
}

.landing-section {
    max-width: 1160px;
    margin: 0 auto;
    padding: 1rem 1.5rem 4rem;
}

.landing-section h2 {
    margin: 0 0 0.4rem;
    font-size: 1.5rem;
}

.landing-section > p {
    margin: 0 0 1.75rem;
    color: var(--hs-ink-muted);
}

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

.feature-card {
    padding: 1.35rem;
    border: 1px solid var(--hs-border);
    border-radius: var(--hs-radius);
    background: var(--hs-surface);
    box-shadow: var(--hs-shadow-xs);
}

.feature-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 0.85rem;
    border-radius: 11px;
    background: var(--hs-accent-soft);
    color: var(--hs-accent-600);
}

.feature-card__icon svg {
    width: 20px;
    height: 20px;
}

.feature-card h3 {
    margin: 0 0 0.35rem;
    font-size: 0.98rem;
}

.feature-card p {
    margin: 0;
    color: var(--hs-ink-muted);
    font-size: 0.84rem;
}

.landing-footer {
    max-width: 1160px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem 2rem;
    border-top: 1px solid var(--hs-border);
    color: var(--hs-ink-soft);
    font-size: 0.78rem;
}

/* --------------------------------------------------------------------------
   Detalle / definiciones
   -------------------------------------------------------------------------- */

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

.detail-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--hs-border);
}

.detail-item:last-child {
    border-bottom: 0;
}

.detail-item dt {
    margin-bottom: 0.2rem;
    color: var(--hs-ink-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.detail-item dd {
    margin: 0;
    color: var(--hs-ink);
    font-size: 0.9rem;
    font-weight: 500;
    word-break: break-word;
}

.avatar-inicial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    background: var(--hs-brand-soft);
    color: var(--hs-brand);
    font-size: 0.78rem;
    font-weight: 700;
}

.avatar-grande {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--hs-brand-soft);
    color: var(--hs-brand);
    font-size: 2rem;
    font-weight: 700;
}

.timeline {
    position: relative;
    margin: 0;
    padding: 0 0 0 1.25rem;
    list-style: none;
    border-left: 2px solid var(--hs-border);
}

.timeline li {
    position: relative;
    padding: 0 0 1.15rem 0.5rem;
}

.timeline li::before {
    content: "";
    position: absolute;
    top: 0.35rem;
    left: -1.65rem;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--hs-brand);
    box-shadow: 0 0 0 3px var(--hs-brand-soft);
}

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

/* --------------------------------------------------------------------------
   Utilidades
   -------------------------------------------------------------------------- */

.icon {
    width: 1.05em;
    height: 1.05em;
    flex: 0 0 auto;
    vertical-align: -0.15em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.text-muted { color: var(--hs-ink-muted) !important; }
.text-brand { color: var(--hs-brand) !important; }
.text-accent { color: var(--hs-accent-600) !important; }
.bg-brand { background-color: var(--hs-brand) !important; }
.bg-surface { background-color: var(--hs-surface) !important; }
.bg-surface-2 { background-color: var(--hs-surface-2) !important; }
.border-hs { border-color: var(--hs-border) !important; }
.rounded-hs { border-radius: var(--hs-radius) !important; }
.shadow-hs { box-shadow: var(--hs-shadow) !important; }
.mono { font-family: var(--hs-font-mono); }
.fw-800 { font-weight: 800 !important; }
.small-muted { color: var(--hs-ink-muted); font-size: 0.8rem; }
.stack-sm { display: flex; flex-direction: column; gap: 0.5rem; }
.inline-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.divider { height: 1px; background: var(--hs-border); margin: 1rem 0; }

.code-block {
    padding: 1rem;
    border: 1px solid var(--hs-border);
    border-radius: var(--hs-radius-sm);
    background: var(--hs-surface-2);
    color: var(--hs-ink-2);
    font-family: var(--hs-font-mono);
    font-size: 0.76rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 420px;
    overflow: auto;
}

/* HTMX indicadores */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-flex;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hs-spin 0.7s linear infinite;
}

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

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1199.98px) {
    .app-content {
        padding: 1.35rem;
    }

    .app-topbar {
        padding: 0.6rem 1.35rem;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: var(--hs-shadow-lg);
    }

    body.nav-open .app-sidebar {
        transform: translateX(0);
    }

    body.nav-open .sidebar-backdrop {
        display: block;
    }

    .app-main {
        margin-left: 0;
    }

    .topbar-toggle {
        display: inline-flex;
    }

    .topbar-company {
        display: none;
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-aside {
        display: none;
    }

    .auth-card__mobile-brand {
        display: inline-flex;
    }

    .landing-hero {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding-top: 2rem;
    }

    .landing-visual {
        order: -1;
    }
}

/* Listados en formato tarjeta para móvil */
@media (max-width: 767.98px) {
    .table-cards thead {
        display: none;
    }

    .table-cards,
    .table-cards tbody,
    .table-cards tr,
    .table-cards td {
        display: block;
        width: 100%;
    }

    .table-cards tr {
        padding: 0.85rem 1rem;
        margin: 0 0 0.7rem;
        border: 1px solid var(--hs-border);
        border-radius: var(--hs-radius-sm);
        background: var(--hs-surface);
        box-shadow: var(--hs-shadow-xs);
    }

    .table-cards td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.3rem 0 !important;
        border: 0 !important;
        text-align: left !important;
    }

    .table-cards td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: var(--hs-ink-muted);
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    .table-cards td.card-hide {
        display: none;
    }

    .table-cards td.card-title-cell {
        display: block;
        padding: 0 0 0.5rem !important;
        margin-bottom: 0.4rem;
        border-bottom: 1px solid var(--hs-border) !important;
    }

    .table-cards td.card-title-cell::before {
        display: none;
    }

    .table-cards td.card-actions {
        justify-content: flex-end;
        padding-top: 0.6rem !important;
        margin-top: 0.4rem;
        border-top: 1px solid var(--hs-border) !important;
    }

    .table-cards td.card-actions::before {
        display: none;
    }

    .table-cards td.card-actions .table-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .table-responsive {
        overflow: visible;
    }
}

@media (max-width: 767.98px) {
    body {
        font-size: 0.9rem;
    }

    .app-topbar {
        padding: 0.5rem 1rem;
        gap: 0.6rem;
    }

    .app-content {
        padding: 1rem;
    }

    .app-footer {
        padding: 0.75rem 1rem 1.25rem;
    }

    .page-header {
        margin-bottom: 1rem;
    }

    .page-header h1 {
        font-size: 1.3rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
    }

    .kpi {
        padding: 0.85rem;
    }

    .kpi__value {
        font-size: 1.5rem;
    }

    .toolbar {
        padding: 0.85rem;
    }

    .toolbar__actions {
        width: 100%;
        margin-left: 0;
    }

    .toolbar__actions .btn {
        flex: 1 1 auto;
    }

    .table > thead th,
    .table > tbody > tr > td {
        padding: 0.6rem 0.7rem;
    }

    .card-body {
        padding: 1rem;
    }

    .auth-main {
        padding: 1.5rem 1rem;
    }

    .landing-nav {
        padding: 1rem;
    }

    .landing-hero {
        padding: 1.5rem 1rem 2.5rem;
    }

    .landing-section {
        padding: 1rem 1rem 2.5rem;
    }
}

@media (max-width: 575.98px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .page-header__actions {
        width: 100%;
    }

    .page-header__actions .btn {
        flex: 1 1 auto;
    }
}

/* Accesibilidad: reducir movimiento */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Impresión */
@media print {
    .app-sidebar,
    .app-topbar,
    .app-footer,
    .page-header__actions,
    .toolbar {
        display: none !important;
    }

    .app-main {
        margin-left: 0;
    }

    body {
        background: #fff;
    }
}
