/* Mobile-first enterprise PWA polish */
:root {
    --mod-surface: #ffffff;
    --mod-page: #f5f7fb;
    --mod-ink: #101828;
    --mod-muted: #667085;
    --mod-line: #e4e7ec;
    --mod-primary: #14b87a;
    --mod-primary-dark: #0f7a56;
    --mod-card-shadow: 0 10px 28px rgba(16, 24, 40, .08);
    --mod-card-shadow-strong: 0 16px 40px rgba(16, 24, 40, .14);
}

body.dashboard-page,
body.digitallibrary-page {
    background: #eef3f8;
}

.dashboard-page .page-container,
.digitallibrary-page .page-container {
    background:
        radial-gradient(circle at top right, rgba(20, 184, 122, .12), transparent 34%),
        linear-gradient(180deg, #f7fafc 0%, #eef3f8 100%);
}

.navbar-custom {
    position: fixed;
    top: 10px;
    right: 14px;
    left: 264px;
    min-height: 66px;
    border: 1px solid rgba(16, 24, 40, .08);
    border-radius: 22px;
    background: rgba(255, 255, 255, .92) !important;
    box-shadow: 0 16px 42px rgba(16, 24, 40, .12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.sidebar-toggled .navbar-custom {
    left: 84px;
}

.navbar-custom .container-fluid,
.navbar-custom .navbar-collapse {
    min-height: 66px;
}

.navbar-custom .navbar-nav {
    align-items: center;
    gap: 6px;
}

.navbar-custom .nav-link {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    color: #475467 !important;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link:focus {
    background: #edf8f2;
    color: var(--mod-primary-dark) !important;
    box-shadow: 0 10px 24px rgba(20, 184, 122, .12);
}

.navbar-custom .nav-link svg {
    width: 21px;
    height: 21px;
    stroke-width: 2.25;
}

.navbar-custom .sidebar-toggle-btn {
    background: #101828;
    color: #fff !important;
    box-shadow: 0 12px 26px rgba(16, 24, 40, .20);
}

.navbar-custom .sidebar-toggle-btn:hover,
.navbar-custom .sidebar-toggle-btn:focus {
    background: #163c35;
    color: #fff !important;
}

.mod-topbar-context .nav-link {
    gap: 10px;
    min-width: 0;
    padding: 6px 12px 6px 7px;
    justify-content: flex-start;
    background: #f8fbfa;
    border: 1px solid rgba(16, 24, 40, .06);
}

.mod-topbar-mark {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: linear-gradient(135deg, #101828, #147a58);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.mod-topbar-copy {
    min-width: 0;
    display: grid;
    line-height: 1.1;
}

.mod-topbar-copy strong {
    max-width: 190px;
    overflow: hidden;
    color: var(--mod-ink);
    font-size: 13px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mod-topbar-copy small {
    color: var(--mod-muted);
    font-size: 11px;
    font-weight: 800;
}

.navbar-custom #user-dropdown {
    gap: 8px;
    min-width: 0;
    min-height: 48px;
    padding: 4px 10px 4px 5px;
    border: 1px solid rgba(16, 24, 40, .08);
    background: #fff;
    box-shadow: 0 8px 22px rgba(16, 24, 40, .08);
}

.navbar-custom #user-dropdown .avatar-xs,
.navbar-custom #user-dropdown .avatar-xs img {
    width: 38px;
    height: 38px;
}

.navbar-custom #user-dropdown .avatar-xs img {
    border: 2px solid rgba(20, 184, 122, .28);
}

.navbar-custom #user-dropdown .user-name {
    max-width: 170px;
    overflow: hidden;
    color: var(--mod-ink);
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navbar-custom .notification-badge-container .badge,
.navbar-custom .notification-badge-container {
    transform: translate(4px, -6px);
}

.navbar-custom .dropdown-menu {
    margin-top: 12px;
    border: 1px solid rgba(16, 24, 40, .08);
    border-radius: 18px;
    box-shadow: 0 22px 60px rgba(16, 24, 40, .16);
    overflow: hidden;
}

.navbar-custom .dropdown-menu .dropdown-item {
    min-height: 42px;
    display: flex;
    align-items: center;
    border-radius: 10px;
    font-weight: 700;
}

.navbar-custom .dropdown-menu .dropdown-item:hover {
    background: #edf8f2;
    color: var(--mod-primary-dark);
}

.admin-view .page-container,
.team-member-view .page-container,
.client-view .page-container {
    padding-top: 86px;
}

.sidebar {
    padding-top: 10px;
}

.mod-app-dashboard {
    max-width: 1540px;
    margin: 0 auto;
    padding: 18px 22px 34px;
}

.mod-dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 24px;
    background:
        linear-gradient(135deg, rgba(16, 24, 40, .96), rgba(17, 91, 69, .94)),
        #101828;
    color: #fff;
    box-shadow: 0 22px 48px rgba(16, 24, 40, .18);
    overflow: hidden;
    position: relative;
}

.mod-dashboard-hero::after {
    content: "";
    position: absolute;
    inset: auto -80px -120px auto;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(20, 184, 122, .22);
}

.mod-dashboard-copy {
    position: relative;
    z-index: 1;
}

.mod-dashboard-copy span {
    display: inline-flex;
    margin-bottom: 10px;
    color: #9ff3cb;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.mod-dashboard-copy h1 {
    margin: 0;
    color: #fff;
    font-size: 34px;
    line-height: 1.08;
    font-weight: 900;
}

.mod-dashboard-copy p {
    max-width: 700px;
    margin: 10px 0 0;
    color: rgba(255, 255, 255, .72);
    font-size: 15px;
    line-height: 1.6;
}

.mod-dashboard-actions {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(96px, 1fr));
    gap: 10px;
}

