:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 82px;
    --slate-dark: #071426;
    --slate-header: #0b1b33;
    --slate-soft: #13274c;
    --primary: #0b63b6;
    --primary-dark: #084d8e;
    --accent: #38bdf8;
    --bg-light: #f1f5f9;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #dbe3ef;
    --text: #172033;
    --muted: #64748b;
    --success: #15803d;
    --warning: #a16207;
    --danger: #b91c1c;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-light);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    overflow-x: hidden;
}

#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    background: var(--slate-dark);
    color: #ffffff;
    overflow-x: hidden;
    overflow-y: auto;
    transition: width 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

#sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 16px;
    transition: padding 0.25s ease;
    background: var(--slate-header);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-system-card {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    text-decoration: none;
    transition: padding 0.25s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.sidebar-system-card:hover,
.sidebar-system-card:focus-visible {
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(255, 255, 255, 0.075);
    color: inherit;
}

.sidebar-system-copy {
    min-width: 0;
}

.sidebar-system-icon,
.brand-icon,
.info-card-icon,
.module-icon,
.patient-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.sidebar-system-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent);
    font-size: 1.1rem;
}

.sidebar-system-title {
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.sidebar-system-subtitle {
    margin-top: 3px;
    color: #94a3b8;
    font-size: 0.68rem;
}

.sidebar-menu {
    flex: 1;
    padding-bottom: 18px;
}

.menu-category {
    margin-top: 15px;
    padding: 10px 25px;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 1.1px;
    text-transform: uppercase;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 22px;
    border-left: 4px solid transparent;
    color: #cbd5e1;
    font-size: 0.88rem;
    text-decoration: none;
    transition: padding 0.25s ease, background-color 0.2s ease, color 0.2s ease;
}

.menu-item i {
    width: 20px;
    color: #94a3b8;
    font-size: 1.05rem;
    text-align: center;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.menu-item.active {
    border-left-color: var(--accent);
    background: var(--slate-header);
    color: var(--accent);
    font-weight: 700;
}

.menu-item.active i {
    color: var(--accent);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    padding: 15px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: #64748b;
    font-size: 0.72rem;
    transition: padding 0.25s ease;
}

.sidebar-footer-icon {
    display: none;
    color: #94a3b8;
    font-size: 1rem;
}

#sidebar.collapsed .sidebar-header {
    padding: 14px 10px;
}

#sidebar.collapsed .sidebar-system-card {
    justify-content: center;
    margin: 0;
    padding: 8px 5px;
    border-color: transparent;
    background: transparent;
}

#sidebar.collapsed .sidebar-system-copy,
#sidebar.collapsed .menu-category,
#sidebar.collapsed .menu-label,
#sidebar.collapsed .sidebar-version {
    display: none;
}

#sidebar.collapsed .menu-item {
    justify-content: center;
    min-height: 50px;
    padding: 10px 0;
    border-left-width: 3px;
}

#sidebar.collapsed .menu-item i {
    width: auto;
    font-size: 1.15rem;
}

#sidebar.collapsed .sidebar-footer {
    justify-content: center;
    padding: 14px 8px;
}

#sidebar.collapsed .sidebar-footer-icon {
    display: inline-block;
}

#content {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: width 0.25s ease, margin-left 0.25s ease;
}

#content.sidebar-compact {
    width: calc(100% - var(--sidebar-collapsed-width));
    margin-left: var(--sidebar-collapsed-width);
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 1050;
    display: grid;
    grid-template-columns: minmax(250px, 1fr) minmax(260px, auto) minmax(250px, 1fr);
    align-items: center;
    min-height: 82px;
    padding: 0 22px;
    border-bottom: 3px solid #04151d;
    background: var(--slate-dark);
    color: #ffffff;
}

.header-government {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.btn-menu {
    flex: 0 0 auto;
    color: #ffffff;
}

.btn-menu:hover,
.btn-menu:focus {
    color: var(--accent);
}

.header-government-logo {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 5px 0;
    border-radius: 8px;
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.header-government-logo:hover,
.header-government-logo:focus-visible {
    opacity: 0.9;
    transform: translateY(-1px);
}

.header-government-logo img {
    display: block;
    width: 190px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.header-title {
    min-width: 0;
    padding: 0 18px;
    text-align: center;
}

.screen-title {
    overflow: hidden;
    color: #ffffff;
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.screen-subtitle {
    overflow: hidden;
    margin-top: 3px;
    color: #c8d5e8;
    font-size: 0.93rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-application {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent);
    font-size: 1.1rem;
}

.brand-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
    line-height: 1.1;
    text-align: left;
}

.brand-title {
    overflow: hidden;
    color: #ffffff;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.55px;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.brand-subtitle {
    overflow: hidden;
    margin-top: 3px;
    color: #94a3b8;
    font-size: 0.66rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.main-container {
    width: 100%;
    max-width: 1760px;
    margin: 0 auto;
    padding: 28px;
}

.page-intro,
.filters-card,
.data-card,
.info-card,
.patient-summary {
    border: 1px solid rgba(219, 227, 239, 0.9);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.055);
}

.page-intro {
    padding: 26px 28px;
}

.page-intro h1,
.section-heading h1,
.content-section-title h2 {
    margin: 3px 0 7px;
    color: #13274c;
    font-weight: 800;
}

.page-intro h1,
.section-heading h1 {
    font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.page-intro p,
.section-heading p {
    max-width: 900px;
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.65;
}

.section-kicker,
.module-label {
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.module-card {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 15px;
    min-height: 215px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.module-card:hover {
    transform: translateY(-3px);
    border-color: #9dc5ec;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
}

.module-icon {
    width: 50px;
    height: 50px;
    border-radius: 13px;
    background: #e7f2fc;
    color: var(--primary);
    font-size: 1.35rem;
}

.module-content h2 {
    margin: 5px 0 8px;
    color: #13274c;
    font-size: 1.05rem;
    font-weight: 800;
}

.module-content p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.module-action {
    position: absolute;
    right: 24px;
    bottom: 20px;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 800;
}

.info-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
}

.info-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 1.15rem;
}

.info-card h2 {
    margin: 0 0 4px;
    color: #13274c;
    font-size: 0.96rem;
    font-weight: 800;
}

.info-card p {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.5;
}

.filters-card,
.data-card {
    padding: 22px;
}

.filters-card-inner {
    padding: 17px;
    border-radius: 12px;
    background: var(--surface-soft);
    box-shadow: none;
}

.section-heading,
.content-section-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.section-heading p {
    font-size: 0.86rem;
}

.record-counter {
    margin: 4px 0 0;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 700;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 29px;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-loading {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-success {
    background: #dcfce7;
    color: #166534;
}

.status-warning {
    border: 1px solid #eadca8;
    background: #fff8dc;
    color: #7a5d12;
}

.status-danger {
    background: #fee2e2;
    color: #991b1b;
}

.status-neutral {
    background: #e2e8f0;
    color: #475569;
}

.form-label {
    margin-bottom: 7px;
    color: #334155;
    font-size: 0.79rem;
    font-weight: 700;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 44px;
    border-color: #cfd9e7;
    font-size: 0.88rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #74a8df;
    box-shadow: 0 0 0 0.2rem rgba(11, 99, 182, 0.12);
}

.btn-primary {
    border-color: var(--primary);
    background: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--primary-dark);
    background: var(--primary-dark);
}

.table-responsive-custom {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
}

.table-moderna {
    width: 100%;
    color: #334155;
    font-size: 0.82rem;
}

.table-moderna thead th {
    padding: 13px 14px;
    border-bottom: 1px solid #cbd8e8;
    background: #e9f1fb;
    color: #173253;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.45px;
    text-transform: uppercase;
    white-space: nowrap;
}

.table-moderna tbody td {
    padding: 12px 14px;
    border-color: #e5ebf3;
    vertical-align: middle;
}

.table-moderna tbody tr:nth-child(even) td {
    background: #fbfdff;
}

.table-moderna tbody tr:hover td {
    background: #eef6ff;
}


.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    color: var(--muted);
    font-size: 0.78rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-controls label {
    font-weight: 600;
}

.pagination-controls .form-select {
    width: 74px;
    min-height: 31px;
}

.pagination-numbers {
    display: inline-flex;
    gap: 4px;
}

.pagination-number {
    min-width: 31px;
    height: 31px;
    padding: 0 8px;
    border: 1px solid #c6d9ef;
    border-radius: 7px;
    background: #ffffff;
    color: #1d4f81;
    font-size: 0.75rem;
    font-weight: 700;
}

.pagination-number:hover,
.pagination-number.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    padding: 0 3px;
    color: var(--muted);
}

.empty-state {
    margin: 16px 0 0;
    padding: 18px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--muted);
    text-align: center;
    font-size: 0.86rem;
}

.position-badge {
    display: inline-block;
    max-width: 210px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.3;
    white-space: normal;
}

.position-success {
    background: #dcfce7;
    color: #166534;
}

.position-danger {
    background: #fee2e2;
    color: #991b1b;
}

.position-warning {
    background: #fef3c7;
    color: #854d0e;
}

.position-neutral {
    background: #e2e8f0;
    color: #475569;
}

.filter-dropdown {
    width: 100%;
    min-width: 280px;
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 8px;
    border-radius: 7px;
    color: #334155;
    font-size: 0.78rem;
    cursor: pointer;
}

.dropdown-check:hover {
    background: #eef6ff;
}

.min-w-170 { min-width: 170px; }
.min-w-180 { min-width: 180px; }
.min-w-190 { min-width: 190px; }
.min-w-260 { min-width: 260px; }
.min-w-320 { min-width: 320px; }

.patient-summary {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    padding: 22px;
}

.patient-avatar {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: #e7f2fc;
    color: var(--primary);
    font-size: 1.4rem;
}

.patient-main span,
.patient-total span,
.appointment-grid span,
.appointment-medicines > span {
    display: block;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.patient-main h2 {
    margin: 3px 0;
    color: #13274c;
    font-size: 1.16rem;
    font-weight: 800;
}

.patient-main p {
    margin: 0;
    color: var(--muted);
    font-size: 0.83rem;
}

.patient-total {
    min-width: 165px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #f1f7fd;
    text-align: center;
}

.patient-total strong {
    display: block;
    margin-top: 3px;
    color: var(--primary);
    font-size: 1.55rem;
    font-weight: 800;
}

.content-section-title h2 {
    font-size: 1.12rem;
}

.appointment-list {
    display: grid;
    gap: 14px;
}

.appointment-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.appointment-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e5ebf3;
}

.appointment-protocol {
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.appointment-card h3 {
    margin: 4px 0 0;
    color: #13274c;
    font-size: 1rem;
    font-weight: 800;
}

.appointment-status {
    max-width: 240px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.7rem;
    font-weight: 800;
    text-align: center;
}

.appointment-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.appointment-grid > div {
    padding: 11px;
    border-radius: 9px;
    background: var(--surface-soft);
}

.appointment-grid strong {
    display: block;
    margin-top: 4px;
    color: #334155;
    font-size: 0.8rem;
}

.appointment-medicines {
    margin-top: 15px;
}

.medicine-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
}

.medicine-tags span {
    padding: 5px 9px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1e40af;
    font-size: 0.73rem;
    font-weight: 700;
}

.sidebar-overlay {
    display: none;
}

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

    .module-card {
        min-height: 170px;
    }

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

@media (max-width: 992px) {
    #sidebar,
    #sidebar.collapsed {
        width: var(--sidebar-width);
        transform: translateX(calc(var(--sidebar-width) * -1));
        box-shadow: 12px 0 32px rgba(15, 23, 42, 0.25);
    }

    #sidebar.mobile-open {
        transform: translateX(0);
    }

    #sidebar.collapsed .sidebar-header {
        padding: 18px;
    }

    #sidebar.collapsed .sidebar-system-card {
        justify-content: flex-start;
        margin: 0;
        padding: 12px;
        border-color: rgba(148, 163, 184, 0.16);
        background: rgba(255, 255, 255, 0.04);
    }

    #sidebar.collapsed .sidebar-system-copy,
    #sidebar.collapsed .menu-category,
    #sidebar.collapsed .menu-label,
    #sidebar.collapsed .sidebar-version {
        display: block;
    }

    #sidebar.collapsed .menu-item {
        justify-content: flex-start;
        min-height: 44px;
        padding: 10px 22px;
        border-left-width: 4px;
    }

    #sidebar.collapsed .menu-item i {
        width: 20px;
        font-size: 1.05rem;
    }

    #sidebar.collapsed .sidebar-footer {
        justify-content: space-between;
        padding: 15px 22px;
    }

    #sidebar.collapsed .sidebar-footer-icon {
        display: none;
    }

    #content,
    #content.sidebar-compact {
        width: 100%;
        margin-left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 1090;
        display: block;
        visibility: hidden;
        background: rgba(2, 8, 23, 0.55);
        opacity: 0;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    .sidebar-overlay.show {
        visibility: visible;
        opacity: 1;
    }

    body.sidebar-mobile-open {
        overflow: hidden;
    }

    .app-header {
        grid-template-columns: minmax(190px, auto) minmax(0, 1fr);
        min-height: 76px;
        padding: 0 16px;
    }

    .header-government {
        gap: 10px;
    }

    .header-government-logo img {
        width: 160px;
    }

    .header-title {
        padding: 0 0 0 16px;
        text-align: right;
    }

    .header-application {
        display: none;
    }

    .main-container {
        padding: 20px;
    }

    .pagination-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .pagination-controls {
        justify-content: flex-start;
    }
}

