html,
body {
    min-height: 100%;
}

body.admin-page,
body.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-shell {
    flex: 1 0 auto;
}

.app-main {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.content-area {
    flex: 1 0 auto;
}

.guest-page-main {
    flex: 1 0 auto;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-page {
    padding: 0;
}

.site-footer {
    width: 100%;
    margin-top: auto;
    padding: 0;
    flex-shrink: 0;
}

.site-footer-inner {
    width: 100%;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    background: rgba(35, 20, 19, 0.72);
    border-top: 1px solid rgba(168, 97, 84, 0.14);
    color: var(--muted);
    font-size: 0.92rem;
    letter-spacing: 0.03em;
    text-align: center;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.topbar-left h1 {
    min-width: 0;
}

.sidebar-toggle,
.sidebar-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 14px;
    border: 1px solid rgba(168, 97, 84, 0.16);
    background: rgba(36, 21, 19, 0.76);
    color: #fff2ee;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.sidebar-toggle:hover,
.sidebar-close:hover {
    transform: translateY(-1px);
    background: rgba(48, 28, 26, 0.92);
    border-color: rgba(209, 106, 85, 0.26);
}

.sidebar-toggle span {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.sidebar-toggle span + span {
    margin-top: 4px;
}

.sidebar-close {
    position: relative;
    flex-shrink: 0;
}

.sidebar-close span {
    position: absolute;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.sidebar-close span:first-child {
    transform: rotate(45deg);
}

.sidebar-close span:last-child {
    transform: rotate(-45deg);
}

.sidebar-brand {
    justify-content: space-between;
    gap: 12px;
}

.sidebar-brand-copy {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.mobile-nav-backdrop {
    display: none;
}

.page-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.table-action-stack {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-link-inline,
.btn-danger-soft {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(168, 97, 84, 0.16);
    background: rgba(178, 74, 61, 0.12);
    color: #fff0eb;
    font-size: 0.9rem;
    font-weight: 600;
    transition: transform .18s ease, background .18s ease, border-color .18s ease, opacity .18s ease;
}

.btn-link-inline:hover,
.btn-danger-soft:hover {
    transform: translateY(-1px);
}

.btn-link-inline:hover {
    background: rgba(178, 74, 61, 0.18);
}

.btn-link-inline.is-danger,
.btn-danger-soft {
    background: rgba(209, 93, 89, 0.12);
    border-color: rgba(209, 93, 89, 0.22);
    color: #ffe0de;
}

.btn-link-inline.is-danger:hover,
.btn-danger-soft:hover {
    background: rgba(209, 93, 89, 0.18);
}

.checkbox-group {
    align-items: stretch;
}

.checkbox-group label.custom-check {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    margin-top: 30px;
    padding: 0 14px;
    border-radius: 16px;
    background: rgba(17, 10, 10, 0.42);
    border: 1px solid rgba(168, 97, 84, 0.12);
    color: #f4ddd7;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.checkbox-group label.custom-check:hover,
.license-check-card:hover {
    border-color: rgba(209, 106, 85, 0.24);
    transform: translateY(-1px);
}

.checkbox-group label.custom-check:has(input:checked) {
    background: rgba(178, 74, 61, 0.12);
    border-color: rgba(209, 106, 85, 0.28);
}

.license-check-card {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(17, 10, 10, 0.42);
    border: 1px solid rgba(168, 97, 84, 0.12);
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.license-check-card .check-indicator {
    margin-top: 2px;
}

.license-check-card:has(input:checked) {
    background: rgba(178, 74, 61, 0.12);
    border-color: rgba(209, 106, 85, 0.28);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
}

.license-check-card:has(input:checked) .license-check-content strong {
    color: #fff5f1;
}

.license-check-content {
    min-width: 0;
}

.license-check-content strong {
    color: #f7ddd6;
    display: block;
}

.license-check-content small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    word-break: break-word;
}

@media (max-width: 960px) {
    .site-footer-inner {
        min-height: 58px;
        font-size: 0.88rem;
        padding-left: 16px;
        padding-right: 16px;
    }

    .guest-page-main {
        padding: 18px;
    }

    .sidebar-toggle{
        display: flex;
        flex-direction: column;
    }

    .sidebar-close,
    .mobile-nav-backdrop {
        display: inline-flex;
    }

    .mobile-nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 79;
        border: 0;
        padding: 0;
        opacity: 0;
        pointer-events: none;
        background: rgba(10, 6, 6, 0.34);
        backdrop-filter: blur(10px);
        transition: opacity .22s ease;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open .mobile-nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 80;
        width: min(340px, 86vw);
        min-height: 100dvh;
        border-right: 1px solid rgba(168, 97, 84, 0.14);
        border-bottom: 0;
        transform: translateX(-110%);
        transition: transform .22s ease;
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .topbar {
        z-index: 60;
    }

    .app-shell{
        margin-bottom: 200px;
    }
}

@media (max-width: 720px) {
    .topbar {
        flex-direction: row;
        align-items: center;
    }

    .topbar-right {
        margin-left: auto;
    }

    .user-menu-toggle {
        padding-right: 8px;
    }

    .user-meta {
        display: none;
    }

    .page-header,
    .section-header {
        align-items: flex-start;
    }

    .page-header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}