/* ==========================================================================
   Hotelero — прототип IT-системы отеля
   Дизайн-система: glassmorphism, мягкие градиенты, скруглённая геометрия
   ========================================================================== */

:root {
  /* Палитра */
  --bg-page: #e9ecf7;
  --shell-1: #a9b7ea;
  --shell-2: #c3cdf1;
  --shell-3: #dfe4f5;

  --ink: #14161f;
  --ink-2: #3a3f52;
  --ink-3: #6b7189;
  --ink-4: #969bb0;

  --glass: rgba(255, 255, 255, 0.46);
  --glass-2: rgba(255, 255, 255, 0.68);
  --glass-3: rgba(255, 255, 255, 0.28);
  --glass-line: rgba(255, 255, 255, 0.55);

  --accent: #4b6bff;
  --accent-2: #7b5cff;
  --accent-grad: linear-gradient(135deg, #6f5cff 0%, #3f8cff 100%);
  --accent-soft: rgba(75, 107, 255, 0.12);

  --ok: #17b26a;
  --ok-soft: rgba(23, 178, 106, 0.14);
  --warn: #e8a33d;
  --warn-soft: rgba(232, 163, 61, 0.16);
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, 0.14);

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 11px;

  --shadow-soft: 0 8px 30px rgba(46, 55, 100, 0.08);
  --shadow-card: 0 2px 14px rgba(46, 55, 100, 0.06);
  --shadow-pop: 0 24px 70px rgba(30, 38, 80, 0.24);

  --sidebar-w: 78px;
  --rail-w: 348px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(80, 92, 140, 0.22); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(80, 92, 140, 0.38); }

/* ==========================================================================
   Оболочка
   ========================================================================== */

.app {
  height: 100vh;
  padding: 22px;
  display: flex;
}

.shell {
  flex: 1;
  min-width: 0;
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 90% at 10% 0%, rgba(255,255,255,.5) 0%, rgba(255,255,255,0) 55%),
    linear-gradient(150deg, var(--shell-1) 0%, var(--shell-2) 42%, var(--shell-3) 100%);
  box-shadow: 0 26px 70px rgba(46, 55, 100, 0.16);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  overflow: hidden;
  position: relative;
}

/* ---------- Сайдбар ---------- */

.sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 0 22px;
  gap: 6px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sb-mark {
  width: 40px; height: 40px;
  margin-bottom: 20px;
  display: grid; place-items: center;
  flex: none;
}

.sb-btn {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: background .18s, color .18s, transform .18s;
  position: relative;
  flex: none;
}
.sb-btn svg { width: 20px; height: 20px; }
.sb-btn:hover { background: rgba(255,255,255,.42); color: var(--ink); }
.sb-btn.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(46,55,100,.14);
}
.sb-btn .sb-tip {
  position: absolute; left: 52px; top: 50%;
  transform: translateY(-50%) translateX(-6px);
  background: var(--ink); color: #fff;
  padding: 5px 10px; border-radius: 9px;
  font-size: 12px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .16s, transform .16s;
  z-index: 60;
}
.sb-btn:hover .sb-tip { opacity: 1; transform: translateY(-50%) translateX(0); }

.sb-sep { width: 22px; height: 1px; background: rgba(255,255,255,.6); margin: 9px 0; flex: none; }
.sb-spacer { flex: 1; min-height: 10px; }

.sb-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-grad);
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 13px;
  border: 2px solid rgba(255,255,255,.75);
  flex: none;
}

/* ---------- Рабочая область ---------- */

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 26px 14px 4px;
}

