/* fk-hr-web · единый CSS. Без препроцессоров и сборки.
   Палитра — ТОЛЬКО здесь. Правка бренда = правка этих строк. */
:root {
  --c-bg:      #ffffff;
  --c-surface: #f7f7f8;
  --c-text:    #1a1a1a;
  --c-muted:   #6b7280;
  --c-border:  #e5e7eb;
  --c-accent:  #111111;   /* ЗАГЛУШКА — заменит Сергей на фирменный */
  --c-danger:  #dc2626;
  --c-ok:      #16a34a;

  --sidebar-w: 220px;
  --topbar-h:  52px;
  --radius:    6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.45;
  color: var(--c-text); background: var(--c-bg);
}
a { color: var(--c-accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
       background: var(--c-surface); padding: 1px 4px; border-radius: 3px; }

/* ---------- каркас: сайдбар + контент ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--c-surface); border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  display: block; padding: 14px 16px 12px; text-decoration: none; color: var(--c-text);
  border-bottom: 1px solid var(--c-border);
}
.brand-name { display: block; font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-sub  { display: block; font-size: 12px; color: var(--c-muted); }

.nav { padding: 8px 0 16px; }
.nav-group { margin-top: 10px; }
.nav-section {
  padding: 4px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--c-muted);
}
.nav-item {
  display: block; padding: 6px 16px 6px 20px; text-decoration: none; color: var(--c-text);
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--c-bg); }
.nav-item.active { border-left-color: var(--c-accent); font-weight: 600; background: var(--c-bg); }
.nav-item.disabled { color: var(--c-muted); cursor: default; }
.nav-item.disabled:hover { background: transparent; }

.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; border-bottom: 1px solid var(--c-border); background: var(--c-bg);
  position: sticky; top: 0; z-index: 10;
}
.screen-title { margin: 0; font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.badge {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--c-muted);
  border: 1px solid var(--c-border); border-radius: 999px; padding: 1px 8px;
}

.main { flex: 1 1 auto; padding: 18px 20px 28px; }

.footer {
  padding: 10px 20px; border-top: 1px solid var(--c-border); font-size: 12px; color: var(--c-muted);
  display: flex; gap: 8px; align-items: center;
}
.footer a { color: var(--c-muted); }
.footer .sep { opacity: .5; }

/* ---------- типографика и элементы ---------- */
.lead { margin: 0 0 14px; }
.note, .muted { color: var(--c-muted); }
.note { font-size: 13px; margin-top: 14px; }

/* плотные таблицы — основной рабочий элемент */
.tbl { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.tbl-narrow { max-width: 520px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--c-border); padding: 6px 10px; text-align: left; vertical-align: middle; }
.tbl th { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
          color: var(--c-muted); background: var(--c-surface); position: sticky; top: var(--topbar-h); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover { background: var(--c-surface); }

/* кнопки/поля — задел под следующие этапы, стиль единый */
.btn {
  display: inline-block; padding: 6px 12px; border-radius: var(--radius); font-size: 13.5px;
  border: 1px solid var(--c-border); background: var(--c-bg); color: var(--c-text); cursor: pointer;
  text-decoration: none; line-height: 1.3;
}
.btn:hover { border-color: var(--c-muted); }
.btn-primary { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.btn-danger  { color: var(--c-danger); border-color: var(--c-danger); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], select, textarea {
  font: inherit; padding: 6px 8px; border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-bg); color: var(--c-text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--c-accent); outline-offset: 0; border-color: var(--c-accent); }

.text-ok { color: var(--c-ok); }
.text-danger { color: var(--c-danger); }

@media (max-width: 800px) {
  .app { flex-direction: column; }
  .sidebar { width: auto; flex: none; height: auto; position: static; }
}

/* ---------- шапка: пользователь ---------- */
.user { font-size: 13px; }
form.inline { display: inline; margin: 0; }
.btn-sm { padding: 3px 9px; font-size: 12.5px; }
.btn-block { display: block; width: 100%; text-align: center; }
.nowrap { white-space: nowrap; }
.small { font-size: 12px; }

/* ---------- сообщения ---------- */
.alert { padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--c-border);
         background: var(--c-surface); margin: 0 0 14px; font-size: 13.5px; }
.alert-danger { border-color: var(--c-danger); color: var(--c-danger); background: var(--c-bg); }

/* ---------- формы ---------- */
.form .field { display: block; margin-bottom: 12px; }
.form .field > span { display: block; font-size: 12px; color: var(--c-muted); margin-bottom: 4px; }
.form .field input, .form .field select { width: 100%; }

/* ---------- страница входа ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh;
             background: var(--c-surface); }
.auth-card { width: 100%; max-width: 360px; background: var(--c-bg); border: 1px solid var(--c-border);
             border-radius: var(--radius); padding: 22px 24px 18px; }
.auth-brand { padding: 0 0 12px; border-bottom: none; }
.auth-title { font-size: 17px; margin: 0 0 12px; }

/* ---------- справочники (этап C) ---------- */
.toolbar { display: flex; align-items: center; gap: 16px; margin: 0 0 12px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { margin: 0; }
.tbl-dict .col-order { width: 84px; white-space: nowrap; }
.tbl-dict .col-actions { width: 1%; text-align: right; }
.order-form { margin-right: 4px; }
.btn-icon {
  border: 1px solid var(--c-border); background: var(--c-bg); color: var(--c-muted); cursor: pointer;
  font-size: 9px; line-height: 1; padding: 3px 4px; border-radius: 3px;
}
.btn-icon:hover:not(:disabled) { color: var(--c-text); border-color: var(--c-muted); }
.btn-icon:disabled { opacity: .3; cursor: default; }
.tabnum { font-variant-numeric: tabular-nums; }
.row-archived td { color: var(--c-muted); }
.row-archived td a { color: var(--c-muted); }
code.uuid { font-size: 11px; }
.alert-ok { border-color: var(--c-ok); color: var(--c-ok); background: var(--c-bg); }
.crumbs { margin: 0 0 12px; font-size: 13px; }
.crumbs a { text-decoration: none; }

/* форма справочника */
.form-dict { max-width: 560px; }
.form-dict .field label > span, .form-dict .field > span { display: block; font-size: 12px; color: var(--c-muted); margin-bottom: 4px; }
.form-dict .field textarea, .form-dict .field select, .form-dict .field input[type=text] { width: 100%; }
.form-dict .field .w-narrow { width: 140px; }
.form-dict .field .ro { padding: 4px 0; }
.form-dict .field .check { display: flex; align-items: center; gap: 8px; }
.form-dict .field .check input[type=checkbox] { width: auto; flex: none; margin: 0; }
.form-dict .field .check > span { font-size: 14px; color: var(--c-text); margin: 0; white-space: nowrap; }
.form-dict .field .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.form-dict .field.has-error input, .form-dict .field.has-error select { border-color: var(--c-danger); }
.field-error { color: var(--c-danger); font-size: 12px; margin-top: 3px; }
.field-help  { color: var(--c-muted); font-size: 12px; margin-top: 3px; }
.req { color: var(--c-danger); font-weight: 600; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; }
.meta { margin-top: 16px; }

/* журнал: изменение по строкам */
.tbl-audit .changes { max-width: 520px; }
.diff { margin: 0; font-size: 12.5px; }
.diff-row { display: flex; gap: 8px; align-items: baseline; padding: 1px 0; }
.diff dt { color: var(--c-muted); flex: 0 0 140px; }
.diff dd { margin: 0; word-break: break-word; }
.diff-old { text-decoration: line-through; color: var(--c-muted); }
.diff-arrow { color: var(--c-muted); }
.diff-new { font-weight: 500; }

/* ---------- сотрудники (этап D) ---------- */
.filters select { max-width: 200px; }
.filters .w-search { width: 220px; }
input[type=search], input[type=tel], input[type=number] {
  font: inherit; padding: 6px 8px; border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-bg); color: var(--c-text);
}
.form-emp { max-width: 1100px; }
.cols { display: flex; gap: 32px; flex-wrap: wrap; }
.cols .col { flex: 1 1 380px; min-width: 0; }
.h { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--c-muted);
     margin: 18px 0 8px; font-weight: 600; }
.cols .col .h:first-child { margin-top: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-emp .field label > span, .form-emp .field > span { display: block; font-size: 12px; color: var(--c-muted); margin-bottom: 4px; }
.form-emp .field input[type=text], .form-emp .field input[type=email], .form-emp .field input[type=tel],
.form-emp .field input[type=date], .form-emp .field select, .form-emp .field textarea { width: 100%; }
.form-emp .field input[type=checkbox], .form-emp .field input[type=radio] { width: auto; margin: 0; }
.form-emp .check { display: inline-flex; align-items: center; gap: 6px; }
.form-emp .check > span { font-size: 13.5px; color: var(--c-text); margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.tbl-pos { max-width: 100%; }
.tbl-pos th, .tbl-pos td { padding: 4px 8px; }
.tbl-pos th { position: static; }
.tbl-pos .col-prim { width: 90px; text-align: center; }
.multi-row { margin-bottom: 6px; }
.form-emp .field.has-error input, .form-emp .field.has-error select { border-color: var(--c-danger); }
.fs-plain { border: 0; padding: 0; margin: 0; min-width: 0; }
.meta-cols { margin-top: 24px; max-width: 1100px; }
