/* ==========================================================================
   «Справка о заработной плате» (Нургыз 13.10.2026) — окно salary-cert.js (window.SCERT).
   Окно живёт в body (.scert-ov), токены — на нём; тёмная тема — body[data-theme="dark"].
   Лист справки внутри — всегда белый (.dark-keep), его HTML уходит в PDF и Word.
   ========================================================================== */
.scert-ov, .scert-pv-ov {
    --sc-bg: #f4f6fa;
    --sc-card: #ffffff;
    --sc-bdr: #e3e7ee;
    --sc-bdr-soft: #eef1f6;
    --sc-ink: #0f172a;
    --sc-ink2: #334155;
    --sc-ink3: #64748b;
    --sc-ink4: #94a3b8;
    --sc-primary: #074783;
    --sc-primary-hover: #063a6b;
    --sc-primary-soft: rgba(7, 71, 131, 0.08);
    --sc-primary-ring: rgba(7, 71, 131, 0.18);
    --sc-input: #ffffff;
    --sc-input-bdr: #d4dae3;
    --sc-ok: #047857;
    --sc-ok-bg: #ecfdf5;
    --sc-info: #1d4ed8;
    --sc-info-bg: #eff6ff;
    --sc-warn: #b45309;
    --sc-warn-bg: #fffbeb;
    --sc-warn-bdr: #fde68a;
    --sc-manual: #6d28d9;
    --sc-manual-bg: #f5f3ff;
    --sc-err: #b91c1c;
    --sc-desk: #e9edf3;
    --sc-shadow: 0 18px 50px rgba(15, 23, 42, 0.22), 0 3px 10px rgba(15, 23, 42, 0.08);
}
body[data-theme="dark"] .scert-ov, body[data-theme="dark"] .scert-pv-ov {
    --sc-bg: #0b1220;
    --sc-card: #0f172a;
    --sc-bdr: #1f2a3d;
    --sc-bdr-soft: #172235;
    --sc-ink: #f1f5f9;
    --sc-ink2: #cbd5e1;
    --sc-ink3: #94a3b8;
    --sc-ink4: #64748b;
    --sc-primary: #60a5fa;
    --sc-primary-hover: #93c5fd;
    --sc-primary-soft: rgba(96, 165, 250, 0.14);
    --sc-primary-ring: rgba(96, 165, 250, 0.28);
    --sc-input: #111a2e;
    --sc-input-bdr: #2a3550;
    --sc-ok: #6ee7b7;
    --sc-ok-bg: rgba(16, 185, 129, 0.12);
    --sc-info: #93c5fd;
    --sc-info-bg: rgba(59, 130, 246, 0.14);
    --sc-warn: #fcd34d;
    --sc-warn-bg: rgba(245, 158, 11, 0.12);
    --sc-warn-bdr: rgba(245, 158, 11, 0.32);
    --sc-manual: #c4b5fd;
    --sc-manual-bg: rgba(139, 92, 246, 0.14);
    --sc-err: #fca5a5;
    --sc-desk: #070d18;
    --sc-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}

.scert-ov { position: fixed; inset: 0; z-index: 9800; background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; padding: 16px; animation: scertFade .16s ease; }
@keyframes scertFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes scertRise { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.scert { width: 1360px; max-width: 100%; height: calc(100vh - 32px); max-height: 980px; display: flex; flex-direction: column; background: var(--sc-card); color: var(--sc-ink);
    border-radius: 18px; box-shadow: var(--sc-shadow); overflow: hidden; font-size: 13px; animation: scertRise .2s ease; }

/* шапка */
.scert-head { position: relative; z-index: 2; display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--sc-bdr);
    background: linear-gradient(135deg, var(--sc-primary-soft), transparent 65%); flex: none; }
