:root {
    --navy-950: #061a3c;
    --navy-900: #08224f;
    --navy-800: #0a2d64;
    --blue: #0d6efd;
    --blue-600: #075ef0;
    --blue-100: #eaf2ff;
    --green: #18b764;
    --red: #ef4444;
    --orange: #ff8a00;
    --text: #07183d;
    --muted: #607091;
    --border: #dbe4f0;
    --surface: #ffffff;
    --body: #f7faff;
    --shadow: 0 12px 30px rgba(20, 40, 90, .08);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--body);
}

a {
    text-decoration: none;
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 324px;
    display: flex;
    flex-direction: column;
    padding: 28px 16px 24px;
    color: #fff;
    background:
        radial-gradient(circle at 20% 12%, rgba(35, 122, 255, .18), transparent 34%),
        linear-gradient(160deg, #061936 0%, #082a5c 52%, #031634 100%);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, .08);
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 8px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-icon {
    display: grid;
    width: 70px;
    height: 70px;
    place-items: center;
    font-size: 40px;
    color: #fff;
}

.brand h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
}

.brand p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, .72);
    font-size: 16px;
}

.sidebar-nav {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 22px;
    min-height: 58px;
    padding: 0 24px;
    color: rgba(255, 255, 255, .92);
    border-radius: 7px;
    font-size: 16px;
    font-weight: 500;
}

.sidebar-nav .nav-link i {
    width: 24px;
    text-align: center;
    font-size: 22px;
}

