:root {
    --sgi-bg: #eef1f6;
    --sgi-card: #ffffff;
    --sgi-border: #d5dde8;
    --sgi-text: #102747;
    --sgi-muted: #62758f;
    --sgi-primary: #2f6cff;
    --sgi-primary-dark: #1f56cf;
    --sgi-success-bg: #d4f2e5;
    --sgi-success-text: #0f9d6a;
    --sgi-warning-bg: #ffe8cf;
    --sgi-warning-text: #c56f00;
    --sgi-radius-lg: 18px;
    --sgi-radius-md: 14px;
    --sgi-shadow-card: 0 10px 24px rgba(15, 23, 42, 0.06);
    --sgi-shadow-soft: 0 8px 18px rgba(47, 108, 255, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 100% 0%, rgba(202, 218, 255, 0.45), transparent 42%),
        linear-gradient(165deg, #eef1f6 0%, #f5f7fb 44%, #e8edf5 100%);
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--sgi-text);
    overflow: hidden;
}

.layout {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 238px;
    background: linear-gradient(180deg, #0b1738 0%, #0a1633 100%);
    color: #fff;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-head {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1.35rem 1.2rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #dce9ff;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.35px;
    color: rgba(228, 236, 255, 0.72);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0.8rem 1rem 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(114, 147, 226, 0.65) rgba(255, 255, 255, 0.05);
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(114, 147, 226, 0.65);
    border-radius: 8px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(141, 170, 240, 0.75);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    color: rgba(230, 237, 255, 0.74);
    text-decoration: none;
    font-family: "Manrope", "Segoe UI", sans-serif;
    font-size: 0.74rem;
    font-weight: 600;
}

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

.menu-item.active {
    color: #fff;
    background: rgba(47, 108, 255, 0.93);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.menu-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.2;
}

details.menu-group {
    margin-top: 0.35rem;
}

.menu-group summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    color: rgba(230, 237, 255, 0.82);
    font-family: "Manrope", "Segoe UI", sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
}

.menu-group summary:hover {
    background: rgba(255, 255, 255, 0.06);
}

.menu-group summary::-webkit-details-marker {
    display: none;
}

.summary-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.summary-left svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.2;
}

.chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid rgba(230, 237, 255, 0.8);
    border-bottom: 2px solid rgba(230, 237, 255, 0.8);
    transform: rotate(45deg);
    transition: transform 0.15s ease;
    margin-right: 0.2rem;
}

.menu-group[open] .chevron {
    transform: rotate(225deg);
    margin-top: 0.2rem;
}

.submenu {
    margin: 0.35rem 0 0.55rem 1.05rem;
    padding-left: 0.8rem;
    border-left: 1px solid rgba(78, 118, 214, 0.45);
}

.submenu .menu-item {
    font-family: "Manrope", "Segoe UI", sans-serif;
    font-size: 0.67rem;
    font-weight: 600;
    padding: 0.62rem 0.85rem;
    border-radius: 10px;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.6rem 0.7rem 0.7rem;
    background: rgba(3, 10, 26, 0.25);
}

.user-line {
    color: rgba(228, 236, 255, 0.72);
    font-size: 0.63rem;
    margin-bottom: 0.3rem;
}

.user-line-link {
    color: inherit;
    text-decoration: none;
}

.user-line-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.sidebar-footer .menu-item {
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
}

.menu-item-btn {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.main {
    flex: 1;
    padding: 1.5rem;
    height: 100vh;
    overflow-y: auto;
}

.card {
    border: 0;
    box-shadow: 0 8px 22px rgba(14, 30, 37, 0.08);
}

.alert {
    border-radius: 12px;
}

.sgi-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sgi-page-title {
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--sgi-text);
    margin: 0;
}

.sgi-page-subtitle {
    color: var(--sgi-muted);
    font-size: 1rem;
    margin-top: 0.3rem;
}

.sgi-search-wrap {
    position: relative;
    max-width: 416px;
}

.sgi-search-wrap svg {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    stroke: #6d7a8d;
}

.sgi-search-input {
    height: 48px;
    padding: 0.58rem 1rem 0.58rem 3rem;
    border-radius: 12px;
    border: 1px solid var(--sgi-border);
    font-size: 1rem;
}

