:root {
    --app-background: #eef5f9;
    --app-border: #e9ecef;
    --app-foreground: #455a64;
    --app-muted: #99abb4;
    --app-primary: #1e88e5;
    --app-sidebar-active: #21c1d6;
    --app-sidebar: #1d2126;
    --app-header-height: 70px;
    --app-sidebar-width: 240px;
    --app-sidebar-mini-width: 65px;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--app-background);
    color: var(--app-foreground);
    font-family: "Poppins", "Segoe UI", Arial, sans-serif;
    font-size: .875rem;
}

.has-app-shell,
.app-shell {
    width: 100%;
    overflow-x: hidden;
}

.topbar {
    position: fixed;
    z-index: 1040;
    top: 0;
    right: 0;
    left: 0;
    height: var(--app-header-height);
    background: #fff;
    box-shadow: 1px 0 7px rgb(0 0 0 / 5%);
}

.top-navbar {
    display: flex;
    min-height: var(--app-header-height);
    padding: 0;
}

.navbar-header {
    display: flex;
    flex: 0 0 var(--app-sidebar-mini-width);
    align-items: center;
    justify-content: center;
    width: var(--app-sidebar-mini-width);
    min-height: var(--app-header-height);
    background: #fff;
    transition: width .2s ease-in, flex-basis .2s ease-in;
}

.topbar .navbar-brand,
.public-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    margin: 0;
    padding: 0 10px;
    color: #263238;
    font-weight: 600;
    text-decoration: none;
}

.topbar .navbar-brand:hover,
.topbar .navbar-brand:focus,
.public-brand:hover,
.public-brand:focus {
    color: #263238;
}

.logo-icon {
    display: block;
    flex: 0 0 38px;
    width: 35px;
    height: 38px;
    object-fit: contain;
}

.logo-text {
    display: none;
    overflow: hidden;
    margin-left: 6px;
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-hovered .navbar-header {
    flex-basis: var(--app-sidebar-width);
    width: var(--app-sidebar-width);
}

.sidebar-hovered .navbar-header .logo-text {
    display: inline;
}

.topbar .navbar-collapse {
    display: flex !important;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    justify-content: flex-end;
    padding: 0 10px 0 0;
    background: #fff;
}

.header-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #67757c;
}

.header-icon-button:hover,
.header-icon-button:focus-visible {
    background: rgb(0 0 0 / 5%);
    color: #263238;
}

.header-icon-button i {
    font-size: 20px;
}

.profile-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    height: var(--app-header-height);
    padding: 0 .75rem;
    border: 0;
    background: transparent;
    color: #67757c;
}

.profile-trigger:hover,
.profile-trigger:focus-visible,
.profile-trigger[aria-expanded="true"] {
    background: rgb(0 0 0 / 5%);
}

.profile-trigger::after {
    display: none;
}

.profile-avatar {
    display: inline-grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--app-primary);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    place-items: center;
}

.profile-avatar-lg {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
}

.dashboard-icon {
    display: inline-grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.3rem;
    place-items: center;
}

.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    height: 38px;
    border: 1px solid #ced4da;
    border-radius: .375rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-right: 2.25rem;
    padding-left: .75rem;
    color: #212529;
    line-height: 36px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
    right: .35rem;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 .25rem rgb(13 110 253 / 25%);
}

.select2-dropdown {
    z-index: 1060;
    border-color: #86b7fe;
}

.user-dropdown {
    width: min(300px, calc(100vw - 1rem));
    margin-top: 0 !important;
    padding: 0;
    border: 0;
    border-radius: 0 0 4px 4px;
    box-shadow: 1px 1px 15px rgb(0 0 0 / 10%);
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1rem;
}

.left-sidebar {
    position: fixed;
    z-index: 1030;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: var(--app-sidebar-mini-width);
    padding-top: var(--app-header-height);
    flex-direction: column;
    background: var(--app-sidebar);
    box-shadow: 1px 0 20px rgb(0 0 0 / 8%);
    transition: width .2s ease-in, transform .2s ease-in;
}

.left-sidebar:hover,
.left-sidebar:focus-within {
    width: var(--app-sidebar-width);
}

