html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

:root {
    --gcs-blue: #005b84;
    --gcs-blue-dark: #00486a;
    --gcs-blue-light: #eaf4f9;
    --gcs-text: #12384d;
    --gcs-border: #d7e3ea;
    --gcs-sidebar: #ffffff;
    --gcs-bg: #f5f8fb;
    --gcs-muted: #667a88;
    --gcs-input-border: #cfd9df;
}

body {
    margin: 0;
    background-color: var(--gcs-bg);
    color: var(--gcs-text);
    font-family: Arial, Helvetica, sans-serif;
}

/* =========================
   FOCUS GENERAL
   ========================= */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 91, 132, 0.15);
}

/* =========================
   LINKS GENERALES
   ========================= */
a {
    color: var(--gcs-blue);
}

a:hover {
    color: var(--gcs-blue-dark);
}

/* =========================
   FORM FLOATING (PLANTILLA)
   ========================= */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* =========================
   BOTONES INSTITUCIONALES
   ========================= */
.btn-gcs-primary {
    background-color: var(--gcs-blue);
    border-color: var(--gcs-blue);
    color: #fff;
    font-weight: 600;
    padding: 0.65rem 1rem;
}

.btn-gcs-primary:hover,
.btn-gcs-primary:focus,
.btn-gcs-primary:active {
    background-color: var(--gcs-blue-dark) !important;
    border-color: var(--gcs-blue-dark) !important;
    color: #fff !important;
}

.btn-outline-secondary {
    color: var(--gcs-blue);
    border-color: var(--gcs-blue);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active {
    background-color: var(--gcs-blue);
    border-color: var(--gcs-blue);
    color: #fff;
}

/* =========================
   LOGIN / AUTH
   ========================= */
.login-page {
    min-height: calc(100vh - 180px);
    align-items: center;
}

.login-card {
    border-radius: 18px;
    background-color: #ffffff;
}

.login-logo {
    max-width: 260px;
    height: auto;
}

.login-title {
    color: var(--gcs-blue);
    font-weight: 700;
}

.login-subtitle {
    color: #5f7280;
    font-size: 0.95rem;
}

.login-label {
    color: var(--gcs-text);
    font-weight: 600;
}

.login-input {
    border-radius: 10px;
    border: 1px solid var(--gcs-input-border);
    min-height: 46px;
}

.login-input:focus {
    border-color: var(--gcs-blue);
    box-shadow: 0 0 0 0.2rem rgba(0, 91, 132, 0.15);
}

.login-link {
    color: var(--gcs-blue);
    font-weight: 500;
    text-decoration: none;
}

.login-link:hover {
    color: var(--gcs-blue-dark);
    text-decoration: underline;
}

/* =========================
   LAYOUT PRINCIPAL
   ========================= */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 270px;
    background-color: var(--gcs-sidebar);
    border-right: 1px solid var(--gcs-border);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gcs-border);
}

.sidebar-logo {
    width: 54px;
    height: auto;
    object-fit: contain;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gcs-blue);
    line-height: 1.2;
}

.sidebar-subtitle {
    font-size: 0.85rem;
    color: var(--gcs-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-link,
.sidebar-sublink,
.sidebar-toggle {
    display: block;
    width: 100%;
    text-align: left;
    text-decoration: none;
    border: 0;
    background: transparent;
    color: var(--gcs-text);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.sidebar-link:hover,
.sidebar-sublink:hover,
.sidebar-toggle:hover {
    background-color: var(--gcs-blue-light);
    color: var(--gcs-blue-dark);
}

.sidebar-link.active,
.sidebar-sublink.active {
    background-color: var(--gcs-blue-light);
    color: var(--gcs-blue);
    font-weight: 700;
}

.sidebar-menu-group {
    display: flex;
    flex-direction: column;
}

.sidebar-submenu {
    margin-top: 0.25rem;
    margin-left: 0.5rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--gcs-border);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-sublink {
    font-size: 0.95rem;
    padding: 0.6rem 0.8rem;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    background-color: #ffffff;
    border-bottom: 1px solid var(--gcs-border);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.app-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gcs-blue);
}

.app-welcome {
    color: var(--gcs-muted);
    font-size: 0.95rem;
}

.app-content {
    padding: 1.5rem;
}

/* =========================
   TABLAS Y TARJETAS
   ========================= */
.card {
    border-radius: 14px;
}

.table thead th {
    color: var(--gcs-blue-dark);
    font-weight: 700;
    border-bottom-width: 1px;
}

.table td,
.table th {
    vertical-align: middle;
}

/* =========================
   FOOTER SIMPLE
   ========================= */
.footer {
    font-size: 0.9rem;
    color: var(--gcs-muted);
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 991.98px) {
    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--gcs-border);
    }

    .app-topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

.sidebar-link,
.sidebar-sublink,
.sidebar-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    text-decoration: none;
    border: 0;
    background: transparent;
    color: var(--gcs-text);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.sidebar-link:hover,
.sidebar-sublink:hover,
.sidebar-toggle:hover {
    background-color: var(--gcs-blue-light);
    color: var(--gcs-blue-dark);
}

.sidebar-link.active,
.sidebar-sublink.active,
.sidebar-toggle.active {
    background-color: var(--gcs-blue-light);
    color: var(--gcs-blue);
    font-weight: 700;
}

.sidebar-toggle {
    justify-content: space-between;
}

.sidebar-toggle::after {
    content: "▾";
    font-size: 0.9rem;
    transition: transform 0.2s ease-in-out;
}

.sidebar-toggle.collapsed::after {
    transform: rotate(-90deg);
}

.sidebar-submenu {
    margin-top: 0.25rem;
    margin-left: 0.5rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--gcs-border);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-sublink {
    font-size: 0.95rem;
    padding: 0.6rem 0.8rem;
}

.sidebar-link i,
.sidebar-sublink i {
    font-size: 1rem;
    min-width: 18px;
}

.sidebar-link,
.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.sidebar-toggle > span {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.permission-check {
    padding: 0.35rem 0;
}

.permission-check .form-check-label {
    cursor: pointer;
}

.permission-matrix-table {
    table-layout: fixed;
    background-color: #ffffff;
}

.permission-matrix-table th,
.permission-matrix-table td {
    padding: 0.65rem 0.75rem;
    vertical-align: middle;
}

.permission-matrix-table thead th {
    background-color: #f5f8fb;
    color: var(--gcs-blue-dark);
    font-weight: 700;
    text-align: center;
}

.permission-matrix-title {
    text-align: left !important;
    min-width: 180px;
    width: 180px;
}

.permission-row-header {
    background-color: #fbfcfd;
    color: var(--gcs-text);
    font-weight: 700;
    white-space: nowrap;
}

.permission-matrix-table tbody tr:hover {
    background-color: #f9fcfe;
}

.permission-matrix-check {
    transform: scale(1.15);
    cursor: pointer;
}

.permission-matrix-check:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 91, 132, 0.15);
}