.sgi-action-btn {
    border-radius: 13px;
    padding: 0.4rem 0.9rem;
    min-height: 24px;
    font-weight: 700;
    box-shadow: var(--sgi-shadow-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.36rem;
    text-align: center;
}

.sgi-icon-plus {
    width: 18px;
    height: 18px;
    margin-right: 0;
    flex-shrink: 0;
}

.sgi-table-card {
    background: var(--sgi-card);
    border: 1px solid var(--sgi-border);
    border-radius: var(--sgi-radius-lg);
    box-shadow: var(--sgi-shadow-card);
}

.sgi-table-card table {
    margin-bottom: 0;
}

.sgi-table-card th {
    color: #67768b;
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1.1rem 0.8rem;
    border-bottom: 1px solid var(--sgi-border);
}

.sgi-table-card td {
    padding: 1.05rem 0.8rem;
    vertical-align: middle;
    color: #12284b;
}

.sgi-status-pill {
    display: inline-flex;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: #edf3ff;
    color: #2b5bc7;
}

.sgi-status-pill-inactive {
    background: #f0f2f5;
    color: #67768b;
}

.sgi-status-pill-ocupada {
    background: #e4ecff;
    color: #2f63cf;
}

.sgi-status-pill-desocupada {
    background: #edf2ff;
    color: #3c6fe0;
}

/* Escala tipográfica reduzida nas telas operacionais (dashboard preservada) */
.main .sgi-page-title,
.main .page-title,
.main .simple-title,
.main .hero-title {
    font-size: 1.68rem;
}

.main .sgi-form-title {
    font-size: 1.6rem;
}

.main .sgi-delete-title {
    font-size: 1.44rem;
}

.main .sgi-page-subtitle,
.main .page-subtitle,
.main .hero-sub,
.main .sgi-search-input,
.main .search-input,
.main .sgi-action-btn,
.main .sgi-form-btn,
.main .sgi-table-card,
.main .sgi-form-card,
.main .sgi-delete-card,
.main .box-card,
.main .simple-card,
.main .sgi-kpi-card,
.main .tir-kpi-card,
.main .sgi-field-label,
.main .sgi-unidade-label,
.main .sgi-form-card input,
.main .sgi-form-card select,
.main .sgi-form-card textarea,
.main .sgi-table-card .form-control,
.main .sgi-table-card .form-select,
.main .sgi-unidade-search-input,
.main .sgi-unidade-form-card input,
.main .sgi-unidade-form-card select,
.main .sgi-unidade-form-card textarea,
.main .simple-card input,
.main .simple-card select,
.main .simple-card textarea,
.main .box-card .form-control,
.main .box-card .form-select,
.main .box-card input,
.main .box-card select,
.main .box-card .btn,
.main .sgi-table-card .btn,
.main .page-head .btn,
.main .pagination .page-link {
    font-size: 0.8rem;
}

.main .sgi-table-card th,
.main .box-card th {
    font-size: 0.688rem;
}

.main .sgi-table-card .h5 {
    font-size: 1rem;
}

.main .sgi-table-card .h6 {
    font-size: 0.8rem;
}

.main .sgi-status-pill,
.main .status-chip {
    font-size: 0.624rem;
}

.main .result-title {
    font-size: 0.88rem;
}

.main .sgi-unidade-page .sgi-action-btn {
    font-size: 0.864rem;
}

.main .sgi-unidade-form-title {
    font-size: 1.2rem;
}

.main .sgi-unidade-close {
    font-size: 1.72rem;
}

.main .sgi-unidade-table tbody td {
    font-size: 0.8rem;
}

.main .sgi-unidade-table .sgi-status-pill {
    font-size: 0.688rem;
}

.main .sgi-kpi-card .sgi-kpi-value {
    font-size: 2.08rem;
}

.main .sgi-kpi-value.sgi-kpi-green,
.main .sgi-kpi-value.sgi-kpi-red,
.main .sgi-kpi-value.sgi-kpi-blue {
    font-size: 1.28rem;
}

.main .sgi-kpi-label,
.main .tir-kpi-label,
.main .tir-kpi-sub,
.main .sgi-pdd-alert {
    font-size: 0.784rem;
}

.main .tir-kpi-value {
    font-size: 2.24rem;
}

.sgi-unidade-head {
    margin-bottom: 1.2rem;
}

.sgi-unidade-search-wrap {
    max-width: 416px;
}

.sgi-unidade-search-input {
    height: 48px;
    border-color: #dbe1ea;
    border-radius: 12px;
    font-size: 0.92rem;
    color: #2f3b50;
}

.sgi-unidade-search-input::placeholder {
    color: #7a8799;
}

.sgi-unidade-table-card {
    border-radius: 22px;
    border-color: #d6deea;
}

.sgi-unidade-table thead th {
    background: #f3f6fb;
    color: #6a778c;
    padding-top: 1.2rem;
    padding-bottom: 1.2rem;
}

.sgi-unidade-table tbody td {
    padding-top: 1.35rem;
    padding-bottom: 1.35rem;
    font-size: 1rem;
    color: #233d63;
}

.sgi-unidade-table tbody tr {
    border-bottom: 1px solid #e0e6f0;
}

.sgi-unidade-table tbody tr:last-child {
    border-bottom: 0;
}

.sgi-unidade-table th:nth-child(1),
.sgi-unidade-table td:nth-child(1) {
    width: 13%;
}

.sgi-unidade-table th:nth-child(2),
.sgi-unidade-table td:nth-child(2) {
    width: 26%;
}

.sgi-unidade-table th:nth-child(3),
.sgi-unidade-table td:nth-child(3) {
    width: 15%;
}

.sgi-unidade-table th:nth-child(4),
.sgi-unidade-table td:nth-child(4) {
    width: 15%;
}

.sgi-unidade-table th:nth-child(5),
.sgi-unidade-table td:nth-child(5) {
    width: 17%;
}

.sgi-unidade-table th:nth-child(6),
.sgi-unidade-table td:nth-child(6) {
    width: 14%;
    text-align: center;
}

.sgi-unidade-table .sgi-status-pill {
    padding: 0.48rem 1rem;
    font-size: 0.86rem;
}

.sgi-unidade-table .sgi-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: #e9eef6;
    border-color: #d0d8e6;
    color: #4d6b95;
}

