/* Общий дизайн-систем для оболочек страниц. Префикс классов — sh- */
:root {
    --sh-ink: #141b26;
    --sh-muted: #5b6576;
    --sh-faint: #8a93a3;
    --sh-line: #e0e4ea;
    --sh-line-strong: #c9d0da;
    --sh-surface: #ffffff;
    --sh-panel: #f5f7fa;
    --sh-navy: #14223b;
    --sh-navy-light: #22396a;
    --sh-red: #c8102e;
    --sh-red-dark: #a00d25;
    --sh-blue: #1f4fa3;
    --sh-blue-soft: #e9effa;
    --sh-female: #c2185b;
    --sh-female-soft: #fbe9f0;
    --sh-mixed: #7b3fa0;
    --sh-mixed-soft: #f2eaf7;
    --sh-live: #12873f;
    --sh-live-soft: #e5f4eb;
    --sh-radius: 12px;
    --sh-radius-sm: 8px;
    --sh-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --sh-shadow: 0 2px 8px -2px rgba(20, 34, 59, 0.15);
    --sh-shadow-hover: 0 16px 32px -18px rgba(20, 34, 59, 0.5);
    --sh-focus-ring: 0 0 0 3px rgba(31, 79, 163, 0.2);
}

.sh-page {
    padding-top: 2rem;
    padding-bottom: 3rem;
    color: var(--sh-ink);
}

.sh-page [hidden] {
    display: none !important;
}

/* ---------- заголовок страницы ---------- */
.sh-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.sh-header__main {
    min-width: 0;
    flex: 1;
}

.sh-header__title {
    margin: 0;
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--sh-ink);
}

.sh-header__subtitle {
    margin: 0.25rem 0 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--sh-muted);
}

.sh-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.sh-header__back {
    order: 999;
}

/* ---------- кнопки ---------- */
.sh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.sh-btn:focus-visible {
    outline: none;
    box-shadow: var(--sh-focus-ring);
}

.sh-btn--primary {
    color: #fff;
    background: var(--sh-blue);
    border-color: var(--sh-blue);
}

.sh-btn--primary:hover {
    background: var(--sh-navy-light);
    border-color: var(--sh-navy-light);
}

.sh-btn--secondary {
    color: var(--sh-blue);
    background: #fff;
    border-color: var(--sh-blue);
}

.sh-btn--secondary:hover {
    color: #fff;
    background: var(--sh-blue);
    border-color: var(--sh-blue);
}

.sh-btn--ghost {
    color: var(--sh-muted);
    background: transparent;
    border-color: var(--sh-line);
}

.sh-btn--ghost:hover {
    color: var(--sh-ink);
    background: var(--sh-panel);
    border-color: var(--sh-line-strong);
}

.sh-btn--danger {
    color: var(--sh-red);
    background: transparent;
    border-color: var(--sh-red);
}

.sh-btn--danger:hover {
    color: #fff;
    background: var(--sh-red);
    border-color: var(--sh-red);
}

.sh-btn--success {
    color: #fff;
    background: var(--sh-live);
    border-color: var(--sh-live);
}

.sh-btn--success:hover {
    background: #0e6d34;
    border-color: #0e6d34;
}

.sh-btn--lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.sh-btn--sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* ---------- карточки/панели ---------- */
.sh-card {
    background: var(--sh-surface);
    border: 1px solid var(--sh-line);
    border-radius: var(--sh-radius);
    box-shadow: var(--sh-shadow);
    transition: transform 0.25s var(--sh-ease), box-shadow 0.25s var(--sh-ease), border-color 0.25s;
    animation: sh-rise 0.55s var(--sh-ease) backwards;
    animation-delay: calc(var(--i, 0) * 55ms);
}

.sh-card:hover {
    transform: translateY(-3px);
    border-color: var(--sh-line-strong);
    box-shadow: var(--sh-shadow-hover);
}

.sh-card:has(:focus-visible) {
    outline: 3px solid var(--sh-blue);
    outline-offset: 2px;
}

.sh-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--sh-line);
}

.sh-card__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--sh-ink);
}

.sh-card__body {
    padding: 1rem 1.15rem;
}

.sh-card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.75rem 1.15rem;
    border-top: 1px dashed var(--sh-line);
}

/* ---------- фильтры/формы ---------- */
.sh-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem 1rem;
    padding: 1rem 1.1rem 1.1rem;
    background: var(--sh-panel);
    border: 1px solid var(--sh-line);
    border-radius: var(--sh-radius);
}

.sh-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.sh-field--wide {
    grid-column: span 2;
}

.sh-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--sh-muted);
}

