:root {
    --sg-primary: #1e3966;
    --sg-primary-dark: #142947;
    --sg-primary-soft: #edf2f8;
    --sg-accent: #f37021;
    --sg-accent-dark: #d95b0c;
    --sg-bg: #f6f7f8;
    --sg-surface: #ffffff;
    --sg-text: #13181f;
    --sg-muted: #657286;
    --sg-border: #e1e6ec;
    --sg-success: #16835f;
    --sg-warning: #bd750d;
    --sg-danger: #c43d4b;
    --sg-radius: 12px;
    --sg-shadow: 0 8px 28px rgba(30, 57, 102, .08);
}

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

body.sg-app,
body.sg-login {
    color: var(--sg-text);
    background: var(--sg-bg) !important;
    font-family: "Lexend", "Helvetica Neue", Arial, sans-serif;
    font-weight: 400;
}

a {
    color: var(--sg-primary);
}

a:hover,
a:focus {
    color: var(--sg-accent-dark);
}

.sg-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Login */
.sg-login {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.sg-login-shell {
    display: grid;
    width: 100%;
    min-height: 100vh;
    grid-template-columns: minmax(340px, 44%) 1fr;
}

.sg-login-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: clamp(36px, 6vw, 84px);
    color: #fff;
    background:
        radial-gradient(circle at 15% 15%, rgba(243, 112, 33, .24), transparent 32%),
        linear-gradient(145deg, var(--sg-primary-dark), var(--sg-primary));
}

.sg-login-brand::after {
    position: absolute;
    right: -18%;
    bottom: -16%;
    width: 440px;
    height: 440px;
    content: "";
    border: 70px solid rgba(255, 255, 255, .05);
    border-radius: 50%;
}

.sg-login-wordmark,
.sg-login-copy,
.sg-login-brand-footer {
    position: relative;
    z-index: 1;
}

.sg-login-wordmark {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #fff;
}

.sg-login-wordmark .sg-login-wordmark-mark {
    display: flex;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border-radius: 15px;
    background: var(--sg-accent);
    box-shadow: 0 6px 16px rgba(243, 112, 33, .28);
}

.sg-login-wordmark-mark svg {
    display: block;
    width: 36px;
    height: 36px;
    fill: #fff;
}

.sg-login-wordmark-text {
    display: block;
}

.sg-login-wordmark-text strong {
    display: block;
    font-size: 22px;
    letter-spacing: .02em;
    line-height: 1.2;
}

.sg-login-wordmark-text span {
    display: block;
    margin-top: 5px;
    color: rgba(255, 255, 255, .68);
    font-size: 13px;
    line-height: 1.25;
}

.sg-login-copy {
    max-width: 560px;
}

.sg-login-eyebrow {
    margin-bottom: 18px;
    color: #f9ad7d;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.sg-login-copy h1 {
    margin: 0 0 18px;
    color: #fff;
    font-size: clamp(34px, 4vw, 56px);
    font-weight: 700;
    line-height: 1.08;
}

.sg-login-copy p {
    max-width: 490px;
    margin: 0;
    color: rgba(255, 255, 255, .74);
    font-size: 16px;
    line-height: 1.7;
}

.sg-login-brand-footer {
    color: rgba(255, 255, 255, .55);
    font-size: 12px;
}

.sg-login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 42px 28px;
    background: var(--sg-bg);
}

.sg-login-card {
    width: 100%;
    max-width: 430px;
}

.sg-login-logo {
    display: flex;
    min-height: 64px;
    align-items: center;
    margin-bottom: 34px;
}

.sg-login-logo img {
    width: auto;
    max-width: 280px;
    max-height: 76px;
    object-fit: contain;
}

.sg-login-heading {
    margin-bottom: 28px;
}

.sg-login-heading h2 {
    margin: 0 0 8px;
    color: var(--sg-text);
    font-size: 28px;
    font-weight: 700;
}

.sg-login-heading p {
    margin: 0;
    color: var(--sg-muted);
    line-height: 1.6;
}

.sg-login .alert {
    border: 0;
    border-radius: 10px;
}

.sg-field {
    margin-bottom: 18px;
}

.sg-field label {
    display: block;
    margin-bottom: 8px;
    color: #344154;
    font-size: 13px;
    font-weight: 600;
}

.sg-input-wrap {
    position: relative;
}

.sg-input-wrap > i {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 15px;
    color: #8490a1;
    transform: translateY(-50%);
}

.sg-login .sg-input-wrap .form-control {
    height: 50px;
    padding: 10px 15px 10px 43px;
    border: 1px solid var(--sg-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: none;
    color: var(--sg-text);
    font-size: 14px;
}

.sg-login .sg-input-wrap .form-control:focus {
    border-color: var(--sg-primary);
    box-shadow: 0 0 0 3px rgba(30, 57, 102, .10);
}

.sg-login-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 26px;
}

