/* ---------- Fonts (self-hosted Inter, variable — covers RU/KZ/EN) ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/Inter-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/Inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/Inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* neutrals (near-neutral gray, BI Group style) */
  --slate-950: #1d1d1f;
  --slate-900: #262629;
  --slate-800: #3a3a3d;
  --slate-700: #545458;
  --slate-600: #6e6e73;
  --slate-500: #86868b;
  --slate-400: #aeaeb2;
  --slate-300: #d2d2d7;
  --slate-200: #e5e5ea;
  --slate-100: #f2f2f4;
  --slate-50: #f9f9fb;

  /* brand — matched to bi.group (Inter everywhere, single strong blue accent, flat/minimal) */
  --primary: #1d1d1f;      /* near-black — sidebar, headings on dark */
  --primary-light: #3a3a3d;
  --accent: #3152df;       /* bi.group blue — primary actions, links */
  --accent-dark: #2540b0;
  --accent-light: #4d6ae8;
  --accent-soft: #eaeefc;
  --tertiary: #1a9c5e;     /* success / on-track */
  --tertiary-dark: #147d4a;
  --tertiary-soft: #e6f7ee;

  --navy-950: var(--slate-950);
  --navy-900: var(--slate-900);
  --navy-800: var(--slate-800);
  --navy-700: var(--slate-700);

  --bg: #f5f5f7;
  --card: #ffffff;
  --border: var(--slate-200);
  --text: #1d1d1f;
  --text-muted: var(--slate-600);

  --danger: #e5484d;
  --danger-soft: #fdecec;
  --warn: #e2932b;
  --warn-soft: #fdf3e2;
  --ok: var(--tertiary);
  --ok-soft: var(--tertiary-soft);
  --info: var(--accent);
  --info-soft: var(--accent-soft);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 20px -6px rgba(16, 24, 40, 0.10);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, 0.20), 0 4px 10px -4px rgba(16, 24, 40, 0.10);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font-head: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv05", "cv11", "ss01";
}
a { color: inherit; }
button { font-family: inherit; }
h1, h2, h3, h4 { font-family: var(--font-head); letter-spacing: -0.015em; font-weight: 600; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); background-clip: padding-box; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(49, 82, 223, 0.30), transparent 60%),
    var(--slate-950);
}
.login-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  padding: 38px;
  width: 100%;
  max-width: 880px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-brand .logo-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 6px 16px -4px rgba(29, 29, 31, 0.45);
}
.login-brand h1 { font-size: 23px; margin: 0; font-weight: 800; }
.login-tagline { color: var(--text-muted); margin: 0 0 22px 54px; font-size: 13.5px; }
.login-hint { color: var(--text-muted); font-size: 12.5px; margin-bottom: 20px; padding: 11px 14px; background: var(--accent-soft); border-radius: var(--radius-sm); border: 1px solid rgba(49, 82, 223, 0.15); }
/* Пояснение под полем ввода — тише самого поля, но читаемо. */
.field-hint { color: var(--text-muted); font-size: 12px; line-height: 1.45; margin-top: 6px; }
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 2px 4px 2px 2px;
}
.role-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  background: #fff;
  transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.role-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.role-card .u-name { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.role-card .u-position { color: var(--text); font-size: 12px; margin-bottom: 3px; }
.role-card .u-role { color: var(--accent-dark); font-size: 12px; font-weight: 600; }
.role-card .u-side { color: var(--text-muted); font-size: 11.5px; margin-top: 4px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px;
  flex-shrink: 0;
  background: var(--primary);
  color: #d2d2d7;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 20px; }
.sidebar .brand .logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 14px;
  box-shadow: 0 4px 12px -2px rgba(29, 29, 31, 0.5);
}
.sidebar .brand span { font-weight: 800; color: #fff; font-size: 16px; letter-spacing: -0.01em; }
.nav-list { list-style: none; margin: 0; padding: 0; flex: 1; }
.nav-list li { margin-bottom: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer;
  color: #a8a8ad; font-size: 13.5px; text-decoration: none; font-weight: 500;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.nav-link .ic { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-link .ic svg { width: 17px; height: 17px; display: block; }
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active { background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 4px 14px -4px rgba(49, 82, 223, 0.55); }
.nav-item { cursor: grab; border-radius: var(--radius-sm); transition: box-shadow .12s var(--ease), opacity .12s var(--ease); }
.nav-item:active { cursor: grabbing; }
.nav-item.dragging { opacity: .35; }
.nav-item.drag-over { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 14px rgba(49, 82, 223, 0.45); }
.sidebar-footer { padding: 10px; font-size: 11px; color: #6e6e73; border-top: 1px solid rgba(255,255,255,0.08); margin-top: 10px; line-height: 1.5; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.select-mini, select, input[type=text], input[type=number], input[type=date], input[type=datetime-local], textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}
.select-mini:focus, select:focus, input:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(49, 82, 223, 0.14);
}
textarea { font-family: inherit; resize: vertical; }
label { font-size: 12.5px; color: var(--text-muted); display: block; margin-bottom: 5px; font-weight: 600; }
.field { margin-bottom: 14px; }
.field select,
.field input[type=text],
.field input[type=number],
.field input[type=password],
.field textarea {
  width: 100%;
  box-sizing: border-box;
  display: block;
  min-height: 38px;
}
.pw-wrap {
  position: relative;
  display: block;
}
.pw-wrap input {
  width: 100%;
  box-sizing: border-box;
  padding-right: 44px;
  min-height: 38px;
}
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 30px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  border-radius: 6px;
  color: var(--text-muted);
}
.pw-toggle:hover { background: var(--slate-100); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; font-size: 16px;
  transition: background .12s var(--ease), transform .12s var(--ease);
}
.icon-btn:hover { background: var(--slate-100); transform: translateY(-1px); }
.badge-dot {
  position: absolute; top: -2px; right: -2px;
  background: var(--danger); color: #fff; border-radius: 50%;
  font-size: 10px; min-width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; padding: 0 3px;
  box-shadow: 0 0 0 2px #fff;
}
.lang-switch { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.lang-switch button { border: none; background: #fff; padding: 7px 10px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-muted); transition: background .12s var(--ease), color .12s var(--ease); }
.lang-switch button:hover { background: var(--slate-100); }
.lang-switch button.active { background: var(--slate-900); color: #fff; }

.user-chip { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--slate-100); cursor: pointer; transition: background .12s var(--ease); }
.user-chip:hover { background: var(--slate-200); }
.user-chip .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.user-chip .u-name { font-size: 12.5px; font-weight: 600; }
.user-chip .u-role { font-size: 10.5px; color: var(--text-muted); }

.content { flex: 1; padding: 24px; overflow-y: auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-header h2 { margin: 0; font-size: 21px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn-ic { display: inline-flex; width: 15px; height: 15px; flex-shrink: 0; }
.btn-ic svg { width: 15px; height: 15px; display: block; }
.btn {
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
  transition: border-color .12s var(--ease), transform .1s var(--ease), box-shadow .12s var(--ease), background .12s var(--ease);
}
.btn:hover { border-color: var(--accent); box-shadow: var(--shadow-xs); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent-dark); color: #fff; box-shadow: 0 4px 12px -3px rgba(49, 82, 223, 0.45); }
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 6px 16px -3px rgba(49, 82, 223, 0.55); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .92; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--slate-100); border-color: transparent; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none !important; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
a.stat-card,
.stat-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s var(--ease);
}
a.stat-card:link,
a.stat-card:visited,
a.stat-card:hover,
a.stat-card:active,
a.stat-card:focus {
  color: inherit;
  text-decoration: none;
}
.stat-card:hover {
  transform: translateY(-1px);
  border-color: #c5cdd8;
  box-shadow: var(--shadow-lg);
}
.stat-card:active { transform: translateY(0); }
.stat-card .stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.35;
  text-decoration: none;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-decoration: none;
}
.stat-card .stat-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.bonus-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); flex-shrink: 0; }
.stat-card.navy .stat-value { color: var(--text); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.ok .stat-value { color: var(--ok); }
.stat-card.warn .stat-value { color: var(--warn); }
.stat-card.danger { border-left: 3px solid var(--danger); }
.stat-card.warn { border-left: 3px solid var(--warn); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--slate-50); }
th:first-child { border-top-left-radius: var(--radius); }
th:last-child { border-top-right-radius: var(--radius); }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.clickable { transition: background .1s var(--ease); }
tr.clickable:hover { background: var(--slate-50); cursor: pointer; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; letter-spacing: 0.01em; }
.pill-new { background: var(--info-soft); color: var(--info); }
.pill-progress { background: var(--warn-soft); color: var(--warn); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: var(--slate-100); color: var(--text-muted); }

.pri-P1 { background: var(--danger-soft); color: var(--danger); }
.pri-P2 { background: var(--warn-soft); color: var(--warn); }
.pri-P3 { background: var(--info-soft); color: var(--info); }
.pri-P4 { background: var(--slate-100); color: var(--text-muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab { padding: 9px 15px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; transition: color .12s var(--ease), border-color .12s var(--ease); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: var(--slate-100); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.kanban-col h4 { font-size: 11.5px; margin: 3px 6px 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 700; }
.kanban-card { background: #fff; border-radius: var(--radius-sm); padding: 11px; margin-bottom: 8px; box-shadow: var(--shadow-xs); cursor: pointer; border-left: 3px solid var(--accent); transition: transform .12s var(--ease), box-shadow .12s var(--ease); }
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kanban-card .kc-number { font-size: 11px; color: var(--text-muted); font-weight: 700; }
.kanban-card .kc-desc { font-size: 12.5px; margin: 4px 0; }
.kanban-card .kc-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(10,14,23,0.55); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 400; animation: vfm-fade .15s var(--ease); }
@keyframes vfm-fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 640px; padding: 26px; box-shadow: var(--shadow-lg); animation: vfm-pop .16s var(--ease); }
@keyframes vfm-pop { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
.modal.modal-wide { max-width: 860px; }
.modal.modal-preview { max-width: 960px; }
.file-preview-panel { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.file-preview-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; background: var(--slate-50); border-bottom: 1px solid var(--border); font-size: 13px; }
.file-preview-frame { width: 100%; height: 480px; border: none; display: block; background: #fff; }
.file-preview-inline .file-preview-frame { height: 260px; }
.file-preview-img { max-width: 100%; max-height: 480px; display: block; margin: 0 auto; padding: 8px; }
.doc-link { color: var(--accent); cursor: pointer; text-decoration: none; font-weight: 600; border: none; background: none; padding: 0; font: inherit; }
.doc-link:hover { text-decoration: underline; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close { cursor: pointer; font-size: 20px; color: var(--text-muted); border: none; background: none; width: 32px; height: 32px; border-radius: 50%; transition: background .12s var(--ease); }
.modal-close:hover { background: var(--slate-100); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.notif-panel {
  position: absolute; top: 60px; right: 22px; width: 340px; max-height: 420px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 90;
  animation: vfm-pop .14s var(--ease);
}
.notif-item { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: none; }
.notif-item .n-title { font-size: 12.5px; font-weight: 700; }
.notif-item .n-body { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.notif-item .n-meta { font-size: 10.5px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 6px; }
.kanban-host { padding: 12px; overflow-x: auto; }
.kanban-host .kanban { min-height: 360px; }

.vfm-bell-wrap { position: relative; }
.vfm-bell-wrap .notif-panel {
  top: 44px; right: 0; width: min(360px, 92vw);
}
.notif-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--border);
}
.notif-item { display: block; text-decoration: none; color: inherit; }
.notif-item .n-time { font-size: 10.5px; color: var(--text-muted); margin-top: 4px; }

/* Telegram connect page — vertical card, plain colors (readable for non-tech users) */
.tg-panel {
  max-width: 520px;
  margin: 0 auto;
}
.tg-panel .card {
  padding: 22px 22px 20px;
}
.tg-panel h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.tg-lead {
  margin: 0 0 18px;
  color: var(--text-muted);
  line-height: 1.45;
  font-size: 14px;
}
.tg-steps {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: block;
}
.tg-steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  color: var(--text);
}
.tg-steps li:last-child { border-bottom: 0; }
.tg-num {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent, #3152df);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.tg-big {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 700;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  background: #2AABEE;
  color: #fff;
}
.tg-big:hover { filter: brightness(1.05); color: #fff; }
.tg-big[disabled] { opacity: .55; cursor: wait; }
.tg-ok-box {
  background: var(--ok-soft, #e8f8ef);
  color: var(--ok, #1b7a3d);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.tg-ok-box strong { display: block; font-size: 1.1rem; margin-bottom: 4px; color: var(--ok, #1b7a3d); }
.tg-wait {
  margin: 14px 0 0;
  color: var(--warn, #b45309);
  font-size: 14px;
  line-height: 1.4;
}
.tg-fallback {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.45;
}
.tg-code {
  font-size: 1.75rem;
  letter-spacing: .14em;
  font-weight: 800;
  color: var(--text);
  margin: 8px 0;
}
.chan-tag { font-size: 9.5px; padding: 1px 6px; border-radius: 6px; background: var(--slate-100); color: var(--text-muted); font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 20px; border-left: 2px solid var(--border); }
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline .t-note { font-size: 13px; }
.timeline .t-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.progress-track { height: 8px; border-radius: 6px; background: var(--slate-100); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width .3s var(--ease); }
.progress-fill.warn { background: var(--warn); }
.progress-fill.danger { background: var(--danger); }

.approval-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.approval-step { flex: 1; min-width: 130px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px; text-align: center; font-size: 11.5px; transition: all .15s var(--ease); }
.approval-step.done { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.approval-step.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; box-shadow: 0 0 0 3px rgba(49, 82, 223, 0.12); }
.approval-step .step-role { font-weight: 700; margin-bottom: 3px; }

.stat-card .stat-label { display: block; text-decoration: none; }

/* ---------- Critical alert cards ---------- */
.alert-card { border-left: 3px solid var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.alert-card.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.alert-card.info { border-left-color: var(--accent); background: var(--accent-soft); }
.alert-card .a-title { font-weight: 700; font-size: 12.5px; }
.alert-card .a-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ---------- Approval workflow — vertical checklist (Block 9) ---------- */
.approval-rows { margin-bottom: 6px; }
.approval-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.approval-row:last-child { border-bottom: none; padding-bottom: 0; }
.approval-row .ar-icon { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; margin-top: 1px; }
.approval-row.done .ar-icon { background: var(--tertiary-soft); color: var(--tertiary); }
.approval-row.active .ar-icon { background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 3px rgba(49, 82, 223, 0.14); }
.approval-row.rejected .ar-icon { background: var(--danger-soft); color: var(--danger); }
.approval-row.pending .ar-icon { background: var(--slate-100); color: var(--text-muted); }
.approval-row .ar-body { flex: 1; min-width: 0; }
.approval-row .ar-role { font-weight: 700; font-size: 13px; }
.approval-row .ar-status { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.approval-row .ar-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; padding-left: 10px; }

/* ---------- Person cell: name + position underneath ---------- */
.person-name { font-weight: 600; }
.person-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Checklists (acceptance & PPR) ---------- */
.checklist-box { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; cursor: pointer; transition: background .12s var(--ease); }
.check-row:last-child { border-bottom: none; }
.checklist-box:not(.readonly) .check-row:hover { background: var(--slate-50); }
.check-row input[type=checkbox] { width: 17px; height: 17px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.checklist-box.readonly .check-row { cursor: default; }
.check-row .check-mark { width: 17px; flex-shrink: 0; font-weight: 700; text-align: center; }
.check-row.done .check-mark { color: var(--tertiary); }
.check-row.undone .check-mark { color: var(--danger); }
.check-row.undone span:last-child { color: var(--text-muted); }
.checklist-editor-item { display: flex; gap: 8px; align-items: center; margin-bottom: 7px; }
.checklist-editor-item input { flex: 1; }

.empty-state { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.help-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }

/* Компактные пары «метка — число» (аналитика и т.п.) — не растягивать на всю ширину */
.an-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.an-panel h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.kv-list { list-style: none; margin: 0; padding: 0; }
.kv-list li {
  border-bottom: 1px solid var(--border);
}
.kv-list li:last-child { border-bottom: none; }
.kv-list .kv-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  width: 100%;
  padding: 9px 0;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}
.kv-list .kv-row:hover { background: var(--slate-50); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 6px; }
.kv-list .kv-k { color: var(--text-muted); font-weight: 600; font-size: 13px; }
.kv-list .kv-v { font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.kv-list .kv-empty { padding: 9px 0; color: var(--text-muted); }
button.stat-card { width: 100%; text-align: left; font: inherit; }

.table-scroll {
  position: relative;
  margin: 0 -4px;
}
.table-scroll-viewport {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.table-scroll-viewport table {
  width: max-content;
  min-width: 100%;
}
.table-scroll-viewport th,
.table-scroll-viewport td {
  white-space: nowrap;
  vertical-align: middle;
}
.table-scroll-viewport td.td-wrap {
  white-space: normal;
  max-width: 220px;
}
.table-scroll-viewport .row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
}
.table-scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(28, 36, 52, 0.72);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, background .15s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
}
.table-scroll.has-overflow .table-scroll-btn.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.table-scroll:hover .table-scroll-btn.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.table-scroll-btn:hover { background: rgba(49, 82, 223, 0.95); }
.table-scroll-btn.left { left: 6px; }
.table-scroll-btn.right { right: 6px; }
.table-scroll-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 56px;
  z-index: 4;
}
.table-scroll-edge.left { left: 0; }
.table-scroll-edge.right { right: 0; }
.mods-short {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  color: var(--text-muted);
  font-size: 12px;
}
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--slate-100); border-radius: 7px; padding: 4px 9px; font-size: 11.5px; font-weight: 500; }
.stars { color: #ea9d0c; letter-spacing: 2px; }
.muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.small { font-size: 11.5px; }
.text-right { text-align: right; }

.burger-btn { display: none; font-size: 18px; }
.sidebar-backdrop { display: none; }

@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 50; height: 100vh; transform: translateX(-100%); transition: transform .2s var(--ease); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 49; }
  .sidebar-backdrop.show { display: block; }
  .burger-btn { display: flex; }
  .field-row, .field-row3 { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .grid-cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* ---------- Print (clean report output, no app chrome) ---------- */
@media print {
  .sidebar, .sidebar-backdrop, .topbar, .toolbar, .page-header .btn, .modal-close,
  .kanban-card [data-open-ticket], .btn, .tabs, #notif-panel { display: none !important; }
  .app-shell, .main-col, .content { display: block !important; padding: 0 !important; overflow: visible !important; }
  body { background: #fff !important; font-size: 12px; }
  .card, .stat-card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
  .grid-cards { display: grid !important; grid-template-columns: repeat(4, 1fr) !important; }
  .page-header h2::before { content: "Verum FM — "; }
  a[href]::after { content: ""; }
}

/* ---------- Themes (ТЗ §16) ---------- */
html[data-theme="theme-teal"] {
  --accent: #0F6E56;
  --accent-dark: #0b5744;
  --accent-light: #1d8a6c;
  --accent-soft: #e6f4ef;
  --primary: #0b3d32;
  --bg: #f2f7f5;
}
html[data-theme="theme-dark"] {
  --bg: #0F172A;
  --card: #1e293b;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #334155;
  --primary: #0f172a;
  --accent: #22c55e;
  --accent-dark: #16a34a;
  --accent-soft: #14532d;
  --slate-100: #1e293b;
  --slate-200: #334155;
  --slate-950: #020617;
}
html[data-theme="theme-dark"] .sidebar { background: #020617; }
html[data-theme="theme-dark"] .topbar { background: #1e293b; border-color: #334155; }
html[data-theme="theme-warm"] {
  --bg: #FAFAF9;
  --accent: #534AB7;
  --accent-dark: #4338ca;
  --accent-soft: #eeedf8;
  --primary: #292524;
  --tertiary: #0d9488;
}

.vfm-viewas {
  background: #fef3c7;
  color: #78350f;
  padding: 10px 16px;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  z-index: 200;
  position: sticky;
  top: 0;
}

/* Полоска состояния связи — поверх всего, чтобы её было видно на любой странице. */
.offline-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9999;
  padding: 10px 16px; text-align: center; font-size: 13.5px; font-weight: 600;
  color: #fff; background: #b45309; }
.offline-bar[data-kind="sync"] { background: #15803d; }
.offline-bar[hidden] { display: none; }

/* Подсказки адресов 2ГИС под полем маршрута. */
.suggest-box { position: absolute; z-index: 60; left: 0; right: 0; margin-top: 2px;
  background: #fff; border: 1px solid var(--slate-300, #cbd5e1); border-radius: var(--radius-sm, 8px);
  box-shadow: 0 8px 24px rgba(15,23,42,.12); max-height: 260px; overflow-y: auto; }
.suggest-box[hidden] { display: none; }
.suggest-item { display: block; width: 100%; text-align: left; padding: 9px 12px;
  background: none; border: 0; cursor: pointer; font-size: 13.5px; }
.suggest-item:hover { background: var(--accent-soft, #eef2ff); }
.suggest-title { display: block; color: var(--text-primary, #1d1d1f); }
.suggest-sub { display: block; color: var(--text-muted, #64748b); font-size: 12px; margin-top: 2px; }
/* поле-родитель должно позиционировать выпадающий список */
.field { position: relative; }