.scroll-sidebar {
    position: relative;
    min-height: 0;
    height: calc(100% - 50px);
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar-nav ul {
    margin: 0;
    padding: 7px;
    list-style: none;
    background: var(--app-sidebar);
}

.sidebar-item {
    width: 100%;
    margin-bottom: 10px;
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 49px;
    padding: 14px 12px;
    border-radius: 4px;
    color: #fff;
    font-size: .9375rem;
    line-height: 25px;
    opacity: .6;
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-link i {
    display: inline-block;
    flex: 0 0 30px;
    width: 30px;
    margin-right: 7px;
    color: #fff;
    font-size: 21px;
    font-style: normal;
    line-height: 25px;
    text-align: center;
}

.sidebar-link .hide-menu {
    display: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.left-sidebar:hover .sidebar-link,
.left-sidebar:focus-within .sidebar-link {
    padding: 8px 35px 8px 8px;
}

.left-sidebar:hover .sidebar-link .hide-menu,
.left-sidebar:focus-within .sidebar-link .hide-menu {
    display: inline;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
    color: #fff;
    opacity: 1;
}

.sidebar-item.selected > .sidebar-link {
    background: var(--app-sidebar-active);
    color: #fff;
    font-weight: 500;
    opacity: 1;
}

.sidebar-footer {
    display: none;
    min-height: 51px;
    flex: 0 0 auto;
    align-items: center;
    border-top: 1px solid rgb(0 0 0 / 10%);
    background: var(--app-sidebar);
}

.left-sidebar:hover .sidebar-footer,
.left-sidebar:focus-within .sidebar-footer {
    display: flex;
}

.sidebar-footer form {
    width: 100%;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    gap: .55rem;
    padding: .6rem;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: .9rem;
    opacity: .7;
}

.sidebar-logout i {
    font-size: 18px;
}

.sidebar-logout:hover,
.sidebar-logout:focus-visible {
    color: #fff;
    opacity: 1;
}

.page-wrapper {
    position: relative;
    display: flex;
    min-height: 100vh;
    margin-left: var(--app-sidebar-mini-width);
    padding-top: var(--app-header-height);
    flex-direction: column;
    background: var(--app-background);
}

.app-content {
    width: 100%;
    min-height: 0;
    padding: 20px 30px 3rem;
    flex: 1 0 auto;
}

.sidebar-backdrop {
    position: fixed;
    z-index: 1020;
    inset: var(--app-header-height) 0 0;
    display: none;
    border: 0;
    background: rgb(29 33 38 / 50%);
}

.public-header {
    display: flex;
    align-items: center;
    min-height: var(--app-header-height);
    padding: 0 clamp(1rem, 4vw, 3rem);
    background: #fff;
    box-shadow: 1px 0 7px rgb(0 0 0 / 5%);
}

.public-brand {
    justify-content: flex-start;
    padding: 0;
}

.public-content {
    width: 100%;
    min-height: 0;
    flex: 1 0 auto;
}

.has-public-shell {
    display: flex;
    flex-direction: column;
}

.app-footer,
.public-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 30px;
    border-top: 1px solid var(--app-border);
    background: #fff;
    color: #67757c;
    font-size: .78rem;
}

.public-footer {
    padding-right: clamp(1rem, 4vw, 3rem);
    padding-left: clamp(1rem, 4vw, 3rem);
}

.legal-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem 1rem;
}

.legal-navigation a {
    color: #546e7a;
    text-decoration: none;
}

.legal-navigation a:hover,
.legal-navigation a:focus-visible {
    color: var(--app-primary);
    text-decoration: underline;
}

.legal-shell {
    width: min(100%, 62rem);
    margin: 0 auto;
    padding: 1rem 0 2rem;
}

.legal-heading {
    margin-bottom: 1.25rem;
}

.legal-card {
    overflow: hidden;
}

.legal-copy section + section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--app-border);
}

.legal-copy :is(p, li),
.legal-card address,
.legal-data-list {
    line-height: 1.7;
}

.legal-copy li + li {
    margin-top: .35rem;
}

.legal-data-list {
    margin-bottom: 1.5rem;
}

.legal-data-list > div {
    display: grid;
    grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr);
    gap: .5rem 1rem;
}

.legal-data-list dt {
    font-weight: 600;
}

.legal-data-list dd {
    margin: 0;
}

.page-shell,
.auth-shell {
    display: grid;
    min-height: calc(100vh - var(--app-header-height) - 3rem);
    padding: 2rem 1rem;
    place-items: center;
}

