:root {
    --sidebar-bg: #0b1630;
    --sidebar-bg-2: #101f42;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-text: #dbe7ff;
    --sidebar-muted: #8ea3d0;
    --sidebar-active: rgba(78, 129, 255, 0.18);
    --sidebar-active-border: rgba(91, 140, 255, 0.48);
    --bg: #f3f6fb;
    --bg-soft: #eef3fb;
    --panel: #ffffff;
    --panel-2: #f9fbff;
    --panel-border: #dfe7f4;
    --text: #0f172a;
    --text-soft: #475569;
    --muted: #64748b;
    --primary: #2158d6;
    --primary-soft: #edf3ff;
    --success: #089669;
    --success-soft: #e8fbf3;
    --danger: #dc2626;
    --danger-soft: #fff1f1;
    --warning: #d97706;
    --warning-soft: #fff6e8;
    --dark-soft: #eef2f7;
    --shadow-xl: 0 18px 48px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 26px rgba(15, 23, 42, 0.07);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.06);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: linear-gradient(180deg, #f7f9fd 0%, var(--bg) 100%);
    color: var(--text);
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
}

a { text-decoration: none; }
img { max-width: 100%; }

.ibl-body.is-authenticated {
    min-height: 100vh;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 1040;
    height: 100vh;
    padding: 22px 18px 18px;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.22), transparent 28%),
        linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: #fff;
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

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

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(94, 140, 255, 0.45));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.24);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.brand-mark-core {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .12em;
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.15;
}

.brand-sub {
    font-size: 12px;
    color: var(--sidebar-muted);
    margin-top: 4px;
    letter-spacing: .04em;
}

.sidebar-close {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    position: relative;
}
.sidebar-close span {
    position: absolute;
    width: 16px;
    height: 2px;
    background: #fff;
    left: 10px;
    top: 18px;
    border-radius: 999px;
}
.sidebar-close span:first-child { transform: rotate(45deg); }
.sidebar-close span:last-child { transform: rotate(-45deg); }

.sidebar-scroll {
    overflow-y: auto;
    padding-right: 2px;
    flex: 1;
}
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 999px; }

.nav-group + .nav-group {
    margin-top: 18px;
}

.nav-group-label {
    color: var(--sidebar-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .14em;
    font-weight: 700;
    margin-bottom: 10px;
    padding: 0 10px;
}

.sidebar-nav {
    display: grid;
    gap: 4px;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sidebar-text);
    border-radius: 14px;
    padding: 11px 12px;
    border: 1px solid transparent;
    transition: .2s ease;
}
.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.05);
    border-color: rgba(255,255,255,.08);
    transform: translateX(2px);
}
.sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--sidebar-active), rgba(59, 130, 246, 0.1));
    border-color: var(--sidebar-active-border);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    flex-shrink: 0;
}
.nav-icon svg { width: 20px; height: 20px; fill: currentColor; }
.nav-text { font-size: 14px; font-weight: 500; }

.sidebar-foot {
    margin-top: auto;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.05);
}
.sidebar-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(255,255,255,.18), rgba(132, 164, 255, .42));
    font-weight: 700;
}
.sidebar-user-meta strong {
    display: block;
    font-size: 14px;
}
.sidebar-user-meta span {
    display: block;
    color: var(--sidebar-muted);
    font-size: 12px;
    margin-top: 2px;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.52);
    opacity: 0;
    visibility: hidden;
    border: 0;
    padding: 0;
    z-index: 1035;
    transition: .25s ease;
}

.main-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.shell-topbar {
    position: sticky;
    top: 0;
    z-index: 1025;
    backdrop-filter: blur(14px);
    background: rgba(243, 246, 251, 0.84);
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 28px;
}

.topbar-leading,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-title-group {
    min-width: 0;
}
.topbar-meta {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
}
.meta-dot { margin: 0 4px; }
.topbar-title {
    font-size: 28px;
    line-height: 1.05;
    margin: 4px 0 0;
    font-weight: 800;
    letter-spacing: -.03em;
}

.mobile-menu-toggle {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--panel-border);
    background: rgba(255,255,255,.8);
    box-shadow: var(--shadow-md);
    position: relative;
    flex-shrink: 0;
}
.mobile-menu-toggle span {
    position: absolute;
    left: 12px;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 999px;
}
.mobile-menu-toggle span:nth-child(1) { top: 14px; }
.mobile-menu-toggle span:nth-child(2) { top: 21px; }
.mobile-menu-toggle span:nth-child(3) { top: 28px; }