.mod-dashboard-actions a {
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 18px;
    background: rgba(255, 255, 255, .10);
    color: #fff !important;
    text-decoration: none;
    font-weight: 900;
    backdrop-filter: blur(12px);
}

.mod-dashboard-actions svg {
    width: 24px;
    height: 24px;
}

.mod-app-dashboard .page-title {
    border: 0;
    border-radius: 18px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 8px 28px rgba(16, 24, 40, .06);
    backdrop-filter: blur(14px);
}

.mod-app-dashboard .dashboards-row {
    margin-left: -8px;
    margin-right: -8px;
}

.mod-app-dashboard .widget-container {
    padding-left: 8px;
    padding-right: 8px;
}

.mod-app-dashboard .card {
    overflow: hidden;
    border: 0 !important;
    border-radius: 22px !important;
    background: #fff;
    box-shadow: 0 14px 34px rgba(16, 24, 40, .10) !important;
}

.mod-app-dashboard .dashboard-icon-widget {
    min-height: 124px;
}

.mod-app-dashboard .dashboard-icon-widget .card-body {
    min-height: 124px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
}

.mod-app-dashboard .dashboard-icon-widget:nth-child(1n) .widget-icon,
.mod-app-dashboard .widget-container:nth-child(1n) .dashboard-icon-widget .widget-icon {
    background: linear-gradient(135deg, #14b87a, #0f7a56);
}

.mod-app-dashboard .widget-container:nth-child(2n) .dashboard-icon-widget .widget-icon {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 10px 24px rgba(59, 130, 246, .24);
}

.mod-app-dashboard .widget-container:nth-child(3n) .dashboard-icon-widget .widget-icon {
    background: linear-gradient(135deg, #f59e0b, #b45309);
    box-shadow: 0 10px 24px rgba(245, 158, 11, .24);
}

.mod-app-dashboard .widget-container:nth-child(4n) .dashboard-icon-widget .widget-icon {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: 0 10px 24px rgba(239, 68, 68, .22);
}

.mod-app-dashboard .card .card-title,
.mod-app-dashboard .card-title {
    color: #101828;
    font-weight: 900;
}

.mod-app-dashboard .list-group-item,
.mod-app-dashboard .table {
    font-size: 14px;
}

body {
    background: var(--mod-page);
}

.dashboard-view .page-wrapper,
.mod-library-page,
.library-analytics-page {
    background: var(--mod-page);
}

.dashboard-view {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
}

.dashboard-view .dashboards-row {
    row-gap: 14px;
}

.dashboard-view .widget-container {
    margin-bottom: 14px;
}

.dashboard-view .card,
.mod-library-page .resource-card,
.library-analytics-page .analytics-panel,
.library-analytics-page .analytics-metrics article {
    border: 1px solid rgba(16, 24, 40, .06) !important;
    border-radius: 12px !important;
    background: var(--mod-surface);
    box-shadow: var(--mod-card-shadow) !important;
}

.dashboard-view .card:hover,
.mod-library-page .resource-card:hover {
    box-shadow: var(--mod-card-shadow-strong) !important;
}

.dashboard-icon-widget .card-body {
    min-height: 112px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px !important;
}

.dashboard-icon-widget .widget-icon {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--mod-primary), var(--mod-primary-dark));
    color: #fff;
    box-shadow: 0 10px 24px rgba(20, 184, 122, .26);
}