.auth-shell .card {
    width: min(100%, 44rem);
    border: 0;
    border-radius: 4px;
    box-shadow: 0 1px 7px rgb(0 0 0 / 8%);
}

.error-shell {
    display: grid;
    min-height: calc(100vh - var(--app-header-height) - 7rem);
    min-height: calc(100dvh - var(--app-header-height) - 7rem);
    padding: clamp(.5rem, 4vw, 3rem) 0;
    place-items: center;
}

.error-card {
    width: min(100%, 48rem);
    overflow: hidden;
    border-top: 4px solid #ef5350;
}

.error-icon {
    display: grid;
    width: clamp(4.5rem, 12vw, 5.5rem);
    height: clamp(4.5rem, 12vw, 5.5rem);
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: #ffebee;
    color: #d32f2f;
    font-size: clamp(2.35rem, 7vw, 3rem);
    place-items: center;
}

.error-title {
    margin-bottom: 1rem;
    color: var(--app-foreground);
    font-size: clamp(1.65rem, 5vw, 2.35rem);
    font-weight: 500;
    overflow-wrap: anywhere;
}

.error-message {
    max-width: 40rem;
    margin: 0 auto;
    color: #37474f;
    font-size: clamp(1.05rem, 3vw, 1.25rem);
    font-weight: 500;
    line-height: 1.65;
}

.error-help-text {
    max-width: 38rem;
    margin: .75rem auto 0;
    color: #67757c;
    font-size: clamp(.95rem, 2.5vw, 1.05rem);
    line-height: 1.65;
}

.error-action {
    min-width: 12rem;
    margin-top: 1.75rem;
}

.card {
    border: 0;
    border-radius: 4px;
}

.app-card {
    width: 100%;
}

.app-content h1.h2 {
    color: var(--app-foreground);
    font-size: 1.45rem;
    font-weight: 400;
}

.eyebrow {
    margin: 0 0 .35rem;
    color: var(--app-primary);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 1rem;
    line-height: 1.2;
}

.btn-primary,
.btn-primary:disabled {
    border-color: var(--app-primary);
    background: var(--app-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: #1976c9;
    background: #1976c9;
}

.status-list {
    margin: 2rem 0 0;
}

.status-list div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem 0;
    border-top: 1px solid var(--app-border);
}

.status-list dt {
    font-weight: 600;
}

.status-list dd {
    margin: 0;
}

.status-ready {
    color: #087443;
}

.status-waiting {
    color: #9a5d00;
}

.signature-box {
    width: min(100%, 46rem);
    height: 182px;
    overflow: hidden;
    border: 1px solid var(--app-border);
    border-radius: 4px;
    background: #fff;
}

.report-signature-panel {
    padding: 1.25rem;
    border: 1px solid var(--app-border);
    border-radius: .375rem;
    background: #f8fafc;
}

.report-action-button {
    display: flex;
    min-height: 86px;
    padding: .85rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
}

.report-action-button strong {
    font-size: 1rem;
}

.report-action-button span {
    margin-top: .2rem;
    font-size: .78rem;
    opacity: .85;
}

.report-page-title,
.report-page-title > div {
    min-width: 0;
}

.report-page-title h1 {
    overflow-wrap: anywhere;
}

.report-draft-status:empty {
    display: none;
}

.signature-box canvas {
    display: block;
    width: 100%;
    height: 180px;
    touch-action: none;
}

.signature-image {
    width: min(100%, 20rem);
    height: 7rem;
    margin: .5rem 0;
    object-fit: contain;
    object-position: left center;
    border-bottom: 1px solid var(--app-border);
}

.pre-line {
    white-space: pre-line;
}

table td,
table th {
    vertical-align: middle;
}