@media (max-width: 680px) {
    .app-header {
        grid-template-columns: minmax(150px, auto) minmax(0, 1fr);
        min-height: 68px;
        padding: 0 11px;
    }

    .header-government {
        gap: 7px;
    }

    .header-government-logo img {
        width: 126px;
    }

    .header-title {
        padding-left: 8px;
    }

    .screen-title {
        font-size: 0.78rem;
        letter-spacing: 0.65px;
    }

    .screen-subtitle {
        display: none;
    }

    .main-container {
        padding: 14px;
    }

    .page-intro,
    .filters-card,
    .data-card {
        padding: 17px;
    }

    .section-heading,
    .content-section-title,
    .appointment-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .module-card {
        grid-template-columns: 1fr;
        min-height: 235px;
    }

    .patient-summary {
        grid-template-columns: auto 1fr;
    }

    .patient-total {
        grid-column: 1 / -1;
        width: 100%;
    }

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

    .pagination-controls {
        width: 100%;
    }

    .pagination-numbers {
        order: 4;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 430px) {
    .app-header {
        grid-template-columns: minmax(134px, auto) minmax(0, 1fr);
    }

    .header-government-logo img {
        width: 112px;
    }

    .screen-title {
        font-size: 0.7rem;
        letter-spacing: 0.4px;
    }
}

/* Atualização individual das unidades */
.unit-updates-panel {
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid #d7e3f1;
    border-radius: 14px;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.unit-updates-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.unit-updates-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.unit-updates-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: #e4f0fc;
    color: var(--primary);
    font-size: 1.05rem;
}

.unit-updates-heading h2 {
    margin: 0;
    color: #173253;
    font-size: 0.92rem;
    font-weight: 800;
}

.unit-updates-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 0.76rem;
}

.unit-updates-count {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e9f1fb;
    color: #1d4f81;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.unit-updates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 9px;
    max-height: 250px;
    padding: 2px 4px 2px 2px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #b8cbe1 transparent;
}

.unit-update-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #dce6f1;
    border-radius: 11px;
    background: #ffffff;
    color: inherit;
    text-align: left;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.unit-update-card:hover,
.unit-update-card:focus-visible {
    border-color: #8db8e3;
    box-shadow: 0 6px 16px rgba(23, 50, 83, 0.09);
    transform: translateY(-1px);
    outline: none;
}

.unit-update-card.is-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 99, 182, 0.11);
}

.unit-update-card.is-latest {
    border-color: #b8dfc4;
    background: #fbfffc;
}

.unit-update-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.unit-update-copy strong {
    overflow: hidden;
    color: #233b59;
    font-size: 0.78rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unit-update-copy > span {
    color: #64748b;
    font-size: 0.71rem;
    font-weight: 600;
}

.unit-update-indicator {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    color: #7a8da5;
    font-size: 0.68rem;
    font-weight: 800;
    white-space: nowrap;
}

.unit-update-card.is-latest .unit-update-indicator {
    color: #16803d;
}

.unit-updates-empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 16px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: var(--muted);
    text-align: center;
    font-size: 0.8rem;
}

@media (max-width: 767.98px) {
    .unit-updates-heading {
        align-items: flex-start;
    }

    .unit-updates-heading p {
        display: none;
    }

    .unit-updates-grid {
        grid-template-columns: 1fr;
        max-height: 230px;
    }

    .unit-update-card {
        padding: 10px 11px;
    }
}

/* Layout superior sem menu lateral */
.topnav-layout #content,
.topnav-layout #content.sidebar-compact {
    width: 100%;
    margin-left: 0;
}

.government-navbar {
    position: sticky;
    top: 0;
    z-index: 1080;
    border-bottom: 3px solid #04151d;
    background: var(--slate-dark);
    color: #ffffff;
}

.government-navbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    max-width: 1760px;
    min-height: 78px;
    margin: 0 auto;
    padding: 0 28px;
}

.government-brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 5px 0;
    text-decoration: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.government-brand:hover,
.government-brand:focus-visible {
    opacity: 0.9;
    transform: translateY(-1px);
}

.government-brand img {
    display: block;
    width: 205px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.government-nav {
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.government-nav-link,
.government-mobile-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid transparent;
    color: #cbd5e1;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.government-nav-link {
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 10px;
}

.government-nav-link:hover,
.government-nav-link:focus-visible,
.government-mobile-link:hover,
.government-mobile-link:focus-visible {
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.government-nav-link.active,
.government-mobile-link.active {
    border-color: rgba(56, 189, 248, 0.28);
    background: rgba(56, 189, 248, 0.12);
    color: #7dd3fc;
}

.government-nav-link i,
.government-mobile-link i {
    font-size: 1rem;
}

.government-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
    font-size: 1.45rem;
}

.government-mobile-nav {
    max-width: 1760px;
    margin: 0 auto;
    padding: 0 16px 13px;
}

.government-mobile-link {
    width: 100%;
    min-height: 44px;
    margin-top: 5px;
    padding: 10px 12px;
    border-radius: 9px;
}

.section-heading-compact {
    margin-bottom: 14px;
}

/* Faixa compacta de atualização das unidades */
.unit-updates-compact {
    margin-bottom: 14px;
    padding: 11px 12px 10px;
    border: 1px solid #d9e4f0;
    border-radius: 12px;
    background: #f8fbff;
}

.unit-updates-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
}

.unit-updates-summary-copy {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.unit-updates-summary-copy > i {
    color: var(--primary);
    font-size: 1rem;
}

.unit-updates-summary h2 {
    margin: 0;
    color: #173253;
    font-size: 0.82rem;
    font-weight: 800;
}

.unit-updates-summary p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.68rem;
}


.unit-update-card.is-outdated {
    border-color: #eadca8;
    background: #fffdf5;
}

