.sgg-portal {
    min-height: 78vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px 18px;
    box-sizing: border-box;
    background: linear-gradient(135deg, #f6f7f7 0%, #ffffff 52%, #eef5fb 100%);
}

.sgg-portal-panel {
    width: 100%;
    max-width: 500px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.08);
    padding: 34px;
    box-sizing: border-box;
}

.sgg-portal-brand {
    margin-bottom: 24px;
}

.sgg-portal-brand span {
    display: inline-block;
    margin-bottom: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #1d2327;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.sgg-portal-brand h1 {
    margin: 0 0 8px;
    color: #1d2327;
    font-size: 30px;
    line-height: 1.12;
}

.sgg-portal-brand p,
.sgg-portal-note p,
.sgg-portal-userbox p {
    margin: 0 0 8px;
    color: #50575e;
}

.sgg-portal-error {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-left: 4px solid #d63638;
    background: #fdecec;
    color: #7a1515;
    font-weight: 600;
}

.sgg-portal-form label {
    display: block;
    margin-bottom: 15px;
    color: #1d2327;
    font-weight: 700;
}

.sgg-portal-form label span {
    display: block;
    margin-bottom: 6px;
}

.sgg-portal-form input[type="text"],
.sgg-portal-form input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #c3c4c7;
    border-radius: 9px;
    padding: 12px 13px;
    font-size: 16px;
    background: #fff;
}

.sgg-portal-remember {
    display: flex !important;
    gap: 8px;
    align-items: center;
    font-weight: 500 !important;
}

.sgg-portal-remember input {
    margin: 0;
}

.sgg-portal-remember span {
    margin: 0 !important;
}

.sgg-portal-submit,
.sgg-portal-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid #1d2327;
    background: #fff;
    color: #1d2327;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: .15s ease;
}

.sgg-portal-submit,
.sgg-portal-button-primary {
    width: 100%;
    border-color: #1d2327;
    background: #1d2327;
    color: #fff !important;
}

.sgg-portal-submit:hover,
.sgg-portal-button-primary:hover {
    background: #000;
    border-color: #000;
}

.sgg-portal-button:hover {
    background: #f6f7f7;
}

.sgg-portal-note {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #dcdcde;
    font-size: 13px;
}

.sgg-portal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.sgg-portal-actions .sgg-portal-button-primary {
    grid-column: 1 / -1;
}

.sgg-portal-userbox {
    padding: 14px;
    border-radius: 12px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
}

.sgg-portal-footer-actions {
    margin-top: 18px;
    text-align: center;
}

.sgg-portal-footer-actions a {
    color: #50575e;
}

@media (max-width: 640px) {
    .sgg-portal-panel {
        padding: 24px;
    }

    .sgg-portal-brand h1 {
        font-size: 25px;
    }

    .sgg-portal-actions {
        grid-template-columns: 1fr;
    }
}

/* Portal front-end completo */
body:has(.sgg-front-shell) {
    background: #f0f2f5;
}

body:has(.sgg-front-shell) .entry-title,
body:has(.sgg-front-shell) .page-title,
body:has(.sgg-front-shell) header.entry-header,
body:has(.sgg-front-shell) .site-header,
body:has(.sgg-front-shell) .site-footer {
    display: none !important;
}

body:has(.sgg-front-shell) .site,
body:has(.sgg-front-shell) .site-main,
body:has(.sgg-front-shell) .entry-content,
body:has(.sgg-front-shell) .wp-site-blocks,
body:has(.sgg-front-shell) main {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sgg-front-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    background: #f0f2f5;
    color: #1d2327;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sgg-front-sidebar {
    background: #111827;
    color: #fff;
    padding: 22px 18px;
    box-sizing: border-box;
    min-height: 100vh;
    position: sticky;
    top: 0;
    align-self: start;
}

.sgg-front-logo {
    padding: 12px 12px 18px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    margin-bottom: 18px;
}

.sgg-front-logo span {
    display: block;
    color: #9ca3af;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
}

