:root {
    --bi-bg: #f3f2ee;
    --bi-surface: #ffffff;
    --bi-stroke: #e7e6dd;
    --bi-text: #20201d;
    --bi-muted: #7d7d74;
    --bi-green: #7ea81b;
    --bi-green-2: #9fc545;
    --bi-green-soft: #eef3df;
    --bi-dark: #1f1f1f;
    --bi-dark-2: #161716;
    --bi-danger: #c74d3e;
    --bi-shadow: 0 14px 34px rgba(42, 44, 35, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bi-bg);
    color: var(--bi-text);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.portal-topbar {
    min-height: 76px;
    background: linear-gradient(180deg, var(--bi-dark) 0%, var(--bi-dark-2) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    border-bottom: 4px solid var(--bi-green);
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 14px 32px rgba(42, 44, 35, .16);
}

.portal-brand { font-size: 1.15rem; font-weight: 850; letter-spacing: .01em; }
.portal-subtitle { font-size: .78rem; color: rgba(255, 255, 255, .68); }
.portal-logout { color: var(--bi-green-2); text-decoration: none; font-size: .85rem; font-weight: 700; }
.portal-logout:hover { color: #fff; }

.portal-shell {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    min-height: calc(100vh - 76px);
}

.portal-sidebar {
    background: linear-gradient(180deg, var(--bi-dark) 0%, var(--bi-dark-2) 100%);
    padding: 22px 14px;
    border-right: 1px solid #2b2b28;
}

.portal-sidebar .nav-link {
    color: rgba(255, 255, 255, .76);
    border-radius: 12px;
    padding: .72rem .9rem;
    font-weight: 700;
}

.portal-sidebar .nav-link:hover,
.portal-sidebar .nav-link.active {
    background: var(--bi-green);
    color: #fff;
}

.portal-content { padding: 28px; min-width: 0; }
.portal-title { font-size: 1.6rem; font-weight: 850; letter-spacing: -.02em; }

.portal-card {
    background: var(--bi-surface);
    border: 1px solid var(--bi-stroke);
    border-radius: 18px;
    box-shadow: var(--bi-shadow);
    overflow: hidden;
}

.metric-card { display: flex; align-items: center; gap: 16px; padding: 20px; }
.metric-card i { font-size: 1.55rem; color: var(--bi-green); background: var(--bi-green-soft); border-radius: 16px; padding: 10px; }
.metric-card span { display: block; color: var(--bi-muted); font-size: .82rem; }
.metric-card strong { display: block; font-size: 1.8rem; line-height: 1.1; }

.btn-portal {
    background: var(--bi-green);
    border-color: var(--bi-green);
    color: #fff;
    font-weight: 800;
    border-radius: 14px;
}

.btn-portal:hover,
.btn-portal:focus { background: #6f9618; border-color: #6f9618; color: #fff; }

.table thead th {
    background: #f8fbf1;
    color: #4f6f0d;
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--bi-stroke);
    padding: .9rem;
}

.table td { padding: .85rem; }
.form-control, .form-select { border-radius: 13px; border-color: var(--bi-stroke); padding: 11px 13px; }
.form-control:focus, .form-select:focus { border-color: var(--bi-green); box-shadow: 0 0 0 .2rem rgba(126, 168, 27, .18); }
.resource-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.resource-item { display: flex; align-items: flex-start; border: 1px solid var(--bi-stroke); border-radius: 12px; padding: 12px; cursor: pointer; }
.resource-item small { display: block; color: var(--bi-muted); font-size: .72rem; }
.resource-modulo { background: var(--bi-green-soft); border-color: rgba(126, 168, 27, .28); }
.license-product-card { background: #f8fbf1; border: 1px solid #dcebc1; border-radius: 16px; padding: 18px; }

.login-body {
    min-height: 100vh;
    background: var(--bi-bg);
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-shell {
    width: min(1080px, 100%);
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    gap: 16px;
}

.login-brand,
.login-card {
    border: 1px solid var(--bi-stroke);
    border-radius: 18px;
    box-shadow: var(--bi-shadow);
    overflow: hidden;
}

.login-brand {
    padding: 58px 52px;
    color: #fff;
    background: linear-gradient(180deg, var(--bi-dark) 0%, var(--bi-dark-2) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.login-brand::after {
    content: "";
    position: absolute;
    right: -90px;
    bottom: -130px;
    width: 270px;
    height: 270px;
    border-radius: 50%;
    background: rgba(126, 168, 27, .22);
    filter: blur(10px);
}

.login-brand .eyebrow { color: var(--bi-green-2); font-weight: 800; font-size: .75rem; letter-spacing: .16em; }
.login-brand h1 { font-size: clamp(2.2rem, 4vw, 4.2rem); line-height: .98; margin: 20px 0; letter-spacing: -.04em; }
.login-brand p { color: rgba(255, 255, 255, .76); max-width: 520px; }
.login-card { padding: 56px 48px; background: var(--bi-surface); }
.login-card h2 { font-weight: 850; letter-spacing: -.03em; }
.login-card p { color: var(--bi-muted); }
code { color: #4f6f0d; background: var(--bi-green-soft); padding: .1rem .25rem; border-radius: 4px; }
.login-single { grid-template-columns: 1fr; max-width: 560px; }

@media (max-width: 900px) {
    .portal-shell { grid-template-columns: 1fr; }
    .portal-sidebar { position: static; padding: 10px; overflow-x: auto; }
    .portal-sidebar .nav { flex-direction: row !important; min-width: max-content; }
    .portal-content { padding: 18px; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { padding: 38px; }
    .login-brand h1 { font-size: 2.4rem; }
    .login-card { padding: 38px; }
    .resource-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .portal-topbar { height: auto; padding: 12px 0; }
    .portal-subtitle { display: none; }
    .portal-content { padding: 14px; }
    .portal-title { font-size: 1.3rem; }
    .login-brand { display: none; }
    .login-card { padding: 30px 22px; }
    .metric-card { padding: 15px; }
    .metric-card strong { font-size: 1.4rem; }
}