.unit-update-card.is-outdated .unit-update-indicator {
    color: #8a6a13;
}

.unit-update-card.is-outdated:hover,
.unit-update-card.is-outdated:focus-visible {
    border-color: #d9c26f;
}


/* Comparativo por medicamento e unidade */
.stock-table-wrapper {
    /* A página continua responsável pela rolagem vertical. Neste contêiner,
       somente as colunas das unidades se deslocam horizontalmente. */
    position: relative;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: #b8cbe1 transparent;
}

.matrix-table {
    min-width: max-content;
    border-collapse: separate;
    border-spacing: 0;
}

.matrix-table thead th {
    /* O cabeçalho acompanha a rolagem vertical da página. */
    position: static;
}

/* Primeira coluna congelada durante a rolagem horizontal. A regra mais
   específica no cabeçalho evita que "position: static" anule o sticky. */
.matrix-table thead th.matrix-product-column,
.matrix-table tbody td.matrix-product-cell {
    position: sticky;
    left: 0;
    background-clip: padding-box;
}

.matrix-product-column,
.matrix-product-cell {
    width: 280px;
    min-width: 280px;
    max-width: 360px;
}

.matrix-table thead th.matrix-product-column {
    z-index: 8;
    background: #e9f1fb;
    box-shadow: none;
}

.matrix-table tbody td.matrix-product-cell {
    z-index: 4;
    background: #ffffff;
    box-shadow: none;
}

.matrix-product-column,
.matrix-product-cell {
    border-right: none !important;
}

.matrix-table tbody tr:nth-child(even) td.matrix-product-cell {
    background: #fbfdff;
}

.matrix-table tbody tr:hover td.matrix-product-cell {
    background: #eef6ff;
}

.matrix-unit-column {
    min-width: 145px;
    max-width: 180px;
    white-space: normal !important;
    line-height: 1.25;
}

.matrix-quantity {
    color: #334155;
    font-weight: 700;
}

.matrix-empty-cell {
    color: #a5b2c2;
}


@media (max-width: 991.98px) {
    .government-navbar-main {
        min-height: 70px;
        padding: 0 18px;
    }

    .government-brand img {
        width: 175px;
    }

    .main-container {
        padding: 20px;
    }

}

@media (max-width: 680px) {
    .government-navbar-main {
        min-height: 64px;
        padding: 0 13px;
    }

    .government-brand img {
        width: 142px;
    }

    .main-container {
        padding: 13px;
    }

    .unit-updates-summary p {
        display: none;
    }


    .matrix-product-column,
    .matrix-product-cell {
        width: 190px;
        min-width: 190px;
        max-width: 190px;
    }

    .matrix-product-cell {
        font-size: 0.78rem;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .matrix-unit-column {
        min-width: 128px;
        max-width: 142px;
    }
}


/* Disponibilidade RioFarmes: matriz única e separação entre disponíveis e faltas */
.unit-updates-grid-readable {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.unit-update-card.readable {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 78px;
    padding: 14px 15px;
    border: 1px solid rgba(255, 214, 102, 0.35);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
    cursor: default;
}

.unit-update-card.readable:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.unit-update-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 214, 102, 0.16);
    color: #ffe08a;
    font-size: 1rem;
    border: 1px solid rgba(255, 214, 102, 0.22);
}

.unit-update-card.readable .unit-update-copy strong {
    color: #f8fbff;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.3;
    white-space: normal;
}

.unit-update-card.readable .unit-update-copy > span {
    color: #d7e6ff;
    font-size: 0.76rem;
    font-weight: 600;
}

.unit-update-card.readable.is-latest {
    border-color: rgba(110, 231, 183, 0.38);
    background: rgba(110, 231, 183, 0.08);
}

.unit-update-card.readable.is-latest .unit-update-card-icon {
    background: rgba(110, 231, 183, 0.16);
    color: #b9f5d4;
    border-color: rgba(110, 231, 183, 0.24);
}

.unit-update-card.readable.is-outdated {
    border-color: rgba(255, 214, 102, 0.38);
    background: rgba(255, 214, 102, 0.08);
}

.unit-update-card.readable.is-outdated .unit-update-card-icon {
    background: rgba(255, 214, 102, 0.16);
    color: #ffe08a;
    border-color: rgba(255, 214, 102, 0.24);
}

.availability-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e1e8f1;
}

.availability-mode-switch {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 5px;
    padding: 4px;
    border: 1px solid #d4dfec;
    border-radius: 11px;
    background: #ffffff;
}

.availability-mode-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #5b6b7e;
    font-size: 0.75rem;
    font-weight: 750;
    transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.availability-mode-button:hover,
.availability-mode-button:focus-visible {
    color: var(--primary);
    outline: none;
}

.availability-mode-button.active {
    background: #e8f2fc;
    color: #0b5fae;
    box-shadow: inset 0 0 0 1px #c9dff4;
}

.availability-mode-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.66rem;
    font-weight: 800;
}

.availability-mode-button.active .availability-mode-count {
    background: #ffffff;
    color: #0b5fae;
}

.availability-filter-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    text-align: right;
}

.availability-filter-copy strong {
    color: #173253;
    font-size: 0.8rem;
    font-weight: 800;
}

.availability-filter-copy span {
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.4;
}

/* Zero é uma informação da matriz, não um alerta visual. */
.matrix-quantity.is-zero {
    color: #64748b;
    font-weight: 650;
}

@media (max-width: 900px) {
    .availability-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .availability-filter-copy {
        text-align: left;
    }
}

@media (max-width: 680px) {
    .unit-updates-grid-readable {
        grid-template-columns: 1fr;
    }

    .unit-update-card.readable {
        min-height: 64px;
    }

    .availability-mode-switch {
        width: 100%;
    }

    .availability-mode-button {
        flex: 1;
        padding-inline: 8px;
    }
}

/* Disponibilidade RioFarmes: cabeçalho e filtros compactos */
.stock-page-card {
    padding: 20px 22px 22px;
}

.stock-heading-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.95fr) minmax(620px, 1.35fr);
    align-items: stretch;
    gap: 22px;
    margin-bottom: 12px;
}

.stock-heading-copy {
    min-width: 0;
    align-self: center;
}

.stock-heading-copy h1 {
    margin: 3px 0 7px;
    color: #13274c;
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    font-weight: 800;
}

.unit-updates-inline {
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid #d9e4f0;
    border-radius: 12px;
    background: #f8fbff;
}

.unit-updates-inline-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.unit-updates-inline-heading h2 {
    margin: 0;
    color: #173253;
    font-size: 0.76rem;
    font-weight: 800;
}

.unit-updates-inline-heading p {
    margin: 1px 0 0;
    color: var(--muted);
    font-size: 0.63rem;
}

.unit-updates-inline-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.unit-updates-inline-grid .unit-update-card.readable {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    min-height: 54px;
    padding: 8px 9px;
    border-radius: 9px;
}

.unit-updates-inline-grid .unit-update-card-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 0.84rem;
}

.unit-updates-inline-grid .unit-update-copy {
    gap: 2px;
}

.unit-updates-inline-grid .unit-update-copy strong {
    font-size: 0.67rem;
    line-height: 1.2;
}

.unit-updates-inline-grid .unit-update-copy > span {
    font-size: 0.62rem;
    line-height: 1.2;
}

.stock-controls-card {
    display: grid;
    grid-template-columns: auto minmax(360px, 1fr);
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: var(--surface-soft);
}

.stock-search-controls {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 180px;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.stock-search-input,
.stock-search-input .form-control,
.stock-search-input .input-group-text,
.stock-clear-button {
    min-height: 40px;
}

.stock-search-input .form-control,
.stock-search-input .input-group-text {
    font-size: 0.84rem;
}

.stock-clear-button {
    white-space: nowrap;
}

/* Mantém a primeira coluna fixa sem criar a marca vertical destacada. */
.matrix-table thead th.matrix-product-column,
.matrix-table tbody td.matrix-product-cell {
    border-right: 0 !important;
    box-shadow: none !important;
}

@media (max-width: 1350px) {
    .stock-heading-layout {
        grid-template-columns: minmax(330px, 0.8fr) minmax(560px, 1.2fr);
        gap: 16px;
    }

    .unit-updates-inline-grid .unit-update-copy strong {
        font-size: 0.64rem;
    }
}

@media (max-width: 1100px) {
    .stock-heading-layout {
        grid-template-columns: 1fr;
    }

    .unit-updates-inline-grid {
        grid-template-columns: repeat(3, minmax(210px, 1fr));
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .stock-controls-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .stock-page-card {
        padding: 15px;
    }

    .stock-heading-layout {
        gap: 12px;
        margin-bottom: 10px;
    }

    .unit-updates-inline {
        padding: 9px;
    }

    .unit-updates-inline-heading p {
        display: none;
    }

    .unit-updates-inline-grid {
        display: flex;
        gap: 8px;
        padding-bottom: 2px;
        overflow-x: auto;
        scroll-snap-type: x proximity;
    }

    .unit-updates-inline-grid .unit-update-card.readable {
        flex: 0 0 235px;
        min-height: 58px;
        scroll-snap-align: start;
    }

    .stock-controls-card {
        gap: 10px;
        margin-bottom: 10px;
        padding: 9px;
    }

    .stock-search-controls {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stock-clear-button {
        width: 100%;
    }
}

/* Disponibilidade RioFarmes: tabela única com sinalização discreta de estoque zerado */
.stock-controls-card-single {
    grid-template-columns: minmax(0, 1fr);
}

.stock-controls-card-single .stock-search-controls {
    width: 100%;
}

.matrix-zero-cell {
    background: #fff8f8 !important;
}

.matrix-quantity.is-zero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 2px 7px;
    border: 1px solid #efd2d2;
    border-radius: 999px;
    background: #fceeee;
    color: #984b4b;
    font-weight: 700;
}

.table-moderna tbody tr.stock-unavailable-row td,
.table-moderna tbody tr.stock-unavailable-row:nth-child(even) td {
    border-color: #f0dddd;
    background: #fffafa;
}

.table-moderna tbody tr.stock-unavailable-row:hover td {
    background: #fff5f5;
}

.table-moderna tbody tr.stock-unavailable-row td.matrix-product-cell,
.table-moderna tbody tr.stock-unavailable-row:nth-child(even) td.matrix-product-cell,
.table-moderna tbody tr.stock-unavailable-row:hover td.matrix-product-cell {
    background: #fffafa;
}

/* ========================================================================== */
/* Layout operacional com cabeçalho institucional fixo e menu lateral         */
/* ========================================================================== */
:root {
    --app-topbar-height: 78px;
    --app-sidebar-width: 304px;
    --app-sidebar-compact-width: 92px;
}

.dashboard-layout {
    padding-top: var(--app-topbar-height);
    background: #edf3f8;
}

.app-topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 1300;
    height: var(--app-topbar-height);
    border-bottom: 3px solid #04151d;
    background: var(--slate-dark);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(2, 8, 23, 0.14);
}

.app-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    height: 100%;
    padding: 0 24px;
}

