/* Страница настроек (/admin). Токены — из pos.css, вкладки — pos-segmented. */

body[data-page="admin"].pos-app {
    height: auto;
    min-height: 100vh;
    overflow: auto;
}

.adm-page {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px 40px;
}

/* ---- Вкладки ---- */

.adm-tabs {
    max-width: 660px;
    margin: 0 auto 16px;
}

.adm-tabs .pos-segmented__btn {
    font-size: 0.85rem;
    padding: 8px 10px;
}

.adm-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.adm-panel.hidden {
    display: none;
}

/* ---- Карточки-группы ---- */

.adm-card {
    background: var(--pos-surface);
    border: 1px solid var(--pos-line);
    border-radius: var(--pos-radius);
    box-shadow: var(--pos-shadow);
    padding: 16px 18px;
}

.adm-card h2 {
    margin: 0 0 12px;
    font-size: 1.05rem;
    font-weight: 700;
}

.adm-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.adm-card__head h2 {
    margin: 0;
}

.adm-card__subhead {
    margin: 18px 0 8px;
}

.adm-card__subhead h3 {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 650;
    color: #334155;
}

/* ---- Формы ---- */

.adm-page input,
.adm-page select {
    border-color: var(--pos-line);
    border-radius: 10px;
    font: inherit;
}

.adm-page textarea {
    border: 1px solid var(--pos-line);
    border-radius: 10px;
    font: inherit;
    margin-top: 4px;
    padding: 10px;
    background: #fff;
    width: 100%;
    min-height: 110px;
    resize: vertical;
}

.adm-page input:focus-visible,
.adm-page select:focus-visible,
.adm-page textarea:focus-visible {
    outline: 2px solid var(--pos-accent);
    outline-offset: 1px;
}

.adm-page .inline-check,
.adm-page .checkbox-inline {
    margin-top: 0;
    align-self: end;
    padding-bottom: 10px;
    font-weight: 600;
}

.adm-form-footer {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.grid-form label.grid-form__full {
    grid-column: 1 / -1;
}

.adm-save-hint {
    font-size: 0.82rem;
    color: var(--pos-muted);
}

.adm-save-hint.is-dirty {
    color: #b45309;
    font-weight: 600;
}

.adm-actions {
    margin: 10px 0;
}

/* ---- Сверка каталога сайт → POS ---- */

.cm-mono {
    font-family: "Consolas", "Courier New", monospace;
    font-weight: 700;
}

.catalog-candidate {
    margin-bottom: 6px;
}

.cm-article-input {
    min-width: 110px;
    padding: 6px 8px;
    border: 1px solid var(--pos-line);
    border-radius: 8px;
    font: inherit;
}

.cm-article-input:focus-visible {
    outline: 2px solid var(--pos-accent);
    outline-offset: 1px;
}

.adm-table-wrap td .actions {
    gap: 6px;
}

/* ---- Таблицы ---- */

.adm-table-wrap {
    border: 1px solid var(--pos-line);
    border-radius: 10px;
    overflow: auto;
}

.adm-table-wrap th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    font-weight: 600;
    z-index: 1;
}

.adm-table-wrap tr:last-child td {
    border-bottom: none;
}

/* ---- Кнопка активного периода аналитики ---- */

button.analytics-period-btn.is-active {
    background: var(--pos-accent);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* ---- Превью чека ---- */

.adm-receipt-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.adm-receipt-layout form {
    flex: 1 1 320px;
    min-width: 0;
}

.adm-receipt {
    flex: 1 1 340px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.adm-receipt__stage {
    flex: 0 1 300px;
    display: flex;
    justify-content: center;
    padding: 20px 14px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    border: 1px dashed var(--pos-line);
    border-radius: 12px;
}

.adm-receipt__paper {
    background: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
    padding: 14px 12px;
    width: 230px;
    font-size: 0.72rem;
    line-height: 1.5;
    transition: width 0.4s var(--ios-spring);
}

.adm-receipt__paper.is-thermal {
    font-family: "Consolas", "Courier New", monospace;
    border-top: 1px dashed #cbd5e1;
    border-bottom: 1px dashed #cbd5e1;
}

.adm-receipt__paper.is-a4 {
    font-family: inherit;
    width: 320px;
    border: 1px solid var(--pos-line);
}

.adm-receipt__brand {
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.adm-receipt__meta-line {
    color: var(--pos-muted);
    font-size: 0.68rem;
    margin-bottom: 6px;
}

.adm-receipt__row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px dotted #e2e8f0;
    padding: 2px 0;
}

.adm-receipt__total {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px solid #cbd5e1;
}

.adm-receipt__desc {
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.adm-receipt__desc p {
    margin: 0;
}

.adm-receipt__format {
    font-size: 0.88rem;
    font-weight: 600;
}

.adm-receipt__fallback {
    font-size: 0.82rem;
    color: #b45309;
}

.adm-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 600;
}

/* ---- Тосты ---- */

.adm-toasts {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}

.adm-toast {
    background: #fff;
    border: 1px solid var(--pos-line);
    border-left: 4px solid var(--pos-accent);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    font-size: 0.9rem;
    cursor: pointer;
    animation: admToastIn 0.25s ease;
    word-break: break-word;
}

.adm-toast--ok {
    border-left-color: var(--pos-ok);
}

.adm-toast--error {
    border-left-color: var(--pos-danger);
}

@keyframes admToastIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .adm-toast,
    .adm-receipt__paper,
    .pos-segmented__thumb {
        animation: none;
        transition: none;
    }
}

/* ---- Мобильная версия ---- */

@media (max-width: 720px) {
    .adm-page {
        padding: 10px 10px 32px;
    }

    .adm-tabs {
        max-width: 100%;
    }

    .adm-tabs .pos-segmented__btn {
        font-size: 0.74rem;
        padding: 7px 6px;
    }

    .adm-card {
        padding: 12px 14px;
    }

    .adm-receipt__stage {
        flex-basis: 100%;
    }
}