@media (max-width: 767.98px) {
    .navbar-header {
        flex: 1 1 auto;
        justify-content: flex-start;
        width: auto;
        padding-left: .35rem;
    }

    .navbar-header .logo-text,
    .sidebar-hovered .navbar-header .logo-text {
        display: inline;
    }

    .sidebar-hovered .navbar-header {
        flex-basis: auto;
        width: auto;
    }

    .topbar .navbar-collapse {
        flex: 0 0 auto;
    }

    .left-sidebar,
    .left-sidebar:hover,
    .left-sidebar:focus-within {
        width: var(--app-sidebar-width);
        transform: translateX(-105%);
    }

    .left-sidebar .sidebar-link,
    .left-sidebar:hover .sidebar-link,
    .left-sidebar:focus-within .sidebar-link {
        padding: 8px 35px 8px 8px;
    }

    .left-sidebar .sidebar-link .hide-menu {
        display: inline;
    }

    .left-sidebar .sidebar-footer {
        display: flex;
    }

    .page-wrapper {
        margin-left: 0;
    }

    body.sidebar-open {
        overflow: hidden;
    }

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

    .sidebar-open .sidebar-backdrop {
        display: block;
    }

    .app-content {
        padding: 20px 15px 2rem;
    }

    .app-footer,
    .public-footer {
        align-items: flex-start;
        padding: 1rem 15px;
        flex-direction: column;
    }

    .legal-shell {
        padding-top: 0;
    }

    .legal-data-list > div {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .error-shell {
        min-height: auto;
        padding: .25rem 0 1rem;
        place-items: start stretch;
    }

    .error-card .card-body {
        padding: 2rem 1.25rem !important;
    }

    .error-action {
        width: 100%;
        min-width: 0;
    }

    :is(.role-trainee, .role-trainer) .nav-toggler,
    :is(.role-trainee, .role-trainer) .left-sidebar,
    :is(.role-trainee, .role-trainer) .sidebar-backdrop {
        display: none !important;
    }

    :is(.role-trainee, .role-trainer) .mobile-card-table-container {
        overflow: visible;
    }

    :is(.role-trainee, .role-trainer) .mobile-card-table {
        display: block;
        width: 100% !important;
        margin: 0;
    }

    :is(.role-trainee, .role-trainer) .mobile-card-table > thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    :is(.role-trainee, .role-trainer) .mobile-card-table > tbody {
        display: grid;
        width: 100%;
        gap: .85rem;
    }

    :is(.role-trainee, .role-trainer) .mobile-card-table > tbody > tr {
        display: block;
        width: 100%;
        overflow: hidden;
        border: 1px solid var(--app-border);
        border-radius: 4px;
        background: #fff;
        box-shadow: 0 2px 8px rgb(0 0 0 / 7%);
    }

    :is(.role-trainee, .role-trainer) .mobile-card-table > tbody > tr.mobile-card-title::before {
        display: block;
        padding: .85rem .8rem;
        border-bottom: 1px solid var(--app-border);
        background: #f8fafc;
        color: #263238;
        content: attr(data-card-title);
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .role-trainee #trainee-reports-table > tbody > tr.mobile-card-title > td:nth-child(-n + 2),
    .role-trainer .trainer-trainees-table > tbody > tr.mobile-card-title > td:first-child {
        display: none;
    }

    :is(.role-trainee, .role-trainer) .mobile-card-table > tbody > tr > :is(th, td) {
        position: relative;
        display: block;
        min-height: 42px;
        padding: .7rem .8rem .7rem 9.25rem !important;
        border: 0;
        border-bottom: 1px solid var(--app-border);
        background: #fff !important;
        box-shadow: none !important;
        text-align: left !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    :is(.role-trainee, .role-trainer) .mobile-card-table > tbody > tr > :is(th, td):last-child {
        border-bottom: 0;
    }

    :is(.role-trainee, .role-trainer) .mobile-card-table > tbody > tr > :is(th, td)::before {
        position: absolute;
        top: .7rem;
        left: .8rem;
        width: 7.7rem;
        color: #67757c;
        content: attr(data-label);
        font-size: .75rem;
        font-weight: 600;
        line-height: 1.35;
    }

    :is(.role-trainee, .role-trainer) .mobile-card-table > tbody > tr > .dt-empty {
        padding-left: .8rem !important;
        text-align: center !important;
    }

    :is(.role-trainee, .role-trainer) .mobile-card-table > tbody > tr > .dt-empty::before {
        content: none;
    }

    :is(.role-trainee, .role-trainer) .report-page-header {
        align-items: stretch !important;
        gap: .75rem !important;
    }

    :is(.role-trainee, .role-trainer) .report-page-title {
        width: 100%;
        align-items: flex-start !important;
    }

    :is(.role-trainee, .role-trainer) .report-page-action {
        width: 100%;
    }

    :is(.role-trainee, .role-trainer) .dt-container > .dt-layout-row:first-child {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: .85rem;
    }

    :is(.role-trainee, .role-trainer) .dt-container > .dt-layout-row:first-child > .dt-layout-cell {
        width: auto !important;
        padding: 0;
        grid-column: 1;
    }

    :is(.role-trainee, .role-trainer) .dt-container > .dt-layout-row:last-child {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        margin-top: 1rem;
    }

    :is(.role-trainee, .role-trainer) .dt-container > .dt-layout-row:last-child > .dt-layout-cell {
        display: flex;
        width: auto;
        align-items: center;
        margin: 0;
        text-align: left;
    }

    :is(.role-trainee, .role-trainer) .dt-container > .dt-layout-row:last-child > .dt-layout-cell > * {
        margin: 0;
    }

    :is(.role-trainee, .role-trainer) .dt-container .dt-length {
        display: flex;
        align-items: center;
        gap: .4rem;
        white-space: nowrap;
    }

    :is(.role-trainee, .role-trainer) .dt-container .dt-length .dt-input {
        min-width: 64px;
        min-height: 38px;
        margin: 0;
        border-color: #ced4da;
        border-radius: .375rem;
        background: #fff;
    }

    :is(.role-trainee, .role-trainer) .dt-container .dt-paging nav {
        display: flex;
        align-items: center;
        gap: .25rem;
    }

    :is(.role-trainee, .role-trainer) .dt-container .dt-paging .dt-paging-button,
    :is(.role-trainee, .role-trainer) .dt-container .dt-paging .dt-paging-button.disabled {
        display: inline-grid;
        min-width: 38px;
        height: 38px;
        margin: 0;
        padding: 0 .5rem;
        border: 1px solid #ced4da;
        border-radius: .375rem;
        background: #fff;
        color: var(--app-foreground) !important;
        font-size: 1rem;
        line-height: 1;
        place-items: center;
    }

    :is(.role-trainee, .role-trainer) .dt-container .dt-paging .dt-paging-button.current,
    :is(.role-trainee, .role-trainer) .dt-container .dt-paging .dt-paging-button.current:hover {
        border-color: var(--app-primary);
        background: var(--app-primary);
        color: #fff !important;
    }

    :is(.role-trainee, .role-trainer) .dt-container .dt-paging .dt-paging-button:not(.current, .disabled):hover {
        border-color: var(--app-primary);
        background: #eef6fd;
        color: var(--app-primary) !important;
    }

    :is(.role-trainee, .role-trainer) .dt-container .dt-paging .dt-paging-button.disabled {
        background: #f8fafc;
        color: var(--app-muted) !important;
        opacity: .7;
    }

    :is(.role-trainee, .role-trainer) .dt-container .dt-search {
        display: grid;
        gap: .35rem;
        text-align: left;
    }

    :is(.role-trainee, .role-trainer) .dt-container .dt-search .dt-input {
        width: 100%;
        min-height: 38px;
        margin: 0;
    }

    :is(.role-trainee, .role-trainer) [data-table-filter-control] {
        display: grid !important;
        width: 100%;
        gap: .35rem !important;
        text-align: left;
    }

    :is(.role-trainee, .role-trainer) [data-table-filter-control] .form-select {
        width: 100% !important;
        min-height: 38px;
    }

    .role-trainee .report-day {
        padding: .9rem;
        border: 1px solid var(--app-border);
        border-radius: 4px;
        background: #f8fafc;
    }

    .role-trainee .report-day-name {
        margin-bottom: 0;
        color: #263238;
        font-size: 1rem;
        font-weight: 600;
    }

    .role-trainee .report-signature-panel {
        padding: .9rem;
    }

    .role-trainee .report-signature-panel .signature-box {
        height: 162px;
    }

    .role-trainee .report-signature-panel .signature-box canvas {
        height: 160px;
    }

    :is(.role-trainee, .role-trainer) .report-detail-table > tbody > tr > :is(th, td) {
        padding-left: 7.5rem !important;
    }

    :is(.role-trainee, .role-trainer) .report-detail-table > tbody > tr > :is(th, td)::before {
        width: 5.75rem;
    }
}

@media (max-width: 430px) {
    .logo-text {
        font-size: .9rem;
    }

    .profile-trigger {
        min-width: 50px;
        padding-right: .4rem;
        padding-left: .4rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .navbar-header,
    .left-sidebar {
        transition: none;
    }
}