.scert-head-ico { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none;
    background: var(--sc-primary); color: #fff; box-shadow: 0 6px 16px var(--sc-primary-ring); }
.scert-head-t { flex: 1; min-width: 0; }
.scert-h { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.scert-sub { font-size: 12.5px; color: var(--sc-ink3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scert-head-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--sc-card); border: 1px solid var(--sc-bdr);
    font-size: 12px; font-weight: 600; color: var(--sc-ink2); white-space: nowrap; }
.scert-x { width: 36px; height: 36px; border: none; border-radius: 10px; background: none; color: var(--sc-ink3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.scert-x:hover { background: var(--sc-bdr-soft); color: var(--sc-ink); }

/* две колонки: форма и лист */
.scert-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(480px, 560px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.scert-form { min-height: 0; overflow-y: auto; padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 14px; border-right: 1px solid var(--sc-bdr); background: var(--sc-card); }
.scert-pv { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--sc-desk); }
.scert-pv-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--sc-ink3); flex: none; }
.scert-pv-bar > span { display: inline-flex; align-items: center; gap: 6px; }
.scert-paper-wrap { flex: 1; min-height: 0; overflow: auto; padding: 4px 16px 24px; }
.scert-paper-holder { position: relative; margin: 0 auto; }
.scert-paper { position: absolute; top: 0; left: 0; width: 794px; min-height: 1123px; box-sizing: border-box; padding: 46px 50px; background: #fff; color: #111;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .16), 0 1px 3px rgba(15, 23, 42, .08); border-radius: 3px; transform-origin: top left; }
.scert-paper-empty { height: 900px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #94a3b8; font-size: 15px; text-align: center; line-height: 1.5; }

/* шаги формы */
.scert-step { border: 1px solid var(--sc-bdr); border-radius: 14px; padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 11px; background: var(--sc-card); }
.scert-step-h { display: flex; align-items: flex-start; gap: 10px; }
.scert-step-n { width: 24px; height: 24px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
    background: var(--sc-primary-soft); color: var(--sc-primary); }
.scert-step-t { font-size: 14px; font-weight: 700; line-height: 24px; }
.scert-step-s { font-size: 12px; color: var(--sc-ink3); line-height: 1.4; margin-top: -1px; }

/* сотрудник */
.scert-emp { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--sc-primary-soft); }
.scert-ava { width: 42px; height: 42px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
    background: var(--sc-primary); color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.scert-ava.sm { width: 32px; height: 32px; font-size: 12px; background: var(--sc-primary-soft); color: var(--sc-primary); }
.scert-emp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.scert-emp-name { font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.scert-emp-meta { font-size: 12px; color: var(--sc-ink3); }
.scert-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.scert-chip { display: inline-flex; align-items: center; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 19px; white-space: nowrap;
    background: var(--sc-bdr-soft); color: var(--sc-ink2); }
.scert-chip.ok { background: var(--sc-ok-bg); color: var(--sc-ok); }
.scert-chip.muted { background: var(--sc-bdr-soft); color: var(--sc-ink3); }
.scert-picker { display: flex; flex-direction: column; gap: 8px; }
.scert-search { display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--sc-input-bdr); border-radius: 10px; background: var(--sc-input); color: var(--sc-ink4); }
.scert-search:focus-within { border-color: var(--sc-primary); box-shadow: 0 0 0 3px var(--sc-primary-ring); }
.scert-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--sc-ink); font: inherit; font-size: 13.5px; padding: 9px 0; }
.scert-emp-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 2px; margin: 0 -2px; }
.scert-emp-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 9px; border: 1px solid transparent; border-radius: 10px; background: none;
    color: var(--sc-ink); font: inherit; text-align: left; cursor: pointer; }
.scert-emp-item:hover { background: var(--sc-bdr-soft); }
.scert-emp-item.active { border-color: var(--sc-primary); background: var(--sc-primary-soft); }
.scert-emp-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.scert-emp-item-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scert-emp-item-meta { font-size: 11.5px; color: var(--sc-ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scert-picker-foot { text-align: right; }
.scert-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 12px; text-align: center; font-size: 12.5px; color: var(--sc-ink3); }
.scert-empty.soft { flex-direction: row; justify-content: center; padding: 16px 12px; border: 1px dashed var(--sc-bdr); border-radius: 12px; }
.scert-empty.err { color: var(--sc-err); }
.scert-spin { animation: scertSpin 1.1s linear infinite; }
@keyframes scertSpin { to { transform: rotate(360deg); } }

/* период */
.scert-period { display: flex; gap: 10px; flex-wrap: wrap; }
.scert-month { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--sc-ink3); }
.scert-month input { padding: 7px 10px; border: 1px solid var(--sc-input-bdr); border-radius: 9px; background: var(--sc-input); color: var(--sc-ink); font: inherit; font-size: 13px; color-scheme: light; }
body[data-theme="dark"] .scert-month input, body[data-theme="dark"] .scert-in[type="date"] { color-scheme: dark; }
.scert-month input:focus { outline: none; border-color: var(--sc-primary); box-shadow: 0 0 0 3px var(--sc-primary-ring); }
.scert-presets { display: flex; gap: 5px; flex-wrap: wrap; }
.scert-presets.tight { margin-top: 6px; }
.scert-pill { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--sc-bdr); background: var(--sc-card); color: var(--sc-ink2); font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap;
    transition: border-color .15s, color .15s, background .15s; }