.sh-control {
    width: 100%;
    min-height: 2.6rem;
    padding: 0.45rem 2.5rem 0.45rem 0.7rem;
    font: inherit;
    font-size: 0.95rem;
    color: var(--sh-ink);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6576' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.7rem center / 14px;
    border: 1px solid var(--sh-line);
    border-radius: var(--sh-radius-sm);
    appearance: none;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.sh-control:hover {
    border-color: var(--sh-line-strong);
}

.sh-control.is-set {
    border-color: var(--sh-blue);
    font-weight: 600;
}

.sh-control:focus-visible {
    outline: none;
    border-color: var(--sh-blue);
    box-shadow: var(--sh-focus-ring);
}

/* ---------- таблицы ---------- */
.sh-table-wrap {
    overflow-x: auto;
    border-radius: var(--sh-radius);
    border: 1px solid var(--sh-line);
}

.sh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.sh-table th,
.sh-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--sh-line);
    text-align: left;
    vertical-align: middle;
}

.sh-table thead th {
    background: var(--sh-panel);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sh-muted);
    white-space: nowrap;
}

.sh-table tbody tr {
    transition: background-color 0.15s;
}

.sh-table tbody tr:hover {
    background: var(--sh-panel);
}

.sh-table tbody tr:last-child td {
    border-bottom: none;
}

/* ---------- статус-бейджи ---------- */
.sh-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
}

.sh-badge__dot {
    width: 0.45rem;
    height: 0.45rem;
    background: currentColor;
    border-radius: 50%;
}

.sh-badge--live {
    color: var(--sh-live);
    background: var(--sh-live-soft);
}

.sh-badge--live .sh-badge__dot {
    animation: sh-pulse 1.6s ease-out infinite;
}

.sh-badge--pending {
    color: var(--sh-blue);
    background: var(--sh-blue-soft);
}

.sh-badge--finished {
    color: var(--sh-muted);
    background: #eef0f3;
}

/* ---------- пустое состояние ---------- */
.sh-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--sh-muted);
    border: 1px dashed var(--sh-line-strong);
    border-radius: var(--sh-radius);
}

.sh-empty__icon {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.sh-empty__title {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--sh-ink);
}

.sh-empty__text {
    margin: 0;
    font-size: 0.95rem;
}

/* ---------- пагинация ---------- */
.sh-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.5rem;
}

.sh-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    padding: 0.35rem 0.75rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--sh-blue);
    background: #fff;
    border: 1px solid var(--sh-line);
    border-radius: var(--sh-radius-sm);
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

.sh-page-link:hover {
    color: #fff;
    background: var(--sh-blue);
    border-color: var(--sh-blue);
}

.sh-page-link.is-active {
    color: #fff;
    background: var(--sh-blue);
    border-color: var(--sh-blue);
    cursor: default;
}

.sh-page-link.is-disabled {
    color: var(--sh-faint);
    background: var(--sh-panel);
    border-color: var(--sh-line);
    cursor: not-allowed;
}

/* ---------- хинты/подсказки ---------- */
.sh-hint {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--sh-muted);
}

.sh-required {
    color: var(--sh-red);
}

/* ---------- анимации ---------- */
@keyframes sh-rise {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }
}

@keyframes sh-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(18, 135, 63, 0.55);
    }
    70%,
    100% {
        box-shadow: 0 0 0 7px rgba(18, 135, 63, 0);
    }
}

@keyframes sh-shimmer {
    from {
        background-position: 100% 0;
    }
    to {
        background-position: 0 0;
    }
}

/* ---------- скелетоны ---------- */
.sh-skeleton {
    pointer-events: none;
    animation: none;
}

.sh-skel {
    display: block;
    height: 0.9rem;
    border-radius: 6px;
    background: linear-gradient(90deg, #eceff3 25%, #f7f8fa 40%, #eceff3 60%);
    background-size: 300% 100%;
    animation: sh-shimmer 1.3s ease-in-out infinite;
}

.sh-skel--title {
    width: 80%;
    height: 1.2rem;
}

.sh-skel--short {
    width: 35%;
}

.sh-skel--mid {
    width: 60%;
}

/* ---------- адаптив ---------- */
@media (max-width: 640px) {
    .sh-field--wide {
        grid-column: auto;
    }

    .sh-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .sh-card__footer{
        flex-direction: column;
    }
    .sh-header__main {
        width: 100%;
        order: 2;
    }

    .sh-header__actions {
        display: flex;
        width: 100%;
        order: 1;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .sh-header__back {
        order: 1;
    }

    .sh-header__actions > *:not(.sh-header__back) {
        order: 2;
    }

    .sh-card__header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sh-card,
    .sh-skel,
    .sh-badge--live .sh-badge__dot {
        animation: none;
    }

    .sh-card,
    .sh-control,
    .sh-btn,
    .sh-page-link {
        transition: none;
    }

    .sh-card:hover {
        transform: none;
    }
}
