@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
    --imtma-red: #b5123d;
    --imtma-ink: #20243a;
    --imtma-blue: #253858;
    --imtma-line: #d9dee8;
    --imtma-muted: #6d7484;
    --imtma-bg: #f4f6f9;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    font-size: 14px;
    background: var(--imtma-bg);
    color: var(--imtma-ink);
}

a {
    color: var(--imtma-red);
    text-decoration: none;
}

a:hover,
a:focus {
    color: #8f0d30;
}

.client-app {
    border-top: 4px solid var(--imtma-red);
}

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

.app-sidebar {
    background: #20243a;
    color: #fff;
    padding: 18px 14px;
    min-width: 0;
    overflow: hidden;
    transition: opacity .15s ease, padding .2s ease, visibility .15s ease;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
    padding: 8px;
    margin-bottom: 14px;
    background: #fff;
    border-radius: 8px;
}

.brand img {
    width: 100%;
    max-width: 145px;
    height: auto;
}

.app-nav {
    gap: 4px;
}

.app-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e7eaf2;
    padding: 12px 13px;
    border-radius: 7px;
    font-size: .9rem;
    font-weight: 600;
}

.app-nav .nav-link:hover,
.app-nav .nav-link.active {
    background: var(--imtma-red);
    color: #fff;
}

.logout-link {
    margin-top: 18px;
}

.app-main {
    min-width: 0;
}

.app-topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px 28px;
    background: #fff;
    border-bottom: 1px solid var(--imtma-line);
}

.app-topbar h1 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.eyebrow {
    color: var(--imtma-muted);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.account-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 240px;
    font-size: .86rem;
}

.account-toggle span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-dropdown .dropdown-menu {
    min-width: 220px;
    border-color: var(--imtma-line);
    box-shadow: 0 12px 30px rgba(20, 31, 56, .12);
}

.account-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .88rem;
}

.account-dropdown .dropdown-item i {
    width: 16px;
    color: var(--imtma-blue);
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.content-panel {
    margin: 24px 28px;
    padding: 24px;
    background: #fff;
    border: 1px solid var(--imtma-line);
    border-radius: 8px;
    min-height: calc(100vh - 120px);
    box-shadow: 0 10px 24px rgba(20, 31, 56, .06);
}

h2 {
    margin: 0 0 22px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--imtma-red);
    font-size: 1.15rem;
}

.table {
    font-size: .86rem;
    vertical-align: middle;
}

.table thead th {
    background: #f2f4f8;
    color: #293047;
    font-weight: 700;
    white-space: nowrap;
}

.btn-primary,
.btn-info {
    --bs-btn-bg: #253858;
    --bs-btn-border-color: #253858;
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: #1b2944;
    --bs-btn-hover-border-color: #1b2944;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
}

.btn-success {
    --bs-btn-bg: #18805d;
    --bs-btn-border-color: #18805d;
}

.btn-warning {
    --bs-btn-bg: var(--imtma-red);
    --bs-btn-border-color: var(--imtma-red);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: #8f0d30;
    --bs-btn-hover-border-color: #8f0d30;
    --bs-btn-hover-color: #fff;
}

.btn-xs {
    --bs-btn-padding-y: .24rem;
    --bs-btn-padding-x: .55rem;
    --bs-btn-font-size: .76rem;
    --bs-btn-border-radius: .25rem;
}

.pull-right {
    float: right !important;
}

.btn-default {
    --bs-btn-color: #253858;
    --bs-btn-bg: #fff;
    --bs-btn-border-color: #cfd6e3;
}

.panel {
    border: 1px solid var(--imtma-line);
    border-radius: 8px;
    background: #fff;
}

.panel-heading,
.panel-body {
    padding: 18px;
}

.img-responsive {
    max-width: 100%;
    height: auto;
}

.form-control,
.form-select,
.dt-input,
.dataTables_length select,
.dataTables_filter input {
    font-size: .86rem;
}

.dt-toolbar {
    display: grid;
    grid-template-columns: minmax(190px, 1fr) auto minmax(220px, 1fr);
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.dt-actions {
    justify-self: center;
}

.dt-search {
    justify-self: end;
}

.dt-search label,
.dt-length label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.dt-search input {
    min-width: 210px;
}

.dt-footer-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.dt-pages {
    justify-self: end;
}

.dt-buttons .btn {
    padding: .36rem .85rem;
    font-size: .86rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.profile-item {
    padding: 14px;
    border: 1px solid var(--imtma-line);
    border-radius: 8px;
    background: #fbfcfe;
}

.profile-item span {
    display: block;
    margin-bottom: 5px;
    color: var(--imtma-muted);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.profile-item strong {
    color: var(--imtma-ink);
    font-size: .92rem;
    font-weight: 600;
}

.profile-address {
    grid-column: 1 / -1;
}

.profile-form {
    max-width: 960px;
}

.password-form {
    max-width: 760px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.admin-error {
    display: block;
    margin-top: 5px;
    color: #900;
    font-size: .8rem;
    font-style: italic;
    font-weight: 400;
    text-align: left;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 .2rem rgba(220, 53, 69, .18);
}

.login-page {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(181, 18, 61, .08), rgba(37, 56, 88, .12)),
        #f6f7fb;
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(430px, 100%);
    padding: 34px;
    background: #fff;
    border: 1px solid var(--imtma-line);
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(32, 36, 58, .14);
}

.login-brand img {
    width: 170px;
    max-width: 100%;
    display: block;
    margin: 0 auto 26px;
}

.login-heading {
    margin-bottom: 24px;
    text-align: center;
}

.login-heading span {
    color: var(--imtma-muted);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.login-heading h1 {
    margin: 4px 0 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar-collapsed .app-sidebar {
    width: 0;
    overflow: hidden;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

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

    .app-sidebar {
        min-height: auto;
    }

    .sidebar-collapsed .app-sidebar {
        display: none;
    }

    .app-topbar {
        padding: 18px;
        flex-wrap: wrap;
    }

    .content-panel {
        margin: 16px;
        padding: 16px;
    }

    .topbar-meta {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

}

@media (max-width: 640px) {
    .topbar-meta {
        align-items: stretch;
        flex-direction: column;
    }

    .account-toggle {
        justify-content: center;
        max-width: none;
        width: 100%;
    }

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

    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .dt-toolbar,
    .dt-footer-row {
        grid-template-columns: 1fr;
    }

    .dt-actions,
    .dt-search,
    .dt-pages {
        justify-self: stretch;
    }

    .dt-actions .dt-buttons,
    .dt-actions .btn,
    .dt-search label,
    .dt-search input {
        width: 100%;
    }

    .dt-search label,
    .dt-length label {
        align-items: flex-start;
        flex-direction: column;
    }
}
