:root {
    --ia-navy-950: #071a2f;
    --ia-navy-900: #0d2744;
    --ia-navy-800: #153858;
    --ia-teal-700: #087f73;
    --ia-teal-600: #0b9384;
    --ia-teal-500: #14a595;
    --ia-bg: #f4f7fa;
    --ia-surface: #ffffff;
    --ia-border: #dce5ec;
    --ia-border-strong: #c8d4de;
    --ia-text: #142033;
    --ia-muted: #66758a;
    --ia-radius: 12px;
    --ia-radius-lg: 18px;
    --ia-shadow: 0 12px 30px rgba(13, 39, 68, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 8% 0%, rgba(31, 95, 155, .08), transparent 28%),
        radial-gradient(circle at 95% 8%, rgba(11, 147, 132, .08), transparent 26%),
        var(--ia-bg);
    color: var(--ia-text);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ia-teal-700); }
a:hover { color: var(--ia-navy-900); }

.app-shell { min-height: 100vh; }
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: 72px;
    border-bottom: 1px solid rgba(200, 212, 222, .85);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 3px 18px rgba(13, 39, 68, .06);
    backdrop-filter: blur(14px);
}
.app-topbar__inner {
    width: 100%;
    max-width: 1540px;
    min-height: 72px;
    margin: 0 auto;
    padding: 11px 26px;
}
.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 210px;
    color: var(--ia-text);
    text-decoration: none;
}
.app-brand:hover { color: var(--ia-text); }
.app-brand__mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--ia-navy-900), var(--ia-teal-600));
    box-shadow: 0 8px 20px rgba(11, 147, 132, .20);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
}
.app-brand__title {
    margin: 0;
    color: var(--ia-navy-950);
    font-size: 17px;
    font-weight: 800;
    line-height: 1.15;
}
.app-brand__subtitle {
    margin: 3px 0 0;
    color: var(--ia-muted);
    font-size: 11px;
}
.app-module-label {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid var(--ia-border);
    border-radius: 999px;
    background: #eef3f7;
    color: var(--ia-navy-800);
    font-size: 12px;
    font-weight: 700;
}
.app-navbar { gap: 4px; }
.app-navbar .nav-link {
    padding: 8px 10px !important;
    border-radius: 9px;
    color: #46566c;
    font-size: 13px;
    font-weight: 600;
}
.app-navbar .nav-link:hover { background: #eef3f7; color: var(--ia-navy-900); }
.app-navbar .nav-link.active { background: var(--ia-navy-900); color: #fff; }
.app-content {
    width: 100%;
    max-width: 1540px;
    margin: 0 auto;
    padding: 28px 26px 52px;
}

h1, h2, h3, h4, h5, h6 { color: var(--ia-navy-950); letter-spacing: -.02em; }
.text-muted, .small-muted, .form-text { color: var(--ia-muted) !important; }

.card {
    border: 1px solid var(--ia-border);
    border-radius: var(--ia-radius-lg);
    background: var(--ia-surface);
    box-shadow: 0 5px 18px rgba(13, 39, 68, .06);
}
.card-header, .card-footer { border-color: var(--ia-border); }

.btn {
    min-height: 40px;
    padding: .52rem .95rem;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: none !important;
    transition: transform .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-sm { min-height: 34px; padding: .38rem .72rem; border-radius: 9px; font-size: 12px; }
.btn-lg { min-height: 48px; border-radius: 12px; }
.btn-primary, .btn-success {
    border-color: var(--ia-teal-700);
    background: var(--ia-teal-700);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-success:hover, .btn-success:focus, .btn-success:active {
    border-color: #05695f !important;
    background: #05695f !important;
    color: #fff !important;
}
.btn-outline-primary, .btn-outline-success { border-color: var(--ia-teal-600); color: var(--ia-teal-700); }
.btn-outline-primary:hover, .btn-outline-success:hover { border-color: var(--ia-teal-700); background: var(--ia-teal-700); color: #fff; }
.btn-outline-secondary { border-color: var(--ia-border-strong); color: #516176; }
.btn-outline-secondary:hover { border-color: var(--ia-navy-800); background: var(--ia-navy-800); color: #fff; }
.btn-warning { border-color: #d99a00; background: #f7b817; color: #382700; }
.btn-outline-danger { border-color: #e86b75; color: #c92c3a; }
.btn-outline-danger:hover { border-color: #dc3545; background: #dc3545; color: #fff; }

.form-label { margin-bottom: .45rem; color: var(--ia-navy-800); font-size: 13px; font-weight: 700; }
.form-control, .form-select {
    min-height: 42px;
    border: 1px solid var(--ia-border-strong);
    border-radius: 10px;
    background: #fff;
    color: var(--ia-text);
    font-size: 13px;
    box-shadow: none !important;
}
.form-control:focus, .form-select:focus {
    border-color: var(--ia-teal-600);
    box-shadow: 0 0 0 .2rem rgba(11, 147, 132, .12) !important;
}
.form-check-input:checked { border-color: var(--ia-teal-700); background-color: var(--ia-teal-700); }

.alert { border: 1px solid transparent; border-radius: 12px; font-size: 13px; }
.alert-success { border-color: #b9e8d7; background: #eaf9f3; color: #176447; }
.alert-info { border-color: #bedcf2; background: #edf7ff; color: #245d83; }
.alert-warning { border-color: #f1d48b; background: #fff7df; color: #71520c; }
.alert-danger { border-color: #f2b9c0; background: #fff0f2; color: #8d2530; }

.table { --bs-table-bg: transparent; margin-bottom: 0; color: var(--ia-text); font-size: 13px; }
.table > :not(caption) > * > * { padding: .78rem .72rem; border-bottom-color: var(--ia-border); }
.table thead th {
    background: #f0f5f8 !important;
    color: var(--ia-navy-900);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.table-hover > tbody > tr:hover > * { --bs-table-accent-bg: #f7fbfc; }
.table-wrap { max-height: 68vh; overflow: auto; border-radius: var(--ia-radius-lg); }
.table-wrap thead th { position: sticky; top: 0; z-index: 4; }

.badge { border-radius: 999px; padding: .42em .68em; font-size: 10px; font-weight: 800; }
.badge-soft, .badge-soft-info { background: #e8f2fb; color: #1f5f9b; }
.badge-soft-success { background: #daf5ea; color: #087552; }
.badge-soft-warning { background: #fff0c7; color: #8a5a00; }
.badge-soft-danger { background: #ffe0e4; color: #a32331; }

.user-pill, .role-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 11px;
    border: 1px solid var(--ia-border);
    border-radius: 999px;
    background: #eef3f7;
    color: #526277;
    font-size: 12px;
    font-weight: 600;
}
.role-pill { background: #dff6f1; color: #07685f; }

.pagination { gap: 5px; margin-bottom: 0; flex-wrap: wrap; }
.pagination .page-link {
    min-width: 34px;
    border: 1px solid var(--ia-border);
    border-radius: 8px !important;
    color: var(--ia-navy-800);
    text-align: center;
    box-shadow: none;
}
.pagination .page-item.active .page-link { border-color: var(--ia-teal-700); background: var(--ia-teal-700); color: #fff; }
.pagination svg { width: 15px !important; height: 15px !important; }
.action-group { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }

.module-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--ia-border);
    border-radius: 12px;
    background: #f8fafc;
}
.module-switcher__button {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #536278;
    text-decoration: none;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
}
.module-switcher__button:hover { background: #e8eef3; color: var(--ia-navy-900); }
.module-switcher__button.is-active { background: var(--ia-navy-900); color: #fff; pointer-events: none; }

.portal-shell { min-height: 100vh; }
.portal-hero {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 52px 24px 72px;
}
.portal-container { width: 100%; max-width: 1040px; }
.portal-heading { max-width: 720px; margin: 0 auto 34px; text-align: center; }
.portal-heading__eyebrow { color: var(--ia-teal-700); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.portal-heading h1 { margin: 8px 0 10px; font-size: clamp(2rem, 4vw, 3rem); font-weight: 850; }
.portal-heading p { margin: 0; color: var(--ia-muted); font-size: 15px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.module-card {
    position: relative;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 30px;
    border: 1px solid var(--ia-border);
    border-radius: 20px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    box-shadow: var(--ia-shadow);
    transition: transform .2s ease, box-shadow .2s ease;
}
.module-card::before { position: absolute; top: 0; left: 0; width: 100%; height: 5px; background: linear-gradient(90deg, var(--ia-navy-900), var(--ia-teal-600)); content: ""; }
.module-card:hover { transform: translateY(-5px); color: inherit; box-shadow: 0 24px 56px rgba(13, 39, 68, .14); }
.module-card__icon {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
    border-radius: 16px;
    background: linear-gradient(145deg, var(--ia-navy-900), var(--ia-teal-600));
    color: #fff;
    font-size: 21px;
    font-weight: 850;
}
.module-card h2 { margin: 0 0 10px; font-size: 23px; font-weight: 800; }
.module-card p { margin: 0 0 24px; color: var(--ia-muted); font-size: 14px; line-height: 1.75; }
.module-card__open { margin-top: auto; color: var(--ia-teal-700); font-weight: 800; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); background: var(--ia-bg); }
.login-visual {
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    padding: 54px;
    background: linear-gradient(145deg, rgba(7, 26, 47, .98), rgba(13, 39, 68, .94));
    color: #fff;
}
.login-visual::after {
    position: absolute;
    right: -140px;
    top: -140px;
    width: 420px;
    height: 420px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
    box-shadow: 0 0 0 70px rgba(255,255,255,.03), 0 0 0 140px rgba(255,255,255,.02);
    content: "";
}
.login-visual__content { position: relative; z-index: 2; max-width: 620px; }
.login-visual__mark { width: 58px; height: 58px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 28px; border-radius: 16px; background: var(--ia-teal-500); color: #fff; font-weight: 850; }
.login-visual h1 { margin-bottom: 14px; color: #fff; font-size: clamp(2.2rem, 4vw, 4rem); font-weight: 850; }
.login-visual p { max-width: 540px; margin: 0; color: rgba(255,255,255,.76); font-size: 16px; line-height: 1.8; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 42px; background: #fff; }
.login-card { width: 100%; max-width: 430px; }
.login-card__brand { display: none; }
.login-card h2 { margin-bottom: 8px; font-size: 28px; font-weight: 850; }
.login-footer { color: #8a98a9; font-size: 12px; text-align: center; }

@media (max-width: 991.98px) {
    .app-topbar__inner { padding: 10px 18px; }
    .app-content { padding: 22px 18px 42px; }
    .app-navbar { margin-top: 14px; padding: 10px 0; border-top: 1px solid var(--ia-border); }
    .module-switcher { width: 100%; margin-top: 8px; overflow-x: auto; }
    .module-switcher__button { flex: 1 0 auto; }
    .module-grid { grid-template-columns: 1fr; }
    .login-page { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .login-panel { min-height: 100vh; padding: 28px 20px; }
    .login-card__brand { display: block; margin-bottom: 28px; text-align: center; }
}

@media (max-width: 575.98px) {
    .app-brand__subtitle { display: none; }
    .app-brand { min-width: auto; }
    .app-content { padding: 18px 12px 36px; }
    .portal-hero { padding: 36px 14px 52px; }
    .module-card { min-height: 260px; padding: 24px; }
}