.scert-pill.sm { padding: 3px 10px; font-size: 11.5px; }
.scert-pill:hover { border-color: var(--sc-primary); color: var(--sc-primary); }
.scert-pill.active { background: var(--sc-primary); border-color: var(--sc-primary); color: #fff; }

/* таблица месяцев */
.scert-table-wrap { border: 1px solid var(--sc-bdr); border-radius: 12px; overflow: hidden; transition: opacity .15s; }
.scert-table-wrap.busy { opacity: .5; pointer-events: none; }
.scert-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; table-layout: fixed; }
.scert-table th { padding: 8px 6px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--sc-ink3); background: var(--sc-bg);
    border-bottom: 1px solid var(--sc-bdr); text-align: left; white-space: nowrap; }
.scert-table th.n, .scert-table td.n { text-align: right; }
.scert-table td { padding: 5px 6px; border-bottom: 1px solid var(--sc-bdr-soft); vertical-align: middle; }
.scert-table td.c-m { padding-left: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scert-table td.c-net { text-align: right; font-weight: 700; padding-right: 6px; white-space: nowrap; }
.scert-table td.c-a { text-align: center; padding: 3px 2px; }
.scert-table col.w-m { width: auto; } .scert-table col.w-n { width: 84px; } .scert-table col.w-net { width: 82px; } .scert-table col.w-a { width: 32px; }
.scert-table tr.zero td.c-m { color: var(--sc-ink3); }
.scert-table tr.note td { padding: 0 8px 7px; border-bottom: 1px solid var(--sc-bdr-soft); white-space: normal; }
.scert-table tr:has(+ tr.note) td { border-bottom: none; }
.scert-table tfoot td { padding: 9px 8px; font-weight: 700; background: var(--sc-bg); border-bottom: none; border-top: 1px solid var(--sc-bdr); }
.scert-table tfoot td:first-child { padding-left: 10px; }
.scert-table tfoot td.strong { color: var(--sc-primary); font-size: 14px; }
.scert-num { width: 100%; box-sizing: border-box; padding: 6px 7px; border: 1px solid transparent; border-radius: 7px; background: var(--sc-input); color: var(--sc-ink);
    font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; transition: border-color .15s, background .15s; }
.scert-num:hover:not(:disabled) { border-color: var(--sc-input-bdr); }
.scert-num:focus { outline: none; border-color: var(--sc-primary); box-shadow: 0 0 0 3px var(--sc-primary-ring); background: var(--sc-input); }
.scert-num.soft { color: var(--sc-ink2); }
.scert-num:disabled { background: transparent; }
.scert-zero { font-size: 11.5px; font-weight: 500; color: var(--sc-ink4); }
.scert-src { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--sc-ink4); }
.scert-src.ok { background: #10b981; }
.scert-src.info { background: #3b82f6; }
.scert-src.manual { background: #8b5cf6; }
.scert-src.muted { background: var(--sc-ink4); }
.scert-ibtn { width: 28px; height: 28px; border: none; border-radius: 7px; background: none; color: var(--sc-ink4); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.scert-ibtn:hover { background: var(--sc-bdr-soft); color: var(--sc-ink); }
.scert-ibtn.on { color: var(--sc-primary); }
.scert-rnote { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 11.5px; line-height: 1.4; color: var(--sc-ink3); }
.scert-rnote.warn { color: var(--sc-warn); }
.scert-rnote.manual { color: var(--sc-manual); }
.scert-legend { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; font-size: 11.5px; color: var(--sc-ink3); }
.scert-legend > span { display: inline-flex; align-items: center; }
.scert-legend-hint { flex-basis: 100%; color: var(--sc-ink4); }

/* реквизиты */
.scert-collapse { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px; border: 1px dashed var(--sc-bdr); border-radius: 10px; background: none;
    color: var(--sc-primary); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: left; }
.scert-collapse span { margin-left: auto; display: inline-flex; transition: transform .2s; }
.scert-collapse.open { border-style: solid; justify-content: center; color: var(--sc-ink3); font-weight: 500; }
.scert-collapse.open span { transform: rotate(180deg); margin-left: 4px; }
.scert-collapse:hover { border-color: var(--sc-primary); background: var(--sc-primary-soft); }
.scert-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.scert-field { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--sc-ink3); min-width: 0; }
.scert-field.full, .scert-checks.full { grid-column: 1 / -1; }
.scert-field-row { display: flex; align-items: center; gap: 8px; }
.scert-field-row em { font-style: normal; color: var(--sc-ink4); }
.scert-in { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--sc-input-bdr); border-radius: 9px; background: var(--sc-input); color: var(--sc-ink);
    font: inherit; font-size: 13px; }
.scert-in:focus { outline: none; border-color: var(--sc-primary); box-shadow: 0 0 0 3px var(--sc-primary-ring); }
textarea.scert-in { resize: vertical; min-height: 54px; line-height: 1.45; }
.scert-two { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 8px; }
.scert-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--sc-bg); border: 1px solid var(--sc-bdr); gap: 2px; align-self: flex-start; }
.scert-seg button { padding: 5px 14px; border: none; border-radius: 7px; background: none; color: var(--sc-ink3); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.scert-seg button.on { background: var(--sc-card); color: var(--sc-primary); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.scert-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 2px 0; }
.scert-check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--sc-ink2); cursor: pointer; }
.scert-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--sc-primary); }
.scert-check.disabled { color: var(--sc-ink4); cursor: default; }

