.admin-body {
    min-height: 100vh;
    margin: 0;
    background: #f4f6f8;
    color: var(--ink);
}

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

.admin-side {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 268px;
    height: 100vh;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px 14px;
    background: #0b1016;
    color: #d7dde6;
    border-right: 1px solid #202832;
    scrollbar-width: thin;
    scrollbar-color: #394452 transparent;
}

.admin-side::-webkit-scrollbar {
    width: 7px;
}

.admin-side::-webkit-scrollbar-track {
    background: transparent;
}

.admin-side::-webkit-scrollbar-thumb {
    background: #394452;
    border-radius: 99px;
}

.admin-side .admin-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    margin: 0 2px 18px;
    padding: 8px 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.admin-side .admin-brand img {
    display: block;
    width: 154px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.admin-side .admin-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-side .admin-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 46px;
    gap: 11px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #aab3bf;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.25;
    text-decoration: none;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.admin-side .admin-nav-link:hover {
    background: #151d27;
    border-color: #26303c;
    color: #fff;
}

.admin-side .admin-nav-link.active {
    background: #1b2430;
    border-color: #303b49;
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.admin-side .admin-nav-link .fa {
    flex: 0 0 20px;
    width: 20px;
    color: #8e99a8;
    font-size: 15px;
    line-height: 1;
    text-align: center;
}

.admin-side .admin-nav-link:hover .fa,
.admin-side .admin-nav-link.active .fa {
    color: #fff;
}

.admin-side .admin-nav-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-nav-badge {
    flex: 0 0 auto;
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    padding: 0 6px;
    border-radius: 999px;
    background: #b42318;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.admin-nav-separator {
    height: 1px;
    margin: 12px 8px;
    background: rgba(255, 255, 255, .08);
}

.admin-side .admin-side-bottom {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.admin-main {
    min-width: 0;
    width: 100%;
    padding: 32px clamp(18px, 3vw, 42px) 42px;
    overflow-x: hidden;
}

.admin-page-intro {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.admin-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.admin-title {
    margin: 0;
    color: #101828;
    font: 800 clamp(26px, 3vw, 34px) / 1.15 Manrope, Inter, Arial, sans-serif;
    letter-spacing: -.035em;
}

.admin-top p:not(.admin-page-intro) {
    max-width: 720px;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.admin-card {
    width: 100%;
    margin: 0 0 20px;
    padding: clamp(18px, 2.2vw, 26px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.admin-card:last-child {
    margin-bottom: 0;
}

.admin-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-section-title h2 {
    margin: 0;
    color: #101828;
    font: 800 20px / 1.25 Manrope, Inter, Arial, sans-serif;
    letter-spacing: -.02em;
}

.admin-count,
.admin-muted {
    color: var(--muted);
    font-size: 12px;
}

.admin-muted {
    margin-top: 4px;
    max-width: 440px;
}

.admin-alert {
    width: 100%;
    margin: 0 0 18px;
    padding: 13px 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 13px;
}

.admin-alert-danger {
    background: #fff1f1;
    border-color: #fecdca;
    color: #b42318;
}

.admin-alert-success {
    background: #ecfdf3;
    border-color: #abefc6;
    color: #067647;
}

.admin-alert-warning {
    background: #fffaeb;
    border-color: #fedf89;
    color: #b54708;
}

.admin-main label {
    display: block;
    margin: 0 0 7px;
    color: #344054;
    font-size: 12px;
    font-weight: 700;
}

.admin-main .input,
.admin-main .select,
.admin-main textarea {
    width: 100%;
    min-width: 0;
}

.admin-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-actions form {
    margin: 0;
}

.admin-actions .btn {
    white-space: nowrap;
}

.admin-filters {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 20px;
    padding: 0 0 18px;
    border-bottom: 1px solid var(--line);
}

.admin-filters .filter-field {
    flex: 1 1 190px;
    min-width: 0;
}

.admin-filters .btn {
    min-height: 46px;
}

.admin-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.admin-table {
    width: 100%;
    min-width: 720px;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}

.admin-table th,
.admin-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    font-size: 13px;
}

.admin-table th {
    background: #f8fafc;
    color: #667085;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .07em;
    line-height: 1.3;
    text-transform: uppercase;
    white-space: nowrap;
}

.admin-table tr:last-child td {
    border-bottom: 0;
}

.admin-table tbody tr {
    transition: background .18s ease;
}

.admin-table tbody tr:hover {
    background: #fafbfc;
}

.admin-table td strong {
    display: block;
    color: #101828;
    font-weight: 700;
}

.admin-table td .input,
.admin-table td .select {
    min-width: 130px;
}

.admin-message-preview {
    width: min(420px, 30vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-email-body {
    max-width: 460px;
    max-height: 90px;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
}

.admin-status {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.admin-status.is-active {
    background: #ecfdf3;
    color: #067647;
}

.admin-status.is-inactive {
    background: #f2f4f7;
    color: #667085;
}

.admin-status.is-warning {
    background: #fffaeb;
    color: #b54708;
}

.admin-status.is-danger {
    background: #fef3f2;
    color: #b42318;
}

.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 20px;
}

.admin-pagination a,
.admin-pagination span {
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: #344054;
    font-size: 12px;
    font-weight: 700;
}

.admin-pagination a:hover,
.admin-pagination .is-active {
    background: #101828;
    border-color: #101828;
    color: #fff;
}

.admin-pagination .is-disabled {
    opacity: .45;
    pointer-events: none;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.admin-stat {
    min-width: 0;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease;
}

.admin-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.admin-stat strong {
    display: block;
    margin-bottom: 5px;
    color: #101828;
    font: 800 28px / 1 Manrope, Inter, Arial, sans-serif;
    letter-spacing: -.03em;
}

.admin-stat span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.admin-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(245, 158, 11, .12), transparent 28%),
        #f4f6f8;
}

.admin-login-card {
    width: min(460px, 100%);
    padding: 30px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.admin-login-logo {
    display: block;
    width: 160px;
    max-width: 70%;
    margin: 0 auto 24px;
}

.admin-login-card h1 {
    margin: 0 0 8px;
    color: #101828;
    text-align: center;
    font: 800 28px / 1.2 Manrope, Inter, Arial, sans-serif;
    letter-spacing: -.03em;
}

.admin-login-card > p {
    margin: 0 0 24px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

.admin-login-form {
    display: grid;
    gap: 16px;
}

.admin-login-form .btn {
    width: 100%;
    min-height: 46px;
}

@media (max-width: 1180px) {
    .admin-shell {
        grid-template-columns: 238px minmax(0, 1fr);
    }

    .admin-side {
        width: 238px;
    }

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

@media (max-width: 820px) {
    .admin-shell {
        display: block;
    }

    .admin-side {
        position: relative;
        top: auto;
        width: 100%;
        height: auto;
        min-height: 0;
        max-height: none;
        overflow: visible;
        padding: 12px;
        border-right: 0;
        border-bottom: 1px solid #202832;
    }

    .admin-side .admin-brand {
        min-height: 54px;
        margin: 0 0 12px;
        padding: 4px 8px 12px;
    }

    .admin-side .admin-brand img {
        width: 138px;
    }

    .admin-side .admin-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
    }

    .admin-side .admin-side-bottom {
        margin-top: 8px;
    }

    .admin-main {
        padding: 22px 16px 32px;
    }

    .admin-top {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .admin-top > .btn,
    .admin-top > a.btn {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .admin-side .admin-nav {
        grid-template-columns: 1fr;
    }

    .admin-main {
        padding: 18px 12px 28px;
    }

    .admin-title {
        font-size: 25px;
    }

    .admin-card {
        padding: 16px;
        border-radius: 13px;
    }

    .admin-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .admin-stat {
        padding: 16px;
    }

    .admin-section-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-filters {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-filters .filter-field,
    .admin-filters .btn {
        width: 100%;
        flex-basis: auto;
    }

    .admin-actions {
        align-items: stretch;
    }

    .admin-actions .btn,
    .admin-actions form,
    .admin-actions form .btn {
        width: 100%;
    }

    .admin-message-preview {
        width: 250px;
    }

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

    .admin-form-actions .btn {
        width: 100%;
    }

    .admin-login {
        padding: 14px;
    }

    .admin-login-card {
        padding: 24px 18px;
        border-radius: 15px;
    }
}

.admin-page-intro-text {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.admin-card-spaced {
    margin-bottom: 20px;
}

.admin-form-submit {
    display: flex;
    align-items: flex-end;
}

@media (max-width: 560px) {
    .admin-form-submit,
    .admin-form-submit .btn {
        width: 100%;
    }
}

.admin-alert {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.5;
}

.admin-alert > span {
    min-width: 0;
    flex: 1;
}

.admin-alert-dismissible {
    padding-right: 42px;
    animation: admin-alert-in .22s ease-out both;
}

.admin-alert-close {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: currentColor;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    opacity: .72;
}

.admin-alert-close:hover {
    background: rgba(0, 0, 0, .06);
    opacity: 1;
}

.admin-alert-info {
    background: #eff8ff;
    border-color: #b2ddff;
    color: #175cd3;
}

@keyframes admin-alert-in {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 820px) {
    .admin-main {
        width: 100%;
        max-width: 100%;
    }

    .admin-card {
        overflow: hidden;
    }

    .admin-section-title {
        flex-wrap: wrap;
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .admin-table {
        min-width: 680px;
    }

    .table-wrap {
        margin-right: -1px;
        scrollbar-width: thin;
    }
}

@media (max-width: 560px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 13px;
    }

    .form-grid > .full {
        grid-column: 1 / -1;
    }

    .admin-top {
        margin-bottom: 18px;
    }

    .admin-card {
        width: 100%;
    }

    .admin-alert {
        padding: 12px 40px 12px 12px;
        font-size: 12px;
    }

    .admin-table {
        min-width: 620px;
    }

    .admin-pagination a,
    .admin-pagination span {
        min-width: 34px;
        height: 34px;
    }
}

/* Keep long values from breaking the mobile layout. */
.admin-table td,
.admin-table th {
    overflow-wrap: anywhere;
}

.admin-main .input,
.admin-main .select,
.admin-main textarea,
.admin-main button,
.admin-main .btn {
    box-sizing: border-box;
}

.admin-main .btn {
    min-height: 42px;
}

.admin-actions .select {
    min-width: 130px;
}

@media (max-width: 560px) {
    .admin-actions {
        width: 100%;
    }

    .admin-actions > * {
        min-width: 0;
    }

    .admin-actions form {
        width: 100%;
    }

    .admin-actions .select {
        width: 100%;
        min-width: 0;
    }
}

/* =========================================================
   MOBILE SIDEBAR / DRAWER
   ========================================================= */
.admin-mobile-toggle,
.admin-mobile-overlay,
.admin-mobile-close {
    display: none;
}

@media (max-width: 820px) {
    body.admin-menu-open {
        overflow: hidden;
    }

    .admin-shell {
        position: relative;
    }

    .admin-side {
        position: fixed;
        z-index: 1200;
        top: 0;
        left: 0;
        width: min(300px, 86vw);
        height: 100dvh;
        min-height: 100dvh;
        max-height: none;
        padding: 18px 14px;
        overflow-x: hidden;
        overflow-y: auto;
        transform: translateX(-105%);
        visibility: hidden;
        box-shadow: 18px 0 45px rgba(0, 0, 0, .25);
        transition: transform .25s ease, visibility 0s linear .25s;
        border-right: 1px solid #202832;
        border-bottom: 0;
    }

    .admin-side.is-open {
        transform: translateX(0);
        visibility: visible;
        transition: transform .25s ease;
    }

    .admin-side .admin-brand {
        min-height: 58px;
        margin: 0 0 18px;
        padding: 4px 42px 14px 8px;
    }

    .admin-side .admin-nav {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .admin-side .admin-side-bottom {
        margin-top: 14px;
    }

    .admin-mobile-toggle {
        position: fixed;
        z-index: 1100;
        top: 12px;
        left: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-width: 48px;
        height: 44px;
        padding: 0 13px;
        border: 1px solid #d0d5dd;
        border-radius: 10px;
        background: #fff;
        color: #101828;
        box-shadow: 0 4px 16px rgba(16, 24, 40, .12);
        cursor: pointer;
        font-size: 13px;
        font-weight: 700;
    }

    .admin-mobile-toggle .fa {
        font-size: 16px;
    }

    .admin-mobile-toggle.is-active {
        background: #0b1016;
        border-color: #0b1016;
        color: #fff;
    }

    .admin-mobile-close {
        position: absolute;
        z-index: 2;
        top: 16px;
        right: 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        padding: 0;
        border: 1px solid rgba(255,255,255,.12);
        border-radius: 9px;
        background: #151d27;
        color: #fff;
        cursor: pointer;
    }

    .admin-mobile-close:hover {
        background: #202a36;
    }

    .admin-mobile-overlay {
        position: fixed;
        z-index: 1150;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        padding: 0;
        border: 0;
        background: rgba(0, 0, 0, .48);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        cursor: pointer;
        transition: opacity .25s ease, visibility 0s linear .25s;
    }

    .admin-mobile-overlay.is-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition: opacity .25s ease;
    }

    .admin-main {
        padding-top: 70px;
    }
}

@media (max-width: 560px) {
    .admin-mobile-toggle {
        top: 10px;
        left: 10px;
        height: 42px;
        padding: 0 11px;
    }

    .admin-main {
        padding-top: 64px;
    }
}
