:root {
  --bg: #f3f2ee; --surface: #fff; --surface-2: #faf9f6; --line: #e6e3db; --line-2: #d2cec4;
  --ink: #17181c; --ink-2: #585c65; --ink-3: #8d9199;
  --brass: #b4892f; --brass-2: #d4a94a; --brass-soft: #f6eed8; --brass-ink: #6f5112;
  --side: #15161a; --side-2: #1f2127; --side-ink: #bdbbb3; --side-ink-2: #76756f;
  --ok: #2e8a57; --ok-soft: #e1f1e8; --warn: #b7791f; --warn-soft: #fbf0d6; --bad: #c23b3b; --bad-soft: #f9e2e2;
  --info: #3a63b8; --info-soft: #e6ecf8;
  --r: 10px; --r-lg: 14px; --shadow: 0 1px 2px rgba(23,24,28,.05), 0 4px 18px rgba(23,24,28,.04);
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14.5px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brass-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
small, .hint { font-size: 12.5px; color: var(--ink-3); }
.boot { padding: 40px; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 16px; }
.num { font-variant-numeric: tabular-nums; }

/* каркас */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; letter-spacing: .08em; font-size: 13.5px; padding: 6px 10px 18px; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 22px; height: 22px; border-radius: 6px; background: var(--side-2); display: grid; place-items: center; }
.brand .mark i { width: 10px; height: 10px; border-radius: 50%; background: var(--brass); }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); font-weight: 500; font-size: 14px; }
.side nav a:hover { background: var(--side-2); text-decoration: none; color: #fff; }
.side nav a.on { background: var(--side-2); color: #fff; }
.side nav a.on svg { color: var(--brass-2); }
.side nav svg { width: 18px; height: 18px; flex: none; color: var(--side-ink-2); }
.side .group { margin: 18px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-ink-2); }
.side .biz-list a { font-weight: 400; font-size: 13.5px; }
.side .biz-list a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--side-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-foot .who { font-size: 13px; color: #fff; min-width: 0; }
.side-foot .who small { display: block; color: var(--side-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot button { background: none; border: 1px solid var(--side-2); color: var(--side-ink); border-radius: 7px; padding: 5px 9px; cursor: pointer; font: inherit; font-size: 12.5px; }
.side-foot button:hover { color: #fff; border-color: var(--side-ink-2); }
.main { min-width: 0; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 32px 0; flex-wrap: wrap; }
.topbar .sub { color: var(--ink-2); margin-top: 2px; }
.content { padding: 20px 32px 56px; }
.content > * + * { margin-top: 18px; }

/* карточки и сетки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-b { padding: 20px; }
.card-b.tight { padding: 0; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 16px 20px; }
.stat .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.stat .v small { font-size: 14px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.stat .l { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.empty { padding: 44px 24px; text-align: center; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.empty ol { text-align: left; display: inline-block; margin: 14px 0 0; padding-left: 20px; }

/* таблицы */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: var(--surface-2); }
.table td.actions { text-align: right; white-space: nowrap; }
.table .dim { color: var(--ink-3); }
.table select, .table input { font-size: 13.5px; padding: 6px 8px; }

/* метки */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.brass { background: var(--brass-soft); color: var(--brass-ink); border-color: transparent; }
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 30px; padding: 0 10px; border-radius: 8px; font-weight: 600; font-size: 14px; background: var(--surface-2); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.score.ok { background: var(--ok-soft); color: var(--ok); }
.score.warn { background: var(--warn-soft); color: var(--warn); }
.score.bad { background: var(--bad-soft); color: var(--bad); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.info { background: var(--info); }

/* кнопки и формы */
.btn { --spin: var(--ink); position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent; background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; user-select: none; transition: background .15s, border-color .15s, color .15s, transform .09s ease-out, box-shadow .15s; }
.btn:hover { background: var(--line); }
.btn:active:not(:disabled) { transform: scale(.95); }
.btn:focus-visible { outline: 2px solid rgba(180,137,47,.55); outline-offset: 2px; }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn.primary, .btn.brass, .btn.danger.loading { --spin: #fff; }
/* работа идёт: текст прячем, по центру крутилка */
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ''; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--spin) 25%, transparent); border-top-color: var(--spin); animation: spin .7s linear infinite; }
.btn.danger.loading { background: var(--bad); }
/* успех и ошибка */
.btn.done { background: var(--ok) !important; border-color: var(--ok) !important; color: #fff !important; animation: pop .38s ease-out; }
.btn.fail { background: var(--bad) !important; border-color: var(--bad) !important; color: #fff !important; animation: shake .42s; }
.btn.loading:disabled, .btn.done:disabled, .btn.fail:disabled { opacity: 1; }
.btn.pulse { animation: pulse 1.5s ease-out 3; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(.9); } 55% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(180,137,47,.6); } 100% { box-shadow: 0 0 0 12px rgba(180,137,47,0); } }
.flash-ok { animation: flashok 1.2s ease-out; }
@keyframes flashok { 0% { box-shadow: 0 0 0 3px rgba(46,138,87,.5); border-color: var(--ok); } 100% { box-shadow: 0 0 0 0 rgba(46,138,87,0); } }
.need { animation: shake .42s; border-color: var(--bad) !important; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #2a2c33; }
.btn.brass { background: var(--brass); color: #fff; }
.btn.brass:hover { background: #9d7626; }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; border-color: var(--line-2); color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.icon { padding: 4px 7px; background: transparent; color: var(--ink-3); }
.btn.icon:hover { color: var(--ink); background: var(--surface-2); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .hint { margin-top: -2px; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 11px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(180,137,47,.35); border-color: var(--brass); }
textarea { min-height: 84px; resize: vertical; }
select { appearance: auto; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: auto; }
.form-error { color: var(--bad); font-size: 13px; margin: 0 0 8px; }
.form-inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.form-inline .field { margin: 0; }

/* диалоги и уведомления */
dialog.dlg { border: none; border-radius: var(--r-lg); padding: 0; width: min(540px, 92vw); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
dialog.dlg::backdrop { background: rgba(23,24,28,.45); }
.dlg-form { padding: 24px; }
.dlg-form h3 { margin-bottom: 16px; font-size: 17px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
dialog.dlg.wide { width: min(880px, 94vw); }
.dlg-head { margin-bottom: 12px; flex-wrap: nowrap; }
.dlg-head h3 { margin: 0 !important; }
.dlg-body { max-height: 72vh; overflow: auto; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink-2); transition: background .15s, color .15s, transform .09s; }
.seg button:active { transform: scale(.96); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.tr-line { display: grid; grid-template-columns: 52px 104px 1fr; gap: 12px; padding: 9px 2px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.5; }
.tr-line .tt { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tr-line .who { font-size: 13px; }
.tr-line.employee .who { color: var(--brass-ink); font-weight: 600; }
.tr-line.other .who { color: var(--ink-3); }
.tr-text mark { background: var(--brass-soft); color: var(--brass-ink); padding: 0 4px; border-radius: 4px; font-weight: 500; }
@media (max-width: 560px) { .tr-line { grid-template-columns: 44px 1fr; } .tr-line .who { grid-column: 2; } .tr-line .tr-text { grid-column: 1 / -1; } }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 11px 16px 11px 12px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: rise .2s ease-out; transition: opacity .25s, transform .25s; }
.toast.out { opacity: 0; transform: translateY(6px); }
.toast-i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ok); font-weight: 700; font-size: 12px; }
.toast-i svg { width: 11px; height: 11px; }
.toast.bad { background: #2a1416; } .toast.bad .toast-i { background: var(--bad); }
.toast.warn { background: #2a2210; } .toast.warn .toast-i { background: var(--warn); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* загрузка файла */
.drop { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 68px; border: 1.5px dashed var(--line-2); border-radius: var(--r); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s, transform .09s; }
.drop:hover, .drop.over { border-color: var(--brass); background: var(--brass-soft); }
.drop:active { transform: scale(.995); }
.drop.has { border-style: solid; border-color: var(--ok); background: var(--ok-soft); }
.drop input { display: none; }
.drop .ico { width: 38px; height: 38px; border-radius: 10px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; flex: none; color: var(--ink-2); }
.drop.has .ico { color: var(--ok); border-color: rgba(46,138,87,.3); }
.drop .t { min-width: 0; }
.drop .t b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop .t span { font-size: 12.5px; color: var(--ink-3); }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brass), var(--brass-2)); transition: width .15s; }
.uploads { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.result { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.result.fresh { animation: rise .22s ease-out; }
.table.compact td, .table.compact th { white-space: nowrap; padding-left: 12px; padding-right: 12px; }
.result .ri { width: 26px; height: 26px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; flex: none; }
.result .ri svg { width: 13px; height: 13px; }
.result .ri.bad { background: var(--bad); font-weight: 700; }
.result .ri.wait { background: var(--warn); }
.result .rt { min-width: 0; flex: 1; }
.result > .btn { align-self: center; }
.result .rt b { word-break: break-all; }
.check-card { transition: border-color .12s, background .12s, transform .09s, opacity .15s; }
.check-card:active:not(.disabled) { transform: scale(.985); }
.check-card.saving { opacity: .6; pointer-events: none; }
select.flash-ok { border-color: var(--ok); }
.rec-code { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.big-code { display: inline-block; margin-top: 6px; font-family: var(--mono); font-size: 22px; letter-spacing: .08em; padding: 8px 14px; border-radius: 10px; background: var(--side); color: var(--brass-2); }

/* уведомления на странице */
.alert { display: flex; gap: 10px; align-items: center; padding: 11px 16px; border-radius: var(--r); font-size: 14px; border: 1px solid transparent; }
.alert.info { background: var(--info-soft); color: #2a4a8a; }
.alert.warn { background: var(--warn-soft); color: #7a4f0f; }
.alert.bad { background: var(--bad-soft); color: #8a2727; }
.alert a { font-weight: 600; color: inherit; text-decoration: underline; }

/* вкладки */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { color: var(--ink); border-color: var(--brass); }

/* чек-лист */
.progress { height: 6px; width: 160px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brass); }
.check-card { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s; user-select: none; }
.check-card:hover { border-color: var(--line-2); }
.check-card.on { border-color: var(--brass); background: var(--brass-soft); }
.check-card.disabled { opacity: .55; cursor: not-allowed; }
.check-card .cb { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-2); background: #fff; display: grid; place-items: center; flex: none; margin-top: 2px; color: #fff; }
.check-card.on .cb { background: var(--brass); border-color: var(--brass); }
.check-card .cb svg { width: 12px; height: 12px; }
.check-card .ct { min-width: 0; flex: 1; }
.check-card .ct p { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; }

/* отчёт по сотруднику */
.emp .who { display: flex; align-items: center; gap: 12px; }
.emp .who b { font-size: 15px; }
.summary { font-size: 15px; margin-bottom: 12px; }
.item-row { display: grid; grid-template-columns: 14px minmax(140px, 220px) 1fr auto; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.item-row .c { color: var(--ink-2); }
.item-row .s { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.trigger { display: grid; grid-template-columns: 48px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.trigger .t { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; color: var(--ink-2); padding-top: 2px; }
.trigger q { display: block; margin-top: 6px; padding-left: 10px; border-left: 3px solid var(--brass-2); color: var(--ink-2); font-style: italic; quotes: "«" "»"; }
.advice { margin-top: 14px; padding: 12px 14px; border-radius: var(--r); background: var(--brass-soft); color: var(--brass-ink); font-size: 14px; }
.week-cell { display: inline-grid; place-items: center; width: 40px; height: 30px; border-radius: 7px; font-weight: 600; font-size: 13px; background: var(--surface-2); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.week-cell.ok { background: var(--ok-soft); color: var(--ok); } .week-cell.warn { background: var(--warn-soft); color: var(--warn); } .week-cell.bad { background: var(--bad-soft); color: var(--bad); }
pre.code { background: var(--side); color: #e8e6df; padding: 14px 16px; border-radius: var(--r); font-size: 12.5px; line-height: 1.5; overflow: auto; margin: 0; }
details.card > summary { padding: 14px 20px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
details.card > summary::after { content: "+"; color: var(--ink-3); }
details.card[open] > summary::after { content: "−"; }
details.card[open] > summary { border-bottom: 1px solid var(--line); }
.tg-preview { white-space: pre-wrap; font-size: 14px; line-height: 1.55; }
.tg-preview b { font-weight: 600; }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--side); padding: 20px; }
.login .card { width: min(380px, 100%); padding: 28px 28px 24px; }
.login .brand { color: var(--ink); padding: 0 0 18px; }
.login .brand .mark { background: var(--side); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 12px 14px; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side .group, .side .biz-list { display: none; }
  .side-foot { margin-top: 8px; padding-top: 10px; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr 1fr; }
  .item-row { grid-template-columns: 14px 1fr auto; } .item-row .c { grid-column: 2 / span 2; }
}
@media (max-width: 560px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } .table { font-size: 13px; } .table td, .table th { padding: 9px 10px; } }