.app-topbar-brand-group,
.app-topbar-context {
    display: flex;
    align-items: center;
}

.app-topbar-brand-group {
    gap: 16px;
    min-width: 0;
}

.app-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 43px;
    height: 43px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.045);
    color: #ffffff;
    font-size: 1.24rem;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.app-sidebar-toggle:hover,
.app-sidebar-toggle:focus-visible {
    border-color: rgba(56, 189, 248, 0.5);
    background: rgba(56, 189, 248, 0.1);
    color: #7dd3fc;
    outline: none;
}

.app-government-brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 4px 0;
    text-decoration: none;
}

.app-government-brand img {
    display: block;
    width: 205px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.app-topbar-context {
    justify-content: flex-end;
    gap: 9px;
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.35px;
    text-transform: uppercase;
}

.app-topbar-context i {
    color: var(--accent);
    font-size: 1rem;
}

.app-sidebar {
    position: fixed;
    inset: var(--app-topbar-height) auto 0 0;
    z-index: 1200;
    display: flex;
    width: var(--app-sidebar-width);
    flex-direction: column;
    border-right: 1px solid #d4deea;
    background: #ffffff;
    box-shadow: 8px 0 24px rgba(15, 23, 42, 0.055);
    transition: width 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}

.app-sidebar-scroll {
    flex: 1;
    min-height: 0;
    padding: 18px 14px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #bdcada transparent;
}

.app-sidebar-nav {
    display: grid;
    gap: 7px;
}

.app-sidebar-label {
    margin: 0 10px 5px;
    color: #8090a4;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.app-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #425269;
    text-decoration: none;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.app-sidebar-link:hover,
.app-sidebar-link:focus-visible {
    border-color: #d5e1ee;
    background: #f6f9fc;
    color: #173253;
    outline: none;
}

.app-sidebar-link.active {
    border-color: #bcd8f2;
    background: #eaf4fd;
    color: #0b5fae;
}

.app-sidebar-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #edf3f8;
    color: #60758d;
    font-size: 1rem;
}

.app-sidebar-link.active .app-sidebar-link-icon {
    background: #d9ecfb;
    color: #0b63b6;
}

.app-sidebar-link-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.app-sidebar-link-copy strong {
    overflow: hidden;
    font-size: 0.79rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar-link-copy small {
    overflow: hidden;
    color: #7d8da1;
    font-size: 0.66rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar-section {
    margin-top: 18px;
    padding-top: 17px;
    border-top: 1px solid #e2e8f0;
}

.app-sidebar-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin: 0 5px 10px;
}

.app-sidebar-section-kicker {
    display: block;
    margin-bottom: 2px;
    color: var(--primary);
    font-size: 0.61rem;
    font-weight: 800;
    letter-spacing: 0.85px;
    text-transform: uppercase;
}

.app-sidebar-section-heading h2 {
    margin: 0;
    color: #243b58;
    font-size: 0.78rem;
    font-weight: 800;
}

.app-sidebar-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 27px;
    height: 25px;
    padding: 0 7px;
    border-radius: 999px;
    background: #eaf2fb;
    color: #1b5a96;
    font-size: 0.65rem;
    font-weight: 800;
}

.sidebar-unit-list {
    display: grid;
    gap: 8px;
}

.sidebar-unit-list .unit-update-card.readable {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 62px;
    padding: 9px 10px;
    border-radius: 10px;
    cursor: default;
    box-shadow: none;
}

.sidebar-unit-list .unit-update-card.readable:hover {
    transform: none;
    box-shadow: none;
}

.sidebar-unit-list .unit-update-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 0.9rem;
}

.sidebar-unit-list .unit-update-copy {
    gap: 3px;
}

.sidebar-unit-list .unit-update-copy strong {
    overflow: visible;
    color: #233b59;
    font-size: 0.7rem;
    line-height: 1.25;
    text-overflow: clip;
    white-space: normal;
}

.sidebar-unit-list .unit-update-copy > span {
    color: #64748b;
    font-size: 0.63rem;
    font-weight: 650;
    line-height: 1.25;
}

.unit-update-compact-date {
    display: none;
}

.sidebar-ceaf-card {
    padding: 12px;
    border: 1px solid #dbe4ef;
    border-radius: 11px;
    background: #f8fbff;
}

.sidebar-ceaf-card .status-badge {
    width: 100%;
}

.sidebar-ceaf-card p {
    margin: 9px 0 0;
    color: #65758a;
    font-size: 0.69rem;
    font-weight: 650;
    line-height: 1.4;
    text-align: center;
}

.app-sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 18px;
    border-top: 1px solid #e2e8f0;
    color: #8a98aa;
    font-size: 0.66rem;
    font-weight: 700;
}

.app-sidebar-footer i {
    color: #61758c;
}

.dashboard-layout #content.app-content {
    width: auto;
    min-height: calc(100vh - var(--app-topbar-height));
    margin-left: var(--app-sidebar-width);
    transition: margin-left 220ms ease;
}

.dashboard-layout .main-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 20px;
}

.app-sidebar-overlay {
    display: none;
}

.workspace-panel {
    width: 100%;
    padding: 20px;
    border: 1px solid #d8e2ee;
    border-radius: 15px;
    background: #ffffff;
    box-shadow: 0 5px 20px rgba(15, 23, 42, 0.05);
}

.workspace-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.workspace-heading h1 {
    margin: 3px 0 6px;
    color: #13274c;
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    font-weight: 800;
}

.workspace-filters {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    background: #f8fafc;
}

.stock-filter-bar {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 180px;
    align-items: end;
    gap: 12px;
}

.ceaf-filter-grid {
    display: grid;
    grid-template-columns: minmax(250px, 1.35fr) minmax(220px, 1fr) minmax(220px, 1fr) 180px;
    align-items: end;
    gap: 12px;
}

.workspace-filter-field {
    min-width: 0;
}

.workspace-filters .form-label {
    margin-bottom: 6px;
}

.workspace-filters .form-control,
.workspace-filters .form-select,
.workspace-filters .input-group-text,
.workspace-clear-button {
    min-height: 42px;
}

.workspace-clear-button {
    white-space: nowrap;
}

.workspace-table-frame {
    border-radius: 11px;
    box-shadow: inset 0 0 0 1px rgba(219, 227, 239, 0.12);
}

.workspace-pagination {
    margin-top: 14px;
}

/* Mantém a primeira coluna fixa, sem divisor visual artificial. */
.matrix-table thead th.matrix-product-column,
.matrix-table tbody td.matrix-product-cell {
    border-right: 0 !important;
    box-shadow: none !important;
}