.dashboard-icon-widget .widget-icon svg {
    width: 24px;
    height: 24px;
}

.dashboard-icon-widget .widget-details {
    min-width: 0;
}

.dashboard-icon-widget .widget-details h1,
.dashboard-icon-widget .widget-details h2 {
    margin: 0;
    color: var(--mod-ink);
    font-size: 28px;
    line-height: 1;
    font-weight: 900;
}

.dashboard-icon-widget .widget-details span,
.dashboard-icon-widget .widget-details small {
    display: block;
    margin-top: 6px;
    color: var(--mod-muted);
    font-size: 13px;
    line-height: 1.35;
}

.library-analytics-widget .card-body {
    position: relative;
    align-items: flex-start;
    flex-direction: column;
}

.library-analytics-widget .widget-details h2 {
    font-size: 34px;
}

.library-widget-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 42px;
    margin-top: 6px;
    border-radius: 10px;
    background: #101828;
    color: #fff !important;
    font-weight: 800;
    text-decoration: none;
}

.library-analytics-shell {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 18px;
}

.analytics-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px;
    border-radius: 14px;
    background: #101828;
    color: #fff;
    box-shadow: var(--mod-card-shadow);
}

.analytics-kicker {
    display: block;
    margin-bottom: 8px;
    color: #8ee6be;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.analytics-hero h1 {
    margin: 0 0 8px;
    font-size: 32px;
    line-height: 1.15;
    font-weight: 900;
}

.analytics-hero p {
    max-width: 720px;
    margin: 0;
    color: #cbd5e1;
    line-height: 1.6;
}

.analytics-action {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 10px;
    background: var(--mod-primary);
    color: #fff !important;
    font-weight: 900;
    text-decoration: none;
}

.analytics-report-tabs {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
    padding: 8px;
    border: 1px solid var(--mod-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--mod-card-shadow);
}

.analytics-report-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--mod-muted);
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
}