.sgi-unidade-table .sgi-icon-btn-danger {
    background: #fff2f2;
    border-color: #f0c7c7;
    color: #d46d6d;
}

.sgi-unidade-page .sgi-action-btn {
    min-height: 30px;
    min-width: 152px;
    border-radius: 13px;
    font-size: 1.08rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.36rem;
    text-align: center;
}

.sgi-unidade-page .sgi-action-btn .sgi-icon-plus {
    margin-right: 0;
}

.sgi-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--sgi-border);
    background: #f4f6fb;
    color: #5b6472;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.sgi-icon-btn:hover {
    background: #e3e8f0;
    color: #12284b;
}

.sgi-icon-btn svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

.sgi-icon-btn-danger {
    background: #fff2f2;
    color: #c0392b;
    border-color: #f5c6c6;
}

.sgi-icon-btn-danger:hover {
    background: #ffe0e0;
    color: #a02020;
}

.sgi-form-shell {
    max-width: 980px;
}

.sgi-unidade-form-shell {
    max-width: 100%;
}

.sgi-unidade-form-card {
    max-width: 100%;
    border-radius: 24px;
    padding: 1.85rem 1.95rem 1.5rem;
}

.sgi-unidade-form-title {
    font-size: 1.5rem;
    line-height: 1.04;
    color: #0f2a52;
}

.sgi-unidade-close {
    color: #7e8796;
    font-size: 2.15rem;
    line-height: 1;
    padding: 0;
    text-decoration: none;
}

.sgi-unidade-close:hover {
    color: #606a7a;
}

.sgi-unidade-form-grid {
    gap: 1.45rem 1.2rem;
}

.sgi-unidade-label {
    font-size: 0.98rem;
    margin-bottom: 0.5rem;
    color: #253a5a;
}

.sgi-unidade-form-card input,
.sgi-unidade-form-card select,
.sgi-unidade-form-card textarea {
    min-height: 44px;
    height: auto;
    border-radius: 10px;
    border-color: #d7deea;
    font-size: 0.8rem;
    line-height: 1.35;
    color: #2f3440;
    padding: 0.48rem 0.75rem;
}

.sgi-unidade-form-card textarea {
    min-height: 60px;
    height: auto;
}

.sgi-unidade-form-card select {
    min-height: 44px;
    line-height: 1.35;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    padding-right: 2rem;
}

.sgi-unidade-form-card input::placeholder,
.sgi-unidade-form-card textarea::placeholder {
    color: #9aa3af;
}

.sgi-unidade-form-actions {
    margin-top: 1.8rem;
}

.sgi-unidade-btn-cancel,
.sgi-unidade-btn-save {
    min-width: 156px;
    min-height: 72px;
    border-radius: 18px;
    font-size: 1.05rem;
    font-weight: 700;
}

.sgi-unidade-btn-cancel {
    background: #f2f4f8;
    border: 1px solid #e2e7ef;
    color: #1f2a3a;
}