.sg-btn-primary {
    min-height: 48px;
    border: 0;
    border-radius: 10px;
    background: var(--sg-primary);
    color: #fff;
    font-weight: 600;
    transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.sg-btn-primary:hover,
.sg-btn-primary:focus {
    background: var(--sg-primary-dark);
    box-shadow: 0 8px 18px rgba(30, 57, 102, .18);
    color: #fff;
    transform: translateY(-1px);
}

.sg-login-link {
    color: var(--sg-primary);
    font-size: 13px;
    font-weight: 600;
}

.sg-login-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 24px;
    color: var(--sg-muted);
    font-size: 13px;
}

/* Main shell */
.sg-app .wrapper,
.sg-app .content-wrapper,
.sg-app .main-footer {
    background: var(--sg-bg);
}

.sg-app .main-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 68px;
    background: var(--sg-surface);
    box-shadow: 0 1px 0 var(--sg-border);
}

.sg-app .main-header .logo {
    display: flex;
    width: 250px;
    height: 68px;
    align-items: center;
    justify-content: center;
    padding: 9px 20px;
    background: var(--sg-primary-dark) !important;
}

.sg-app .main-header .logo:hover {
    background: var(--sg-primary-dark) !important;
}

.sg-app .main-header .logo .logo-lg,
.sg-app .main-header .logo .logo-mini {
    width: 100%;
}

.sg-app .main-header .logo img {
    width: auto;
    max-width: 100%;
    max-height: 48px;
    margin: 0 auto;
    filter: brightness(0) invert(1);
    object-fit: contain;
}

.sg-app .main-header .logo .logo-mini img {
    filter: none;
}

.sg-app .main-header .logo .sg-logo-fallback {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .05em;
}

.sg-app .main-header .navbar {
    min-height: 68px;
    margin-left: 250px;
    background: #fff !important;
}

.sg-app .main-header .sidebar-toggle {
    display: flex;
    width: 68px;
    height: 68px;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--sg-primary) !important;
}

.sg-app .main-header .sidebar-toggle:hover,
.sg-app .main-header .sidebar-toggle:focus {
    background: var(--sg-primary-soft) !important;
}

.sg-app .main-header .sidebar-toggle::before {
    font-size: 18px;
}

.sg-header-title {
    display: inline-flex;
    height: 68px;
    align-items: center;
    color: var(--sg-muted);
    font-size: 13px;
}

.sg-header-title strong {
    margin-left: 5px;
    color: var(--sg-text);
    font-weight: 600;
}

.sg-app .navbar-custom-menu > .navbar-nav > li > a {
    height: 68px;
    padding-top: 14px;
    padding-bottom: 14px;
    color: var(--sg-text);
}

.sg-company-trigger {
    display: flex !important;
    align-items: center;
    gap: 10px;
}

.sg-company-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 9px;
    background: var(--sg-primary-soft);
    color: var(--sg-primary);
}

.sg-company-meta {
    display: block;
    max-width: 250px;
    line-height: 1.25;
}

.sg-company-meta strong,
.sg-company-meta small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sg-company-meta strong {
    font-size: 12px;
}

.sg-company-meta small {
    margin-top: 3px;
    color: var(--sg-muted);
    font-size: 10px;
}

.sg-app .main-header .user-image {
    width: 36px;
    height: 36px;
    margin-top: 2px;
    object-fit: cover;
}

.sg-user-name {
    display: inline-block;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
}

.sg-app .navbar-nav > .user-menu > .dropdown-menu {
    width: 280px;
    border: 1px solid var(--sg-border);
    border-radius: 0 0 12px 12px;
    box-shadow: var(--sg-shadow);
}

.sg-app .navbar-nav > .user-menu > .dropdown-menu > .user-header {
    height: auto;
    padding: 24px;
    background: var(--sg-primary);
}

.sg-app .navbar-nav > .user-menu > .dropdown-menu > .user-footer {
    padding: 12px;
    background: #fff;
}

.sg-app .dropdown-menu {
    border: 1px solid var(--sg-border);
    box-shadow: var(--sg-shadow);
}

.sg-app .main-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 250px;
    padding-top: 68px;
    background: var(--sg-primary-dark) !important;
}

.sg-app .sidebar {
    /* AdminLTE removes this height inline when the layout is not `fixed`.
       Keep the scrolling viewport bounded so menu entries never go behind
       the bottom edge on short displays. */
    height: calc(100vh - 68px) !important;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 18px 12px 26px;
}

.sg-app .sidebar-menu > li.header {
    padding: 16px 12px 8px;
    background: transparent !important;
    color: rgba(255, 255, 255, .44) !important;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.sg-app .sidebar-menu > li > a,
.sg-app .sidebar-menu .treeview-menu > li > a {
    border: 0 !important;
    border-radius: 8px;
    color: rgba(255, 255, 255, .78) !important;
    font-size: 13px;
    transition: background .18s ease, color .18s ease;
}

.sg-app .sidebar-menu > li > a {
    margin-bottom: 4px;
    padding: 12px 40px 12px 12px;
}

.sg-app .sidebar-menu > li.treeview > a > span:not(.pull-right-container) {
    display: inline-block;
    max-width: calc(100% - 24px);
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
}

.sg-app .sidebar-menu > li:hover > a,
.sg-app .sidebar-menu > li.active > a,
.sg-app .sidebar-menu > li.menu-open > a {
    background: rgba(255, 255, 255, .10) !important;
    color: #fff !important;
}

.sg-app .sidebar-menu .treeview-menu {
    margin: 2px 0 8px;
    padding: 5px 0 5px 12px;
    background: transparent !important;
    border-left: 1px solid rgba(255, 255, 255, .12);
}

.sg-app .sidebar-menu .treeview-menu > li > a {
    padding: 9px 10px 9px 14px;
}

.sg-app .sidebar-menu .treeview-menu > li > a:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff !important;
}