.password-toggle-btn {
    min-width: 46px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.password-toggle-btn i {
    pointer-events: none;
}

.report-filter-dropdown {
    position: relative;
}

.report-filter-button {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--gcs-input-border);
    border-radius: 10px;
    background-color: #fff;
    color: var(--gcs-text);
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
}

.report-filter-button:hover,
.report-filter-button:focus {
    border-color: var(--gcs-blue);
    box-shadow: 0 0 0 0.2rem rgba(0, 91, 132, 0.15);
}

.report-filter-button-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-filter-menu {
    width: 100%;
    min-width: 320px;
    max-height: 320px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--gcs-border);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    padding: 0;
}

.report-filter-menu-header {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--gcs-border);
    background-color: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.report-filter-menu-body {
    max-height: 240px;
    overflow-y: auto;
    padding: 0.5rem 0.75rem 0.75rem 0.75rem;
    background-color: #fff;
}

.report-filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
}

.report-filter-option label {
    margin: 0;
    cursor: pointer;
    width: 100%;
}

.report-filter-empty {
    color: #6c757d;
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

/* =========================
   HOME / DASHBOARD
========================= */
.home-dashboard {
    padding-top: 0.25rem;
}

.home-hero {
    border-radius: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f4f9fc 100%);
    overflow: hidden;
}

.home-hero-badge {
    display: inline-flex;
    align-items: center;
    background-color: rgba(0, 91, 132, 0.10);
    color: var(--gcs-blue);
    border: 1px solid rgba(0, 91, 132, 0.15);
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
}

.home-hero-title {
    color: var(--gcs-blue);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.15;
    margin: 0;
}

.home-hero-subtitle {
    color: #516674;
    font-size: 1rem;
    max-width: 760px;
}

.home-hero-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    background-color: #fff;
    border: 1px solid #d9e6ee;
    color: var(--gcs-text);
    font-size: 0.92rem;
    font-weight: 500;
}

.home-hero-logo-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 150px;
}

.home-hero-logo {
    max-width: 260px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.home-hero-icon-fallback {
    width: 110px;
    height: 110px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--gcs-blue), var(--gcs-blue-dark));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    box-shadow: 0 10px 30px rgba(0, 91, 132, 0.20);
}

.home-section-icon {
    color: var(--gcs-blue);
    font-size: 1.1rem;
}

.home-section-title {
    color: var(--gcs-blue);
    font-weight: 700;
}

.home-stat-card {
    border-radius: 18px;
}

.home-stat-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.home-stat-label {
    color: #5c6f7c;
    font-size: 0.9rem;
    margin-bottom: 0.45rem;
}

.home-stat-value {
    color: #102a3a;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.home-stat-footer {
    margin-top: 1rem;
    color: #637887;
    font-size: 0.9rem;
}

.home-stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.home-stat-icon.icon-sitios {
    background-color: rgba(13, 110, 253, 0.10);
    color: #0d6efd;
}

.home-stat-icon.icon-empleados {
    background-color: rgba(25, 135, 84, 0.10);
    color: #198754;
}

.home-stat-icon.icon-ingresos {
    background-color: rgba(255, 193, 7, 0.15);
    color: #d39e00;
}

.home-stat-icon.icon-usuarios {
    background-color: rgba(13, 202, 240, 0.15);
    color: #0dcaf0;
}

.home-table thead th {
    color: var(--gcs-blue);
    font-weight: 700;
    border-bottom-width: 1px;
}

.home-empty-icon {
    font-size: 3rem;
    color: var(--gcs-blue);
}

@media (max-width: 992px) {
    .home-hero-title {
        font-size: 1.6rem;
    }

    .home-hero-logo {
        max-width: 220px;
    }
}

@media (max-width: 576px) {
    .home-hero-title {
        font-size: 1.35rem;
    }

    .home-stat-value {
        font-size: 1.6rem;
    }
}