/* кнопки и низ окна */
.scert-foot { position: relative; z-index: 2; flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding: 11px 18px; border-top: 1px solid var(--sc-bdr); background: var(--sc-card); }
.scert-status { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--sc-ink3); }
.scert-status.ok { color: var(--sc-ok); font-weight: 600; }
.scert-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--sc-bdr); border-radius: 10px; background: var(--sc-card); color: var(--sc-ink);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: border-color .15s, color .15s, background .15s, box-shadow .15s; }
.scert-btn:hover:not(:disabled) { border-color: var(--sc-primary); color: var(--sc-primary); }
.scert-btn:disabled { opacity: .5; cursor: default; }
.scert-btn.sm { padding: 6px 10px; font-size: 12px; }
.scert-btn.primary { background: var(--sc-primary); border-color: var(--sc-primary); color: #fff; box-shadow: 0 4px 12px var(--sc-primary-ring); }
.scert-btn.primary:hover:not(:disabled) { background: var(--sc-primary-hover); color: #fff; }
body[data-theme="dark"] .scert-btn.primary, body[data-theme="dark"] .scert-btn.primary:hover:not(:disabled) { color: #0b1220; }
.scert-btn.wa { color: #15803d; border-color: rgba(37, 211, 102, .55); }
.scert-btn.wa:hover:not(:disabled) { background: rgba(37, 211, 102, .1); color: #15803d; border-color: #25d366; }
body[data-theme="dark"] .scert-btn.wa, body[data-theme="dark"] .scert-btn.wa:hover:not(:disabled) { color: #4ade80; }
.scert-link { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: none; background: none; color: var(--sc-primary); font: inherit; font-size: inherit; font-weight: 600; cursor: pointer;
    text-decoration: underline; text-decoration-color: rgba(127, 127, 127, .35); text-underline-offset: 2px; }
.scert-link:hover { text-decoration-color: currentColor; }

/* окно просмотра готовой справки */
.scert-pv-ov { position: fixed; inset: 0; z-index: 9900; background: rgba(15, 23, 42, .62); display: flex; align-items: center; justify-content: center; padding: 16px; animation: scertFade .15s ease; }
.scert-pv-box { width: min(920px, 96vw); max-height: 94vh; display: flex; flex-direction: column; background: #525659; border-radius: 12px; overflow: hidden; box-shadow: 0 14px 44px rgba(0, 0, 0, .45); }
.scert-pv-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #1e293b; color: #fff; flex-wrap: wrap; }
.scert-pv-title { flex: 1; min-width: 200px; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scert-pv-title em { font-style: normal; font-weight: 400; font-size: 12px; color: #cbd5e1; margin-left: 8px; }
.scert-pv-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px; border: none; border-radius: 8px; color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.scert-pv-btn.red { background: #dc2626; } .scert-pv-btn.red:hover { background: #b91c1c; }
.scert-pv-btn.blue { background: #2563eb; } .scert-pv-btn.blue:hover { background: #1d4ed8; }
.scert-pv-btn.green { background: #16a34a; } .scert-pv-btn.green:hover { background: #15803d; }
.scert-pv-btn.gray { background: #475569; } .scert-pv-btn.gray:hover { background: #334155; }
.scert-pv-x { width: 34px; height: 34px; border: none; border-radius: 8px; background: none; color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.scert-pv-x:hover { background: rgba(255, 255, 255, .12); }
.scert-pv-scroll { flex: 1; overflow-y: auto; padding: 24px; }
.scert-pv-page { width: 794px; max-width: 100%; box-sizing: border-box; margin: 0 auto; padding: 46px 50px; background: #fff; color: #111; border-radius: 2px; box-shadow: 0 4px 16px rgba(0, 0, 0, .35); }

@media (max-width: 1100px) {
    .scert { height: calc(100vh - 20px); }
    .scert-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; overflow-y: auto; }
    .scert-form { overflow: visible; border-right: none; border-bottom: 1px solid var(--sc-bdr); }
    .scert-pv { min-height: 620px; }
}
@media (max-width: 640px) {
    .scert-ov { padding: 0; }
    .scert { height: 100vh; max-height: none; border-radius: 0; }
    .scert-form-grid { grid-template-columns: minmax(0, 1fr); }
    .scert-head-badge { display: none; }
    .scert-status { width: 100%; }
}
