:root {
  --navy: #1C2340;
  --bg: #EEF1F8;
  --white: #FFFFFF;
  --border: #DDE2EE;
  --text: #1A1D2E;
  --sec: #64748B;
  --muted: #94A3B8;
  --accent: #4361EE;
  --accent-h: #3451D1;
  --red: #EF4444;
  --orange: #F97316;
  --amber: #F59E0B;
  --green: #22C55E;
  --r: 10px; --rs: 6px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui,-apple-system,sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

/* Toast */
.toast { position: fixed; bottom: 20px; right: 20px; background: #1A1D2E; color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 13px; z-index: 9999; opacity: 0; pointer-events: none; transform: translateY(8px); transition: all 0.22s ease; max-width: 420px; }
.toast.on { opacity: 1; transform: translateY(0); }
.toast.err { background: #991B1B; }

/* Views */
.view { display: none; }
.view.active { display: flex; flex-direction: column; min-height: 100vh; }

/* Login */
#view-login.active { background: var(--navy); align-items: center; justify-content: center; }
.lcard { background: #fff; border-radius: 14px; padding: 40px; width: 360px; max-width: calc(100vw - 32px); box-shadow: 0 24px 64px rgba(0,0,0,0.4); }
.logo { font-size: 22px; font-weight: 700; color: var(--navy); margin-bottom: 4px; letter-spacing: -0.03em; }
.logo span { color: var(--accent); }
.lsub { color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.fg { margin-bottom: 14px; }
.fg label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 5px; }
.fi { width: 100%; padding: 9px 11px; border: 1.5px solid var(--border); border-radius: var(--rs); font-size: 14px; color: var(--text); outline: none; font-family: inherit; }
.fi:focus { border-color: var(--accent); }
.btn-p { width: 100%; padding: 11px; background: var(--accent); color: #fff; border: none; border-radius: var(--rs); font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .15s; }
.btn-p:hover { background: var(--accent-h); }
.btn-p:disabled { opacity: .6; cursor: default; }
.lerr { font-size: 12px; color: var(--red); margin-top: 10px; text-align: center; min-height: 16px; }

/* Top nav */
.tnav { background: var(--navy); color: #fff; display: flex; align-items: center; padding: 0 18px; height: 50px; flex-shrink: 0; gap: 12px; }
.tlogo { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.tlogo span { color: #7C90F0; }
.tgroup { background: rgba(255,255,255,0.12); border-radius: 20px; padding: 3px 11px; font-size: 12px; color: rgba(255,255,255,0.8); }
.tsp { flex: 1; }
.tswitch { display: flex; background: rgba(255,255,255,0.08); border-radius: 6px; padding: 2px; }
.tswitch button { background: none; border: none; color: rgba(255,255,255,0.6); font-size: 12px; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-family: inherit; }
.tswitch button:hover { color: #fff; }
.tswitch button.on { background: rgba(255,255,255,0.18); color: #fff; font-weight: 600; cursor: default; }
.tuser { font-size: 13px; color: rgba(255,255,255,0.6); }
.tuser strong { color: #fff; }
.tuser-btn { background: none; border: none; cursor: pointer; font-family: inherit; padding: 4px 8px; border-radius: 4px; }
.tuser-btn:hover { background: rgba(255,255,255,0.1); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 800; display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px 16px; }
.modal { background: #fff; border-radius: 12px; max-width: 100%; max-height: calc(100vh - 80px); overflow-y: auto; box-shadow: 0 24px 80px rgba(0,0,0,0.35); }
.modal-hdr { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 18px 20px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--text); }
.tlout { background: none; border: none; color: rgba(255,255,255,0.35); font-size: 12px; cursor: pointer; padding: 4px 8px; font-family: inherit; }
.tlout:hover { color: #fff; }

.mbody { flex: 1; overflow-y: auto; padding: 20px 24px; }
.stub { max-width: 520px; margin: 60px auto; text-align: center; color: var(--sec); line-height: 1.6; }

/* Cards, buttons */
.chart-box { background:#fff; border:1px solid var(--border); border-radius:var(--r); padding:16px 20px; margin-bottom:14px; }
.chart-hdr { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; gap: 12px; flex-wrap: wrap; }
.chart-title { font-size:13px; font-weight:600; }
.note { font-size: 12px; color: var(--sec); line-height: 1.6; }
.nd { color: #CBD5E1; }
.btn-pri { padding:7px 16px; background:var(--accent); color:#fff; border:none; border-radius:6px; cursor:pointer; font-family:inherit; font-weight:600; font-size: 13px; }
.btn-pri:hover { background:var(--accent-h); }
.btn-pri:disabled { opacity: .6; cursor: default; }
.btn-sec { padding:7px 14px; background:#fff; color:var(--accent); border:1.5px solid var(--accent); border-radius:6px; cursor:pointer; font-family:inherit; font-weight:500; font-size: 13px; }
.btn-sec:hover { background:#EEF2FF; }
.irow-toggle { background:none; border:none; cursor:pointer; color:var(--accent); font-size:12px; padding:2px 8px; border-radius:4px; font-family:inherit; }
.irow-toggle:hover { background:#EEF2FF; }
.irow-toggle.danger { color: var(--red); }
.irow-toggle.danger:hover { background: #FEF2F2; }

/* Form fields */
.ied-l { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin-bottom: 4px; }
.ied-in { padding:7px 9px; border:1.5px solid var(--border); border-radius:5px; font-size:13px; font-family:inherit; width:100%; outline:none; background:#fff; color: var(--text); }
.ied-in:focus { border-color:var(--accent); }
.ied-in[readonly] { background: #F8F9FE; color: var(--sec); }
.ied-cancel { background:none; border:none; color:var(--muted); font-size:13px; cursor:pointer; font-family:inherit; }
.ied-cancel:hover { color:var(--text); }

/* Admin */
.admin-tabs { display:flex; gap:4px; margin-bottom:16px; }
.admin-tab { padding:6px 14px; background:#fff; border:1.5px solid var(--border); border-radius:6px; font-size:13px; cursor:pointer; font-family:inherit; color:var(--sec); }
.admin-tab.on { background:var(--navy); color:#fff; border-color:var(--navy); }
.tbl-wrap { overflow-x: auto; }
.admin-tbl { width:100%; border-collapse:collapse; }
.admin-tbl th { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); padding:9px 12px; text-align:left; border-bottom:1px solid var(--border); background:#FAFBFF; white-space: nowrap; }
.admin-tbl td { padding:10px 12px; font-size:13px; border-bottom:1px solid #F0F3FC; vertical-align: top; }
.admin-tbl tr:last-child td { border-bottom:none; }
.admin-tbl tbody tr:hover td { background:#F8F9FE; }
.admin-tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.role-pill { display:inline-flex; padding:2px 9px; border-radius:10px; font-size:11px; font-weight:600; }
.role-spec { background:#EEF2FF; color:var(--accent); }
.role-mgr  { background:#ECFDF5; color:#16A34A; }
.role-adm  { background:#FFF7ED; color:#D97706; }
.inactive-row td { opacity:.45; }
.admin-form { background:#fff; border:1px solid var(--border); border-radius:var(--r); padding:20px; max-width:640px; margin-bottom:16px; }
.admin-form-title { font-size:14px; font-weight:700; margin-bottom:14px; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:12px; }
.q-dir { margin-bottom: 10px; }
.q-dir-title { font-size: 12px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.q-list { display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
.q-item { display:flex; align-items:center; gap:6px; font-size:12px; padding: 2px 0; cursor:pointer; color: var(--sec); }
.q-item input, .q-dir-title input { accent-color: var(--accent); }
.form-err { font-size: 12px; color: var(--red); min-height: 16px; margin-top: 8px; }

/* Import */
.kv { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.big-id { font-family: monospace; font-size: 20px; font-weight: 700; color: var(--navy); background: #F1F4FD; padding: 4px 12px; border-radius: 6px; }
.stat-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.stat { background: #F8F9FE; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; min-width: 96px; }
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 11px; color: var(--muted); }
.stat.good b { color: #16A34A; }
.stat.warn b { color: #D97706; }
.stat.bad b { color: var(--red); }
.err-list { font-size: 12px; color: var(--sec); margin-top: 6px; max-height: 180px; overflow-y: auto; line-height: 1.7; }
.status-ok { color: #16A34A; font-weight: 600; font-size: 12px; }
.status-rb { color: var(--muted); font-size: 12px; }

/* === Экран разметки === */
#view-work.active { height: 100vh; }
.app-layout { flex: 1; display: flex; overflow: hidden; min-height: 0; }

.sidebar { width: 220px; background: #fff; border-right: 1px solid var(--border); padding: 14px; flex-shrink: 0; overflow-y: auto; }
.sbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; margin-top: 18px; }
.sbl:first-child { margin-top: 0; }
.fopt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--sec); user-select: none; }
.fopt:hover { background: #F0F2FA; }
.fopt.on { background: #EEF2FF; color: var(--accent); font-weight: 500; }
.fdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cnt { margin-left: auto; font-size: 11px; opacity: .6; }
.cnt.alert { opacity: 1; background: var(--red); color: #fff; border-radius: 10px; padding: 0 6px; font-weight: 700; }
.fchk { display: flex; align-items: center; gap: 8px; padding: 5px 8px; font-size: 13px; color: var(--sec); cursor: pointer; border-radius: 6px; user-select: none; }
.fchk:hover { background: #F0F2FA; }
.fchk input { accent-color: var(--accent); cursor: pointer; }
.sidesel { width: 100%; margin-top: 2px; padding: 7px 9px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 13px; background: #fff; color: var(--text); font-family: inherit; }

.cw { flex: 1; display: flex; overflow: hidden; min-width: 0; }
.elist { width: 380px; min-width: 300px; flex-shrink: 0; overflow-y: auto; padding: 14px; border-right: 1px solid var(--border); }
.lhdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ltitle { font-size: 15px; font-weight: 600; }
.lmeta { font-size: 12px; color: var(--muted); }
.lsrch { padding: 0 0 8px; }
.lsrch-in { width: 100%; padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 13px; font-family: inherit; outline: none; color: var(--text); background: #fff; }
.lsrch-in:focus { border-color: var(--accent); }
.prog-wrap { margin-bottom: 10px; }
.prog-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.prog-bg { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }

.ecard { background: #fff; border: 1.5px solid var(--border); border-radius: var(--r); padding: 13px; margin-bottom: 7px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.ecard:hover { border-color: #C0CBEE; box-shadow: 0 2px 8px rgba(67,97,238,.07); }
.ecard.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(67,97,238,.12); }
.ecard.done { opacity: .72; }
.ecard.locked { background: #FFFDF0; border-color: #F5E6A3; }
.etop { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 7px; }
.sbadge { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; color: #fff; flex-shrink: 0; }
.s1 { background: var(--red); }
.s2 { background: var(--orange); }
.elogin { font-size: 13px; font-weight: 600; font-family: monospace; }
.etopic { font-size: 12px; color: var(--sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edate { font-size: 11px; color: var(--muted); }
.ecmt { font-size: 12px; color: var(--sec); background: #F8F9FE; border-radius: 5px; padding: 5px 8px; font-style: italic; border-left: 2px solid #C5D0F0; margin-bottom: 7px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.eftr { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.ppending { background: #F1F5F9; color: #64748B; }
.pdone { background: #F0FDF4; color: #16A34A; }
.plocked { background: #FFFBEB; color: #D97706; }
.pcall { background: #FEF2F2; color: var(--red); }
.eempty { text-align: center; padding: 36px 16px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.repeat-badge { background: #FEF2F2; color: #DC2626; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-left: 4px; font-family: system-ui, sans-serif; }

.apanel { flex: 1; background: #fff; overflow-y: auto; display: flex; flex-direction: column; min-width: 0; }
.apempty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; gap: 8px; }
.apempty-ico { font-size: 28px; opacity: .4; }
.aphdr { padding: 16px 18px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 13px; }
.apscore { width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 21px; font-weight: 800; color: #fff; flex-shrink: 0; }
.apscore-l { font-size: 10px; font-weight: 600; text-align: center; margin-top: 3px; }
.aplogin { font-size: 17px; font-weight: 700; font-family: monospace; letter-spacing: -.02em; }
.apmeta { font-size: 12px; color: var(--sec); margin-top: 2px; }
.aplinks { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.aptlink { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 12px; text-decoration: none; padding: 3px 9px; background: #EEF2FF; border-radius: 4px; }
.aptlink:hover { background: #E0E7FF; }
.agent-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 9px; background: #F1F5F9; color: var(--sec); border-radius: 4px; }
.agent-chip b { font-family: monospace; color: var(--text); font-weight: 600; }
.agent-chip.incident { background: #FFF7ED; color: #C2410C; font-weight: 600; }
.pincident { background: #FFF7ED; color: #C2410C; }

.apblock { padding: 12px 18px 0; }
.apcmt { padding: 9px 12px; background: #FFF7ED; border-radius: 6px; border-left: 3px solid var(--orange); font-size: 13px; color: var(--sec); font-style: italic; white-space: pre-wrap; word-break: break-word; }
.apcmtl { font-size: 10px; font-weight: 700; color: var(--orange); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; font-style: normal; }
.apnocmt { font-size: 12px; color: var(--muted); }
.repeat-box { background: #FFF7ED; border: 1px solid #FED7AA; border-radius: 8px; padding: 10px 12px; font-size: 12px; color: #92400E; line-height: 1.6; }
.repeat-box b.t { color: #C2410C; }
.proc-box { background: #F8FAFC; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12px; line-height: 1.55; }
.proc-box.has { background: #F5F3FF; border-color: #DDD6FE; }
.proc-t { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.proc-box.has .proc-t { color: #6D28D9; }
.proc-item + .proc-item { margin-top: 7px; }
.proc-name { font-weight: 600; color: #4C1D95; }
.proc-detail { font-weight: 500; }
.proc-hint { color: var(--sec); }
.proc-none { color: var(--sec); }
.proc-foot { margin-top: 8px; font-size: 11px; color: var(--muted); }
.pproc { background: #F5F3FF; color: #6D28D9; }
.smini { display: inline-flex; width: 16px; height: 16px; border-radius: 50%; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: #fff; vertical-align: -2px; }

.lockp { padding: 36px 24px; text-align: center; color: var(--sec); flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lockico { font-size: 32px; margin-bottom: 12px; opacity: .7; }
.lockt { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.locks { font-size: 13px; max-width: 280px; line-height: 1.6; }
.lockby { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; background: #FFFBEB; border: 1px solid #F5E6A3; border-radius: 6px; padding: 6px 12px; font-size: 13px; color: #D97706; font-weight: 500; }

.donev { padding: 16px 18px; }
.dhr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; }
.dby { font-size: 12px; color: var(--muted); }
.btned { padding: 5px 12px; background: #fff; color: var(--accent); border: 1.5px solid var(--accent); border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: 500; font-family: inherit; }
.btned:hover { background: #EEF2FF; }
.df { margin-bottom: 14px; }
.dfl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.dfv { font-size: 13px; color: var(--text); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.dbadge { display: inline-flex; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.bno { background: #F0FDF4; color: #16A34A; }
.byes { background: #FEF2F2; color: var(--red); }
.type-badge { display: inline-block; background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; border-radius: 5px; padding: 2px 8px; font-size: 12px; font-weight: 500; margin: 0 4px 4px 0; }

.apform { padding: 14px 18px; flex: 1; }
.fg2 { margin-bottom: 14px; }
.fl { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 5px; }
.fl i { font-style: normal; font-weight: 400; text-transform: none; letter-spacing: 0; }
.fta { width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 13px; color: var(--text); resize: vertical; min-height: 80px; font-family: inherit; outline: none; line-height: 1.5; }
.fta:focus, .fi2:focus { border-color: var(--accent); }
.fi2 { width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 13px; color: var(--text); font-family: inherit; outline: none; }
.tchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip { display: flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; padding: 5px 10px; border: 1.5px solid var(--border); border-radius: 6px; user-select: none; color: var(--sec); }
.tchip.on { border-color: var(--accent); background: #EEF2FF; color: var(--accent); }
.tchip input { accent-color: var(--accent); }
.rgroup { display: flex; gap: 8px; }
.ropt { flex: 1; display: flex; align-items: center; justify-content: center; padding: 8px; border: 1.5px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--sec); user-select: none; }
.ropt:hover { border-color: var(--muted); }
.ropt.rno { border-color: var(--green); background: #F0FDF4; color: #16A34A; font-weight: 600; }
.ropt.ryes { border-color: var(--red); background: #FEF2F2; color: var(--red); font-weight: 600; }
.apacts { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-shrink: 0; background: #fff; position: sticky; bottom: 0; }
.btns { flex: 1; padding: 9px; background: var(--accent); color: #fff; border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btns:hover { background: var(--accent-h); }
.btns:disabled { opacity: .6; cursor: default; }
.btnc { padding: 9px 14px; background: #fff; color: var(--sec); border: 1.5px solid var(--border); border-radius: 6px; font-size: 13px; cursor: pointer; font-family: inherit; }
.btnc:hover { border-color: var(--sec); }

.ichips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
.ichip { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px 3px 9px; background: #EEF2FF; color: var(--accent); border-radius: 12px; font-size: 12px; line-height: 1.4; }
.ichip.new { background: #F0FDF4; color: #16A34A; }
.ichip button { background: none; border: none; cursor: pointer; color: inherit; font-size: 15px; padding: 0 0 0 2px; line-height: 1; opacity: .55; }
.ichip button:hover { opacity: 1; }
.issue-wrap { position: relative; }
.issue-dd { position: absolute; top: calc(100% + 3px); left: 0; right: 0; background: #fff; border: 1.5px solid var(--border); border-radius: 6px; z-index: 300; max-height: 220px; overflow-y: auto; display: none; box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.issue-dd.open { display: block; }
.iopt { padding: 7px 10px; cursor: pointer; font-size: 13px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; line-height: 1.4; }
.iopt:hover { background: #F0F2FA; }
.iopt.isel { background: #EEF2FF; color: var(--accent); }
.iopt-meta { font-size: 11px; color: var(--muted); flex-shrink: 0; margin-top: 1px; }
.iopt-empty { padding: 10px; font-size: 13px; color: var(--muted); }
.iadd { padding: 7px 10px; cursor: pointer; font-size: 13px; color: var(--accent); border-top: 1px solid var(--border); }
.iadd:hover { background: #F0F2FA; }

.bulk-bar { background: #EEF2FF; border: 1px solid #C7D2FE; border-radius: 6px; padding: 9px 12px; margin-top: 12px; display: flex; align-items: center; gap: 10px; font-size: 12px; color: #4338CA; }
.bulk-btn { padding: 4px 12px; background: var(--accent); color: #fff; border: none; border-radius: 4px; font-size: 12px; cursor: pointer; font-family: inherit; font-weight: 600; white-space: nowrap; }
.bulk-btn:hover { background: var(--accent-h); }
.hist-wrap { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }
.hist-item { font-size: 11px; color: var(--muted); padding: 3px 0; border-bottom: 1px solid #F0F3FC; }
.hist-item:last-child { border-bottom: none; }

.fu-block { background: #F0FDF4; border: 1px solid #BBF7D0; border-radius: 8px; padding: 12px 14px; margin: 0 18px 16px; }
.fu-block.pending { background: #FEF2F2; border-color: #FECACA; }
.fu-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #16A34A; margin-bottom: 6px; }
.fu-block.pending .fu-lbl { color: var(--red); }
.fu-btns { display: flex; gap: 6px; margin: 8px 0; }
.fu-btn { padding: 5px 12px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 12px; cursor: pointer; font-family: inherit; background: #fff; color: var(--sec); }
.fu-btn:hover { border-color: var(--accent); color: var(--accent); }
.fu-btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.fu-meta { font-size: 11px; color: var(--muted); margin-top: 6px; }

@media (max-width: 1000px) {
  #view-work.active { height: auto; }
  .app-layout, .cw { flex-direction: column; overflow: visible; }
  .sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .elist { width: auto; min-width: 0; border-right: none; max-height: 50vh; }
  .apanel { overflow: visible; }
}

@media (max-width: 640px) {
  .mbody { padding: 16px; }
  .form-grid, .q-list { grid-template-columns: 1fr; }
  .tgroup { display: none; }
}

/* Статистика */
.st-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.st-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.st-ctrl a.btn-sec { text-decoration: none; }
.st-sel { padding: 6px 9px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 13px; font-family: inherit; background: #fff; color: var(--text); outline: none; }
.st-sel:focus { border-color: var(--accent); }
.st-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }
.st-muted { color: var(--muted); font-size: 12px; }
.st-h { margin-bottom: 12px; }
.st-pad { padding: 14px 20px 0; }
.st-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.st-grid .chart-box { margin-bottom: 14px; }
@media (max-width: 900px) { .st-grid { grid-template-columns: 1fr; } }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; }
.kpi-n { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi-l { font-size: 12px; font-weight: 600; margin-top: 2px; }
.kpi-d { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.c-ok { color: #16A34A; } .c-mid { color: #D97706; } .c-bad { color: #DC2626; }
td.c-ok, td.c-mid, td.c-bad { font-weight: 600; }
.dlt { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.dlt.good { color: #16A34A; } .dlt.bad { color: #DC2626; }
.segs { display: flex; gap: 4px; flex-wrap: wrap; }
.seg { padding: 4px 10px; border: 1.5px solid var(--border); background: #fff; border-radius: 14px; font-size: 12px; cursor: pointer; font-family: inherit; color: var(--sec); }
.seg.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-matrix td.st-name { white-space: nowrap; }
.st-matrix .st-total td { background: #F8F9FE; }
.st-matrix .st-queue td { font-size: 12px; }
.st-matrix .st-queue td.st-name { padding-left: 38px; color: var(--sec); }
.mx-toggle { background: none; border: none; cursor: pointer; color: var(--muted); width: 18px; margin-right: 4px; font-size: 12px; }
.st-name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.sbar { flex: 1; height: 7px; background: #EEF1F8; border-radius: 4px; overflow: hidden; display: flex; min-width: 60px; }
.sbar > div { height: 100%; border-radius: 4px; }
.sbar.split > div { border-radius: 0; }
.brow { display: grid; grid-template-columns: minmax(120px, 42%) 1fr 36px; align-items: center; gap: 4px 10px; margin-bottom: 9px; font-size: 12px; }
.bname { display: flex; align-items: center; gap: 6px; }
.bval { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bsub { grid-column: 2 / 4; font-size: 11px; color: var(--muted); margin-top: -4px; }
.tdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.heat { border-collapse: collapse; font-size: 12px; }
.heat th { font-size: 10px; font-weight: 600; color: var(--muted); padding: 4px 6px; text-align: center; max-width: 90px; }
.heat td { padding: 2px 3px; text-align: center; }
.heat td.st-name { text-align: left; padding-right: 10px; white-space: nowrap; }
.hcell { display: inline-block; min-width: 38px; padding: 5px 4px; border-radius: 4px; font-weight: 600; }
.st-sub td { background: #FAFBFF; padding-top: 4px; }
.case-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.case-row:hover { background: #EEF2FF; }
.case-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-qline { display: flex; gap: 10px; align-items: center; font-size: 11px; color: var(--muted); margin-top: 3px; }
.st-qline span:first-child { min-width: 160px; }
.tta { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.tta.fast { background: #ECFDF5; color: #16A34A; } .tta.ok { background: #FFFBEB; color: #D97706; } .tta.slow { background: #FEF2F2; color: #DC2626; }
.st-dim td { opacity: .5; }
.st-issue { max-width: 380px; }
.st-task { font-family: monospace; font-size: 11px; color: var(--accent); }
.spark { display: block; margin: 3px 0 0 auto; }
.ist-tracked { color: var(--sec); } .ist-in_work { color: #D97706; font-weight: 600; } .ist-fixed { color: #16A34A; font-weight: 600; }
.mcols { display: flex; gap: 6px; align-items: flex-end; }
.mcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.mcol-v { font-size: 11px; font-weight: 700; }
.mcol-b { width: 100%; background: #C7D2FE; border-radius: 3px 3px 0 0; }
.mcol-l { font-size: 10px; color: var(--muted); }
.case-modal .aphdr { padding-left: 0; padding-right: 0; }
.case-modal .apblock { padding-left: 0; padding-right: 0; }
.st-fixed { table-layout: fixed; }
.st-fixed td { overflow: hidden; text-overflow: ellipsis; }
.lock-checked { margin-top: 8px; font-size: 12px; color: var(--muted); }
.kpi-l { margin-top: 0; margin-bottom: 4px; line-height: 1.35; }
.kpi-pair { display: flex; gap: 18px; }
.kpi-t { font-size: 11px; color: var(--sec); }
.kc { white-space: nowrap; }
.kdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.st-legend { margin-top: 10px; }
.st-grouped th.st-gh { text-align: center; border-bottom: 1px solid var(--border); }
.st-grouped th.st-gh.neg { color: #DC2626; }
.st-grouped th.st-gh.neu { color: #EA580C; }
.st-grouped .st-gl { border-left: 1px solid var(--border); }
.mcol-stack { width: 100%; display: flex; flex-direction: column; border-radius: 3px 3px 0 0; overflow: hidden; }
.kpi-row { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi-pair { flex-wrap: wrap; gap: 4px 14px; }
.kpi-pair .kpi-n { font-size: 20px; }
.type-hint { font-size: 12px; color: var(--sec); margin-top: 6px; line-height: 1.5; }
.version-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #1C2340; color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; z-index: 9998; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.version-bar button { margin-left: 10px; background: #4361EE; color: #fff; border: none; border-radius: 5px; padding: 5px 12px; cursor: pointer; font-family: inherit; }
.proc-lead { color: var(--sec); margin-bottom: 6px; }
.info { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--muted); color: var(--muted); font-size: 10px; font-weight: 700; font-style: normal; cursor: help; vertical-align: 1px; text-transform: none; letter-spacing: 0; margin-left: 3px; }
.info:hover, .info:focus { border-color: var(--accent); color: var(--accent); outline: none; }
.st-tip { position: fixed; z-index: 9999; max-width: 320px; background: #1C2340; color: #fff; font-size: 12px; line-height: 1.5; padding: 9px 12px; border-radius: 7px; box-shadow: 0 8px 24px rgba(0,0,0,.25); pointer-events: none; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent); }
th.sortable.sorted { color: var(--accent); }
th.sortable.sorted[data-dir="desc"]::after { content: ' ▾'; }
th.sortable.sorted[data-dir="asc"]::after { content: ' ▴'; }
.st-few { font-size: 10px; color: var(--muted); font-weight: 400; }
.kt-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: #EEF1F8; margin: 6px 0 6px; }
.kt-row { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 1.6; }
.kt-name { color: var(--sec); flex: 1; }
.kt-share { color: var(--muted); min-width: 44px; text-align: right; }
.link-num { background: none; border: none; color: #DC2626; font-weight: 700; font-size: 13px; cursor: pointer; font-family: inherit; text-decoration: underline dotted; padding: 0; }
.seg:disabled { opacity: .45; cursor: default; }
.st-period { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -6px 0 16px; }
.st-dates { display: flex; align-items: center; gap: 6px; }
.st-dates .st-sel { padding: 4px 7px; font-size: 12px; }
.side-dates { display: flex; flex-direction: column; gap: 6px; }
.side-dates label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--sec); }
.side-dates .sidesel { flex: 1; min-width: 0; padding: 5px 7px; }
.side-dates .irow-toggle { align-self: flex-start; padding-left: 0; }
.date-btn { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1.5px solid var(--border); border-radius: 6px; background: #fff; color: var(--sec); font-size: 13px; font-family: inherit; cursor: pointer; white-space: nowrap; }
.date-btn:hover { border-color: var(--accent); color: var(--accent); }
.date-btn.set { color: var(--text); }
.sidebar .date-btn { width: 100%; }
.dp-pop { position: absolute; z-index: 900; width: 262px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(28,35,64,.18); padding: 10px 12px 8px; font-size: 13px; }
.dp-head { display: flex; align-items: center; gap: 2px; margin-bottom: 6px; }
.dp-title { flex: 1; text-align: center; font-weight: 600; }
.dp-nav { width: 26px; height: 26px; border: none; background: none; border-radius: 5px; cursor: pointer; color: var(--sec); font-size: 15px; font-family: inherit; }
.dp-nav:hover:not(:disabled) { background: #EEF2FF; color: var(--accent); }
.dp-nav:disabled { opacity: .3; cursor: default; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; }
.dp-wd span { text-align: center; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 3px 0; }
.dp-day { height: 30px; border: none; background: none; font-family: inherit; font-size: 13px; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dp-day:hover { background: #EEF2FF; border-radius: 6px; }
.dp-day.today { font-weight: 700; color: var(--accent); }
.dp-day.in { background: #E0E7FF; border-radius: 0; }
.dp-day.start, .dp-day.end { background: var(--accent); color: #fff; }
.dp-day.start { border-radius: 6px 0 0 6px; } .dp-day.end { border-radius: 0 6px 6px 0; } .dp-day.start.end { border-radius: 6px; }
.dp-day.off { color: #CBD5E1; cursor: default; }
.dp-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }

/* --- Уведомления: админка и окно ------------------------------------------ */
.al-page { max-width: 1180px; }
.al-status { display:flex; flex-wrap:wrap; align-items:center; gap:6px 14px; background:#fff; border:1px solid var(--border); border-radius:var(--r); padding:12px 20px; margin-bottom:14px; font-size:13px; color:var(--sec); }
.al-status b { color: var(--text); font-weight:600; }
.al-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:#16A34A; margin-right:6px; vertical-align:1px; }
.al-dot.off { background: var(--muted); }
.al-grid { display:grid; grid-template-columns: 360px minmax(0, 1fr); gap:14px; align-items:start; }
@media (max-width: 1000px) { .al-grid { grid-template-columns: 1fr; } }
.al-grid .chart-box { margin-bottom:14px; }
.al-hdr { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:12px; }
.al-kind { display:flex; gap:10px; align-items:flex-start; padding:9px 0; border-top:1px solid #F0F3FC; cursor:pointer; }
.al-kind:first-of-type { border-top:none; padding-top:2px; }
.al-kind input { margin-top:3px; }
.al-kind b { font-size:13px; font-weight:600; display:block; }
.al-kind span { font-size:12px; color:var(--sec); line-height:1.5; }
.al-form { display:grid; grid-template-columns: 1fr auto; gap:10px 12px; align-items:center; font-size:13px; }
.al-form .ied-in { width:72px; text-align:right; }
.al-form small { display:block; font-size:11px; color:var(--muted); }
.al-chat { border:1px solid var(--border); border-radius:8px; padding:12px 14px; margin-top:10px; }
.al-chat-top { display:flex; justify-content:space-between; align-items:baseline; gap:10px; margin-bottom:10px; }
.al-row { display:flex; gap:10px; align-items:baseline; margin-bottom:8px; }
.al-row > .ied-l { width:92px; flex:none; margin:0; }
.al-actions { display:flex; gap:6px; justify-content:flex-end; align-items:center; margin-top:10px; }
.chips { display:flex; flex-wrap:wrap; gap:6px; }
.chip { display:inline-flex; align-items:center; gap:6px; padding:4px 11px; border:1.5px solid var(--border); border-radius:999px; font-size:12px; color:var(--sec); cursor:pointer; user-select:none; background:#fff; }
.chip input { width:13px; height:13px; margin:0; accent-color: var(--accent); }
.chip:has(input:checked) { border-color: var(--accent); background:#EEF2FF; color: var(--accent); }
.chip:has(input:disabled) { cursor:default; opacity:.75; }
.al-sec-title { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin:0 0 10px; }
.tg-modal .modal-body { padding:22px 26px 24px; }
.tg-section { margin-bottom:22px; }
.tg-kind { display:flex; gap:12px; align-items:flex-start; padding:10px 0; border-top:1px solid #F0F3FC; cursor:pointer; }
.tg-kind:first-of-type { border-top:none; padding-top:0; }
.tg-kind input { margin-top:3px; }
.tg-kind b { display:block; font-size:14px; font-weight:600; margin-bottom:2px; }
.tg-kind span { font-size:12px; color:var(--sec); line-height:1.5; }
.tg-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-top:6px; }
.tg-actions .danger { margin-left:auto; }