.sg-app .sidebar-menu li > a > .fa:first-child {
    width: 20px;
    color: #f6a675;
}

.sg-app .content-wrapper {
    min-height: calc(100vh - 68px) !important;
    margin-top: 68px;
    margin-left: 250px;
}

.sg-app .content {
    padding: 24px;
}

.sg-app .main-footer {
    margin-left: 250px;
    padding: 16px 24px;
    border-top: 1px solid var(--sg-border);
    color: var(--sg-muted);
    font-size: 12px;
}

.sg-app .main-footer a {
    font-weight: 600;
}

/* Dashboard and system tabs */
.sg-workspace {
    overflow: hidden;
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius);
    background: var(--sg-surface);
    box-shadow: var(--sg-shadow);
}

.sg-workspace-tabs {
    padding: 10px 14px 0;
    border-bottom: 1px solid var(--sg-border);
    background: #f4f6f9;
}

.sg-workspace-tabs .nav-tabs,
#abasSistemas.nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    border: 0 !important;
}

.sg-workspace-tabs .nav-tabs > li,
#abasSistemas.nav-tabs > li {
    float: none !important;
    margin: 0 0 -1px !important;
    border: 0 !important;
}

.sg-workspace-tabs .nav-tabs > li > a,
#abasSistemas.nav-tabs > li > a {
    display: flex !important;
    height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 !important;
    padding: 0 14px !important;
    border: 1px solid transparent !important;
    border-bottom: 0 !important;
    border-radius: 10px 10px 0 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--sg-muted) !important;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.sg-workspace-tabs .nav-tabs > li,
#abasSistemas.nav-tabs > li {
    display: flex;
    align-items: stretch;
}

.sg-workspace-tabs .nav-tabs > li > a,
#abasSistemas.nav-tabs > li > a {
    justify-content: center;
}

.sg-workspace-tabs .nav-tabs > li > a > span,
#abasSistemas.nav-tabs > li > a > span {
    display: inline-flex;
    height: 20px;
    align-items: center;
    line-height: 20px;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

.sg-workspace-tabs .nav-tabs > li > a > i,
#abasSistemas.nav-tabs > li > a > i {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.sg-workspace-tabs .nav-tabs > li > a > i:first-child,
#abasSistemas.nav-tabs > li > a > i:first-child {
    color: #8a96a8;
    font-size: 13px;
}

.sg-workspace-tabs .nav-tabs > li > a:hover,
#abasSistemas.nav-tabs > li > a:hover {
    border-color: #d7dde6 !important;
    background: rgba(255, 255, 255, .7) !important;
    color: var(--sg-primary) !important;
}

.sg-workspace-tabs .nav-tabs > li.active > a,
.sg-workspace-tabs .nav-tabs > li.active > a:hover,
.sg-workspace-tabs .nav-tabs > li.active > a:focus,
#abasSistemas.nav-tabs > li.active > a,
#abasSistemas.nav-tabs > li.active > a:hover,
#abasSistemas.nav-tabs > li.active > a:focus {
    border-color: var(--sg-border) !important;
    border-bottom-color: #fff !important;
    background: #fff !important;
    color: var(--sg-primary) !important;
    box-shadow: inset 0 3px 0 var(--sg-accent) !important;
}

.sg-workspace-tabs .nav-tabs > li.active > a > i:first-child,
#abasSistemas.nav-tabs > li.active > a > i:first-child {
    color: var(--sg-accent);
}

.sg-workspace-tabs .iconeFecharTab,
#abasSistemas .iconeFecharTab {
    display: inline-flex !important;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    margin: 0 0 0 2px !important;
    border-radius: 50%;
    color: #97a2b2 !important;
    font-size: 11px !important;
    line-height: 1;
    vertical-align: middle;
    transition: background .15s ease, color .15s ease;
}

.sg-workspace-tabs .iconeFecharTab:hover,
#abasSistemas .iconeFecharTab:hover {
    background: rgba(196, 61, 75, .12);
    color: var(--sg-danger) !important;
}

.sg-workspace-body {
    min-height: 430px;
    padding: 26px;
}