.sgg-front-logo strong {
    display: block;
    margin-top: 4px;
    font-size: 24px;
    line-height: 1;
}

.sgg-front-menu-group {
    margin-bottom: 18px;
}

.sgg-front-menu-group h3 {
    margin: 0 0 8px;
    padding: 0 12px;
    color: #9ca3af;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
}

.sgg-front-menu a {
    display: block;
    color: #e5e7eb;
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 650;
}

.sgg-front-menu a:hover,
.sgg-front-menu a.is-active {
    background: #2563eb;
    color: #fff;
}

.sgg-front-main {
    min-width: 0;
}

.sgg-front-topbar {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 28px;
    background: #fff;
    border-bottom: 1px solid #dcdcde;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 30;
}

.sgg-front-topbar span {
    display: block;
    color: #646970;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.sgg-front-topbar strong {
    display: block;
    font-size: 22px;
    color: #1d2327;
}

.sgg-front-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.sgg-front-user a {
    color: #b42318;
    text-decoration: none;
    font-weight: 700;
}

.sgg-front-content {
    padding: 26px 28px 48px;
    box-sizing: border-box;
}

.sgg-front-content .wrap {
    margin: 0;
    max-width: 100%;
}

.sgg-front-content .wrap > h1:first-child {
    display: none;
}

.sgg-front-content .button,
.sgg-front-content button.button,
.sgg-front-content input.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid #2271b1;
    border-radius: 6px;
    background: #f6f7f7;
    color: #2271b1;
    text-decoration: none;
    font-weight: 650;
    cursor: pointer;
    line-height: 1.2;
}

.sgg-front-content .button-primary,
.sgg-front-content button.button-primary,
.sgg-front-content input.button-primary {
    background: #2271b1;
    color: #fff;
}

.sgg-front-content .button:hover {
    filter: brightness(.96);
}

.sgg-front-content table {
    border-collapse: collapse;
}

.sgg-front-content .widefat {
    width: 100%;
    background: #fff;
    border: 1px solid #dcdcde;
}

.sgg-front-content .widefat th,
.sgg-front-content .widefat td {
    padding: 9px 10px;
    border-bottom: 1px solid #dcdcde;
    vertical-align: top;
}

.sgg-front-content .widefat th {
    background: #f6f7f7;
    text-align: left;
    font-weight: 800;
}

.sgg-front-content input[type="text"],
.sgg-front-content input[type="email"],
.sgg-front-content input[type="number"],
.sgg-front-content input[type="date"],
.sgg-front-content input[type="url"],
.sgg-front-content input[type="password"],
.sgg-front-content select,
.sgg-front-content textarea {
    max-width: 100%;
    border: 1px solid #c3c4c7;
    border-radius: 7px;
    padding: 8px 10px;
    background: #fff;
    color: #1d2327;
    box-sizing: border-box;
}