/* Estado compacto no desktop: navegação por ícones e cards reduzidos. */
@media (min-width: 992px) {
    .dashboard-layout.sidebar-collapsed .app-sidebar {
        width: var(--app-sidebar-compact-width);
    }

    .dashboard-layout.sidebar-collapsed #content.app-content {
        margin-left: var(--app-sidebar-compact-width);
    }

    .dashboard-layout.sidebar-collapsed .app-sidebar-scroll {
        padding-inline: 9px;
    }

    .dashboard-layout.sidebar-collapsed .app-sidebar-label,
    .dashboard-layout.sidebar-collapsed .app-sidebar-link-copy,
    .dashboard-layout.sidebar-collapsed .app-sidebar-section-heading,
    .dashboard-layout.sidebar-collapsed .app-sidebar-footer-copy {
        display: none;
    }

    .dashboard-layout.sidebar-collapsed .app-sidebar-link {
        justify-content: center;
        min-height: 54px;
        padding: 7px;
    }

    .dashboard-layout.sidebar-collapsed .app-sidebar-link-icon {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .dashboard-layout.sidebar-collapsed .app-sidebar-section {
        margin-top: 14px;
        padding-top: 14px;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-unit-list {
        gap: 7px;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-unit-list .unit-update-card.readable {
        display: flex;
        min-height: 64px;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        padding: 7px 4px;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-unit-list .unit-update-card-icon {
        width: 31px;
        height: 31px;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-unit-list .unit-update-copy {
        align-items: center;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-unit-list .unit-update-copy strong,
    .dashboard-layout.sidebar-collapsed .sidebar-unit-list .unit-update-date-full {
        display: none;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-unit-list .unit-update-compact-date {
        display: block;
        color: #60758d;
        font-size: 0.6rem;
        font-weight: 800;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-ceaf-card {
        padding: 8px 5px;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-ceaf-card .status-badge {
        min-height: 30px;
        padding-inline: 5px;
        overflow: hidden;
        font-size: 0;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-ceaf-card .status-badge::before {
        content: '•';
        font-size: 1.35rem;
        line-height: 1;
    }

    .dashboard-layout.sidebar-collapsed .sidebar-ceaf-card p {
        display: none;
    }

    .dashboard-layout.sidebar-collapsed .app-sidebar-footer {
        justify-content: center;
        padding-inline: 8px;
    }
}

@media (max-width: 1200px) {
    .ceaf-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ceaf-filter-grid .workspace-clear-button {
        width: 100%;
    }
}

@media (max-width: 991.98px) {
    :root {
        --app-topbar-height: 70px;
    }

    .app-topbar-inner {
        padding: 0 15px;
    }

    .app-government-brand img {
        width: 174px;
    }

    .app-sidebar {
        width: min(310px, calc(100vw - 44px));
        transform: translateX(-105%);
        box-shadow: 14px 0 32px rgba(15, 23, 42, 0.24);
    }

    .dashboard-layout.sidebar-mobile-open .app-sidebar {
        transform: translateX(0);
    }

    .dashboard-layout #content.app-content,
    .dashboard-layout.sidebar-collapsed #content.app-content {
        margin-left: 0;
    }

    .app-sidebar-overlay {
        position: fixed;
        inset: var(--app-topbar-height) 0 0 0;
        z-index: 1150;
        display: block;
        visibility: hidden;
        border: 0;
        background: rgba(2, 8, 23, 0.5);
        opacity: 0;
        transition: opacity 180ms ease, visibility 180ms ease;
    }

    .dashboard-layout.sidebar-mobile-open .app-sidebar-overlay {
        visibility: visible;
        opacity: 1;
    }

    .dashboard-layout.sidebar-mobile-open {
        overflow: hidden;
    }

    .dashboard-layout .main-container {
        padding: 15px;
    }
}

@media (max-width: 767.98px) {
    .workspace-panel {
        padding: 14px;
        border-radius: 12px;
    }

    .workspace-heading {
        margin-bottom: 11px;
    }

    .stock-filter-bar,
    .ceaf-filter-grid {
        grid-template-columns: 1fr;
    }

    .workspace-clear-button {
        width: 100%;
    }

    .workspace-pagination {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    .app-topbar-inner {
        padding-inline: 10px;
    }

    .app-topbar-brand-group {
        gap: 10px;
    }

    .app-sidebar-toggle {
        width: 40px;
        height: 40px;
    }

    .app-government-brand img {
        width: 145px;
    }

    .dashboard-layout .main-container {
        padding: 10px;
    }

    .workspace-panel {
        padding: 12px;
    }

    .workspace-heading h1 {
        font-size: 1.23rem;
        line-height: 1.24;
    }

    .workspace-filters {
        padding: 10px;
    }
}

/* ========================================================================== */
/* Refinamento: título no cabeçalho, filtros compactos e menu azul moderno    */
/* ========================================================================== */
:root {
    --app-sidebar-blue-start: #0b63b6;
    --app-sidebar-blue-mid: #084f91;
    --app-sidebar-blue-end: #063763;
}

.app-topbar {
    background: #06172d;
    border-bottom-color: #0b63b6;
}

.app-topbar-inner {
    display: grid;
    grid-template-columns: minmax(290px, auto) minmax(0, 1fr);
    gap: 28px;
}

.app-topbar-page {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 11px;
    min-width: 0;
}

.app-topbar-page-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(125, 211, 252, 0.24);
    border-radius: 11px;
    background: rgba(56, 189, 248, 0.1);
    color: #7dd3fc;
    font-size: 1rem;
}

.app-topbar-page-copy {
    display: flex;
    min-width: 0;
    max-width: 720px;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    line-height: 1.2;
    text-align: right;
}

.app-topbar-page-copy strong,
.app-topbar-page-copy small {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-topbar-page-copy strong {
    color: #ffffff;
    font-size: 0.91rem;
    font-weight: 800;
    letter-spacing: 0.25px;
}

.app-topbar-page-copy small {
    color: #9fb2c8;
    font-size: 0.67rem;
    font-weight: 600;
}

.app-sidebar {
    border-right: 0;
    background:
        radial-gradient(circle at 15% 0%, rgba(125, 211, 252, 0.18), transparent 34%),
        linear-gradient(180deg, var(--app-sidebar-blue-start) 0%, var(--app-sidebar-blue-mid) 55%, var(--app-sidebar-blue-end) 100%);
    color: #ffffff;
    box-shadow: 10px 0 28px rgba(4, 31, 59, 0.16);
}

.app-sidebar-scroll {
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.app-sidebar-label {
    color: rgba(255, 255, 255, 0.58);
}

.app-sidebar-link {
    color: rgba(255, 255, 255, 0.84);
}

.app-sidebar-link:hover,
.app-sidebar-link:focus-visible {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
}

.app-sidebar-link.active {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.17);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(2, 22, 43, 0.12);
}

.app-sidebar-link-icon,
.app-sidebar-link.active .app-sidebar-link-icon {
    background: rgba(255, 255, 255, 0.13);
    color: #ffffff;
}

.app-sidebar-link-copy small {
    color: rgba(255, 255, 255, 0.65);
}

.app-sidebar-section {
    border-top-color: rgba(255, 255, 255, 0.16);
}

.app-sidebar-section-kicker {
    color: #bae6fd;
}

.app-sidebar-section-heading h2 {
    color: #ffffff;
}

.app-sidebar-count {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.sidebar-unit-list .unit-update-card.readable,
.sidebar-unit-list .unit-update-card.readable.is-latest,
.sidebar-unit-list .unit-update-card.readable.is-outdated {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-unit-list .unit-update-card.readable.is-latest {
    border-color: rgba(167, 243, 208, 0.48);
    background: rgba(16, 185, 129, 0.12);
}

.sidebar-unit-list .unit-update-card.readable.is-outdated {
    border-color: rgba(253, 230, 138, 0.5);
    background: rgba(245, 158, 11, 0.12);
}

.sidebar-unit-list .unit-update-copy strong,
.sidebar-unit-list .unit-update-copy > span,
.dashboard-layout.sidebar-collapsed .sidebar-unit-list .unit-update-compact-date {
    color: #ffffff;
}

.sidebar-unit-list .unit-update-copy > span,
.dashboard-layout.sidebar-collapsed .sidebar-unit-list .unit-update-compact-date {
    color: rgba(255, 255, 255, 0.72);
}

.sidebar-unit-list .unit-update-card-icon {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.sidebar-unit-list .unit-update-card.readable.is-latest .unit-update-card-icon {
    background: rgba(167, 243, 208, 0.2);
    color: #d1fae5;
}

.sidebar-unit-list .unit-update-card.readable.is-outdated .unit-update-card-icon {
    background: rgba(253, 230, 138, 0.19);
    color: #fef3c7;
}

.sidebar-ceaf-card {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-ceaf-card p {
    color: rgba(255, 255, 255, 0.76);
}

.app-sidebar-footer {
    border-top-color: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.66);
}

.app-sidebar-footer i {
    color: #bae6fd;
}

/* O título passa a viver no cabeçalho fixo; o conteúdo começa nos filtros. */
.workspace-panel {
    padding: 12px;
    border-radius: 13px;
}

.workspace-filters-compact {
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 10px;
    background: #f7faff;
}

.stock-filter-bar {
    grid-template-columns: minmax(280px, 1fr) auto auto;
    align-items: center;
    gap: 8px;
}

.ceaf-filter-grid {
    grid-template-columns: minmax(220px, 1.35fr) minmax(180px, 0.9fr) minmax(190px, 0.95fr) auto auto;
    align-items: center;
    gap: 8px;
}

.workspace-filters-compact .form-control,
.workspace-filters-compact .form-select,
.workspace-filters-compact .input-group-text,
.workspace-filters-compact .workspace-clear-button {
    min-height: 38px;
    font-size: 0.8rem;
}

.workspace-filters-compact .input-group-text {
    padding-inline: 11px;
}

.workspace-clear-button {
    padding-inline: 13px;
}

.workspace-record-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid #d4e2f1;
    border-radius: 999px;
    background: #ffffff;
    color: #315a82;
    font-size: 0.69rem;
    white-space: nowrap;
}

.workspace-table-frame {
    border-radius: 10px;
}

.workspace-pagination {
    margin-top: 10px;
}

@media (max-width: 1260px) {
    .ceaf-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ceaf-filter-grid .workspace-record-counter {
        justify-self: start;
    }
}

@media (max-width: 991.98px) {
    .app-topbar-inner {
        grid-template-columns: minmax(245px, auto) minmax(0, 1fr);
        gap: 16px;
    }

    .app-topbar-page-copy small {
        display: none;
    }

    .app-topbar-page-copy strong {
        font-size: 0.78rem;
    }
}

@media (max-width: 767.98px) {
    .app-topbar-inner {
        display: flex;
        justify-content: flex-start;
    }

    .app-topbar-page {
        display: none;
    }

    .stock-filter-bar,
    .ceaf-filter-grid {
        grid-template-columns: 1fr auto;
    }

    .stock-filter-bar .workspace-filter-grow,
    .ceaf-filter-grid .workspace-filter-field:first-child {
        grid-column: 1 / -1;
    }

    .ceaf-filter-grid .workspace-filter-field:nth-child(2),
    .ceaf-filter-grid .workspace-filter-field:nth-child(3) {
        grid-column: 1 / -1;
    }

    .workspace-record-counter {
        justify-self: start;
    }
}

@media (max-width: 520px) {
    .workspace-panel {
        padding: 8px;
    }

    .workspace-filters-compact {
        padding: 7px;
    }

    .stock-filter-bar,
    .ceaf-filter-grid {
        grid-template-columns: 1fr;
    }

    .workspace-clear-button,
    .workspace-record-counter {
        width: 100%;
    }

    .workspace-record-counter {
        border-radius: 8px;
    }
}

/* ========================================================================== */
/* Padrão institucional final: logo fixa no header e menu lateral azul        */
/* ========================================================================== */
:root {
    --app-topbar-height: 88px;
    --app-sidebar-width: 286px;
    --app-sidebar-compact-width: 82px;
    --institutional-navy: #0b1f3a;
    --institutional-navy-deep: #07162b;
    --institutional-blue: #1b3a66;
    --institutional-blue-soft: #365984;
}

.dashboard-layout {
    padding-top: var(--app-topbar-height);
    background: #eef3f8;
}

.app-topbar {
    height: var(--app-topbar-height);
    border-bottom: 1px solid #d7e0eb;
    background: #f8fafc;
    color: #0b1f3a;
    box-shadow: 0 3px 14px rgba(15, 35, 61, 0.1);
}

.app-topbar-inner {
    display: grid;
    grid-template-columns: minmax(235px, 1fr) minmax(360px, 760px) minmax(235px, 1fr);
    align-items: center;
    gap: 22px;
    width: 100%;
    height: 100%;
    padding: 0 28px;
}

.app-topbar-brand-slot {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
}

.app-government-brand {
    padding: 2px 0;
}

.app-government-brand img {
    width: 202px;
    max-width: none;
}

.app-topbar-page {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
}

.app-topbar-page strong,
.app-topbar-kicker {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-topbar-page strong {
    color: #0b1f3a;
    font-size: clamp(1rem, 1.35vw, 1.28rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.15px;
}

.app-topbar-kicker {
    color: #6b7c93;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.app-sidebar-toggle {
    width: 44px;
    height: 44px;
    border-color: #cbd7e5;
    background: #ffffff;
    color: #17375f;
    box-shadow: 0 5px 14px rgba(16, 43, 75, 0.08);
}

.app-sidebar-toggle:hover,
.app-sidebar-toggle:focus-visible {
    border-color: #80a8d4;
    background: #edf5fd;
    color: #0b63b6;
}

.app-sidebar {
    inset: var(--app-topbar-height) auto 0 0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(circle at 10% 0%, rgba(87, 129, 183, 0.38), transparent 37%),
        linear-gradient(180deg, var(--institutional-blue) 0%, var(--institutional-navy) 47%, var(--institutional-navy-deep) 100%);
    color: #ffffff;
    box-shadow: 8px 0 24px rgba(7, 22, 43, 0.16);
}

.app-sidebar-scroll {
    padding: 22px 14px;
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.app-sidebar-label {
    margin: 0 10px 9px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.67rem;
    letter-spacing: 1.05px;
}

.app-sidebar-nav {
    gap: 10px;
}

.app-sidebar-link {
    min-height: 64px;
    padding: 10px 12px;
    border-color: transparent;
    border-radius: 15px;
    color: rgba(255, 255, 255, 0.82);
}

.app-sidebar-link:hover,
.app-sidebar-link:focus-visible {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
}

.app-sidebar-link.active {
    border-color: rgba(173, 208, 247, 0.42);
    background: linear-gradient(135deg, rgba(92, 135, 190, 0.58), rgba(61, 95, 142, 0.48));
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(2, 17, 35, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.app-sidebar-link-icon,
.app-sidebar-link.active .app-sidebar-link-icon {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.app-sidebar-link-copy strong {
    font-size: 0.82rem;
}

.app-sidebar-link-copy small {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.65rem;
}

.app-sidebar-section {
    margin-top: 22px;
    padding-top: 19px;
    border-top-color: rgba(255, 255, 255, 0.14);
}

.app-sidebar-section-kicker {
    color: #b9d9fb;
}

.app-sidebar-section-heading h2 {
    color: #ffffff;
}

.app-sidebar-count {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.sidebar-unit-list .unit-update-card.readable,
.sidebar-unit-list .unit-update-card.readable.is-latest,
.sidebar-unit-list .unit-update-card.readable.is-outdated,
.sidebar-ceaf-card {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.085);
    color: #ffffff;
}

.sidebar-unit-list .unit-update-card.readable.is-latest {
    border-color: rgba(164, 231, 190, 0.43);
    background: rgba(22, 128, 61, 0.16);
}

.sidebar-unit-list .unit-update-card.readable.is-outdated {
    border-color: rgba(239, 211, 122, 0.46);
    background: rgba(161, 98, 7, 0.17);
}

.sidebar-unit-list .unit-update-copy strong,
.sidebar-unit-list .unit-update-copy > span,
.dashboard-layout.sidebar-collapsed .sidebar-unit-list .unit-update-compact-date {
    color: #ffffff;
}

.sidebar-unit-list .unit-update-copy > span,
.dashboard-layout.sidebar-collapsed .sidebar-unit-list .unit-update-compact-date,
.sidebar-ceaf-card p {
    color: rgba(255, 255, 255, 0.72);
}

.sidebar-unit-list .unit-update-card-icon {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.app-sidebar-footer {
    border-top-color: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.64);
}

.app-sidebar-footer i {
    color: #b9d9fb;
}

.dashboard-layout #content.app-content {
    min-height: calc(100vh - var(--app-topbar-height));
    margin-left: var(--app-sidebar-width);
}

.dashboard-layout .main-container {
    max-width: none;
    padding: 18px;
}

.workspace-panel {
    padding: 12px;
    border-radius: 14px;
    box-shadow: 0 7px 22px rgba(15, 35, 61, 0.07);
}

.workspace-filters-compact {
    margin-bottom: 10px;
    padding: 8px;
}

.workspace-table-frame {
    border-radius: 11px;
}

@media (min-width: 992px) {
    .dashboard-layout.sidebar-collapsed .app-sidebar {
        width: var(--app-sidebar-compact-width);
    }

    .dashboard-layout.sidebar-collapsed #content.app-content {
        margin-left: var(--app-sidebar-compact-width);
    }
}

@media (max-width: 991.98px) {
    :root {
        --app-topbar-height: 76px;
    }

    .app-topbar-inner {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 12px;
        padding: 0 16px;
    }

    .app-government-brand img {
        width: 166px;
    }

    .app-topbar-page strong {
        font-size: 0.88rem;
    }

    .app-topbar-kicker {
        display: none;
    }

    .app-sidebar {
        width: min(310px, calc(100vw - 44px));
    }

    .dashboard-layout #content.app-content,
    .dashboard-layout.sidebar-collapsed #content.app-content {
        margin-left: 0;
    }

    .dashboard-layout .main-container {
        padding: 14px;
    }
}

@media (max-width: 680px) {
    :root {
        --app-topbar-height: 70px;
    }

    .app-topbar-inner {
        gap: 9px;
        padding: 0 11px;
    }

    .app-government-brand img {
        width: 140px;
    }

    .app-topbar-page strong {
        font-size: 0.72rem;
        line-height: 1.25;
        white-space: normal;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .app-sidebar-toggle {
        width: 40px;
        height: 40px;
    }

    .dashboard-layout .main-container {
        padding: 9px;
    }
}

@media (max-width: 430px) {
    .app-government-brand img {
        width: 118px;
    }

    .app-topbar-page strong {
        font-size: 0.66rem;
    }
}

/* ========================================================================== */
/* Ajuste solicitado: cabeçalho institucional azul, alinhado ao menu lateral   */
/* ========================================================================== */
.app-topbar {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background:
        radial-gradient(circle at 10% 0%, rgba(87, 129, 183, 0.34), transparent 38%),
        linear-gradient(90deg, var(--institutional-blue) 0%, var(--institutional-navy) 58%, var(--institutional-navy-deep) 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(7, 22, 43, 0.2);
}

.app-topbar-page strong {
    color: #ffffff;
}

.app-topbar-kicker {
    color: rgba(255, 255, 255, 0.68);
}

.app-sidebar-toggle {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    box-shadow: none;
}

.app-sidebar-toggle:hover,
.app-sidebar-toggle:focus-visible {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.app-topbar-kicker {
    font-size: 0.93rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.75px;
}


/* ========================================================================== */
/* Otimização das tabelas: colunas padronizadas e mais registros por tela     */
/* ========================================================================== */

/* RioFarmes: medicamento mais largo; todas as unidades com a mesma largura. */
.matrix-table {
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
}

.matrix-table .matrix-product-column,
.matrix-table .matrix-product-cell {
    width: 440px;
    min-width: 440px;
    max-width: 440px;
}

.matrix-table .matrix-unit-column,
.matrix-table tbody td:not(.matrix-product-cell) {
    width: 230px;
    min-width: 230px;
    max-width: 230px;
}

.matrix-table tbody td {
    height: 40px;
    padding: 8px 12px;
    line-height: 1.2;
}

.matrix-table thead th {
    padding: 10px 12px;
}

.matrix-product-cell {
    overflow: hidden;
}

.matrix-product-name {
    display: block;
    width: 100%;
    overflow: hidden;
    color: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* CEAF: medicamento recebe mais espaço e as colunas operacionais ficam iguais. */
.ceaf-table {
    width: 100%;
    min-width: 1460px;
    table-layout: fixed;
}

.ceaf-table .ceaf-col-medicamento {
    width: 360px;
}

.ceaf-table .ceaf-col-padrao {
    width: 190px;
}

.ceaf-table .ceaf-col-status {
    width: 210px;
}

.ceaf-table .ceaf-col-comentarios {
    width: 320px;
}

.ceaf-table tbody td {
    height: 40px;
    padding: 8px 12px;
    line-height: 1.2;
}

.ceaf-table thead th {
    padding: 10px 12px;
}

.ceaf-cell-medicamento,
.ceaf-cell-nowrap {
    overflow: hidden;
}

.ceaf-cell-medicamento > span,
.ceaf-cell-nowrap > span {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ceaf-cell-status {
    overflow: hidden;
}

.ceaf-table .position-badge {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    padding: 4px 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 991.98px) {
    .matrix-table .matrix-product-column,
    .matrix-table .matrix-product-cell {
        width: 340px;
        min-width: 340px;
        max-width: 340px;
    }

    .matrix-table .matrix-unit-column,
    .matrix-table tbody td:not(.matrix-product-cell) {
        width: 180px;
        min-width: 180px;
        max-width: 180px;
    }
}

@media (max-width: 680px) {
    .matrix-table .matrix-product-column,
    .matrix-table .matrix-product-cell {
        width: 275px;
        min-width: 275px;
        max-width: 275px;
    }

    .matrix-table .matrix-unit-column,
    .matrix-table tbody td:not(.matrix-product-cell) {
        width: 150px;
        min-width: 150px;
        max-width: 150px;
    }

    .matrix-table tbody td,
    .ceaf-table tbody td {
        height: 38px;
        padding: 7px 10px;
    }

    .ceaf-table {
        min-width: 1310px;
    }

    .ceaf-table .ceaf-col-medicamento {
        width: 300px;
    }

    .ceaf-table .ceaf-col-padrao {
        width: 165px;
    }

    .ceaf-table .ceaf-col-status {
        width: 190px;
    }

    .ceaf-table .ceaf-col-comentarios {
        width: 280px;
    }
}


/* ========================================================================== */
/* Botão do menu no canto superior esquerdo                                   */
/* ========================================================================== */
.app-topbar-brand-slot {
    gap: 14px;
}

.app-topbar-spacer {
    min-width: 0;
}

@media (max-width: 991.98px) {
    .app-topbar-brand-slot {
        gap: 10px;
    }
}

@media (max-width: 680px) {
    .app-topbar-brand-slot {
        gap: 7px;
    }
}

/* ========================================================================== */
/* Administração: autenticação por modal e atualização controlada por Excel   */
/* ========================================================================== */
.admin-workspace {
    min-height: calc(100vh - var(--app-topbar-height) - 36px);
}

.admin-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
    padding: 8px 8px 18px;
    border-bottom: 1px solid #e2e8f0;
}

.admin-heading h1 {
    margin: 3px 0 6px;
    color: #13274c;
    font-size: 1.35rem;
    font-weight: 800;
}

.admin-heading p {
    max-width: 900px;
    margin: 0;
    color: #64748b;
    font-size: 0.84rem;
    line-height: 1.55;
}

.admin-security-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    padding: 7px 11px;
    border: 1px solid #bbd7c5;
    border-radius: 999px;
    background: #f0fdf4;
    color: #166534;
    font-size: 0.7rem;
    font-weight: 800;
    white-space: nowrap;
}

.admin-upload-form {
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid #dce5ef;
    border-radius: 13px;
    background: #f8fbff;
}

.admin-upload-grid {
    display: grid;
    grid-template-columns: minmax(240px, 0.7fr) minmax(360px, 1.3fr) auto;
    align-items: end;
    gap: 12px;
}

.admin-upload-field small {
    display: block;
    margin-top: 5px;
    color: #718096;
    font-size: 0.68rem;
}

.admin-upload-action .btn {
    min-height: 44px;
    padding-inline: 18px;
    white-space: nowrap;
}

.admin-rules-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.admin-rule-card {
    padding: 16px;
    border: 1px solid #dce5ef;
    border-radius: 13px;
    background: #ffffff;
}

.admin-rule-title {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 13px;
}

.admin-rule-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: #e8f2fc;
    color: #0b63b6;
    font-size: 1rem;
}

.admin-rule-title span:not(.admin-rule-icon) {
    display: block;
    color: #173253;
    font-size: 0.82rem;
    font-weight: 800;
}

.admin-rule-title strong {
    display: block;
    margin-top: 2px;
    color: #718096;
    font-size: 0.67rem;
    font-weight: 700;
}

.admin-rule-card p {
    margin: 0 0 7px;
    color: #52647a;
    font-size: 0.75rem;
    line-height: 1.45;
}

.admin-transaction-note {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 13px 15px;
    border: 1px solid #cfe0f1;
    border-radius: 12px;
    background: #f7fbff;
    color: #315a82;
}

.admin-transaction-note > i {
    font-size: 1.15rem;
}

.admin-transaction-note strong,
.admin-transaction-note span {
    display: block;
}

.admin-transaction-note strong {
    font-size: 0.78rem;
}

.admin-transaction-note span {
    margin-top: 2px;
    color: #64748b;
    font-size: 0.7rem;
}

.admin-result-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.admin-result-icon {
    flex: 0 0 auto;
    font-size: 1.1rem;
}

.admin-result-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 16px;
    margin-top: 5px;
    font-size: 0.74rem;
}

.admin-sidebar-card > i {
    display: block;
    margin-bottom: 7px;
    color: #d9ecff;
    font-size: 1.15rem;
    text-align: center;
}

.admin-sidebar-card p strong {
    color: #ffffff;
}

.admin-locked-state {
    display: flex;
    min-height: 420px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #64748b;
    text-align: center;
}

.admin-locked-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    margin-bottom: 14px;
    border-radius: 18px;
    background: #e8f2fc;
    color: #0b63b6;
    font-size: 1.7rem;
}

.admin-locked-state h1 {
    margin: 0 0 6px;
    color: #173253;
    font-size: 1.25rem;
    font-weight: 800;
}

.admin-locked-state p {
    margin: 0;
    font-size: 0.82rem;
}

.admin-login-modal .modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(7, 22, 43, 0.28);
}

.admin-login-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.13);
    background: linear-gradient(135deg, var(--institutional-blue), var(--institutional-navy-deep));
    color: #ffffff;
}

.admin-login-heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 1.05rem;
}

.admin-login-heading span:not(.admin-login-icon) {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 0.75px;
    text-transform: uppercase;
}

.admin-login-heading h2 {
    margin-top: 2px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
}

.admin-login-modal .modal-body {
    padding: 22px;
}

.admin-login-footer {
    padding: 13px 22px 18px;
    border-top: 0;
}

@media (max-width: 1100px) {
    .admin-upload-grid {
        grid-template-columns: 1fr 1fr;
    }

    .admin-upload-action {
        grid-column: 1 / -1;
    }

    .admin-upload-action .btn {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .admin-heading {
        flex-direction: column;
    }

    .admin-upload-grid,
    .admin-rules-grid {
        grid-template-columns: 1fr;
    }

    .admin-upload-action {
        grid-column: auto;
    }
}

/* Administração: usuários, permissões e status */
.admin-users-section {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #dbe4ef;
}

.admin-users-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.admin-users-heading h2 {
    margin: 3px 0 5px;
    color: #173253;
    font-size: 1.05rem;
    font-weight: 800;
}

.admin-users-heading p {
    margin: 0;
    color: #64748b;
    font-size: 0.78rem;
}

.admin-users-table-wrap {
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    background: #ffffff;
}

.admin-users-table {
    min-width: 980px;
}

.admin-users-table td {
    font-size: 0.75rem;
}

.admin-auth-chip,
.admin-permission-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 800;
    white-space: nowrap;
}

.admin-auth-chip {
    background: #edf3f8;
    color: #3f5874;
}

.admin-permission-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.admin-permission-chip {
    border: 1px solid #cfe0f1;
    background: #f2f8fe;
    color: #1f5e96;
}

.admin-permission-all {
    border-color: #b9ddc5;
    background: #eefbf2;
    color: #176b35;
}

.admin-user-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.admin-user-actions form {
    margin: 0;
}

.admin-permissions-editor {
    padding: 13px 14px;
    border: 1px solid #dbe4ef;
    border-radius: 11px;
    background: #f8fbff;
}

.admin-permission-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 14px;
}

.admin-permission-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 650;
}

.admin-permission-options input {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.admin-permissions-editor small {
    display: block;
    margin-top: 8px;
    color: #64748b;
    font-size: 0.69rem;
}

@media (max-width: 767.98px) {
    .admin-users-heading {
        flex-direction: column;
    }

    .admin-users-heading .btn {
        width: 100%;
    }

    .admin-permission-options {
        grid-template-columns: 1fr;
    }
}


/* ========================================================================== */
/* Ajuste final: filtros alinhados e com altura uniforme                       */
/* ========================================================================== */
.workspace-filters-compact {
    align-items: stretch;
}

.workspace-filters-compact > .workspace-filter-field,
.workspace-filters-compact > .workspace-clear-button,
.workspace-filters-compact > .workspace-record-counter {
    min-width: 0;
    height: 40px;
    margin: 0;
}

.workspace-filters-compact .workspace-filter-field > .input-group,
.workspace-filters-compact .workspace-filter-field > .dropdown,
.workspace-filters-compact .workspace-filter-field > .form-select {
    width: 100%;
    height: 100%;
}

.workspace-filters-compact .form-control,
.workspace-filters-compact .form-select,
.workspace-filters-compact .input-group-text,
.workspace-filters-compact .workspace-clear-button {
    min-height: 40px;
    height: 40px;
}

.workspace-filters-compact .dropdown > .form-select {
    display: flex;
    align-items: center;
    width: 100%;
}

.stock-filter-bar {
    grid-template-columns: minmax(320px, 1fr) 120px minmax(190px, auto);
    align-items: center;
}

.ceaf-filter-grid {
    grid-template-columns: minmax(280px, 1.35fr) minmax(220px, 1fr) minmax(220px, 1fr) 120px minmax(160px, auto);
    align-items: center;
}

.workspace-record-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    height: 40px;
}

@media (max-width: 1260px) {
    .ceaf-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ceaf-filter-grid .workspace-clear-button,
    .ceaf-filter-grid .workspace-record-counter {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .stock-filter-bar,
    .ceaf-filter-grid {
        grid-template-columns: 1fr;
    }

    .workspace-filters-compact > .workspace-filter-field,
    .workspace-filters-compact > .workspace-clear-button,
    .workspace-filters-compact > .workspace-record-counter {
        width: 100%;
    }
}

/* ========================================================================== */
/* Administração: visual de gestão                                            */
/* ========================================================================== */
.admin-workspace {
    min-height: calc(100vh - var(--app-topbar-height) - 36px);
    padding: 18px;
}

.admin-management-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.admin-management-heading h1 {
    margin: 3px 0 5px;
    color: #13274c;
    font-size: 1.38rem;
    font-weight: 800;
}

.admin-management-heading p {
    margin: 0;
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1.5;
}

.admin-management-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid #b9ddc5;
    border-radius: 999px;
    background: #effbf3;
    color: #176b35;
    font-size: 0.69rem;
    font-weight: 800;
    white-space: nowrap;
}

.admin-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.admin-summary-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 92px;
    padding: 14px 15px;
    border: 1px solid #dce5ef;
    border-radius: 13px;
    background: #ffffff;
}

.admin-summary-icon,
.admin-section-icon,
.admin-sidebar-avatar,
.admin-management-note-icon,
.admin-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.admin-summary-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: #e8f2fc;
    color: #0b63b6;
    font-size: 1.05rem;
}

.admin-summary-card > div {
    min-width: 0;
}

.admin-summary-card span:not(.admin-summary-icon),
.admin-summary-card small {
    display: block;
}

.admin-summary-card > div > span {
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 700;
}

.admin-summary-card strong {
    display: block;
    margin-top: 1px;
    color: #173253;
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.15;
}

.admin-summary-card strong.admin-summary-text-value {
    font-size: 1rem;
}

.admin-summary-card small {
    margin-top: 3px;
    color: #8090a4;
    font-size: 0.65rem;
    line-height: 1.35;
}

.admin-nav-wrap {
    margin-bottom: 12px;
    padding: 5px;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    background: #f8fafc;
}

.admin-nav-pills {
    gap: 5px;
}

.admin-nav-pills .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 7px 12px;
    border-radius: 9px;
    color: #60758d;
    font-size: 0.76rem;
    font-weight: 800;
}

.admin-nav-pills .nav-link:hover,
.admin-nav-pills .nav-link:focus-visible {
    color: #0b63b6;
}

.admin-nav-pills .nav-link.active {
    background: #0b63b6;
    color: #ffffff;
}

.admin-tab-content {
    min-height: 360px;
}

.admin-section-card {
    padding: 16px;
    border: 1px solid #dce5ef;
    border-radius: 13px;
    background: #ffffff;
}

.admin-section-heading,
.admin-users-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.admin-section-heading.compact {
    margin-bottom: 10px;
}

.admin-section-heading-main {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.admin-section-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: #e8f2fc;
    color: #0b63b6;
    font-size: 1rem;
}

.admin-section-heading h2,
.admin-users-heading h2 {
    margin: 0 0 3px;
    color: #173253;
    font-size: 1rem;
    font-weight: 800;
}

.admin-section-heading p,
.admin-users-heading p {
    margin: 0;
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.45;
}

.admin-upload-form.admin-upload-form-management {
    margin: 0;
    padding: 14px;
    border: 1px solid #dbe4ef;
    border-radius: 11px;
    background: #f8fbff;
}

.admin-upload-grid.admin-upload-grid-management {
    grid-template-columns: minmax(230px, 0.8fr) minmax(360px, 1.4fr) auto;
    align-items: start;
    gap: 10px;
}

.admin-upload-grid-management .form-select,
.admin-upload-grid-management .form-control,
.admin-upload-grid-management .btn {
    min-height: 42px;
}

.admin-upload-grid-management .form-label {
    display: block;
    min-height: 19px;
    margin-bottom: 6px;
}

/* Alinha o botão à mesma linha visual dos campos de formulário. */
.admin-upload-grid-management .admin-upload-action {
    align-self: start;
    padding-top: 25px;
}

.admin-upload-grid-management .admin-upload-action .btn {
    min-width: 148px;
}

.admin-management-note {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 11px 12px;
    border: 1px solid #cfe0f1;
    border-radius: 10px;
    background: #f7fbff;
}

.admin-management-note-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #e8f2fc;
    color: #0b63b6;
}

.admin-management-note strong,
.admin-management-note span:not(.admin-management-note-icon) {
    display: block;
}

.admin-management-note strong {
    color: #315a82;
    font-size: 0.75rem;
}

.admin-management-note span:not(.admin-management-note-icon) {
    margin-top: 2px;
    color: #64748b;
    font-size: 0.69rem;
    line-height: 1.4;
}

.admin-access-overview {
    margin-top: 12px;
    padding: 14px 16px;
    border: 1px solid #dce5ef;
    border-radius: 12px;
    background: #ffffff;
}

.admin-access-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.admin-access-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 29px;
    padding: 5px 9px;
    border: 1px solid #cfe0f1;
    border-radius: 999px;
    background: #f4f9fe;
    color: #315a82;
    font-size: 0.68rem;
    font-weight: 750;
}

.admin-access-item i {
    color: #15803d;
}

.admin-empty-state {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px dashed #cbd5e1;
    border-radius: 11px;
    background: #f8fafc;
}

.admin-empty-state > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: #e8f2fc;
    color: #0b63b6;
}

.admin-empty-state strong {
    display: block;
    color: #334155;
    font-size: 0.78rem;
}

.admin-empty-state p {
    margin: 2px 0 0;
    color: #64748b;
    font-size: 0.7rem;
}

.admin-empty-warning > span {
    background: #fff7df;
    color: #9a6700;
}

.admin-users-section {
    margin: 0;
    padding: 16px;
    border-top: 1px solid #dce5ef;
}

.admin-users-heading {
    align-items: center;
}

.admin-users-table-wrap {
    overflow: hidden;
    border-radius: 11px;
}

.admin-users-table {
    min-width: 1040px;
}

.admin-users-table thead th {
    padding-top: 11px;
    padding-bottom: 11px;
}

.admin-users-table td {
    padding-top: 10px;
    padding-bottom: 10px;
    font-size: 0.74rem;
}

.admin-user-identity {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 180px;
}

.admin-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #edf3f8;
    color: #60758d;
}

.admin-user-identity strong,
.admin-user-identity small {
    display: block;
}

.admin-user-identity strong {
    color: #243b58;
    font-size: 0.75rem;
    font-weight: 800;
}

.admin-user-identity small {
    margin-top: 2px;
    color: #8090a4;
    font-size: 0.63rem;
}

.admin-profile-badge {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 800;
}

.admin-profile-badge.administrator {
    border: 1px solid #b9ddc5;
    background: #eefbf2;
    color: #176b35;
}

.admin-profile-badge.operator {
    border: 1px solid #cfe0f1;
    background: #f2f8fe;
    color: #1f5e96;
}

.admin-permission-chip.muted {
    border-color: #dbe4ef;
    background: #f8fafc;
    color: #8090a4;
}

.admin-table-empty {
    padding: 18px;
    color: #8090a4;
    text-align: center;
    font-size: 0.75rem;
}

.admin-sidebar-card {
    text-align: left;
}

.admin-sidebar-avatar {
    width: 40px;
    height: 40px;
    margin: 0 auto 9px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.11);
    color: #ffffff;
    font-size: 1rem;
}