.sg-dashboard-welcome {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.sg-dashboard-eyebrow {
    margin-bottom: 7px;
    color: var(--sg-accent-dark);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.sg-dashboard-welcome h1 {
    margin: 0 0 7px;
    color: var(--sg-text);
    font-size: 25px;
    font-weight: 700;
}

.sg-dashboard-welcome p {
    margin: 0;
    color: var(--sg-muted);
    font-size: 13px;
}

.sg-dashboard-date {
    color: var(--sg-muted);
    font-size: 12px;
}

.sg-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.sg-metric-card {
    position: relative;
    display: block;
    overflow: hidden;
    min-height: 138px;
    padding: 20px;
    border: 1px solid var(--sg-border);
    border-radius: 12px;
    background: #fff;
    color: var(--sg-text);
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.sg-metric-card:hover,
.sg-metric-card:focus {
    border-color: #bdc9d8;
    box-shadow: 0 10px 24px rgba(30, 57, 102, .10);
    color: var(--sg-text);
    transform: translateY(-2px);
}

.sg-metric-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    margin-bottom: 17px;
    border-radius: 10px;
    background: var(--sg-primary-soft);
    color: var(--sg-primary);
    font-size: 16px;
}

.sg-metric-card:nth-child(2) .sg-metric-icon {
    background: #e9f7f2;
    color: var(--sg-success);
}

.sg-metric-card:nth-child(3) .sg-metric-icon {
    background: #fff5e5;
    color: var(--sg-warning);
}

.sg-metric-card:nth-child(4) .sg-metric-icon {
    background: #fff0f1;
    color: var(--sg-danger);
}

.sg-metric-value {
    display: block;
    color: var(--sg-text);
    font-size: 27px;
    font-weight: 700;
    line-height: 1;
}

.sg-metric-label {
    display: block;
    margin-top: 7px;
    color: var(--sg-muted);
    font-size: 11px;
}

.sg-metric-arrow {
    position: absolute;
    right: 18px;
    bottom: 18px;
    color: #a4adba;
}

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

.sg-card {
    border: 1px solid var(--sg-border);
    border-radius: 12px;
    background: #fff;
}

.sg-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--sg-border);
}

.sg-card-header h2 {
    margin: 0;
    color: var(--sg-text);
    font-size: 14px;
    font-weight: 650;
}

.sg-card-header i {
    margin-right: 7px;
    color: var(--sg-accent);
}

.sg-news-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sg-news-item {
    padding: 17px 20px;
    border-bottom: 1px solid #edf0f3;
}

.sg-news-item:last-child {
    border-bottom: 0;
}

.sg-news-item-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 7px;
}

.sg-news-item strong {
    color: #293448;
    font-size: 12px;
}

.sg-news-item time,
.sg-news-item p {
    color: var(--sg-muted);
    font-size: 11px;
}

.sg-news-item p {
    margin: 0;
    line-height: 1.55;
}

.sg-empty-state {
    padding: 45px 20px;
    color: var(--sg-muted);
    text-align: center;
}

.sg-empty-state i {
    display: block;
    margin-bottom: 10px;
    color: #aeb7c3;
    font-size: 27px;
}

.sg-quick-links {
    display: grid;
    gap: 9px;
    padding: 14px;
}

.sg-quick-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px;
    border-radius: 9px;
    color: #344154;
    font-size: 12px;
    font-weight: 500;
}

.sg-quick-link:hover,
.sg-quick-link:focus {
    background: var(--sg-primary-soft);
    color: var(--sg-primary);
}

.sg-quick-link i {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 8px;
    background: #f1f4f7;
    color: var(--sg-primary);
}

/* Company selection */
.sg-company-page {
    min-height: calc(100vh - 149px);
    padding: 32px 24px;
}

.sg-company-select {
    max-width: 860px;
    margin: 0 auto;
}

.sg-company-select-head {
    margin-bottom: 24px;
}

.sg-company-select-head h1 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
}

.sg-company-select-head p {
    margin: 0;
    color: var(--sg-muted);
}

.sg-company-list {
    display: grid;
    gap: 12px;
}

.sg-company-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border: 1px solid var(--sg-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(30, 57, 102, .04);
    cursor: pointer;
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.sg-company-option:hover,
.sg-company-option:focus {
    border-color: #bcc8d6;
    box-shadow: var(--sg-shadow);
    transform: translateY(-1px);
}

.sg-company-option-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sg-company-option-icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 10px;
    background: var(--sg-primary-soft);
    color: var(--sg-primary);
}

.sg-company-option strong,
.sg-company-option small {
    display: block;
}

.sg-company-option strong {
    margin-bottom: 4px;
    color: var(--sg-text);
}

.sg-company-option small {
    color: var(--sg-muted);
}

/* Keep legacy component surfaces consistent */
.sg-app .panel,
.sg-app .box {
    border-color: var(--sg-border);
    box-shadow: none;
}

.sg-app .panel {
    border-radius: 10px;
}

.sg-app .panel-heading {
    border-color: var(--sg-border);
    border-radius: 10px 10px 0 0;
    background: #f9fafb;
    color: var(--sg-text);
}

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

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

.sg-app .pagination > .active > a,
.sg-app .pagination > .active > a:hover {
    border-color: var(--sg-primary);
    background: var(--sg-primary);
}