.topbar-search {
    position: relative;
    min-width: 340px;
    max-width: 420px;
    width: 100%;
}
.topbar-search .form-control {
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: rgba(255,255,255,.92);
    padding: 13px 106px 13px 44px;
    height: 52px;
    box-shadow: var(--shadow-md);
}
.topbar-search .form-control:focus {
    border-color: rgba(33, 88, 214, .32);
    box-shadow: 0 0 0 4px rgba(33, 88, 214, .08);
}
.topbar-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #6b7c98;
    z-index: 2;
}
.topbar-search-icon svg { width: 18px; height: 18px; fill: currentColor; }
.topbar-search-clear {
    position: absolute;
    top: 7px;
    right: 8px;
    height: 38px;
    border-radius: 999px;
    padding: 0 16px;
    border: 0;
    background: #eef3fb;
    color: #31425b;
    font-size: 13px;
    font-weight: 700;
}
.topbar-search-clear:hover { background: #e4ebf7; }

.system-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 176px;
    padding: 10px 14px;
    background: rgba(255,255,255,.92);
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    box-shadow: var(--shadow-md);
}
.system-chip strong {
    display: block;
    font-size: 14px;
    line-height: 1.1;
}
.system-chip small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}
.status-dot {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 6px rgba(8, 150, 105, 0.1);
    flex-shrink: 0;
}

.profile-button {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
    border: 1px solid var(--panel-border);
    background: #fff;
    border-radius: 18px;
    padding: 8px 12px 8px 8px;
    box-shadow: var(--shadow-md);
}
.profile-button::after {
    margin-left: auto;
}
.profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #dbe8ff, #bdd1ff);
    color: #23408f;
    font-size: 18px;
    font-weight: 800;
    flex-shrink: 0;
}
.profile-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}
.profile-copy strong {
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}
.profile-copy small {
    color: var(--muted);
    font-size: 12px;
}
.dropdown-menu {
    border-radius: 18px;
    padding: 10px;
}
.dropdown-item {
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
}

.content-wrap {
    padding: 24px 28px 28px;
}

