/* =========================================================================
   Стили модуля "Шеф-монтаж". Минимальные, адаптивные, готовые к печати.
   ========================================================================= */

:root {
    /* Палитра под фирстиль КЛМ (шинопроводклм.рф): глубокий тёмно-синий + электрик-голубой акцент. */
    --c-navy: #0c2d52;
    --c-navy-dark: #081f3a;
    --c-bg: #eef2f6;
    --c-surface: #ffffff;
    --c-border: #d4dce6;
    --c-text: #16243a;
    --c-muted: #65758a;
    --c-primary: #0098d8;
    --c-primary-dark: #0079ad;
    --c-accent: #00b4e6;
    --c-success: #1f9d57;
    --c-warning: #c6890f;
    --c-danger: #d23b30;
    --c-info: #1f7aa0;
    --shadow-sm: 0 1px 3px rgba(12, 45, 82, .08);
    --shadow-md: 0 4px 14px rgba(12, 45, 82, .12);
    --radius: 6px;
    --radius-lg: 10px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a {
    color: var(--c-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.shef-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.shef-header {
    background: linear-gradient(90deg, var(--c-navy-dark), var(--c-navy));
    border-bottom: 3px solid var(--c-accent);
    padding: 12px 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 10;
}

.shef-header .shef-container {
    display: flex;
    align-items: center;
    gap: 24px;
}

.shef-logo {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.05;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: .04em;
    color: #fff;
    margin-right: 12px;
}

.shef-logo:hover { text-decoration: none; }

.shef-logo .shef-logo__mark { color: var(--c-accent); }

.shef-logo .shef-logo__sub {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .02em;
    color: #9fc6e6;
    text-transform: uppercase;
}

.shef-nav {
    display: flex;
    gap: 8px;
    flex: 1;
}

.shef-nav a {
    color: #dbe8f4;
    padding: 6px 10px;
    border-radius: var(--radius);
}

.shef-nav a:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    text-decoration: none;
}

.shef-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #cfe0ef;
}

.shef-logout {
    color: #ffd0cb;
}

/* Sections */
.shef-section {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin: 20px 0;
    box-shadow: var(--shadow-sm);
}

.shef-section h1 {
    margin: 0 0 18px;
    font-size: 22px;
}

.shef-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.shef-row--between {
    justify-content: space-between;
}

.shef-row--right {
    justify-content: flex-end;
}

.shef-block {
    background: #fbfcfe;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 16px 0;
}

.shef-block legend, .shef-form legend {
    padding: 0 8px;
    font-weight: 600;
    color: var(--c-primary-dark);
    font-size: 15px;
}

.shef-muted {
    color: var(--c-muted);
    font-size: 13px;
}

/* Forms */
.shef-form fieldset {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 14px;
}

.shef-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
}

.shef-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--c-muted);
}

.shef-grid .shef-col-2 {
    grid-column: span 2;
}

.shef-grid--inline {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.shef-grid--inline label {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    color: var(--c-text);
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--c-text);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(0, 152, 216, .18);
}

input[type="checkbox"] {
    width: auto;
    transform: scale(1.1);
    margin: 0 6px 0 0;
}

/* Buttons */
.shef-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--c-text);
    cursor: pointer;
    text-decoration: none;
    font: inherit;
    transition: background .15s, border-color .15s;
}

.shef-btn:hover {
    background: var(--c-bg);
    text-decoration: none;
}

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

.shef-btn--primary:hover {
    background: var(--c-primary-dark);
    border-color: var(--c-primary-dark);
}

.shef-btn--warning {
    background: var(--c-warning);
    color: #fff;
    border-color: var(--c-warning);
}

.shef-btn--ghost {
    background: transparent;
    color: var(--c-muted);
}

.shef-btn--sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* Tables */
.shef-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
}

.shef-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.shef-table th, .shef-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--c-border);
}

.shef-table th {
    background: #f7f9fc;
    font-weight: 600;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    font-size: 11px;
}

.shef-table tr:hover td {
    background: #fafbff;
}

.shef-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Filters */
.shef-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px 16px;
    margin: 12px 0 18px;
    padding: 14px;
    background: #f7f9fc;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
}

.shef-filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--c-muted);
}

.shef-filters__buttons {
    align-self: end;
    display: flex;
    gap: 6px;
}

/* Status / badges */
.shef-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background: #e8edf6;
    color: var(--c-muted);
}