.sg-app .form-control:focus,
.sg-app .select2-container--focus .select2-selection {
    border-color: var(--sg-primary) !important;
    box-shadow: 0 0 0 2px rgba(30, 57, 102, .08);
}

/* CRUD opt-in */
.sg-crud.panel,
.sg-crud .panel {
    overflow: hidden;
    margin: 0;
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius);
    background: var(--sg-surface);
    box-shadow: 0 5px 20px rgba(30, 57, 102, .06);
}

.sg-crud .panel-heading,
.sg-crud > .panel-heading {
    min-height: 65px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--sg-border);
    border-radius: 0;
    background: #fbfcfd;
}

.sg-crud__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.sg-crud__search {
    position: relative;
    width: 100%;
    max-width: 330px;
}

.sg-crud__search > i {
    position: absolute;
    top: 50%;
    left: 13px;
    color: #8793a3;
    transform: translateY(-50%);
}

.sg-crud__search .form-control {
    height: 40px;
    padding-left: 38px;
    border-color: var(--sg-border);
    border-radius: 9px;
    box-shadow: none;
    font-size: 12px;
}

.sg-crud__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.sg-crud .sg-crud__btn {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 13px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.sg-crud .sg-crud__btn:hover,
.sg-crud .sg-crud__btn:focus {
    transform: translateY(-1px);
}

.sg-crud .sg-crud__btn--primary {
    border-color: var(--sg-primary);
    background: var(--sg-primary);
    color: #fff;
}

.sg-crud .sg-crud__btn--primary:hover,
.sg-crud .sg-crud__btn--primary:focus {
    border-color: var(--sg-primary-dark);
    background: var(--sg-primary-dark);
    color: #fff;
}

.sg-crud .sg-crud__btn--danger {
    border-color: #f2c7cd;
    background: #fff5f6;
    color: var(--sg-danger);
}

.sg-crud .sg-crud__btn--danger:hover,
.sg-crud .sg-crud__btn--danger:focus {
    border-color: #e8aab2;
    background: #ffebed;
    color: #a62f3c;
}

.sg-crud .sg-crud__btn--secondary {
    border-color: var(--sg-border);
    background: #fff;
    color: #405069;
}

.sg-crud .sg-crud__btn--secondary:hover,
.sg-crud .sg-crud__btn--secondary:focus {
    border-color: #bdc7d3;
    background: var(--sg-primary-soft);
    color: var(--sg-primary);
}

.sg-crud__body,
.sg-crud > .panel-body {
    padding: 0;
}

.sg-crud__table-wrap {
    width: 100%;
    overflow-x: auto;
}

.sg-crud table.dataTable,
.sg-crud .sg-crud__table {
    width: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-collapse: collapse !important;
}

.sg-crud .sg-crud__table > thead > tr > th {
    padding: 12px 14px;
    border: 0 !important;
    border-bottom: 1px solid var(--sg-border) !important;
    background: #f7f9fb;
    color: #667387;
    font-size: 9px !important;
    font-weight: 700;
    letter-spacing: .075em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sg-crud .sg-crud__table > tbody > tr > td {
    padding: 12px 14px;
    border: 0 !important;
    border-bottom: 1px solid #edf0f4 !important;
    background: #fff;
    color: #344154;
    font-size: 11px !important;
}

.sg-crud .sg-crud__table > tbody > tr:hover > td {
    background: #f8fafd;
}

.sg-crud .sg-crud__table > tbody > tr:last-child > td {
    border-bottom: 0 !important;
}

.sg-crud__checkbox-cell {
    width: 42px;
    text-align: center;
}

.sg-crud__checkbox {
    width: 16px;
    height: 16px;
    margin: 0 !important;
    accent-color: var(--sg-primary);
    cursor: pointer;
}

.sg-crud__row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.sg-crud .sg-crud__icon-btn {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 7px;
    font-size: 12px;
}

.sg-crud__badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 650;
}

.sg-crud__badge::before {
    width: 5px;
    height: 5px;
    content: "";
    border-radius: 50%;
    background: currentColor;
}

.sg-crud__badge--active {
    background: #eaf7f2;
    color: var(--sg-success);
}

.sg-crud__badge--inactive {
    background: #f0f2f5;
    color: #687588;
}

.sg-crud .dataTables_wrapper {
    padding-bottom: 0;
}

.sg-crud .dataTables_wrapper > .row {
    margin: 0;
    padding: 12px 14px;
}

.sg-crud .dataTables_wrapper > .row:first-child {
    display: none;
}

.sg-crud .dataTables_wrapper > .row:last-child {
    border-top: 1px solid var(--sg-border);
    background: #fbfcfd;
}

.sg-crud .dataTables_info {
    padding-top: 8px !important;
    color: var(--sg-muted);
    font-size: 10px;
}

.sg-crud .pagination {
    margin: 0;
}

.sg-crud .pagination > li > a {
    min-width: 32px;
    border-color: var(--sg-border);
    color: #4f5e72;
    font-size: 10px;
    text-align: center;
}

.sg-crud--form .panel-heading {
    display: flex;
    justify-content: flex-end;
}

.sg-crud__form-body {
    padding: 20px;
}

.sg-crud__tabs.nav-tabs-custom {
    margin: 0;
    box-shadow: none;
}

.sg-crud__tabs.nav-tabs-custom > .nav-tabs {
    border-bottom: 1px solid var(--sg-border);
}

.sg-crud__tabs.nav-tabs-custom > .nav-tabs > li {
    margin: 0 4px 0 0;
    border-top: 0;
}

.sg-crud__tabs.nav-tabs-custom > .nav-tabs > li > a {
    padding: 11px 14px;
    border: 0;
    border-bottom: 3px solid transparent;
    color: var(--sg-muted);
    font-size: 11px;
    font-weight: 600;
}

.sg-crud__tabs.nav-tabs-custom > .nav-tabs > li.active > a,
.sg-crud__tabs.nav-tabs-custom > .nav-tabs > li > a:hover {
    border-bottom-color: var(--sg-accent);
    background: transparent;
    color: var(--sg-primary);
}

.sg-crud__tabs .tab-content {
    padding: 20px 4px 4px;
}

.sg-crud__section {
    margin-bottom: 22px;
    padding-bottom: 6px;
    border-bottom: 1px solid #edf0f4;
}

.sg-crud__section:last-child {
    margin-bottom: 0;
    border-bottom: 0;
}

.sg-crud__section-title {
    margin: 0 0 15px;
    color: var(--sg-primary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.sg-crud__field {
    margin-bottom: 16px;
}

.sg-crud__field label {
    display: block;
    margin-bottom: 7px;
    color: #4d5a6e;
    font-size: 10px;
    font-weight: 650;
}

.sg-crud__field .form-control {
    height: 40px;
    border-color: var(--sg-border);
    border-radius: 8px;
    box-shadow: none;
    color: var(--sg-text);
    font-size: 11px;
}

.sg-crud__field .input-group .form-control {
    border-radius: 8px 0 0 8px;
}

.sg-crud__field .input-group-addon {
    min-width: 40px;
    border-color: var(--sg-border);
    border-radius: 0 8px 8px 0;
    background: #f7f9fb;
    color: var(--sg-muted);
}

.sg-crud__field .select2-container .select2-selection--single {
    height: 40px;
    border-color: var(--sg-border);
    border-radius: 8px !important;
}

.sg-crud__field .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 12px;
    line-height: 38px;
}

.sg-crud__field .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px;
}

.sg-crud__company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 9px;
}