.alert-soft {
    border: 0;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.panel,
.metric-card,
.login-card {
    background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}
.panel {
    padding: 22px;
}
.panel-hero {
    padding: 28px;
    margin-bottom: 18px;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
    gap: 22px;
    align-items: stretch;
}
.section-kicker {
    color: #5a6f95;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.hero-title {
    font-size: 34px;
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -.04em;
    margin: 0 0 12px;
    max-width: 760px;
}
.hero-text {
    color: var(--text-soft);
    font-size: 16px;
    max-width: 760px;
    margin-bottom: 18px;
}
.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.hero-chip {
    padding: 9px 13px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: #264489;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(33, 88, 214, 0.12);
}
.hero-side {
    display: grid;
    gap: 12px;
}
.hero-stat {
    min-height: 104px;
    border-radius: 20px;
    padding: 16px 18px;
    border: 1px solid var(--panel-border);
    background: var(--panel-2);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.hero-stat span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.hero-stat strong {
    font-size: 22px;
    line-height: 1.1;
}
.hero-stat-primary { background: linear-gradient(135deg, #eff5ff, #f8fbff); }
.hero-stat-danger { background: linear-gradient(135deg, #fff4f3, #fffafb); }
.hero-stat-warning { background: linear-gradient(135deg, #fff7ea, #fffdf8); }

.metric-card {
    padding: 20px;
    height: 100%;
}
.metric-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}
.metric-card-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.metric-card-pill {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: currentColor;
    opacity: .18;
}
.metric-card-value {
    font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -.04em;
}
.metric-card-meta {
    color: var(--text-soft);
    font-size: 13px;
    margin-top: 10px;
}
.metric-card-primary { color: var(--primary); }
.metric-card-primary .metric-card-value { color: #113b95; }
.metric-card-warning { color: var(--warning); }
.metric-card-warning .metric-card-value { color: #9a4d05; }
.metric-card-danger { color: var(--danger); }
.metric-card-danger .metric-card-value { color: #a71c1c; }
.metric-card-success { color: var(--success); }
.metric-card-success .metric-card-value { color: #066f4d; }

.mini-stat {
    padding: 20px;
    height: 100%;
}
.mini-stat-label,
.panel-subtitle {
    color: var(--muted);
    font-size: 13px;
}
.mini-stat-value {
    font-size: 26px;
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -.03em;
    margin: 8px 0;
}
.mini-stat-meta {
    color: var(--text-soft);
    font-size: 13px;
}

.panel-title {
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
}
.panel-header-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}
.panel-badge,
.table-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.badge-soft-primary { background: var(--primary-soft); color: #264489; }
.badge-soft-success { background: var(--success-soft); color: #0b6a4d; }
.badge-soft-danger { background: var(--danger-soft); color: #b32020; }
.badge-soft-warning { background: var(--warning-soft); color: #9a4d05; }
.badge-soft-dark { background: var(--dark-soft); color: #334155; }

.chart-wrap {
    position: relative;
    height: 320px;
}
.chart-panel canvas {
    width: 100% !important;
    height: 100% !important;
}

.ibl-table {
    margin-bottom: 0;
}
.ibl-table thead th,
.table thead th {
    border-bottom: 1px solid var(--panel-border);
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 700;
    background: #f9fbff;
    padding-top: 14px;
    padding-bottom: 14px;
}
.ibl-table tbody td,
.table tbody td {
    padding-top: 16px;
    padding-bottom: 16px;
    border-color: #edf1f7;
}
.table-hover > tbody > tr:hover > * {
    background: #f9fbff;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.quick-action-card {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--panel-border);
    background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
    transition: .18s ease;
}
.quick-action-card:hover {
    transform: translateY(-2px);
    border-color: rgba(33, 88, 214, 0.26);
    box-shadow: var(--shadow-md);
}
.quick-action-card strong {
    display: block;
    color: var(--text);
    font-size: 15px;
}
.quick-action-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
    line-height: 1.45;
}
.quick-action-card-wide {
    grid-column: 1 / -1;
}

.form-panel { max-width: 1160px; }
.form-label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}
.form-control,
.form-select,
textarea.form-control {
    border-radius: 14px;
    border: 1px solid #d5deec;
    padding: 12px 14px;
    background: #fff;
    box-shadow: none;
}
.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    border-color: rgba(33, 88, 214, .45);
    box-shadow: 0 0 0 4px rgba(33, 88, 214, 0.08);
}
.btn {
    border-radius: 14px;
    font-weight: 600;
}
.btn-primary {
    background: linear-gradient(135deg, #2455d6, #2e67f2);
    border-color: #2455d6;
    box-shadow: 0 10px 20px rgba(33, 88, 214, 0.18);
}
.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #214ec5, #285bda);
    border-color: #214ec5;
}
.btn-light {
    background: #f5f8fd;
    border-color: #d9e1ef;
}
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger,
.btn-outline-dark {
    border-width: 1px;
}

.panel-inner {
    background: #f8fbff;
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    padding: 16px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.18), transparent 30%),
        radial-gradient(circle at bottom left, rgba(8, 150, 105, 0.1), transparent 26%),
        #eef3fb;
    padding: 20px;
}
.login-card {
    width: min(440px, 100%);
    padding: 34px;
}
.login-brand {
    font-size: 30px;
    line-height: 1.05;
    font-weight: 800;
    margin-bottom: 10px;
}
.login-note {
    margin-top: 16px;
    color: var(--muted);
    font-size: 14px;
}

.page-search-dim [data-search-item] {
    display: none;
}
.page-search-dim [data-search-item].match {
    display: table-row;
}
.page-search-dim .quick-action-card,
.page-search-dim .metric-card,
.page-search-dim .panel,
.page-search-dim .mini-stat,
.page-search-dim .hero-stat {
    transition: opacity .18s ease;
}
.page-search-dim .search-fade {
    opacity: .24;
}
.page-search-dim .search-match {
    opacity: 1;
}

@media print {
    .sidebar,
    .shell-topbar,
    .sidebar-backdrop,
    .btn,
    .quick-action-card,
    .mobile-menu-toggle {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .content-wrap {
        padding: 0 !important;
    }

    body {
        background: #fff;
    }

    .panel,
    .metric-card {
        box-shadow: none;
        border-color: #d9e1ef;
    }
}

@media (max-width: 1400px) {
    .topbar-search {
        min-width: 280px;
    }
}

@media (max-width: 1199.98px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(88vw, 310px);
        transform: translateX(-104%);
        transition: transform .24s ease;
        box-shadow: 0 24px 54px rgba(2, 6, 23, 0.3);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
    }

    .topbar-inner,
    .content-wrap {
        padding-left: 18px;
        padding-right: 18px;
    }

    .topbar-inner {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .topbar-search {
        order: 3;
        min-width: 100%;
        max-width: 100%;
    }

    .profile-button {
        min-width: 0;
    }

    .panel-hero {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 29px;
    }
}

@media (max-width: 767.98px) {
    .shell-topbar {
        position: static;
        background: transparent;
        border-bottom: 0;
    }

    .topbar-inner {
        padding-top: 16px;
        gap: 14px;
    }

    .topbar-leading {
        width: 100%;
        justify-content: space-between;
        align-items: flex-start;
    }

    .topbar-title {
        font-size: 24px;
    }

    .topbar-meta {
        white-space: normal;
        letter-spacing: .12em;
        line-height: 1.5;
    }

    .topbar-actions {
        width: 100%;
        gap: 12px;
    }

    .system-chip,
    .profile-dropdown {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
    }

    .system-chip {
        min-width: 0;
        padding: 12px;
    }

    .profile-button {
        width: 100%;
        min-width: 0;
        justify-content: flex-start;
    }

    .profile-copy strong {
        max-width: 110px;
    }

    .content-wrap {
        padding-top: 4px;
        padding-bottom: 20px;
    }

    .panel,
    .metric-card,
    .login-card {
        border-radius: 20px;
    }

    .panel,
    .metric-card {
        padding: 18px;
    }

    .panel-hero {
        padding: 20px;
        margin-bottom: 14px;
    }

    .hero-title {
        font-size: 26px;
    }

    .hero-text {
        font-size: 15px;
    }

    .hero-side {
        grid-template-columns: 1fr;
    }

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

    .chart-wrap {
        height: 260px;
    }

    .table-responsive {
        margin-inline: -6px;
    }

    .btn,
    .form-control,
    .form-select {
        min-height: 46px;
    }
}

/* ===== Enterprise module patches ===== */
.module-page {
    display: grid;
    gap: 18px;
}

.module-hero-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 24px;
    border-radius: 26px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.10), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid rgba(148, 163, 184, 0.14);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.05);
}

.module-eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.module-title {
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.55rem, 2.6vw, 2.25rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
    font-weight: 850;
}

.module-subtitle {
    margin: 10px 0 0;
    max-width: 760px;
    color: #64748b;
    font-size: 0.98rem;
    line-height: 1.75;
}

.module-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.module-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid rgba(37, 99, 235, 0.12);
}

.module-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.module-kpi-grid--reports {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.module-kpi-card,
.report-nav-card {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    padding: 18px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.14);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.045);
}

.module-kpi-card::after,
.report-nav-card::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 4px;
}

.module-kpi-card.is-primary::after,
.report-nav-card.is-primary::after { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.module-kpi-card.is-success::after,
.report-nav-card.is-success::after { background: linear-gradient(90deg, #059669, #34d399); }
.module-kpi-card.is-info::after,
.report-nav-card.is-info::after { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.module-kpi-card.is-warning::after,
.report-nav-card.is-warning::after { background: linear-gradient(90deg, #d97706, #fbbf24); }
.module-kpi-card.is-danger::after,
.report-nav-card.is-danger::after { background: linear-gradient(90deg, #dc2626, #fb7185); }

.module-kpi-label,
.report-nav-title {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.module-kpi-value,
.report-nav-value {
    margin-top: 10px;
    color: #0f172a;
    font-size: 1.25rem;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-weight: 850;
}

.module-kpi-meta,
.report-nav-meta {
    margin-top: 9px;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.6;
}

.report-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.report-nav-card {
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}

.report-nav-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.08);
}

.filter-panel,
.report-section,
.form-panel,
.table-panel {
    border-radius: 24px;
}

.module-form-stack {
    display: grid;
    gap: 18px;
}

.module-line-items {
    display: grid;
    gap: 14px;
}

.module-item-row {
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.module-line-total {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: #0f172a;
    font-weight: 800;
}

.sticky-summary-card {
    position: sticky;
    top: 96px;
}

.summary-stack {
    display: grid;
    gap: 12px;
}

.summary-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: #475569;
}

.summary-line strong {
    color: #0f172a;
    font-weight: 800;
}

.summary-line.total {
    background: linear-gradient(135deg, #eff6ff, #f8fbff);
    border-color: rgba(37, 99, 235, 0.14);
}

.module-callout {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid rgba(37, 99, 235, 0.1);
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.65;
}

.module-table-wrap {
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    overflow: hidden;
}

.module-data-table {
    margin-bottom: 0;
}

.module-data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    color: #475569;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.module-data-table tbody tr {
    transition: background-color .2s ease, transform .2s ease;
}

.module-data-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.03);
}

.module-row-title {
    color: #0f172a;
    font-weight: 800;
}

.module-row-meta {
    color: #64748b;
    font-size: 0.84rem;
    margin-top: 3px;
}

.app-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid transparent;
}

.app-status-badge.is-success {
    background: rgba(16, 185, 129, 0.10);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.16);
}

.app-status-badge.is-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.16);
}

.app-status-badge.is-danger {
    background: rgba(239, 68, 68, 0.10);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.16);
}

.app-status-badge.is-neutral {
    background: rgba(148, 163, 184, 0.12);
    color: #475569;
    border-color: rgba(148, 163, 184, 0.16);
}

.module-empty-state {
    padding: 46px 24px;
    text-align: center;
    border: 1px dashed rgba(148, 163, 184, 0.22);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255,255,255,0.9));
}

.module-empty-state h3 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 1.1rem;
    font-weight: 800;
}

.module-empty-state p,
.module-empty-inline,
.form-help {
    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.65;
}

.module-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 1.5rem;
    font-weight: 800;
}

.module-empty-inline {
    padding: 18px 10px;
    text-align: center;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.module-report-stack {
    display: grid;
    gap: 18px;
}

@media (max-width: 1399.98px) {
    .module-kpi-grid,
    .report-card-grid,
    .module-kpi-grid--reports {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .module-hero-card {
        flex-direction: column;
    }

    .module-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .sticky-summary-card {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .module-kpi-grid,
    .report-card-grid,
    .module-kpi-grid--reports {
        grid-template-columns: 1fr;
    }

    .module-hero-card,
    .module-kpi-card,
    .report-nav-card,
    .panel {
        border-radius: 20px;
    }

    .module-data-table thead {
        display: none;
    }

    .module-data-table,
    .module-data-table tbody,
    .module-data-table tr,
    .module-data-table td {
        display: block;
        width: 100%;
    }

    .module-data-table tr {
        padding: 14px;
        border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    }

    .module-data-table td {
        padding: 8px 0;
        border: 0;
        text-align: left !important;
    }

    .module-data-table td:last-child {
        padding-bottom: 2px;
    }
}

@media print {
    .print-hidden,
    .sidebar,
    .shell-topbar,
    .sidebar-backdrop,
    .module-actions .btn {
        display: none !important;
    }

    .content-wrap,
    .module-page,
    .module-report-stack {
        padding: 0 !important;
        margin: 0 !important;
        gap: 12px !important;
    }

    .panel,
    .module-hero-card,
    .module-kpi-card,
    .report-nav-card {
        box-shadow: none !important;
        break-inside: avoid;
    }
}


.form-help {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}
.module-table-wrap {
    border-radius: 18px;
}
@media (max-width: 767.98px) {
    .mobile-stack-table thead {
        display: none;
    }
    .mobile-stack-table,
    .mobile-stack-table tbody,
    .mobile-stack-table tr,
    .mobile-stack-table td {
        display: block;
        width: 100%;
    }
    .mobile-stack-table tr {
        border-bottom: 1px solid var(--panel-border);
        padding: 10px 0;
    }
    .mobile-stack-table td {
        text-align: left !important;
        padding: 8px 12px;
    }
    .mobile-stack-table td::before {
        content: attr(data-label);
        display: block;
        color: var(--muted);
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .08em;
        margin-bottom: 4px;
    }
    .table-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}
