:root {
  --bg: #f2f6f3;
  --panel: #ffffff;
  --panel-2: #edf3ef;
  --line: #dbe6df;
  --text: #12261c;
  --muted: #5f7a6c;
  --muted-2: #8aa296;
  --accent: #12a06a;
  --accent-soft: #e3f6ed;
  --ok: #0f9f6e;
  --warn: #b7791f;
  --high: #c53030;
  --design: #12a06a;
  --support: #2a9bd4;
  --comms: #7c6bd6;
  --admin: #7b8c93;
  --noise: #d9534f;
  --idle: #cfdcd5;
  --unknown: #9aa9a1;
  --shadow: 0 1px 2px #12261c0a, 0 6px 18px #12261c0d;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ---------- вход ---------- */
.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card {
  width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 32px; box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 6px; font-size: 26px; }
.login-card p { margin: 0 0 22px; color: var(--muted); font-size: 15px; }
input, select, button, textarea { font: inherit; color: var(--text); }
input, select {
  width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 12px; outline: none; font-size: 16px;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #12a06a1f; }
button {
  background: var(--accent); color: #fff; border: 0; border-radius: 12px;
  padding: 12px 18px; cursor: pointer; font-weight: 600; font-size: 15px;
}
button:hover { filter: brightness(1.06); }
button.ghost { background: #fff; border: 1px solid var(--line); color: var(--text); font-weight: 600; }
button.ghost:hover { border-color: var(--accent); color: var(--accent); }
button.danger { background: #fff; border: 1px solid #f0c9c9; color: var(--high); }
button.small { padding: 7px 13px; font-size: 14px; }
button:disabled { opacity: .55; cursor: default; }
.error { color: var(--high); font-size: 14px; min-height: 20px; }

/* ---------- каркас ---------- */
header.top {
  display: flex; align-items: center; gap: 14px; padding: 10px 20px;
  border-bottom: 1px solid var(--line); background: #fffffff2; backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20; flex-wrap: nowrap;
}
.logo {
  font-weight: 700; letter-spacing: .2px; font-size: 17px; text-decoration: none;
  color: var(--text); display: inline-flex; align-items: center; gap: 2px;
  padding: 4px 6px; border-radius: 10px; transition: .15s; cursor: pointer; flex: 0 0 auto;
}
.logo:hover { background: var(--panel-2); }
.logo span { color: var(--accent); }
.logo::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); margin-right: 8px;
  box-shadow: 0 0 0 4px #12a06a1f;
}
.nav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 600;
  padding: 7px 11px; border-radius: 9px; transition: .15s; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.who { color: var(--muted); font-size: 13.5px; white-space: nowrap; margin-right: 4px; }
.top button { padding: 7px 11px; font-size: 14px; }
button.icon { display: inline-flex; align-items: center; gap: 7px; }
button.icon svg {
  width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto;
}
button.wide { width: 100%; }
main { padding: 26px 28px 70px; max-width: 1180px; margin: 0 auto; }
h2 { font-size: 22px; margin: 30px 0 14px; color: var(--text); font-weight: 650; }
h3 { font-size: 17px; margin: 0 0 10px; color: var(--text); }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar h2 { margin: 0; }
.toolbar input[type=date] { width: auto; margin: 0; padding: 9px 12px; }

/* ---------- карточки ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; box-shadow: var(--shadow);
}
.metric .val { font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.metric .lbl { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.metric.design .val { color: var(--accent); }
.metric.noise .val { color: var(--noise); }
.metric.idle .val { color: var(--comms); }

/* ---------- люди ---------- */
.people { display: grid; gap: 12px; }
.person {
  display: grid; grid-template-columns: 240px 1fr 130px 120px; gap: 18px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 20px; cursor: pointer; transition: .15s; box-shadow: var(--shadow);
}
.person:hover { border-color: var(--accent); transform: translateY(-1px); }
.person .name { font-weight: 650; font-size: 17px; }
.person .role { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.bars { display: flex; height: 12px; border-radius: 7px; overflow: hidden; background: var(--idle); }
.bars i { display: block; height: 100%; }
.chips { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.chips b { color: var(--text); font-weight: 650; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  font-size: 13.5px; font-weight: 650; border: 1px solid transparent; white-space: nowrap;
}
.badge.ok { background: #e4f7ee; color: #0b7a53; border-color: #c2e9d8; }
.badge.warn { background: #fdf3df; color: #96650f; border-color: #f0dcb4; }
.badge.high { background: #fdeaea; color: #b02a2a; border-color: #f3cccc; }
.badge.info { background: var(--panel-2); color: var(--muted); border-color: var(--line); }

/* ---------- таймлайн ---------- */
.timeline { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 34px; box-shadow: var(--shadow); }
.track { position: relative; height: 52px; background: var(--panel-2); border-radius: 10px; overflow: hidden; }
.track .seg { position: absolute; top: 0; bottom: 0; border-right: 1px solid #fff6; }
.track .seg:hover { filter: brightness(.92); }
.ticks { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 12px; margin-top: 8px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); margin-top: 12px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }

/* ---------- наблюдения ---------- */
.findings { display: grid; gap: 10px; }
.finding {
  display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--muted-2); border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--shadow);
}
.finding.high { border-left-color: var(--high); }
.finding.warn { border-left-color: var(--warn); }
.finding b { display: block; font-size: 15.5px; }
.finding .d { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---------- скриншоты ---------- */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.shot { background: #000; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; position: relative; }
.shot img { width: 100%; height: 130px; object-fit: cover; display: block; }
.shot .t { position: absolute; left: 8px; bottom: 8px; background: #000c; color: #fff; padding: 3px 8px; border-radius: 7px; font-size: 12px; }
.shot.noise { border-color: #f3cccc; }
.modal { position: fixed; inset: 0; background: #000c; display: grid; place-items: center; z-index: 50; padding: 24px; }
.modal img { max-width: 92vw; max-height: 88vh; border-radius: 12px; box-shadow: 0 20px 80px #000; }

/* ---------- таблица ---------- */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
th { color: var(--muted); font-weight: 600; background: var(--panel-2); }
tr:last-child td { border-bottom: 0; }

/* ---------- ИИ ---------- */
.ai { background: linear-gradient(180deg, #f0faf5 0%, #fff 70%); border: 1px solid #cfe9de; border-radius: 18px; padding: 22px; box-shadow: var(--shadow); }
.ai h3 { display: flex; align-items: center; gap: 10px; }
.ai .sum { font-size: 16px; margin: 10px 0 16px; }
.ai ul { margin: 6px 0 14px; padding-left: 22px; }
.ai li { margin: 4px 0; font-size: 15px; }
.ai .action { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.ai .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.ai .mode { font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; background: #fff; }

/* ---------- отделы ---------- */
.dept-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 18px; }
.dept-tab {
  padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .15s;
}
.dept-tab:hover { border-color: var(--accent); color: var(--accent); }
.dept-tab.active { background: var(--accent-soft); color: var(--accent); border-color: #b6e3d1; }
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.dept-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.dept-card h3 { margin: 0 0 6px; font-size: 16.5px; }
.dept-card .n { color: var(--muted); font-size: 14px; }
.dept-card .row { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.kind {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
  background: var(--panel-2);
}
.kind.design { color: #0d7d55; border-color: #bfe6d6; background: #e9f8f1; }
.kind.sales { color: #16688f; border-color: #c3e2f2; background: #eaf6fc; }
.kind.production { color: #8a6410; border-color: #efdcb3; background: #fdf6e7; }
.kind.retail { color: #5b47a8; border-color: #d9d0f3; background: #f3f0fd; }
.kind.admin { color: #4c5f66; border-color: #d7e0e3; background: #f1f5f6; }

/* ---------- установка ---------- */
.cmd { position: relative; background: #f7faf8; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 12px; }
.cmd code { display: block; font: 13px/1.6 Consolas, "Cascadia Mono", monospace; color: #14402f; word-break: break-all; white-space: pre-wrap; }
.cmd .copy { position: absolute; top: 10px; right: 10px; }
.ok-note { background: #e9f8f1; border: 1px solid #c2e9d8; color: #0b7a53; padding: 12px 14px; border-radius: 12px; font-size: 14px; }

/* ---------- пользователи ---------- */
.role-chip {
  font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--muted);
}
.role-chip.owner { color: #0d7d55; border-color: #bfe6d6; background: #e9f8f1; }
.role-chip.director { color: #16688f; border-color: #c3e2f2; background: #eaf6fc; }
.role-chip.manager { color: #8a6410; border-color: #efdcb3; background: #fdf6e7; }
.role-chip.employee { color: #4c5f66; }
.dept-pick { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.dept-pick label {
  display: inline-flex; align-items: center; gap: 7px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; cursor: pointer; background: #fff;
}
.dept-pick input { width: auto; margin: 0; }

@media (max-width: 1500px) {
  .who { display: none; }
  button.icon .txt { display: none; }
  button.icon { padding: 8px; }
}
@media (max-width: 1200px) {
  header.top { gap: 10px; padding: 9px 14px; }
  .logo { font-size: 16px; }
  .nav a { font-size: 14px; padding: 6px 9px; }
  main { padding: 20px 16px 60px; }
}
@media (max-width: 980px) {
  .logo::before { display: none; }
  .logo span { display: none; }
}
@media (max-width: 1300px) {
  .person { grid-template-columns: 1fr 120px; row-gap: 12px; }
  .person > div:nth-child(2),
  .person > div:nth-child(4) { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .ai .cols { grid-template-columns: 1fr; }
  .person { grid-template-columns: 1fr; }
  .person > div { grid-column: 1 / -1; }
}