.admin-sidebar-user {
    text-align: center;
}

.admin-sidebar-user strong,
.admin-sidebar-user span,
.admin-sidebar-user small {
    display: block;
}

.admin-sidebar-user strong {
    color: #ffffff;
    font-size: 0.76rem;
    font-weight: 800;
}

.admin-sidebar-user span {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.84);
    font-size: 0.68rem;
}

.admin-sidebar-user small {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.62rem;
}

.admin-sidebar-actions {
    display: grid;
    gap: 7px;
    margin-top: 12px;
}

.admin-sidebar-actions form {
    margin: 0;
}

.admin-user-form .form-control,
.admin-user-form .form-select {
    min-height: 42px;
}

.admin-user-form .row > div {
    display: flex;
    flex-direction: column;
}

.admin-user-form .form-label {
    min-height: 19px;
    margin-bottom: 6px;
}

@media (max-width: 1200px) {
    .admin-upload-grid.admin-upload-grid-management {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-upload-grid-management .admin-upload-action {
        grid-column: 1 / -1;
        padding-top: 0;
    }

    .admin-upload-grid-management .admin-upload-action .btn {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .admin-summary-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .admin-workspace {
        padding: 12px;
    }

    .admin-management-heading,
    .admin-users-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-management-status {
        align-self: flex-start;
    }

    .admin-upload-grid.admin-upload-grid-management {
        grid-template-columns: 1fr;
    }

    .admin-upload-grid-management .admin-upload-action {
        grid-column: auto;
        padding-top: 0;
    }

    .admin-users-heading .btn {
        width: 100%;
    }

    .admin-nav-pills {
        display: grid;
        grid-template-columns: 1fr;
    }

    .admin-nav-pills .nav-link {
        width: 100%;
        justify-content: center;
    }
}