.sgi-unidade-btn-cancel:hover {
    background: #e8edf4;
}

.sgi-unidade-btn-save {
    box-shadow: none;
}

.sgi-form-card {
    background: var(--sgi-card);
    border: 1px solid var(--sgi-border);
    border-radius: 22px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
    padding: 1.6rem 1.6rem 1.4rem;
}

.sgi-form-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--sgi-text);
    margin-bottom: 1.25rem;
}

.sgi-form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem 1.15rem;
}

.sgi-col-12 { grid-column: span 12; }
.sgi-col-6 { grid-column: span 6; }
.sgi-col-4 { grid-column: span 4; }
.sgi-col-3 { grid-column: span 3; }
.sgi-col-2 { grid-column: span 2; }

.sgi-field-label {
    display: block;
    margin-bottom: 0.45rem;
    color: #172c4d;
    font-weight: 700;
}

.sgi-field-label.required::after {
    content: " *";
    color: #d14545;
}

.sgi-form-card input,
.sgi-form-card select,
.sgi-form-card textarea,
.sgi-search-input {
    border-radius: var(--sgi-radius-md);
    border: 1px solid #dbe2ee;
}

.sgi-form-card input,
.sgi-form-card select,
.sgi-form-card textarea {
    padding: 0.82rem 1rem;
    font-size: 1rem;
}

.sgi-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.35rem;
}

.sgi-form-btn {
    min-width: 106px;
    border-radius: var(--sgi-radius-md);
    padding: 0.8rem 1.15rem;
    font-weight: 700;
}

.sgi-delete-card {
    max-width: 760px;
    background: var(--sgi-card);
    border: 1px solid var(--sgi-border);
    border-radius: var(--sgi-radius-lg);
    box-shadow: var(--sgi-shadow-card);
}

.sgi-delete-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--sgi-text);
    margin-bottom: 0.6rem;
}

.sgi-delete-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

@media (max-width: 991.98px) {
    body {
        overflow: auto;
    }

    .layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .sidebar-nav {
        max-height: 42vh;
    }

    .main {
        height: auto;
        padding: 1rem;
        overflow: visible;
    }

    .brand-title {
        font-size: 1.2rem;
    }

    .brand-icon {
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }

    .sidebar-footer {
        position: sticky;
        bottom: 0;
    }

    .sgi-col-6,
    .sgi-col-4,
    .sgi-col-3,
    .sgi-col-2 {
        grid-column: span 12;
    }
}

@media (max-width: 767.98px) {
    .sgi-page-head {
        flex-direction: column;
        align-items: stretch;
    }

    .sgi-search-wrap {
        max-width: 100%;
    }

    .sgi-action-btn {
        width: 80%;
        margin: 0 auto;
    }

    .sgi-unidade-search-input {
        height: 44px;
        font-size: 0.92rem;
    }

    .sgi-unidade-page .sgi-action-btn {
        width: 80%;
        min-height: 32px;
        min-width: 0;
        margin: 0 auto;
        font-size: 1rem;
    }

    .sgi-unidade-table tbody td {
        font-size: 0.95rem;
    }

    .sgi-unidade-form-card {
        padding: 1.2rem 1rem 1rem;
    }

    .sgi-unidade-form-title {
        font-size: 1.02rem;
    }

    .sgi-unidade-form-card input,
    .sgi-unidade-form-card select,
    .sgi-unidade-form-card textarea {
        min-height: 44px;
        height: auto;
        border-radius: 10px;
        font-size: 0.8rem;
    }

    .sgi-unidade-btn-cancel,
    .sgi-unidade-btn-save {
        min-height: 56px;
        min-width: 0;
        width: 100%;
        border-radius: 14px;
    }
}

@media (max-width: 575.98px) {
    .sidebar-head {
        padding: 1rem 0.9rem;
    }

    .sidebar-nav {
        padding: 0.8rem 0.6rem 0.8rem 0.7rem;
    }

    .menu-item,
    .menu-group summary {
        font-size: 0.72rem;
    }

    .main {
        padding: 0.8rem;
    }

    .sgi-page-title {
        font-size: 1.6rem;
    }

    .sgi-form-title,
    .sgi-delete-title {
        font-size: 1.5rem;
    }

    .sgi-form-card {
        padding: 1rem;
        border-radius: 16px;
    }

    .sgi-form-actions {
        flex-direction: column-reverse;
    }

    .sgi-form-btn,
    .sgi-delete-actions .btn {
        width: 100%;
    }
}