.sg-crud__company {
    display: flex !important;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    margin: 0 !important;
    padding: 10px 12px;
    border: 1px solid var(--sg-border);
    border-radius: 8px;
    background: #fff;
    color: #344154 !important;
    cursor: pointer;
    font-size: 10px !important;
    font-weight: 500 !important;
}

.sg-crud__company:hover {
    border-color: #bdc8d5;
    background: #f9fbfd;
}

.sg-crud__company input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--sg-primary);
}

.sg-crud__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 64px;
    padding: 12px 18px;
    border-top: 1px solid var(--sg-border);
    background: #fbfcfd;
}

@media (max-width: 767px) {
    .sg-crud__toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .sg-crud__search {
        max-width: none;
    }

    .sg-crud__actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .sg-crud__actions .sg-crud__btn {
        flex: 1;
    }

    .sg-crud__form-body {
        padding: 14px;
    }

    .sg-crud__tabs .tab-content {
        padding: 16px 0 0;
    }
}

/* BI dashboard */
.sg-bi-workspace { background: linear-gradient(180deg, #fff 0%, #fbfcff 100%); }
.sg-bi-hero { position: relative; display: flex; justify-content: space-between; gap: 30px; overflow: hidden; padding: 30px 32px; border-radius: 15px; color: #fff; background: linear-gradient(116deg, #142947 0%, #1e3966 56%, #275280 100%); box-shadow: 0 15px 30px rgba(20,41,71,.18); }
.sg-bi-hero-copy,.sg-bi-hero-actions { position: relative; z-index: 1; }.sg-bi-kicker { display:block; margin-bottom: 11px; color:#f7b689; font-size:10px; font-weight:700; letter-spacing:.13em; text-transform:uppercase; }.sg-bi-kicker i { margin-right:7px; font-size:7px; }.sg-bi-hero h1 { margin:0 0 8px; color:#fff; font-size:27px; font-weight:700; }.sg-bi-hero p { max-width:650px; margin:0; color:rgba(255,255,255,.75); font-size:13px; line-height:1.6; }.sg-bi-hero-actions { display:flex; flex-direction:column; align-items:flex-end; justify-content:center; gap:12px; white-space:nowrap; }.sg-bi-live { color:rgba(255,255,255,.72); font-size:11px; }.sg-bi-live i { margin-right:5px; color:#65d6ae; }.sg-bi-filter { border:1px solid rgba(255,255,255,.24); border-radius:8px; padding:9px 13px; background:rgba(255,255,255,.12); color:#fff; font:600 11px "Lexend",sans-serif; transition:.2s; }.sg-bi-filter:hover { background:#fff; color:var(--sg-primary); }.sg-bi-filter.is-loading i { animation:sg-spin .7s linear infinite; }.sg-bi-orbit { position:absolute; border:1px solid rgba(255,255,255,.1); border-radius:50%; }.sg-bi-orbit-one { width:340px; height:340px; top:-190px; right:90px; }.sg-bi-orbit-two { width:230px; height:230px; right:-45px; bottom:-125px; border-width:35px; }
.sg-bi-toolbar { display:flex; align-items:center; justify-content:space-between; margin:22px 0 16px; color:var(--sg-muted); font-size:11px; }.sg-bi-toolbar strong { margin-right:8px; color:var(--sg-text); font-size:13px; }.sg-bi-segmented { display:flex; gap:3px; padding:3px; border:1px solid var(--sg-border); border-radius:9px; background:#fff; }.sg-bi-segmented button { border:0; border-radius:6px; padding:6px 10px; background:transparent; color:var(--sg-muted); font:600 10px "Lexend",sans-serif; }.sg-bi-segmented button.active { background:var(--sg-primary); color:#fff; }
.sg-bi-metrics { margin-bottom:18px; }.sg-bi-metric-card { min-height:154px; }.sg-bi-metric-card .sg-metric-icon { margin-bottom:13px; }.sg-bi-trend { position:absolute; top:21px; right:18px; font-size:9px; font-weight:700; }.sg-bi-trend.positive { color:var(--sg-success); }.sg-bi-trend.neutral { color:var(--sg-warning); }.sg-bi-trend i { margin-right:3px; }.sg-bi-spark { position:absolute; right:20px; bottom:43px; width:53px; height:22px; opacity:.7; background:linear-gradient(135deg,transparent 0 15%,currentColor 16% 20%,transparent 21% 35%,currentColor 36% 40%,transparent 41% 52%,currentColor 53% 58%,transparent 59% 72%,currentColor 73% 78%,transparent 79%); clip-path:polygon(0 70%,20% 50%,38% 65%,58% 20%,76% 45%,100% 0,100% 100%,0 100%); }.sg-bi-spark-blue {color:#7d9fc8;background:#dce8f6}.sg-bi-spark-green {color:#60b99d;background:#dff3eb}.sg-bi-spark-orange {color:#f0a158;background:#fff0dd}.sg-bi-spark-red {color:#d9848d;background:#fce4e6}
.sg-bi-dashboard-grid { display:grid; grid-template-columns:minmax(0,1.8fr) minmax(270px,.85fr); gap:18px; margin-bottom:18px; }.sg-bi-chart-card .sg-card-header,.sg-bi-distribution-card .sg-card-header,.sg-bi-bottom-grid .sg-card-header { align-items:flex-start; }.sg-card-header p { margin:5px 0 0; color:var(--sg-muted); font-size:10px; }.sg-bi-chart-wrap { height:270px; padding:20px 20px 12px; }.sg-bi-chip,.sg-bi-score { border-radius:20px; padding:6px 9px; background:#fff4eb; color:var(--sg-accent-dark); font-size:9px; font-weight:700; }.sg-bi-chip i { margin-right:5px; font-size:7px; }.sg-bi-score { background:#edf7f3; color:var(--sg-success); }.sg-bi-doughnut-wrap { position:relative; width:190px; height:190px; margin:19px auto 12px; }.sg-bi-doughnut-center { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; pointer-events:none; }.sg-bi-doughnut-center strong { font-size:25px; }.sg-bi-doughnut-center span { color:var(--sg-muted); font-size:10px; }.sg-bi-legend { padding:0 20px 18px; }.sg-bi-legend button { display:flex; width:100%; align-items:center; gap:8px; padding:7px 0; border:0; border-top:1px solid #eef1f5; background:transparent; color:var(--sg-muted); font:11px "Lexend",sans-serif; text-align:left; }.sg-bi-legend i { width:8px; height:8px; border-radius:50%; }.sg-bi-legend strong { margin-left:auto; color:var(--sg-text); font-size:11px; }
.sg-bi-bottom-grid { grid-template-columns:minmax(0,1.55fr) minmax(270px,1fr); }.sg-bi-opportunities { padding:5px 20px 13px; }.sg-bi-opportunities a { display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid #edf0f3; color:var(--sg-text); }.sg-bi-opportunities a:last-child { border-bottom:0; }.sg-bi-opportunities a > .fa { margin-left:auto; color:#a1adbd; }.sg-bi-opportunities strong,.sg-bi-opportunities small { display:block; }.sg-bi-opportunities strong { font-size:11px; }.sg-bi-opportunities small { margin-top:4px; color:var(--sg-muted); font-size:10px; }.sg-bi-action-icon { display:grid; width:34px; height:34px; place-items:center; border-radius:9px; }.sg-bi-action-icon.blue {background:#e8f0fa;color:#2d5e99}.sg-bi-action-icon.orange {background:#fff0df;color:#dc7c24}.sg-bi-action-icon.green {background:#e5f5ef;color:#218460}.sg-bi-news-card .sg-news-item { padding:12px 20px; }.sg-bi-news-card .sg-news-item p { display:-webkit-box; overflow:hidden; -webkit-line-clamp:1; -webkit-box-orient:vertical; }.sg-bi-news-card .sg-news-item-head { margin-bottom:4px; }@keyframes sg-spin {to {transform:rotate(360deg)}}

.sg-bi-doughnut-wrap { min-width: 190px; min-height: 190px; }
.sg-bi-doughnut-wrap canvas { display: block !important; width: 190px !important; height: 190px !important; }

/* Collapsed and responsive shell */
.sidebar-collapse.sg-app .main-header .logo {
    width: 50px;
    padding: 10px 7px;
}

.sidebar-collapse.sg-app .main-header .navbar {
    margin-left: 50px;
}

.sidebar-collapse.sg-app .main-sidebar {
    width: 50px;
}

.sidebar-collapse.sg-app .content-wrapper,
.sidebar-collapse.sg-app .main-footer {
    margin-left: 50px;
}

@media (max-width: 1199px) {
    .sg-metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sg-company-meta {
        max-width: 180px;
    }
}

@media (max-width: 991px) {
    .sg-bi-dashboard-grid,
    .sg-bi-bottom-grid {
        grid-template-columns: 1fr;
    }

    .sg-bi-hero {
        padding: 25px;
    }

    .sg-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .sg-header-title {
        display: none;
    }

    .sg-login-shell {
        grid-template-columns: minmax(300px, 38%) 1fr;
    }
}

@media (max-width: 767px) {
    .sg-bi-hero {
        display: block;
        padding: 23px 20px;
    }

    .sg-bi-hero h1 {
        font-size: 23px;
    }

    .sg-bi-hero-actions {
        align-items: flex-start;
        margin-top: 18px;
    }

    .sg-bi-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .sg-bi-chart-wrap {
        height: 220px;
        padding: 16px 10px 10px;
    }

    .sg-workspace-tabs {
        padding: 8px 10px 0;
        overflow-x: auto;
    }

    .sg-workspace-tabs .nav-tabs,
    #abasSistemas.nav-tabs {
        flex-wrap: nowrap;
        min-width: max-content;
    }

    .sg-workspace-tabs .nav-tabs > li > a,
    #abasSistemas.nav-tabs > li > a {
        height: 38px;
        padding: 0 12px !important;
        font-size: 11px;
    }

    .sg-login-shell {
        display: block;
    }

    .sg-login-brand {
        min-height: 220px;
        padding: 28px;
    }

    .sg-login-copy {
        margin-top: 45px;
    }

    .sg-login-copy h1 {
        font-size: 30px;
    }

    .sg-login-copy p,
    .sg-login-brand-footer {
        display: none;
    }

    .sg-login-main {
        padding: 34px 22px 46px;
    }

    .sg-login-logo {
        display: none;
    }

    .sg-app .main-header {
        height: 58px;
    }

    .sg-app .main-header .logo,
    .sidebar-collapse.sg-app .main-header .logo {
        width: 100%;
        height: 58px;
        padding: 8px 64px;
        background: var(--sg-primary-dark) !important;
    }

    .sg-app .main-header .navbar,
    .sidebar-collapse.sg-app .main-header .navbar {
        min-height: 58px;
        margin-left: 0;
    }

    .sg-app .main-header .sidebar-toggle,
    .sg-app .navbar-custom-menu > .navbar-nav > li > a {
        height: 58px;
    }

    .sg-app .main-header .sidebar-toggle {
        width: 58px;
    }

    .sg-app .main-sidebar,
    .sidebar-collapse.sg-app .main-sidebar {
        width: 250px;
        padding-top: 58px;
        transform: translate(-250px, 0);
    }

    .sg-app .sidebar {
        height: calc(100vh - 58px) !important;
    }

    .sidebar-open.sg-app .main-sidebar {
        transform: translate(0, 0);
    }

    .sg-app .content-wrapper,
    .sidebar-collapse.sg-app .content-wrapper {
        margin-top: 58px;
        margin-left: 0;
    }

    .sg-app .main-footer,
    .sidebar-collapse.sg-app .main-footer {
        margin-left: 0;
    }

    .sg-app .content {
        padding: 14px;
    }

    .sg-company-trigger {
        display: none !important;
    }

    .sg-user-name {
        display: none;
    }

    .sg-workspace-body {
        padding: 18px 14px;
    }

    .sg-dashboard-welcome {
        display: block;
    }

    .sg-dashboard-date {
        margin-top: 12px;
    }

    .sg-metric-grid {
        grid-template-columns: 1fr;
    }

    .sg-company-page {
        padding: 22px 14px;
    }
}

@media (max-width: 420px) {
    .sg-login-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .sg-login-actions .btn,
    .sg-login-actions .sg-login-link {
        width: 100%;
        text-align: center;
    }

    .sg-company-option {
        padding: 15px;
    }
}