.sidebar-nav .nav-link.active,
.sidebar-nav .nav-link:hover {
    color: #fff;
    background: linear-gradient(135deg, #1477ff 0%, #075af0 100%);
    box-shadow: 0 12px 24px rgba(6, 100, 242, .28);
}

.sidebar-card {
    margin-top: auto;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 10px;
    background: rgba(9, 46, 97, .55);
    box-shadow: 0 18px 38px rgba(0, 0, 0, .18);
}

.sidebar-card-title {
    margin: 0 0 18px;
    font-size: 16px;
    font-weight: 700;
}

.next-calibration {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.next-calibration strong {
    display: block;
    margin-bottom: 10px;
    color: #21c673;
    font-size: 16px;
}

.next-calibration span {
    color: #fff;
}

.mini-icon {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    font-size: 22px;
}

.mini-icon.warning {
    color: #ffd400;
}

.sidebar-card-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 26px;
    color: #3aa0ff;
    font-size: 16px;
}

.main-content {
    flex: 1;
    min-width: 0;
    margin-left: 324px;
}

.topbar {
    height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 36px;
    background: rgba(255, 255, 255, .84);
    border-bottom: 1px solid #edf1f7;
    backdrop-filter: blur(16px);
}

.icon-button,
.notification-btn {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    color: #06183d;
    border: 0;
    border-radius: 50%;
    background: transparent;
}

.icon-button {
    font-size: 22px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.notification-btn {
    position: relative;
    font-size: 20px;
}

.notification-btn span {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    border-radius: 50%;
    background: #ef5350;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text);
    font-weight: 500;
}

.avatar {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    border-radius: 50%;
    background: #0d4fb6;
    box-shadow: 0 8px 18px rgba(13, 79, 182, .2);
}

.page-content {
    padding: 26px 22px 38px;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    padding: 0 18px;
}

.page-heading h2 {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
}

.page-heading p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 16px;
}

.main-action {
    min-width: 212px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 3px;
    font-weight: 700;
    border-radius: 7px;
    background: linear-gradient(135deg, #0f74ff, #075eef);
    box-shadow: 0 12px 24px rgba(13, 110, 253, .22);
}

.dashboard-card {
    height: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    box-shadow: var(--shadow);
}

.kpi-row {
    margin-bottom: 18px;
}

.kpi-card {
    min-height: 198px;
    padding: 30px;
}

.kpi-main {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.kpi-icon {
    width: 78px;
    height: 78px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 78px;
    border-radius: 18px;
    font-size: 38px;
    line-height: 1;
    text-align: center;
    overflow: hidden;
}

.kpi-icon i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    line-height: 1;
    font-size: 38px;
}

.kpi-icon.blue {
    color: #126dff;
    background: #e8f0ff;
}

.kpi-icon.green {
    color: #10b75c;
    background: #dbf4e4;
}

.kpi-icon.purple {
    color: #7a3cff;
    background: #eadcff;
}

.kpi-icon.yellow {
    color: #ff9900;
    background: #fff0c9;
}

.kpi-main p {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
}

.kpi-main strong {
    display: block;
    color: var(--text);
    font-size: 34px;
    line-height: 1;
}

.kpi-main span {
    display: block;
    margin-top: 12px;
    color: #425679;
    font-size: 15px;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 34px;
    color: var(--muted);
    font-size: 14px;
}

.kpi-trend span {
    font-weight: 800;
}

.kpi-trend.up {
    color: var(--green);
}

.kpi-trend.down {
    color: var(--red);
}

.kpi-trend.warning-text {
    color: var(--orange);
}

.kpi-trend small {
    color: #425679;
    font-size: 14px;
}

.chart-card {
    min-height: 378px;
    padding: 22px 28px 28px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.card-head h3 {
    margin: 0;
    color: var(--text);
    font-size: 19px;
    font-weight: 800;
}

.filter-btn {
    min-width: 142px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    color: var(--text);
    border: 1px solid #d5dfed;
    border-radius: 7px;
    background: #fff;
}

.chart-wrapper {
    position: relative;
    height: 262px;
    margin-top: 10px;
}

.table-card {
    margin-top: 18px;
    padding: 24px 28px 18px;
}

.table {
    color: #365074;
    font-size: 14px;
}

.table thead th {
    padding: 24px 0 16px;
    color: #526485;
    border-bottom-color: #dce5f1;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.table tbody td {
    padding: 13px 0;
    border-bottom-color: #e7edf5;
    white-space: nowrap;
}

.status-pill,
.due-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    height: 28px;
    padding: 0 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
}

.status-pill.accepted {
    color: #049a4c;
    background: #d9f2df;
}

.status-pill.conditional {
    color: #f28a00;
    background: #fff1d5;
}

.status-pill.pending {
    color: #f28a00;
    background: #fff1d5;
}

.status-pill.inactive {
    color: #667085;
    background: #edf1f7;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    color: #0066ff;
    border: 0;
    border-radius: 50%;
    background: #eef4ff;
}

.action-btn.danger {
    color: #dc3545;
    background: #fff0f0;
}

.action-btn.success {
    color: #10a657;
    background: #e6f8ed;
}

.card-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 18px;
    color: #006bff;
    font-weight: 600;
}

.right-card {
    padding: 24px 28px;
}

.due-list {
    display: grid;
    gap: 21px;
    margin-top: 28px;
}

.due-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px;
}

.due-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    color: #006cff;
    border-radius: 50%;
    background: #e9f2ff;
    border: 1px solid #d6e7ff;
}

.due-body strong,
.due-body span {
    display: block;
}

.due-body strong {
    margin-bottom: 3px;
    font-size: 15px;
}

.due-body span {
    color: #526485;
    font-size: 13px;
}

.due-date {
    color: #3c5277;
    font-size: 14px;
    white-space: nowrap;
}

.due-badge {
    min-width: 76px;
}

.due-badge.red {
    color: #f15b2a;
    background: #ffe3d6;
}

.due-badge.orange {
    color: #ff6b00;
    background: #ffe3d6;
}

.due-badge.amber {
    color: #ff8a00;
    background: #fff0cf;
}

.due-badge.green {
    color: #12a657;
    background: #d5f4df;
}

.quick-card {
    margin-top: 18px;
}

.quick-list {
    display: grid;
    margin-top: 18px;
}

.quick-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    color: #40577a;
    border-bottom: 1px solid #e2e9f3;
}

.quick-list a:last-child {
    border-bottom: 0;
}

.quick-list span {
    display: inline-flex;
    align-items: center;
    gap: 18px;
}

.quick-list i {
    color: #006bff;
}

.user-stat-card {
    min-height: 150px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 26px;
}