.brand { min-width: 190px; }
.brand h1 { font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.brand p { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }

.topbar-spacer { flex: 1; }

.pill-info {
  background: var(--glass-2);
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  padding: 10px 18px;
  display: flex; align-items: center; gap: 14px;
  font-size: 13px; font-weight: 500;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.pill-info .muted { color: var(--ink-3); font-weight: 400; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.5);
  border: 1px solid var(--glass-line);
  color: var(--ink-2);
  transition: background .16s, transform .16s;
  position: relative;
}
.icon-btn:hover { background: #fff; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 1.5px solid #fff;
}

/* ---------- Сетка контента ---------- */

.content {
  display: grid;
  grid-template-columns: 1fr var(--rail-w);
  gap: 0;
  min-height: 0;
  overflow: hidden;
}
.content.no-rail { grid-template-columns: 1fr; }

.main-col {
  padding: 4px 22px 24px 4px;
  overflow-y: auto;
  min-width: 0;
  display: flex; flex-direction: column; gap: 18px;
}
/* Дети flex-колонки не должны сжиматься под высоту вьюпорта */
.main-col > *, .rail > * { flex: none; }

.rail {
  background: #fff;
  border-radius: var(--r-xl) 0 0 0;
  margin: 0;
  padding: 26px 22px 22px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px;
}

/* ==========================================================================
   Карточки и типографика
   ========================================================================== */

.card {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-card);
}
.card.solid { background: rgba(255,255,255,.82); }
.card.flat { box-shadow: none; }
.card.tight { padding: 16px 18px; }

.card-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.card-head h3 { font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.card-head .sub { font-size: 12px; color: var(--ink-3); }
.card-head .spacer { flex: 1; }

.section-title { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.section-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-21 { grid-template-columns: 2fr 1fr; }
.g-12 { grid-template-columns: 1fr 2fr; }

.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--ink-3); }
.tiny { font-size: 11.5px; }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }

/* ---------- Кнопки ---------- */