.analytics-report-tabs a.active {
    background: linear-gradient(135deg, #163c35, #1b6f5b);
    color: #fff;
    box-shadow: 0 12px 28px rgba(22, 60, 53, 0.24);
}

.analytics-report-tabs svg {
    width: 18px;
    height: 18px;
}

.analytics-metrics,
.analytics-grid {
    display: grid;
    gap: 14px;
    margin-top: 14px;
}

.analytics-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.analytics-metrics article {
    padding: 16px;
}

.analytics-metrics span {
    display: block;
    color: var(--mod-muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.analytics-metrics strong {
    display: block;
    margin-top: 8px;
    color: var(--mod-ink);
    font-size: 28px;
    font-weight: 900;
}

.analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.analytics-panel {
    padding: 18px;
}

.analytics-panel.wide {
    grid-column: 1 / -1;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.panel-head span {
    display: block;
    color: var(--mod-muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.panel-head h2 {
    margin: 4px 0 0;
    color: var(--mod-ink);
    font-size: 18px;
    font-weight: 900;
}

.progress-bands {
    display: grid;
    gap: 12px;
}

.band-label,
.mini-list > div,
.reader-row,
.activity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.band-label span,
.mini-list span,
.reader-row span,
.resource-rank-list span,
.activity-row span {
    color: var(--mod-muted);
    font-size: 13px;
}

.band-label strong,
.mini-list strong {
    color: var(--mod-ink);
    font-weight: 900;
}

.band-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2f6;
}

.band-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--mod-primary), #36c3ff);
}

.mini-list,
.reader-list,
.resource-rank-list,
.activity-table {
    display: grid;
    gap: 10px;
}

.mini-list > div,
.reader-row,
.resource-rank-list > div,
.activity-row {
    padding: 12px;
    border-radius: 10px;
    background: #f8fafc;
}

.reader-row {
    justify-content: flex-start;
}

.reader-row > div:nth-child(2),
.resource-rank-list > div,
.activity-row > div:first-child {
    min-width: 0;
}

.reader-row strong,
.resource-rank-list strong,
.activity-row strong {
    display: block;
    overflow: hidden;
    color: var(--mod-ink);
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-row em {
    margin-left: auto;
    color: var(--mod-primary-dark);
    font-style: normal;
    font-weight: 900;
}

.avatar-dot {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #101828;
    color: #fff;
    font-weight: 900;
}

.activity-row {
    grid-template-columns: minmax(0, 1fr) 70px 70px 150px;
}

.warning-list > div {
    background: #fff7ed;
}

.empty-note {
    margin: 0;
    color: var(--mod-muted);
}

@media (max-width: 991px) {
    .navbar-custom,
    .sidebar-toggled .navbar-custom {
        position: fixed !important;
        top: 8px;
        right: 10px;
        left: 10px;
        min-height: 62px;
        border-radius: 20px;
    }

    .navbar-custom .container-fluid,
    .navbar-custom .navbar-collapse {
        min-height: 62px;
    }

    .navbar-custom .nav-link {
        min-width: 42px;
        min-height: 42px;
        border-radius: 14px;
    }

    .admin-view .page-container,
    .team-member-view .page-container,
    .client-view .page-container {
        padding-top: 78px;
    }

    .mod-app-dashboard {
        padding: 14px;
    }

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

    .mod-dashboard-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-view #page-content,
    .dashboard-view.page-wrapper,
    .library-analytics-shell {
        padding: 12px;
    }

    .analytics-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .analytics-report-tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .analytics-report-tabs a {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    .navbar-custom,
    .sidebar-toggled .navbar-custom {
        position: fixed !important;
        top: 6px;
        right: 8px;
        left: 8px;
        min-height: 58px;
        border-radius: 18px;
    }

    .navbar-custom .container-fluid {
        padding-right: 8px;
        padding-left: 8px;
    }

    .navbar-custom .navbar-nav {
        gap: 2px;
    }

    .navbar-custom .nav-link {
        min-width: 40px;
        min-height: 40px;
    }

    .navbar-custom .nav-link svg {
        width: 20px;
        height: 20px;
    }

    .navbar-custom #user-dropdown {
        min-height: 42px;
        padding: 3px;
        border-radius: 15px;
    }

    .navbar-custom #user-dropdown .avatar-xs,
    .navbar-custom #user-dropdown .avatar-xs img {
        width: 34px;
        height: 34px;
    }

    .navbar-custom #user-dropdown .user-name {
        display: none;
    }

    .navbar-custom .dropdown-menu {
        border-radius: 16px;
    }

    .mod-app-dashboard {
        padding: 10px 10px calc(22px + env(safe-area-inset-bottom));
    }

    .mod-dashboard-hero {
        margin-bottom: 12px;
        padding: 18px;
        border-radius: 22px;
    }

    .mod-dashboard-copy h1 {
        font-size: 28px;
    }

    .mod-dashboard-copy p {
        font-size: 14px;
    }

    .mod-dashboard-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .mod-dashboard-actions a {
        min-height: 74px;
        border-radius: 16px;
        font-size: 12px;
    }

    .mod-app-dashboard .page-title {
        margin-bottom: 12px;
        border-radius: 18px;
    }

    .mod-app-dashboard .card {
        border-radius: 20px !important;
    }

    .dashboard-view .dashboards-row {
        margin-right: 0;
        margin-left: 0;
        gap: 10px;
    }

    .dashboard-view .widget-container {
        width: 100%;
        padding-right: 0;
        padding-left: 0;
        margin-bottom: 10px;
    }

    .dashboard-icon-widget .card-body {
        min-height: 96px;
        padding: 16px !important;
    }

    .dashboard-icon-widget .widget-icon {
        flex-basis: 48px;
        width: 48px;
        height: 48px;
        border-radius: 14px;
    }

    .dashboard-icon-widget .widget-details h1,
    .dashboard-icon-widget .widget-details h2 {
        font-size: 24px;
    }

    .analytics-hero {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px;
    }

    .analytics-hero h1 {
        font-size: 24px;
    }

    .analytics-action {
        width: 100%;
    }

    .analytics-report-tabs {
        margin-right: -12px;
        margin-left: -12px;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .analytics-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-metrics article,
    .analytics-panel {
        padding: 14px;
    }

    .analytics-metrics strong {
        font-size: 23px;
    }

    .activity-row {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }
}
