*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    color: #1a1a1a;
    background: #f5f5f5;
}

/* Собственная прокрутка внутри приложения (удобно во iframe Poster с scrolling=no) */
.app-scroll {
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.page {
    max-width: 40rem;
    margin: 4rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.app-shell {
    max-width: 52rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.app-shell .page {
    max-width: none;
    margin: 0;
}

.page--home h1 {
    margin-bottom: 0.25rem;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.app-nav__brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1a1a1a;
    text-decoration: none;
}

.app-nav__brand:hover {
    color: #333;
}

.app-nav__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.app-nav__link {
    color: #444;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.2rem 0;
    border-bottom: 2px solid transparent;
}

.app-nav__link:hover {
    color: #111;
}

.app-nav__link.is-active {
    color: #111;
    font-weight: 600;
    border-bottom-color: #2563eb;
}

.app-nav__tools {
    margin-left: auto;
    flex-shrink: 0;
}

.app-nav__dropdown-wrap {
    position: relative;
}

.app-nav__gear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #444;
    cursor: pointer;
}

.app-nav__gear:hover {
    background: #f1f5f9;
    color: #111;
}

.app-nav__gear:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.app-nav__dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 14rem;
    margin: 0;
    padding: 0.35rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 20;
}

.app-nav__dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.9rem;
    color: #1a1a1a;
    cursor: pointer;
}

.app-nav__dropdown-item:hover {
    background: #f8fafc;
}

.app-nav__dropdown-item:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.section-card {
    display: flex;
    align-items: center;
    min-height: 4.5rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    color: #1a1a1a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.section-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.section-card__title {
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.35;
}

h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
}

.lead {
    margin: 1rem 0 0;
    font-size: 1.05rem;
}

.meta {
    margin: 0.75rem 0 0;
    font-size: 0.95rem;
}

.muted {
    color: #666;
}

.error-text {
    color: #b42318;
}

.page--poster h1 {
    margin-bottom: 0.25rem;
}

.page--access-denied {
    max-width: 36rem;
}

.test-snapshot-home {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
}

.small {
    font-size: 0.875rem;
    margin: 0.35rem 0 0;
}

.snapshot-dialog {
    border: none;
    border-radius: 8px;
    padding: 0;
    max-width: 22rem;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.snapshot-dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}

.snapshot-dialog__inner {
    padding: 1.25rem;
}

.snapshot-dialog__title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

.snapshot-dialog .field {
    display: block;
    margin-bottom: 1rem;
}

.snapshot-dialog .field__label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #374151;
}

.snapshot-dialog .field__control {
    width: 100%;
    font-size: 0.95rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

.snapshot-dialog__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Печать / «Сохранить как PDF»: весь документ на нескольких страницах, а не обрезка по viewport iframe */
@media print {
    html {
        height: auto !important;
        overflow: visible !important;
    }

    body {
        height: auto !important;
        overflow: visible !important;
    }

    #app-scroll,
    .app-scroll {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        overscroll-behavior: auto;
    }
}
