.admin-toolbar {
    position: fixed;
    top: 74px;
    right: 18px;
    z-index: 1200;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 64, 213, 0.3);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 14px 32px rgba(27, 31, 45, 0.22);
    backdrop-filter: blur(10px);
    font-size: 14px;
    color: #272727;
}

.admin-toolbar strong {
    color: #9440d5;
}

.admin-toolbar a,
.admin-toolbar button {
    padding: 8px 11px;
    border: 0;
    border-radius: 10px;
    background: #f1e7fb;
    font: inherit;
    color: #522070;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease;
}

.admin-toolbar a:hover,
.admin-toolbar button:hover {
    background: #e5cef8;
    transform: translateY(-1px);
}

.admin-inline-button {
    position: absolute;
    z-index: 12;
    padding: 12px 18px;
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: 999px;
    background: rgba(148, 64, 213, 0.9);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.25);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.admin-inline-button:hover {
    background: #7c2ebe;
    transform: translateY(-2px);
}

.hero__admin-action-row {
    display: flex;
    align-items: flex-end;
    gap: 28px;
}

.admin-hero-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 260px;
}

.admin-inline-button--hero {
    position: static;
    width: 100%;
    min-height: 54px;
    padding: 12px 18px;
}

.admin-button {
    min-height: 46px;
    padding: 0 22px;
    border: 0;
    border-radius: 13px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.admin-button:hover {
    transform: translateY(-1px);
}

.admin-button:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

.admin-button--primary {
    background: #9440d5;
    color: #ffffff;
}

.admin-button--secondary {
    background: #ececec;
    color: #333333;
}

.admin-button--danger {
    background: #d54157;
    color: #ffffff;
}

.admin-button--push-left {
    margin-right: auto;
}

.admin-preview img[hidden] {
    display: none;
}

.articles-add-button {
    display: block;
    margin: 28px auto 0;
}

.post-card {
    position: relative;
}

.post-card__admin-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 9px;
    margin: -4px 0 18px;
}

.admin-card-button {
    padding: 8px 12px;
    border: 1px solid rgba(148, 64, 213, 0.35);
    border-radius: 10px;
    background: #f5ebfd;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #642394;
    cursor: pointer;
}

.admin-card-button--danger {
    border-color: rgba(213, 65, 87, 0.35);
    background: #fff0f2;
    color: #b52e43;
}

.admin-loading {
    width: 100%;
    margin: auto;
    padding: 28px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    text-align: center;
    color: #555555;
}

.admin-loading--error {
    color: #b52e43;
}

.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.admin-modal--open {
    display: flex;
}

.admin-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 17, 28, 0.72);
    backdrop-filter: blur(5px);
}

.admin-modal__window {
    position: relative;
    z-index: 1;
    width: min(640px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    padding: 34px;
    border-radius: 26px;
    background: #ffffff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.36);
}

.admin-modal__window--wide {
    width: min(900px, 100%);
}

.admin-modal__window--small {
    width: min(480px, 100%);
}

.admin-modal__window h2 {
    margin: 0 46px 26px 0;
    font-size: 30px;
    line-height: 1.15;
    color: #171717;
}

.admin-modal__window p {
    font-size: 18px;
    line-height: 1.55;
    color: #333333;
}

.admin-modal__close {
    position: absolute;
    top: 17px;
    right: 19px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: #f0f0f0;
    font-size: 26px;
    line-height: 1;
    color: #444444;
    cursor: pointer;
}

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.admin-field span,
.admin-preview span {
    font-size: 15px;
    font-weight: 700;
    color: #383838;
}

.admin-field input,
.admin-field textarea,
.admin-field select {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid #cfcfcf;
    border-radius: 13px;
    outline: none;
    background: #ffffff;
    font-family: inherit;
    font-size: 16px;
    color: #202020;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-field input:focus,
.admin-field textarea:focus,
.admin-field select:focus {
    border-color: #9440d5;
    box-shadow: 0 0 0 4px rgba(148, 64, 213, 0.13);
}

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

.admin-field--full {
    grid-column: 1 / -1;
}

.admin-preview {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 4px 0 20px;
}

.admin-preview img {
    width: 100%;
    max-height: 240px;
    border-radius: 16px;
    object-fit: cover;
    background: #eeeeee;
}

.admin-modal__actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.admin-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 4000;
    max-width: min(420px, calc(100vw - 48px));
    padding: 15px 20px;
    border-radius: 14px;
    background: #2d9b65;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
    color: #ffffff;
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.admin-toast--error {
    background: #c73c51;
}

.admin-toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.is-admin-modal-open {
    overflow: hidden;
}

.hero__subtitle,
.post-card p {
    white-space: pre-line;
}

@media (max-width: 900px) {
    .admin-toolbar {
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .admin-toolbar strong {
        width: 100%;
        text-align: center;
    }

    .hero__admin-action-row {
        flex-wrap: wrap;
    }

    .admin-hero-actions {
        width: 291px;
        max-width: 100%;
    }
}

@media (max-width: 700px) {
    .admin-modal {
        padding: 10px;
    }

    .admin-modal__window {
        padding: 26px 18px;
        border-radius: 20px;
    }

    .admin-modal__window h2 {
        font-size: 25px;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-field--full {
        grid-column: auto;
    }

    .admin-modal__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .admin-inline-button {
        padding: 10px 14px;
        font-size: 14px;
    }

    .hero__admin-action-row {
        align-items: stretch;
        gap: 18px;
    }

    .hero__button,
    .admin-hero-actions {
        width: 100%;
        max-width: 291px;
    }

    .post-card__admin-actions {
        justify-content: center;
    }
}

.articles-list > .admin-loading {
    grid-column: 1 / -1;
}


[data-admin-only] {
    display: none !important;
}

body.is-admin [data-admin-only] {
    display: flex !important;
}

.header__account-button,
.header__mini-account {
    width: 52px;
    height: 52px;
    border: 1px solid #c9dcff;
    border-radius: 50%;
    background: #fff;
    padding: 3px;
    cursor: pointer;
    flex: 0 0 auto;
}

.header__account-button img,
.header__mini-account img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.header__contacts {
    gap: 10px;
}

.header__mini {
    gap: 8px;
}

.header__mini-account {
    width: 44px;
    height: 44px;
}

.account-popover {
    position: fixed;
    z-index: 1500;
    top: 82px;
    right: 24px;
    display: none;
    min-width: 220px;
    padding: 16px;
    border: 1px solid #dec5f6;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 16px 45px rgba(42, 24, 59, 0.2);
    gap: 12px;
    flex-direction: column;
}

.account-popover.is-open {
    display: flex;
}

.hero {
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
}

.admin-preview,
.admin-preview img {
    aspect-ratio: 16 / 9;
}

.admin-preview img {
    width: 100%;
    object-fit: cover;
}

.admin-only-link {
    display: none !important;
}

body.is-admin .admin-only-link {
    display: inline-flex !important;
}

.account-popover .admin-button {
    width: 100%;
    text-align: center;
}

.admin-preview,
.admin-preview img {
    aspect-ratio: 1920 / 860;
}

.admin-password-field {
    position: relative;
}

.admin-password-field input {
    padding-right: 58px;
}

.admin-password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 11px;
    background: transparent;
    font-size: 21px;
    cursor: pointer;
    transform: translateY(-50%);
}

.admin-password-toggle:hover,
.admin-password-toggle:focus-visible {
    background: #f1e7fb;
    outline: none;
}

.admin-password-toggle__icon {
    line-height: 1;
}