.sgg-front-content .notice {
    background: #fff;
    border-left: 4px solid #00a32a;
    padding: 10px 12px;
    margin: 10px 0 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.sgg-front-content .notice-error {
    border-left-color: #d63638;
}

@media print {
    .sgg-front-sidebar,
    .sgg-front-topbar,
    .sgg-print-actions {
        display: none !important;
    }

    .sgg-front-shell {
        display: block;
        background: #fff;
    }

    .sgg-front-content {
        padding: 0;
    }
}

@media (max-width: 980px) {
    .sgg-front-shell {
        grid-template-columns: 1fr;
    }

    .sgg-front-sidebar {
        position: static;
        min-height: auto;
    }

    .sgg-front-menu {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .sgg-front-topbar {
        position: static;
    }
}

@media (max-width: 640px) {
    .sgg-front-content,
    .sgg-front-topbar {
        padding-left: 16px;
        padding-right: 16px;
    }

    .sgg-front-menu {
        grid-template-columns: 1fr;
    }

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


/* Ajuste v1.2.1 — portal em largura total no front-end */
body:has(.sgg-front-shell),
html:has(.sgg-front-shell) {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden;
}

body:has(.sgg-front-shell) .site-content,
body:has(.sgg-front-shell) .content-area,
body:has(.sgg-front-shell) .site-main,
body:has(.sgg-front-shell) .entry-content,
body:has(.sgg-front-shell) .entry,
body:has(.sgg-front-shell) .hentry,
body:has(.sgg-front-shell) .post,
body:has(.sgg-front-shell) .page,
body:has(.sgg-front-shell) .wp-block-post-content,
body:has(.sgg-front-shell) .wp-block-group,
body:has(.sgg-front-shell) .wp-block-group__inner-container,
body:has(.sgg-front-shell) .wp-site-blocks,
body:has(.sgg-front-shell) .site,
body:has(.sgg-front-shell) .container,
body:has(.sgg-front-shell) .ast-container,
body:has(.sgg-front-shell) .inside-article,
body:has(.sgg-front-shell) .entry-content-wrap,
body:has(.sgg-front-shell) .content-wrap,
body:has(.sgg-front-shell) main {
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.sgg-front-shell {
    width: 100vw !important;
    max-width: none !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    box-sizing: border-box;
}

.sgg-front-main {
    width: 100% !important;
    max-width: none !important;
}

.sgg-front-content {
    width: 100% !important;
    max-width: none !important;
}

.sgg-front-content .sgg-card,
.sgg-front-content .sgg-grid,
.sgg-front-content .sgg-table-responsive,
.sgg-front-content .widefat {
    max-width: none !important;
}


/* Ajuste v1.2.5 — modo aplicativo limpo: sem cabeçalho, título e rodapé do tema */
body.sgg-app-body,
body.sgg-app-body #sgg-app-root {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: 100vh !important;
    background: #f0f2f5 !important;
}

body.sgg-app-body .sgg-portal,
body.sgg-app-body .sgg-front-shell {
    min-height: 100vh !important;
}

/* Fallback para temas que ainda renderizem a página normal antes do template limpo */
body:has(.sgg-portal-login) .site-header,
body:has(.sgg-portal-login) .site-footer,
body:has(.sgg-portal-login) .entry-title,
body:has(.sgg-portal-login) .page-title,
body:has(.sgg-portal-login) header,
body:has(.sgg-portal-login) footer,
body:has(.sgg-portal-login) nav.wp-block-navigation,
body:has(.sgg-portal-login) .wp-block-site-title,
body:has(.sgg-portal-login) .wp-block-site-logo,
body:has(.sgg-portal-login) .wp-block-template-part,
body:has(.sgg-front-shell) .wp-block-site-title,
body:has(.sgg-front-shell) .wp-block-site-logo,
body:has(.sgg-front-shell) .wp-block-navigation,
body:has(.sgg-front-shell) .wp-block-template-part,
body:has(.sgg-front-shell) .site-title,
body:has(.sgg-front-shell) .site-branding,
body:has(.sgg-front-shell) .main-navigation,
body:has(.sgg-front-shell) #colophon,
body:has(.sgg-front-shell) #masthead {
    display: none !important;
}


/* Ajuste v1.2.6 — cards do Dashboard no portal em 4 colunas */
.sgg-front-content .sgg-grid-stats {
    grid-template-columns: repeat(4, minmax(190px, 1fr));
}

@media (max-width: 1400px) {
    .sgg-front-content .sgg-grid-stats {
        grid-template-columns: repeat(3, minmax(190px, 1fr));
    }
}

@media (max-width: 1100px) {
    .sgg-front-content .sgg-grid-stats {
        grid-template-columns: repeat(2, minmax(190px, 1fr));
    }
}

@media (max-width: 782px) {
    .sgg-front-content .sgg-grid-stats {
        grid-template-columns: 1fr;
    }
}


/* Menu lateral do sistema — versão 2.1 */
.sgg-front-shell {
    grid-template-columns: 230px minmax(0, 1fr);
}

.sgg-front-sidebar {
    padding: 18px 12px;
}

.sgg-front-logo {
    padding: 10px 9px 14px;
}

.sgg-front-logo span {
    font-size: 10px;
}

.sgg-front-logo strong {
    font-size: 22px;
}

.sgg-front-menu-group {
    margin-bottom: 14px;
}

.sgg-front-menu-group h3 {
    padding: 0 9px;
    font-size: 9px;
}

.sgg-front-menu a {
    padding: 7px 9px;
    border-radius: 8px;
    font-size: 12px;
}


/* Menu recolhível do sistema — versão 2.2 */
.sgg-front-shell {
    grid-template-columns: 68px minmax(0, 1fr);
    transition: grid-template-columns .18s ease;
}

.sgg-front-shell.is-sidebar-expanded {
    grid-template-columns: 230px minmax(0, 1fr);
}

.sgg-front-sidebar {
    padding: 14px 8px;
    overflow: hidden;
}

.sgg-sidebar-toggle {
    width: 34px;
    height: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 8px;
    background: rgba(255,255,255,.06);
    color: #fff;
    cursor: pointer;
}

.sgg-sidebar-toggle:hover {
    background: rgba(255,255,255,.13);
}

.sgg-sidebar-toggle .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
    line-height: 18px;
}

.sgg-front-logo {
    padding: 8px 4px 12px;
    text-align: center;
    margin-bottom: 12px;
}

.sgg-front-shell.is-sidebar-collapsed .sgg-front-logo span {
    display: none;
}

.sgg-front-shell.is-sidebar-collapsed .sgg-front-logo strong {
    font-size: 0;
    margin-top: 0;
}

.sgg-front-shell.is-sidebar-collapsed .sgg-front-logo strong::after {
    content: "SG";
    font-size: 15px;
    line-height: 1;
    letter-spacing: .04em;
}

.sgg-front-shell.is-sidebar-collapsed .sgg-front-menu-group {
    margin-bottom: 10px;
}

.sgg-front-shell.is-sidebar-collapsed .sgg-front-menu-group h3 {
    display: none;
}

.sgg-front-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sgg-front-menu a .dashicons {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    font-size: 18px;
    line-height: 18px;
}

.sgg-front-shell.is-sidebar-collapsed .sgg-front-menu a {
    justify-content: center;
    width: 42px;
    height: 36px;
    margin: 0 auto 6px;
    padding: 0;
    border-radius: 10px;
}

.sgg-front-shell.is-sidebar-collapsed .sgg-front-menu-label {
    display: none;
}

.sgg-front-shell.is-sidebar-expanded .sgg-front-sidebar {
    padding: 18px 12px;
}

.sgg-front-shell.is-sidebar-expanded .sgg-sidebar-toggle {
    margin-left: 9px;
    margin-right: auto;
}

.sgg-front-shell.is-sidebar-expanded .sgg-front-logo {
    text-align: left;
    padding: 10px 9px 14px;
}

.sgg-front-shell.is-sidebar-expanded .sgg-front-menu-group h3 {
    display: block;
}

.sgg-front-shell.is-sidebar-expanded .sgg-front-menu a {
    justify-content: flex-start;
}

@media (max-width: 980px) {
    .sgg-front-shell,
    .sgg-front-shell.is-sidebar-expanded,
    .sgg-front-shell.is-sidebar-collapsed {
        grid-template-columns: 1fr;
    }

    .sgg-front-shell.is-sidebar-collapsed .sgg-front-menu-label {
        display: inline;
    }

    .sgg-front-shell.is-sidebar-collapsed .sgg-front-menu a {
        width: auto;
        height: auto;
        justify-content: flex-start;
        padding: 7px 9px;
        margin: 0;
    }

    .sgg-front-shell.is-sidebar-collapsed .sgg-front-menu-group h3 {
        display: block;
    }

    .sgg-sidebar-toggle {
        display: none;
    }
}