.btn {
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform .15s, box-shadow .15s, background .15s, opacity .15s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: scale(.975); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { box-shadow: 0 8px 22px rgba(20,22,31,.28); }
.btn-light { background: rgba(255,255,255,.78); color: var(--ink); border: 1px solid var(--glass-line); }
.btn-light:hover { background: #fff; }
.btn-accent { background: var(--accent-grad); color: #fff; }
.btn-accent:hover { box-shadow: 0 8px 22px rgba(80,100,255,.36); }
.btn-ghost { color: var(--ink-2); padding: 8px 14px; }
.btn-ghost:hover { background: rgba(255,255,255,.5); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-xs { padding: 5px 11px; font-size: 11.5px; border-radius: 999px; }
.btn[disabled] { opacity: .42; pointer-events: none; }

/* ---------- Переключатели / табы ---------- */

.seg {
  display: inline-flex;
  background: rgba(255,255,255,.5);
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border-radius: 999px;
  padding: 6px 15px;
  font-size: 12.5px;
  color: var(--ink-3);
  transition: background .16s, color .16s;
}
.seg button.is-active { background: #fff; color: var(--ink); font-weight: 500; box-shadow: 0 2px 8px rgba(46,55,100,.1); }

.tabs { display: flex; gap: 22px; border-bottom: 1px solid rgba(255,255,255,.55); }
.tabs button {
  padding: 0 0 11px; font-size: 13.5px; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .16s, border-color .16s;
}
.tabs button.is-active { color: var(--ink); font-weight: 600; border-color: var(--ink); }

/* ---------- Бэйджи ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11.5px; font-weight: 500;
  background: rgba(255,255,255,.7); color: var(--ink-2);
  white-space: nowrap;
}
.badge.b-accent { background: var(--accent); color: #fff; }
.badge.b-ok { background: var(--ok-soft); color: #0d7f4a; }
.badge.b-warn { background: var(--warn-soft); color: #96631a; }
.badge.b-danger { background: var(--danger-soft); color: #b3272c; }
.badge.b-dark { background: var(--ink); color: #fff; }
.badge.b-plain { background: rgba(120,130,170,.13); color: var(--ink-2); }
.badge .bdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Списки-строки ---------- */

.lrow {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  transition: background .16s, box-shadow .16s;
  cursor: pointer;
}
.lrow:hover { background: rgba(255,255,255,.62); }
.lrow.is-sel { background: #fff; box-shadow: var(--shadow-card); }
.lrow .lava {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  background: rgba(255,255,255,.85);
  color: var(--ink-2);
  font-size: 12px; font-weight: 600;
}
.lrow .lava svg { width: 15px; height: 15px; }
.lrow .lmain { min-width: 0; flex: 1; }
.lrow .ltitle { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .lsub { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .lamt { font-size: 13.5px; font-weight: 600; }

.rail .lrow { border-radius: 12px; padding: 9px 8px; }
.rail .lrow:hover { background: #f4f6fd; }

/* ---------- Таблица ---------- */

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 500; font-size: 11.5px;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em;
  padding: 0 12px 10px; white-space: nowrap;
}
.tbl td { padding: 12px; border-top: 1px solid rgba(255,255,255,.6); vertical-align: middle; }
.tbl tbody tr { transition: background .14s; }
.tbl tbody tr:hover { background: rgba(255,255,255,.5); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

.tbl-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }

/* ---------- Метрики ---------- */

.kpi { display: flex; flex-direction: column; gap: 3px; }
.kpi .k-label { font-size: 12px; color: var(--ink-3); }
.kpi .k-value { font-size: 26px; font-weight: 700; letter-spacing: -.8px; line-height: 1.15; }
.kpi .k-value small { font-size: 15px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.kpi .k-delta { font-size: 11.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 3px; }
.k-up { color: #0d7f4a; }
.k-down { color: #b3272c; }

/* ---------- Прогресс ---------- */

.bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.62); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent-grad); }
.bar.thin { height: 4px; }

/* ---------- Поля ввода ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.input, .select, .textarea {
  background: rgba(255,255,255,.8);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(75,107,255,.55);
  box-shadow: 0 0 0 3px rgba(75,107,255,.12);
  background: #fff;
}
.textarea { resize: vertical; min-height: 78px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7189' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.search {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255,255,255,.65);
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  padding: 8px 16px;
  min-width: 220px;
}
.search svg { width: 15px; height: 15px; color: var(--ink-3); flex: none; }
.search input { border: none; background: none; outline: none; width: 100%; font-size: 13px; }

.switch {
  width: 38px; height: 22px; border-radius: 999px;
  background: rgba(120,130,170,.3);
  position: relative; transition: background .2s; flex: none;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(16px); }

/* ==========================================================================
   Специальные блоки
   ========================================================================== */

/* Hero-карточка с кругами (референс: Total balance) */
.hero { position: relative; overflow: hidden; padding: 22px 26px 24px; }
.hero-top { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 6px; }
.hero-value { font-size: 34px; font-weight: 700; letter-spacing: -1.2px; }
.hero-value .cur { font-size: 18px; font-weight: 500; color: var(--ink-3); margin-right: 2px; }

.venn { display: flex; align-items: center; justify-content: center; margin: 4px 0 2px; height: 152px; position: relative; }
.venn-c {
  width: 132px; height: 132px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.venn-c.mid {
  background: radial-gradient(circle at 34% 30%, #8b6bff 0%, #5a5cff 45%, #3f8cff 100%);
  color: #fff; border: none;
  box-shadow: 0 12px 40px rgba(90,92,255,.42);
  z-index: 2; width: 142px; height: 142px;
}
.venn-c:first-child { margin-right: -26px; }
.venn-c:last-child { margin-left: -26px; }
.venn-c b { display: block; font-size: 19px; font-weight: 700; letter-spacing: -.5px; }
.venn-c span { font-size: 11.5px; opacity: .78; }
.venn-c.mid b { font-size: 21px; }

.hero-actions { display: flex; flex-direction: column; gap: 10px; justify-content: center; min-width: 168px; }

/* Синяя градиентная карточка (референс: Financial health) */
.card-blue {
  background: linear-gradient(150deg, #5b64ff 0%, #4a8bff 55%, #8fc0ff 100%);
  color: #fff; border: none;
  border-radius: var(--r-lg);
  padding: 20px 22px;
  position: relative; overflow: hidden;
  box-shadow: 0 12px 34px rgba(74,110,255,.3);
}
.card-blue .card-head h3 { color: #fff; }
.card-blue .big { font-size: 32px; font-weight: 700; letter-spacing: -1px; }
.card-blue .cap { font-size: 12px; opacity: .8; }

/* Столбчатая диаграмма */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 130px; }
.bars .b {
  flex: 1; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; gap: 8px; cursor: pointer;
}
.bars .b .col {
  width: 100%; border-radius: 12px;
  background: rgba(255,255,255,.62);
  transition: background .2s, transform .2s;
  position: relative; min-height: 18px; max-height: calc(100% - 24px);
}
.bars .b:hover .col { transform: translateY(-2px); }
.bars .b.is-active .col { background: linear-gradient(180deg, #6f5cff 0%, #4a8bff 100%); }
.bars .b .lbl { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.bars .b.is-active .lbl { color: var(--ink); font-weight: 600; }
.bars .tip {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 11px;
  padding: 3px 9px; border-radius: 8px; white-space: nowrap;
}

/* ==========================================================================
   Шахматка
   ========================================================================== */

.rack { overflow: auto; border-radius: var(--r-md); background: rgba(255,255,255,.4); }
.rack-grid { display: grid; min-width: max-content; font-size: 11.5px; }
.rack-hcell {
  padding: 8px 4px; text-align: center; font-size: 10.5px; color: var(--ink-3);
  position: sticky; top: 0; background: rgba(238,241,251,.96); z-index: 3;
  border-left: 1px solid rgba(255,255,255,.7);
  backdrop-filter: blur(6px);
}
.rack-hcell.we { color: var(--danger); }
.rack-hcell b { display: block; font-size: 12.5px; color: var(--ink); font-weight: 600; }
.rack-room {
  position: sticky; left: 0; z-index: 2;
  background: rgba(238,241,251,.96);
  padding: 8px 12px; display: flex; align-items: center; gap: 8px;
  border-top: 1px solid rgba(255,255,255,.7);
  backdrop-filter: blur(6px);
}
.rack-room b { font-weight: 600; font-size: 12.5px; }
.rack-cell {
  border-top: 1px solid rgba(255,255,255,.7);
  border-left: 1px solid rgba(255,255,255,.7);
  min-height: 40px; position: relative;
}
.rack-cell.today { background: rgba(75,107,255,.07); }
.rack-bk {
  position: absolute; top: 4px; bottom: 4px; left: 3px; right: 3px;
  border-radius: 9px; padding: 0 9px;
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: #fff; font-weight: 500;
  overflow: hidden; white-space: nowrap;
  cursor: grab; z-index: 1;
  transition: transform .16s, box-shadow .16s, filter .16s;
}
.rack-bk:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(40,50,100,.28); filter: brightness(1.06); z-index: 4; }
.rack-bk.dragging { opacity: .45; }
.rack-cell.drop-ok { background: rgba(23,178,106,.18); box-shadow: inset 0 0 0 2px rgba(23,178,106,.5); }
.rack-cell.drop-no { background: rgba(229,72,77,.14); box-shadow: inset 0 0 0 2px rgba(229,72,77,.4); }
.bk-c1 { background: linear-gradient(135deg,#6f5cff,#4a8bff); }
.bk-c2 { background: linear-gradient(135deg,#17b26a,#4fd18b); }
.bk-c3 { background: linear-gradient(135deg,#e8a33d,#f2c36b); }
.bk-c4 { background: linear-gradient(135deg,#8b5cf6,#c084fc); }
.bk-c5 { background: linear-gradient(135deg,#0ea5e9,#67d9f5); }
.bk-ooo { background: repeating-linear-gradient(45deg,#9aa1bd,#9aa1bd 6px,#8890ad 6px,#8890ad 12px); }

/* ==========================================================================
   План этажа / диспетчерский пульт
   ========================================================================== */

.floorplan {
  position: relative;
  background: rgba(255,255,255,.42);
  border-radius: var(--r-md);
  padding: 16px;
  min-height: 300px;
}
.fp-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.fp-room {
  border-radius: 12px; padding: 10px;
  background: rgba(255,255,255,.72);
  border: 1.5px solid transparent;
  cursor: pointer; transition: transform .16s, box-shadow .16s;
  position: relative; min-height: 74px;
  display: flex; flex-direction: column; gap: 3px;
}
.fp-room:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(46,55,100,.14); }
.fp-room b { font-size: 13px; font-weight: 600; }
.fp-room .st { font-size: 10.5px; color: var(--ink-3); }
.fp-room.s-occupied { border-color: var(--accent); background: rgba(75,107,255,.12); }
.fp-room.s-clean { border-color: rgba(23,178,106,.5); }
.fp-room.s-dirty { border-color: rgba(232,163,61,.6); background: rgba(232,163,61,.1); }
.fp-room.s-alarm { border-color: var(--danger); background: rgba(229,72,77,.14); animation: pulse-alarm 1.6s infinite; }
.fp-room.s-ooo { background: rgba(150,155,176,.2); border-color: rgba(150,155,176,.5); }
.fp-room .chips { display: flex; gap: 3px; margin-top: auto; flex-wrap: wrap; }
.fp-room .chip {
  width: 18px; height: 18px; border-radius: 5px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.9); color: var(--ink-3);
}
.fp-room .chip svg { width: 10px; height: 10px; }
.fp-room .chip.alert { background: var(--danger); color: #fff; }
.fp-room .chip.warn { background: var(--warn); color: #fff; }

@keyframes pulse-alarm {
  0%,100% { box-shadow: 0 0 0 0 rgba(229,72,77,.4); }
  50% { box-shadow: 0 0 0 7px rgba(229,72,77,0); }
}

/* Камеры */
.cams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cam {
  border-radius: var(--r-md); overflow: hidden;
  background: linear-gradient(160deg,#252a3d,#3c4256);
  aspect-ratio: 16/10; position: relative; cursor: pointer;
  transition: transform .16s, box-shadow .16s;
}
.cam:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(30,38,80,.3); }
.cam .noise {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.028) 0 1px, transparent 1px 3px);
  opacity: .8;
}
.cam .scan {
  position: absolute; left: 0; right: 0; height: 32%;
  background: linear-gradient(180deg, rgba(255,255,255,.06), transparent);
  animation: scan 5.5s linear infinite;
}
@keyframes scan { 0% { top: -32%; } 100% { top: 100%; } }
.cam .cam-lbl {
  position: absolute; left: 10px; top: 9px;
  font-size: 10.5px; color: rgba(255,255,255,.92); font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.cam .cam-time {
  position: absolute; right: 10px; top: 9px;
  font-size: 10px; color: rgba(255,255,255,.72); font-variant-numeric: tabular-nums;
}
.cam .rec {
  position: absolute; left: 10px; bottom: 9px;
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; color: rgba(255,255,255,.85);
}
.cam .rec i { width: 6px; height: 6px; border-radius: 50%; background: #ff4d4f; animation: blink 1.6s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.25} }
.cam .box {
  position: absolute; border: 1.5px solid #5cf58f; border-radius: 3px;
  box-shadow: 0 0 12px rgba(92,245,143,.35);
}
.cam .box::after {
  content: attr(data-lbl); position: absolute; top: -16px; left: -1px;
  background: #5cf58f; color: #06301a; font-size: 9px; font-weight: 600;
  padding: 1px 5px; border-radius: 3px; white-space: nowrap;
}
.cam.offline { background: #1b1e2b; }
.cam.offline .off-msg {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(255,255,255,.4); font-size: 12px;
}

/* Инцидент */
.incident {
  border-radius: var(--r-md);
  background: rgba(255,255,255,.7);
  padding: 14px 16px;
  border-left: 3px solid var(--ink-4);
  display: flex; flex-direction: column; gap: 8px;
}
.incident.i-danger { border-left-color: var(--danger); background: rgba(229,72,77,.09); }
.incident.i-warn { border-left-color: var(--warn); background: rgba(232,163,61,.1); }
.incident.i-ok { border-left-color: var(--ok); }

/* ==========================================================================
   Условная выдача доступа
   ========================================================================== */

.gate { display: flex; flex-direction: column; gap: 8px; }
.gate-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 13px;
  background: rgba(255,255,255,.62);
  transition: background .2s;
}
.gate-item .g-ico {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  background: rgba(150,155,176,.22); color: var(--ink-3);
}
.gate-item .g-ico svg { width: 13px; height: 13px; }
.gate-item.done .g-ico { background: var(--ok); color: #fff; }
.gate-item.fail .g-ico { background: var(--danger); color: #fff; }
.gate-item .g-name { font-size: 13px; font-weight: 500; }
.gate-item .g-src { font-size: 11px; color: var(--ink-3); }
.gate-verdict {
  border-radius: 14px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
}
.gate-verdict.ok { background: var(--ok-soft); color: #0d7f4a; }
.gate-verdict.no { background: var(--danger-soft); color: #b3272c; }

/* ==========================================================================
   Чат
   ========================================================================== */

.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 2px 12px; }
.msg { max-width: 78%; display: flex; flex-direction: column; gap: 4px; }
.msg .bubble {
  padding: 10px 14px; border-radius: 16px; font-size: 13px; line-height: 1.45;
  background: rgba(255,255,255,.85);
}
.msg .meta { font-size: 10.5px; color: var(--ink-4); }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.me .bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 5px; }
.msg.them .bubble { border-bottom-left-radius: 5px; }
.msg.ai .bubble { background: linear-gradient(135deg, rgba(111,92,255,.16), rgba(63,140,255,.16)); border: 1px solid rgba(111,92,255,.2); }
.msg.sys { align-self: center; max-width: 100%; }
.msg.sys .bubble { background: rgba(120,130,170,.14); color: var(--ink-3); font-size: 11.5px; padding: 6px 12px; }
.chat-input { display: flex; gap: 9px; align-items: center; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.6); }

.typing { display: inline-flex; gap: 3px; align-items: center; padding: 2px 0; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-4); animation: typing 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ==========================================================================
   Модальные окна / дровер / тосты
   ========================================================================== */

.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(28, 34, 66, 0.42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: grid; place-items: center;
  padding: 30px;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }

.modal {
  background: linear-gradient(160deg, #f2f4fc 0%, #ffffff 60%);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop);
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: pop .22s cubic-bezier(.2,.9,.3,1.1);
}
.modal.wide { width: min(1020px, 100%); }
.modal.narrow { width: min(460px, 100%); }
@keyframes pop { from { transform: translateY(14px) scale(.985); opacity: 0; } }

.modal-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid rgba(120,130,170,.12);
}
.modal-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -.3px; }
.modal-head .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 16px 24px; display: flex; gap: 10px; align-items: center;
  border-top: 1px solid rgba(120,130,170,.12);
  background: rgba(255,255,255,.5);
}
.modal .card { background: rgba(255,255,255,.7); }

.drawer-wrap { position: fixed; inset: 0; z-index: 200; }
.drawer-bg { position: absolute; inset: 0; background: rgba(28,34,66,.4); backdrop-filter: blur(4px); animation: fade .18s; }
.drawer {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: min(560px, 96vw);
  background: linear-gradient(170deg,#f2f4fc,#fff 55%);
  box-shadow: -20px 0 60px rgba(30,38,80,.2);
  display: flex; flex-direction: column;
  animation: slide-in .24s cubic-bezier(.2,.9,.3,1);
}
@keyframes slide-in { from { transform: translateX(30px); opacity: .4; } }

.toasts { position: fixed; right: 26px; bottom: 24px; z-index: 400; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  background: var(--ink); color: #fff;
  border-radius: 14px; padding: 12px 16px;
  font-size: 13px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 14px 40px rgba(20,22,31,.3);
  animation: toast-in .25s cubic-bezier(.2,.9,.3,1.1);
  max-width: 380px;
}
.toast.t-ok { background: #10633f; }
.toast.t-danger { background: #a3252a; }
.toast.t-warn { background: #8a5c14; }
.toast svg { width: 16px; height: 16px; flex: none; }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } }
.toast.out { animation: toast-out .25s forwards; }
@keyframes toast-out { to { transform: translateX(20px); opacity: 0; } }

/* ==========================================================================
   Полноэкранные режимы (гость / персонал)
   ========================================================================== */

.fullmode {
  position: fixed; inset: 0; z-index: 300;
  background: radial-gradient(90% 70% at 20% 0%, #cfd8f6 0%, #e9ecf7 60%);
  overflow-y: auto;
  animation: fade .2s;
}
.fm-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.7);
}
.fm-bar .tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 600;
}

/* Телефонный макет */
.phone-stage { display: grid; place-items: center; padding: 30px 20px 50px; }
.phone {
  width: 372px; height: 760px;
  background: #f5f7fd;
  border-radius: 42px;
  border: 10px solid #14161f;
  box-shadow: 0 40px 90px rgba(20,26,60,.34);
  overflow: hidden; position: relative;
  display: flex; flex-direction: column;
}
.phone-notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 128px; height: 26px; background: #14161f;
  border-radius: 0 0 16px 16px; z-index: 10;
}
.phone-status {
  padding: 12px 22px 6px; display: flex; align-items: center;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
}
.phone-body { flex: 1; overflow-y: auto; padding: 8px 18px 18px; display: flex; flex-direction: column; gap: 13px; }
.phone-body::-webkit-scrollbar { width: 0; }
.phone-tabbar {
  display: flex; padding: 10px 14px 16px; gap: 4px;
  background: rgba(255,255,255,.85);
  border-top: 1px solid rgba(120,130,170,.14);
}
.phone-tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; font-size: 9.5px; color: var(--ink-4); border-radius: 10px;
}
.phone-tabbar button svg { width: 18px; height: 18px; }
.phone-tabbar button.is-active { color: var(--accent); }

/* Мастер чек-ина */
.wizard { max-width: 620px; margin: 0 auto; padding: 26px 20px 60px; }
.wiz-steps { display: flex; align-items: center; gap: 6px; margin-bottom: 26px; }
.wiz-steps .st { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.wiz-steps .st .ln { height: 4px; border-radius: 999px; background: rgba(255,255,255,.75); }
.wiz-steps .st.done .ln, .wiz-steps .st.cur .ln { background: var(--accent-grad); }
.wiz-steps .st .nm { font-size: 10.5px; color: var(--ink-4); }
.wiz-steps .st.cur .nm { color: var(--ink); font-weight: 600; }

.scan-frame {
  border-radius: var(--r-md);
  background: linear-gradient(150deg,#2a2f45,#454b66);
  aspect-ratio: 1.58;
  position: relative; overflow: hidden;
  display: grid; place-items: center;
}
.scan-frame .corner { position: absolute; width: 26px; height: 26px; border: 2.5px solid #5cf58f; }
.scan-frame .c1 { top: 14px; left: 14px; border-right: none; border-bottom: none; border-radius: 7px 0 0 0; }
.scan-frame .c2 { top: 14px; right: 14px; border-left: none; border-bottom: none; border-radius: 0 7px 0 0; }
.scan-frame .c3 { bottom: 14px; left: 14px; border-right: none; border-top: none; border-radius: 0 0 0 7px; }
.scan-frame .c4 { bottom: 14px; right: 14px; border-left: none; border-top: none; border-radius: 0 0 7px 0; }
.scan-frame .beam {
  position: absolute; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, #5cf58f, transparent);
  box-shadow: 0 0 18px #5cf58f;
  animation: beam 2s ease-in-out infinite;
}
@keyframes beam { 0%,100% { top: 12%; } 50% { top: 86%; } }

.selfie-frame {
  width: 190px; height: 190px; border-radius: 50%;
  background: linear-gradient(150deg,#2a2f45,#454b66);
  margin: 0 auto; position: relative;
  display: grid; place-items: center;
  border: 3px solid rgba(255,255,255,.5);
  overflow: hidden;
}
.selfie-frame.verifying { border-color: #5cf58f; animation: pulse-ok 1.4s infinite; }
@keyframes pulse-ok { 0%,100% { box-shadow: 0 0 0 0 rgba(92,245,143,.4); } 50% { box-shadow: 0 0 0 12px rgba(92,245,143,0); } }

.keycode {
  font-size: 42px; font-weight: 700; letter-spacing: 10px;
  font-variant-numeric: tabular-nums;
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* Чек-лист */
.checklist { display: flex; flex-direction: column; gap: 7px; }
.ck {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: 12px;
  background: rgba(255,255,255,.68); cursor: pointer;
  transition: background .16s;
}
.ck:hover { background: #fff; }
.ck .box {
  width: 21px; height: 21px; border-radius: 7px; flex: none;
  border: 1.8px solid rgba(120,130,170,.42);
  display: grid; place-items: center; transition: all .16s;
}
.ck .box svg { width: 12px; height: 12px; color: #fff; opacity: 0; }
.ck.on .box { background: var(--ok); border-color: var(--ok); }
.ck.on .box svg { opacity: 1; }
.ck.on .txt { color: var(--ink-3); text-decoration: line-through; }
.ck .txt { font-size: 13px; }

/* Таймлайн */
.timeline { position: relative; padding-left: 22px; display: flex; flex-direction: column; gap: 16px; }
.timeline::before {
  content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px;
  width: 1.5px; background: rgba(120,130,170,.25);
}
.tl-item { position: relative; }
.tl-item::before {
  content: ''; position: absolute; left: -22px; top: 4px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--ink-4);
}
.tl-item.ok::before { border-color: var(--ok); }
.tl-item.now::before { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(75,107,255,.16); }
.tl-item.err::before { border-color: var(--danger); }
.tl-item .tl-t { font-size: 13px; font-weight: 500; }
.tl-item .tl-m { font-size: 11.5px; color: var(--ink-3); }

/* Пустое состояние */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty svg { width: 34px; height: 34px; opacity: .4; margin-bottom: 10px; }

/* Аватары-стек */
.avatars { display: flex; }
.avatars .av {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid #fff; margin-left: -8px;
  display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff;
}
.avatars .av:first-child { margin-left: 0; }

/* Точечная карта / heat */
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 4px; background: rgba(255,255,255,.5); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }

/* Утилиты */
.hide { display: none !important; }
.fade-in { animation: fade .3s ease; }
.mt-a { margin-top: auto; }
.divider { height: 1px; background: rgba(255,255,255,.6); margin: 4px 0; }
.scroll-y { overflow-y: auto; }

/* Адаптив */
@media (max-width: 1400px) { :root { --rail-w: 310px; } }
@media (max-width: 1200px) {
  .content { grid-template-columns: 1fr; }
  .rail { display: none; }
  .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 860px) {
  .app { padding: 0; }
  .shell { border-radius: 0; grid-template-columns: 56px 1fr; }
  :root { --sidebar-w: 56px; }
  .sb-btn { width: 38px; height: 38px; }
  .sb-btn svg { width: 18px; height: 18px; }
  .sb-mark { transform: scale(.82); margin-bottom: 12px; }
  .sb-avatar { width: 34px; height: 34px; font-size: 12px; }

  .g-2, .g-3, .g-4, .g-21, .g-12 { grid-template-columns: 1fr; }
  .grid[style*="repeat(5"] { grid-template-columns: repeat(2, 1fr) !important; }

  .topbar { padding: 16px 14px 10px 2px; gap: 9px; }
  .brand { min-width: 0; flex: 1; }
  .brand h1 { font-size: 17px; }
  .brand p { display: none; }
  .pill-info { display: none; }
  .topbar .btn { padding: 9px 14px; font-size: 12.5px; }

  .main-col { padding: 4px 12px 20px 2px; }
  .card { padding: 16px 15px; }
  .hero { padding: 16px 15px 18px; }
  .hero-top { flex-direction: column; gap: 10px; }
  .hero-value { font-size: 28px; }
  .hero-top .seg { align-self: flex-start; }
  .hero .row { flex-direction: column; gap: 12px !important; align-items: stretch !important; }
  .hero-actions { min-width: 0; }
  .venn { height: 118px; }
  .venn-c { width: 94px; height: 94px; }
  .venn-c.mid { width: 104px; height: 104px; }
  .venn-c b { font-size: 16px; }
  .venn-c.mid b { font-size: 18px; }
  .venn-c span { font-size: 10px; }

  .fp-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .cams { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; gap: 16px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .search { min-width: 150px; }

  .phone { width: min(340px, 92vw); height: 690px; border-width: 8px; }
  .wizard { padding: 18px 14px 50px; }
  .modal, .modal.wide, .modal.narrow { width: 100%; max-height: 92vh; }
  .overlay { padding: 12px; }
  .toasts { right: 12px; left: 12px; bottom: 14px; }
  .toast { max-width: none; }
}

@media (max-width: 520px) {
  .kpi .k-value { font-size: 22px; }
  .venn-c { width: 82px; height: 82px; }
  .venn-c.mid { width: 92px; height: 92px; }
  /* На узком экране круги не перекрываем — иначе подписи уходят под соседний круг */
  .venn { gap: 6px; }
  .venn-c:first-child { margin-right: 0; }
  .venn-c:last-child { margin-left: 0; }
  .fp-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
