:root {
    --brand-900: #053663;
    --brand-700: #074983;
    --brand-500: #1b6aad;
    --brand-soft: #ddeff0;
    --bg-1: #031a31;
    --bg-2: #06406f;
    --text-main: #f5fbff;
    --text-soft: #cde2ee;
    --danger: #e5484d;
    --warning: #f8b84a;
    --orange: #ff8e3c;
    --success: #2fcf8b;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: 'Manrope', sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at 15% 20%, rgba(221, 239, 240, 0.2), transparent 35%),
        radial-gradient(circle at 85% 0%, rgba(27, 106, 173, 0.35), transparent 40%),
        linear-gradient(145deg, var(--bg-1), var(--bg-2));
    overflow-x: hidden;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    gap: 18px;
    padding: 18px;
}

.glass {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 18px;
}

.sidebar {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-block p {
    margin: 3px 0 0;
    font-size: 13px;
    color: var(--text-soft);
}

.brand-logo {
    width: 112px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
}

.nav-links {
    display: grid;
    gap: 8px;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.nav-links a.active {
    background: rgba(221, 239, 240, 0.16);
    border-color: rgba(221, 239, 240, 0.4);
}

.nav-badge {
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(145deg, #e5484d, #ae2f34);
    border: 1px solid rgba(255, 255, 255, 0.28);
    padding: 0 6px;
}

.logout-link {
    margin-top: auto;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    padding: 11px 14px;
    border-radius: 12px;
    background: rgba(229, 72, 77, 0.2);
    border: 1px solid rgba(229, 72, 77, 0.35);
    text-align: center;
}

.content-area {
    display: grid;
    align-content: start;
    gap: 14px;
}

.topbar {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.topbar-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-logo {
    width: 86px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.22));
}

.topbar h1 {
    margin: 0;
    font-size: 23px;
}

.topbar small {
    color: var(--text-soft);
}

.version-chip {
    display: inline-flex;
    margin-left: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(221, 239, 240, 0.16);
    border: 1px solid rgba(221, 239, 240, 0.38);
    color: #ecf7ff;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip strong {
    display: block;
}

.user-chip small {
    color: var(--text-soft);
}

.avatar-sm,
.avatar-fallback {
    width: 42px;
    height: 42px;
    border-radius: 999px;
}

.avatar-sm {
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.avatar-fallback {
    display: grid;
    place-items: center;
    font-weight: 800;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
}

.flash {
    border-radius: 14px;
    padding: 11px 14px;
    font-weight: 600;
}

.flash-success {
    background: rgba(47, 207, 139, 0.18);
    border: 1px solid rgba(47, 207, 139, 0.36);
}

.flash-error {
    background: rgba(229, 72, 77, 0.18);
    border: 1px solid rgba(229, 72, 77, 0.36);
}

.flash-info {
    background: rgba(221, 239, 240, 0.15);
    border: 1px solid rgba(221, 239, 240, 0.25);
}

.grid-2,
.grid-3,
.grid-4 {
    display: grid;
    gap: 14px;
}

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

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(7, 73, 131, 0.25);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.card h2,
.card h3 {
    margin: 0 0 12px;
}

.metric {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
}

.metric-label {
    color: var(--text-soft);
    font-size: 13px;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 14px;
    overflow: hidden;
}

th,
td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    vertical-align: top;
    font-size: 14px;
}

th {
    background: rgba(255, 255, 255, 0.08);
    font-weight: 700;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-red {
    background: rgba(229, 72, 77, 0.2);
    color: #ffd4d6;
    border: 1px solid rgba(229, 72, 77, 0.48);
}

.status-yellow {
    background: rgba(248, 184, 74, 0.2);
    color: #ffe7ba;
    border: 1px solid rgba(248, 184, 74, 0.5);
}

.status-orange {
    background: rgba(255, 142, 60, 0.2);
    color: #ffe1c9;
    border: 1px solid rgba(255, 142, 60, 0.5);
}

.status-green {
    background: rgba(47, 207, 139, 0.2);
    color: #ccffe8;
    border: 1px solid rgba(47, 207, 139, 0.46);
}

.controls,
.form-grid {
    display: grid;
    gap: 10px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: var(--text-soft);
}

input,
select,
textarea,
button {
    font-family: inherit;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
}

input,
select,
textarea {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

option {
    color: #0a1626;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

button,
.btn {
    background: linear-gradient(140deg, #0b68b7, #074983);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-muted {
    background: rgba(255, 255, 255, 0.12);
}

.btn-warning {
    background: linear-gradient(145deg, #d48e16, #ac6400);
}

.btn-danger {
    background: linear-gradient(145deg, #e5484d, #ae2f34);
}

.inline-form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 12px;
    background: rgba(221, 239, 240, 0.16);
    border: 1px solid rgba(221, 239, 240, 0.4);
}

.contact-actions {
    display: inline-flex;
    gap: 5px;
    margin-top: 6px;
    margin-bottom: 3px;
}

.contact-icon {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px;
    min-height: 24px;
    flex: 0 0 24px;
    padding: 0 !important;
    line-height: 0;
    overflow: hidden;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.28);
    text-decoration: none;
    transition: transform 120ms ease, opacity 120ms ease;
}

.contact-icon:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

.contact-icon svg {
    width: 11px !important;
    height: 11px !important;
    min-width: 11px;
    min-height: 11px;
    display: block;
    fill: #ffffff;
}

.contact-whatsapp {
    background: linear-gradient(145deg, #1fbf66, #11924b);
}

.contact-call {
    background: linear-gradient(145deg, #0b68b7, #074983);
}

.contact-mail {
    background: linear-gradient(145deg, #6f8da3, #456175);
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(460px, 100%);
    padding: 26px;
}

.login-logo {
    width: 165px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 10px;
    object-fit: contain;
}

.login-card h1 {
    margin: 0 0 8px;
    text-align: center;
}

.login-card p {
    margin: 0 0 18px;
    color: var(--text-soft);
    text-align: center;
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quick-links a {
    flex: 1;
    min-width: 180px;
}

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }

    .sidebar {
        order: 1;
        gap: 12px;
        padding: 14px;
        position: sticky;
        top: 8px;
        z-index: 15;
    }

    .content-area {
        order: 2;
    }

    .brand-block {
        justify-content: space-between;
    }

    .brand-logo {
        width: 96px;
    }

    .nav-links {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links a {
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .logout-link {
        margin-top: 0;
        align-self: flex-start;
    }

    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .app-shell {
        padding: 10px;
    }

    .sidebar {
        top: 6px;
        padding: 12px;
    }

    .topbar {
        flex-direction: row;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px;
    }

    .topbar-main {
        width: 100%;
    }

    .topbar-logo {
        width: 74px;
        margin-top: 2px;
    }

    .topbar h1 {
        font-size: 21px;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 12px;
    }

    .quick-links a {
        min-width: 100%;
    }

    .inline-form {
        display: flex;
        width: 100%;
    }

    .inline-form > * {
        max-width: 100%;
    }

    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    table tbody,
    table thead {
        white-space: nowrap;
    }

    input,
    select,
    textarea,
    button,
    .btn {
        font-size: 16px;
        min-height: 44px;
    }

    .contact-icon {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px;
        min-height: 30px;
        flex-basis: 30px;
    }

    .contact-icon svg {
        width: 13px !important;
        height: 13px !important;
    }

    th,
    td {
        font-size: 13px;
    }
}

@supports (padding-top: env(safe-area-inset-top)) {
    @media (max-width: 720px) {
        body {
            padding-top: env(safe-area-inset-top);
            padding-right: env(safe-area-inset-right);
            padding-bottom: env(safe-area-inset-bottom);
            padding-left: env(safe-area-inset-left);
        }
    }
}
