: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; }
.iq-activities-scroll { overflow-x: auto !important; }
.iq-activities-table { min-width: 1200px; font-size: .72rem; }
.iq-activities-table th, .iq-activities-table td { white-space: nowrap; vertical-align: top; padding: .4rem .35rem; }
.iq-activities-table td:nth-child(4), .iq-activities-table td:nth-child(5), .iq-activities-table td:nth-child(6) { white-space: normal; min-width: 120px; max-width: 190px; overflow-wrap: anywhere; }
.iq-file-content { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; font-size: .95rem; }
.iq-modal-toggle { display: none !important; }
.iq-modal-toggle + label { cursor: pointer; }
.iq-modal-toggle + label + .iq-content-dialog { display: none; }
.iq-modal-toggle:checked + label + .iq-content-dialog { display: block; position: fixed; z-index: 2000; inset: 10vh auto auto 50%; transform: translateX(-50%); width: min(760px, 90vw); max-height: 80vh; padding: 0; border-radius: 14px; background: #fff; box-shadow: 0 18px 60px rgba(0,0,0,.28); }
.iq-modal-toggle:checked + label + .iq-content-dialog::before { content: ''; position: fixed; z-index: -1; inset: -10vh -50vw; background: rgba(0,0,0,.48); }
.iq-content-dialog .modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--bi-stroke); }
.iq-content-dialog .modal-body { padding: 1.25rem; overflow: auto; max-height: 65vh; }
.iq-content-dialog .btn-close { border: 0; background: transparent; font-size: 1.25rem; line-height: 1; cursor: pointer; }
.iq-hash { display: inline-block; max-width: 145px; white-space: normal; overflow-wrap: anywhere; vertical-align: bottom; }
.iq-file-download { border: 0; padding: 0; background: transparent; color: var(--bi-green); text-decoration: underline; text-align: left; cursor: pointer; font: inherit; }
.iq-download-available { color: var(--bi-green); font-weight: 700; font-size: .78rem; white-space: nowrap; }
.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; }
.iq-equipment-link { color: inherit; text-decoration: none; display: inline-block; }
.iq-equipment-link:hover strong { color: var(--bi-green); }
.iq-equipment-icon { color: var(--bi-green); font-size: 1.2rem; vertical-align: -.1em; }
.iq-nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.12); }
.iq-nav-title { color: var(--bi-green-2); font-size: .78rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; padding: .55rem .9rem .35rem; }
.iq-nav-submenu { padding-left: 10px; }
.iq-nav-submenu .nav-link { font-size: .88rem; padding: .55rem .9rem; }

.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; }
}