.shef-status--draft           { background: #e8edf6; color: #444; }
.shef-status--files_uploaded  { background: #e6f0fc; color: #1f5db1; }
.shef-status--transcribed     { background: #e7f4ff; color: #186b97; }
.shef-status--report_generated{ background: #e3f5e1; color: #1f7a3c; }
.shef-status--manager_review  { background: #fff4d6; color: #836200; }
.shef-status--act_required    { background: #ffe6cc; color: #8a4a00; }
.shef-status--letter_required { background: #ffe0e8; color: #8a1f3c; }
.shef-status--closed          { background: #efefef; color: #555; }

.shef-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    margin-right: 3px;
    background: #eee;
    color: #444;
}

.shef-badge--danger  { background: #f8d2cf; color: var(--c-danger); }
.shef-badge--warning { background: #fde9c3; color: var(--c-warning); }
.shef-badge--info    { background: #d3ecf6; color: var(--c-info); }

/* Flash */
.shef-flash {
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
    background: #fff;
}

.shef-flash--success { background: #e3f5e1; border-color: #b9e0a8; color: #1f7a3c; }
.shef-flash--error   { background: #fde0de; border-color: #f0a8a0; color: var(--c-danger); }
.shef-flash--info    { background: #e6f0fc; border-color: #b8d0f0; color: var(--c-info); }

/* Login */
.shef-login-card {
    max-width: 400px;
    margin: 60px auto;
    padding: 30px;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.shef-login-card h1 {
    margin: 0 0 20px;
    font-size: 18px;
    text-align: center;
}

.shef-login-card form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shef-login-card label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--c-muted);
}

/* Footer */
.shef-footer {
    padding: 20px 0;
    color: var(--c-muted);
    text-align: center;
    font-size: 12px;
}

/* Транскрибация */
.shef-tr-status {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    background: #eee;
    color: #555;
    margin-right: 6px;
    font-size: 11px;
}

.shef-tr-status[data-status="pending"] { background: #fff4d6; color: #836200; }
.shef-tr-status[data-status="done"]    { background: #e3f5e1; color: #1f7a3c; }
.shef-tr-status[data-status="failed"]  { background: #fde0de; color: var(--c-danger); }

/* Сформированный отчёт */
.shef-report-text {
    background: #fbfcfe;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font: 12px/1.55 ui-monospace, "Cascadia Code", "Consolas", monospace;
}

/* Заголовки в фирменном тёмно-синем */
.shef-section h1 { color: var(--c-navy); }
.shef-media-h {
    margin: 18px 0 8px;
    font-size: 14px;
    color: var(--c-navy);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.shef-btn--danger {
    background: #fff;
    color: var(--c-danger);
    border-color: #eab8b3;
}
.shef-btn--danger:hover {
    background: #fdeceb;
    border-color: var(--c-danger);
}

.shef-btn--accent {
    background: var(--c-accent);
    color: #06314a;
    border-color: var(--c-accent);
    font-weight: 600;
}

/* Вкладки списка отчётов */
.shef-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--c-border);
    margin-bottom: 16px;
}
.shef-tab {
    padding: 10px 18px;
    color: var(--c-muted);
    font-weight: 600;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}
.shef-tab:hover { color: var(--c-navy); text-decoration: none; }
.shef-tab--active {
    color: var(--c-navy);
    border-bottom-color: var(--c-accent);
}

/* Пагинация */
.shef-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 14px;
}

/* Инлайн-форма (кнопки удалить / в работу) */
.shef-inline-form { display: inline; margin: 0; }

/* Медиа-плееры в карточке */
.shef-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 10px;
}
.shef-media-item {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 10px;
    background: #fbfdff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.shef-media-item audio { width: 100%; }
.shef-media-item video { width: 100%; max-height: 320px; border-radius: var(--radius); background: #000; }
.shef-media-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
}
.shef-media-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* Раскрывающаяся галерея фото */
.shef-gallery-details {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: #fbfdff;
    margin: 10px 0;
    padding: 4px 12px;
}
.shef-gallery-details > summary {
    cursor: pointer;
    padding: 8px 4px;
    font-weight: 600;
    color: var(--c-navy);
    user-select: none;
}
.shef-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 10px 0 14px;
}
.shef-thumb { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.shef-thumb img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
    cursor: zoom-in;
    transition: transform .12s;
}
.shef-thumb img:hover { transform: scale(1.03); border-color: var(--c-accent); }

/* Модальное окно (продление сессии) */
.shef-modal {
    position: fixed;
    inset: 0;
    background: rgba(8, 20, 35, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 20px;
}
.shef-modal__box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    max-width: 380px;
    width: 100%;
    box-shadow: var(--shadow-md);
    text-align: center;
}
.shef-modal__box--wide { max-width: 680px; text-align: left; }
.shef-modal__box--wide .shef-table { margin-bottom: 14px; }
.shef-modal__title { margin: 0 0 8px; font-size: 16px; font-weight: 700; color: var(--c-navy); }
.shef-modal__text { margin: 0 0 16px; color: var(--c-text); }
.shef-modal__count { font-weight: 700; color: var(--c-danger); font-variant-numeric: tabular-nums; }
.shef-modal__actions { display: flex; gap: 10px; justify-content: center; }

/* Тост-уведомления (расшифровка получена) */
.shef-toasts {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}
.shef-toast {
    background: var(--c-navy);
    color: #fff;
    padding: 12px 16px;
    border-radius: var(--radius);
    border-left: 4px solid var(--c-accent);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    opacity: 1;
    transition: opacity .4s;
}
.shef-toast--out { opacity: 0; }

/* Лайтбокс */
.shef-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(8, 20, 35, .88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: zoom-out;
    padding: 24px;
}
.shef-lightbox img {
    max-width: 96vw;
    max-height: 92vh;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
}

/* Диктофон */
.shef-recorder {
    border: 1px dashed var(--c-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    background: #f7fbfe;
}
.shef-rec-timer {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--c-danger);
    align-self: center;
}
.shef-rec-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.shef-rec-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.shef-rec-item audio { flex: 1; min-width: 200px; }

/* Строка аудио: поле выбора файла + значок записи по удержанию */
.shef-audio-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.shef-audio-row input[type="file"] { flex: 1; width: auto; }
.shef-rec-hold {
    flex: 0 0 auto;
    width: 44px;
    height: 38px;
    font-size: 18px;
    line-height: 1;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}
.shef-rec-hold:hover { border-color: var(--c-accent); }
.shef-rec-hold:disabled { opacity: .5; cursor: not-allowed; }
.shef-rec-hold--active {
    background: var(--c-danger);
    border-color: var(--c-danger);
    color: #fff;
    animation: shef-rec-pulse 1s ease-in-out infinite;
}
@keyframes shef-rec-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(210, 59, 48, .5); }
    50%      { box-shadow: 0 0 0 6px rgba(210, 59, 48, 0); }
}

/* Живой превью камеры при записи видео */
.shef-rec-preview {
    display: block;
    width: 100%;
    max-width: 360px;
    max-height: 260px;
    margin-top: 8px;
    border-radius: var(--radius);
    background: #000;
}
.shef-rec-preview[hidden] { display: none; }
.shef-rec-item video.shef-rec-prev {
    max-width: 320px;
    max-height: 220px;
    background: #000;
    border-radius: var(--radius);
}

/* Подтверждение отчёта */
.shef-confirm-bar {
    background: #eaf6fd;
    border: 1px solid #b9e0f4;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 14px;
}
.shef-confirm-form { display: flex; flex-direction: column; gap: 12px; }
.shef-confirm-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--c-text);
}

/* Заблокированная форма */
fieldset[disabled] {
    opacity: .85;
    background: #f6f8fb;
}

/* Админка */
.shef-admin-cols {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 2fr;
    gap: 18px;
}
.shef-admin-users .shef-table { font-size: 12px; }
.shef-row--sel td { background: #eaf6fd !important; }
.shef-fields-grid label {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 6px 10px;
    background: #fff;
}

/* Адаптив */
@media (max-width: 720px) {
    .shef-admin-cols { grid-template-columns: 1fr; }
    .shef-grid { grid-template-columns: 1fr; }
    .shef-grid .shef-col-2 { grid-column: span 1; }
    .shef-header .shef-container { flex-wrap: wrap; }
    .shef-nav { width: 100%; }
}

/* Печать: убираем шапку и нав */
@media print {
    .shef-header, .shef-footer, .shef-nav, .shef-user, .shef-filters, .shef-actions, .shef-row, button {
        display: none !important;
    }
    .shef-section { border: none; box-shadow: none; padding: 0; }
}