.user-stat-card p,
.user-stat-card strong,
.user-stat-card span {
    display: block;
}

.user-stat-card p {
    margin: 0 0 7px;
    font-weight: 800;
}

.user-stat-card strong {
    color: var(--text);
    font-size: 32px;
    line-height: 1;
}

.user-stat-card span {
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
}

.users-card {
    padding: 26px 28px 20px;
}

.users-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 10px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 260px;
}

.search-box i {
    position: absolute;
    top: 50%;
    left: 16px;
    color: #7890b2;
    transform: translateY(-50%);
}

.search-box .form-control {
    height: 46px;
    padding-left: 44px;
    border-color: #d5dfed;
    border-radius: 7px;
}

.toolbar-filters {
    display: flex;
    gap: 12px;
}

.toolbar-filters .form-select {
    width: 180px;
    height: 46px;
    border-color: #d5dfed;
    border-radius: 7px;
}

.users-table tbody td {
    padding-top: 16px;
    padding-bottom: 16px;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-cell strong,
.user-cell span {
    display: block;
}

.user-cell strong {
    margin-bottom: 4px;
    color: var(--text);
    font-size: 15px;
}

.user-cell span {
    color: var(--muted);
    font-size: 13px;
}

.avatar.small {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    font-size: 13px;
}

.green-avatar {
    background: #099a50;
}

.orange-avatar {
    background: #df7b08;
}

.gray-avatar {
    background: #65728a;
}

.red-avatar {
    background: #c33d4d;
}

.role-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 98px;
    height: 30px;
    padding: 0 13px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
}

.role-pill.admin {
    color: #075ef0;
    background: #e8f0ff;
}

.role-pill.supervisor {
    color: #049a4c;
    background: #d9f2df;
}

.role-pill.tecnico {
    color: #f28a00;
    background: #fff1d5;
}

.role-pill.consulta {
    color: #667085;
    background: #edf1f7;
}

.users-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 18px;
    color: var(--muted);
    font-size: 14px;
}

.pagination .page-link {
    color: #0d5ee8;
    border-color: #d8e2ef;
}

.pagination .active .page-link {
    color: #fff;
    background: #0d6efd;
    border-color: #0d6efd;
}

.app-modal {
    border: 0;
    border-radius: 10px;
    box-shadow: 0 30px 70px rgba(8, 34, 79, .22);
}

.app-modal .modal-header,
.app-modal .modal-footer {
    padding: 22px 26px;
    border-color: #e4ebf5;
}

.app-modal .modal-body {
    padding: 24px 26px;
}

.app-modal .modal-title {
    font-weight: 800;
}

.app-modal .modal-header p {
    margin: 5px 0 0;
    color: var(--muted);
}

.app-modal .form-label {
    color: var(--text);
    font-weight: 700;
}

.app-modal .form-control,
.app-modal .form-select {
    min-height: 44px;
    border-color: #d5dfed;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
    border: 1px solid #d5dfed;
    border-radius: 8px;
    background: #f8fbff;
}

.permissions-grid label {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #40577a;
    font-weight: 600;
}

@media (max-width: 1399px) {
    .due-item {
        grid-template-columns: 48px minmax(0, 1fr) auto;
    }

    .due-badge {
        grid-column: 2 / 4;
        justify-self: start;
    }
}

@media (max-width: 1199px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .page-content {
        padding-inline: 18px;
    }
}

@media (max-width: 767px) {
    .topbar {
        height: 68px;
        padding: 0 16px;
    }

    .user-menu span {
        display: none;
    }

    .page-heading {
        flex-direction: column;
        padding: 0;
    }

    .main-action {
        width: 100%;
    }

    .kpi-card,
    .chart-card,
    .table-card,
    .right-card {
        padding: 20px;
    }

    .due-item {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .due-date,
    .due-badge {
        grid-column: 2;
    }

    .users-toolbar,
    .users-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar-filters {
        flex-direction: column;
    }

    .toolbar-filters .form-select,
    .search-box {
        width: 100%;
    }

    .permissions-grid {
        grid-template-columns: 1fr;
    }
}
