/* Дизайн-токены Kimi Design «BK Оборудование» → CSS-переменные */
:root {
  --bg: #F5EBDC;
  --surface: #FFFFFF;
  --ink: #502314;
  --ink2: #8A7365;
  --line: #EAE0D0;
  --red: #D62300;
  --redsoft: #FBE9E4;
  --orange: #FF8732;
  --orangesoft: #FFEDE0;
  --orange-ink: #C2571B;
  --green: #1F7A43;
  --greensoft: #E3F1E8;
  --creamdeep: #F0E7D8;
  --radius-card: 14px;
  --radius-ctl: 10px;
  --shadow-modal: 0 12px 40px rgba(80, 35, 20, .15);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }

/* ---------- каркас ---------- */
.layout {
  display: grid;
  grid-template-columns: 232px 1fr;
  grid-template-rows: 64px 1fr;
  grid-template-areas: "sidebar header" "sidebar main";
  min-height: 100vh;
}
.sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.header {
  grid-area: header;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.main {
  grid-area: main;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* ---------- сайдбар ---------- */
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--orange); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}
.logo-title { font-size: 13px; font-weight: 700; }
.logo-sub { font-size: 10px; font-weight: 600; letter-spacing: .6px; color: var(--ink2); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 12px; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: var(--ink2);
}
.nav-item svg { width: 16px; height: 16px; }
.nav-item:hover { background: var(--creamdeep); }
.nav-item.active { background: var(--bg); color: var(--ink); }
.nav-item.active svg { color: var(--red); }
.nav-badge {
  margin-left: auto; height: 20px; padding: 0 7px;
  background: var(--creamdeep); border-radius: 10px;
  font-size: 10px; font-weight: 700; color: var(--ink2);
  display: flex; align-items: center;
}
.sidebar-spacer { flex: 1; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; background: var(--bg); border-radius: 12px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 16px;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.user-name { font-size: 12px; font-weight: 700; }
.user-role { font-size: 10px; color: var(--ink2); }

/* ---------- шапка ---------- */
.header-title { font-size: 17px; font-weight: 700; white-space: nowrap; }
.header-title .crumb { color: var(--ink2); font-weight: 500; }
.header-search {
  margin-left: auto;
  width: 340px; height: 38px;
  background: var(--bg); border-radius: 10px;
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
}
.header-search svg { width: 14px; height: 14px; color: var(--ink2); flex: none; }
.header-search input {
  border: 0; background: transparent; outline: none;
  width: 100%; font-size: 13px; color: var(--ink);
}
.header-search input::placeholder { color: var(--ink2); }
.header-updated { font-size: 12px; color: var(--ink2); white-space: nowrap; }
.live-dot { color: var(--green); font-weight: 600; }

/* ---------- карточки и сетки ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-card);
}
.kpi-row { display: flex; gap: 16px; }
.kpi {
  flex: 1; background: var(--surface); border-radius: var(--radius-card);
  padding: 16px 20px; display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.kpi-label {
  font-size: 10px; font-weight: 700; letter-spacing: .8px;
  color: var(--ink2); text-transform: uppercase;
}
.kpi-value { display: flex; align-items: baseline; gap: 8px; }
.kpi-num { font-size: 26px; font-weight: 700; }
.kpi-num.red { color: var(--red); }
.kpi-num.green { color: var(--green); }
.kpi-delta { font-size: 12px; font-weight: 600; color: var(--red); }
.kpi-sub { font-size: 11px; color: var(--ink2); }
.content-row { display: flex; gap: 24px; align-items: stretch; }
.content-row > .grow { flex: 1; min-width: 0; }
.side-panel {
  width: 376px; flex: none;
  background: var(--surface); border-radius: var(--radius-card);
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
  align-self: flex-start;
}
.side-title { font-size: 14px; font-weight: 700; }
.divider { height: 1px; background: var(--line); border: 0; }

/* ---------- таблицы (flex-строки, как в дизайне) ---------- */
.table-card { display: flex; flex-direction: column; overflow: hidden; }
.table-head { padding: 18px 20px 14px; display: flex; flex-direction: column; gap: 14px; }
.table-head-row { display: flex; align-items: center; gap: 10px; }
.table-title { font-size: 15px; font-weight: 700; }
.count-chip {
  height: 20px; padding: 0 7px; border-radius: 10px;
  background: var(--redsoft); color: var(--red);
  font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center;
}
.count-chip.gray { background: var(--creamdeep); color: var(--ink2); }
.table-head-spacer { flex: 1; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-search {
  width: 220px; height: 34px;
  background: var(--bg); border-radius: 8px;
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
}
.filter-search svg { width: 12px; height: 12px; color: var(--ink2); flex: none; }
.filter-search input {
  border: 0; background: transparent; outline: none;
  width: 100%; font-size: 12px; color: var(--ink);
}
.filter-select {
  height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
select.filter-select { appearance: none; padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238A7365' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  cursor: pointer;
}
.trow {
  display: flex; align-items: center;
  min-height: 52px; padding: 6px 20px;
  border-bottom: 1px solid var(--line);
  gap: 0;
}
.trow:last-child { border-bottom: 0; }
a.trow:hover { background: #FBF6EC; }
.trow.head {
  min-height: 36px; padding: 0 20px;
  font-size: 10px; font-weight: 700; letter-spacing: .6px;
  color: var(--ink2); text-transform: uppercase;
  background: var(--surface);
}
.tcell { padding-right: 12px; min-width: 0; }
.tcell .name { font-size: 13px; font-weight: 600; }
.tcell .sub { font-size: 11px; color: var(--ink2); }
.tcell.num { font-size: 13px; font-weight: 700; }
.tcell.num.red { color: var(--red); }
.tcell.txt { font-size: 12px; color: var(--ink2); }
.tcell.txt.ink { color: var(--ink); }
.table-footer {
  display: flex; align-items: center;
  padding: 12px 20px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--ink2);
}

/* ---------- чипы статусов (status-chip из дизайна) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 3px; }
.chip--red { background: var(--redsoft); color: var(--red); }
.chip--red::before { background: var(--red); }
.chip--orange { background: var(--orangesoft); color: var(--orange-ink); }
.chip--orange::before { background: var(--orange-ink); }
.chip--green { background: var(--greensoft); color: var(--green); }
.chip--green::before { background: var(--green); }
.chip--gray { background: var(--creamdeep); color: var(--ink2); }
.chip--gray::before { background: var(--ink2); }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.btn svg { width: 12px; height: 12px; }
.btn:hover { background: var(--creamdeep); }
.btn-lg { height: 40px; padding: 0 16px; font-size: 13px; border-radius: 10px; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.btn-primary:hover { background: #B81E00; }
.btn-back { border: 0; background: transparent; color: var(--ink2); padding: 0; height: auto; }
.btn-back:hover { color: var(--ink); background: transparent; }

/* ---------- пагинация ---------- */
.pagination { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.page-btn {
  min-width: 26px; height: 26px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--ink2);
}
.page-btn:hover { background: var(--creamdeep); }
.page-btn.active { background: var(--ink); color: #fff; font-weight: 700; }
.page-btn svg { width: 12px; height: 12px; }

/* ---------- бары «топ оборудования» ---------- */
.bar-row { display: flex; flex-direction: column; gap: 6px; }
.bar-line { display: flex; align-items: center; }
.bar-name { flex: 1; font-size: 13px; font-weight: 500; }
.bar-name.top { font-weight: 600; }
.bar-val { font-size: 13px; font-weight: 700; }
.bar-val.top { color: var(--red); }
.bar-track { height: 6px; background: var(--creamdeep); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 6px; border-radius: 3px; background: var(--orange); }
.bar-fill.top { background: var(--red); }
.kv-row { display: flex; align-items: center; font-size: 13px; }
.kv-row .k { flex: 1; }
.kv-row .v { font-size: 12px; font-weight: 700; color: var(--ink2); }

/* ---------- табы ---------- */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); align-items: flex-end; }
.tab { padding-bottom: 0; font-size: 13px; font-weight: 600; color: var(--ink2); }
.tab.active { color: var(--ink); font-weight: 700; }
.tab .tab-inner { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.tab .tab-bar { height: 2px; width: 100%; background: transparent; }
.tab.active .tab-bar { background: var(--red); }
.tab:not(.active) { padding-bottom: 10px; }

/* ---------- карточка ресторана/оборудования ---------- */
.entity-card { display: flex; gap: 24px; padding: 20px; align-items: center; }
.entity-info { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.entity-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.entity-name { font-size: 20px; font-weight: 700; }
.id-chip {
  height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--creamdeep); color: var(--ink2);
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center;
}
.entity-sub { font-size: 12px; color: var(--ink2); }
.entity-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.entity-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- секции оборудования на странице ресторана ---------- */
.section-card { overflow: hidden; }
.section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
}
.section-title { font-size: 14px; font-weight: 700; }
.section-count { font-size: 12px; font-weight: 600; color: var(--ink2); }
.dish-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; border-top: 1px solid var(--line);
}
.dish-name { font-size: 13px; font-weight: 600; }
.dish-sub { font-size: 11px; color: var(--ink2); }
.product-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.product-tag {
  background: var(--bg); border-radius: 6px; padding: 3px 8px;
  font-size: 11px; color: var(--ink);
}
.ticket-line { font-size: 12px; color: var(--ink2); }
.ticket-line a { color: var(--ink); font-weight: 600; }
.ticket-line a:hover { text-decoration: underline; }
.ticket-flag { font-weight: 700; }
.ticket-flag.red { color: var(--red); }
.ticket-flag.green { color: var(--green); }
.ticket-flag.orange { color: var(--orange-ink); }

/* ---------- регионы-чипы ---------- */
.region-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rchip {
  height: 32px; padding: 0 14px; border-radius: 8px;
  display: inline-flex; align-items: center;
  background: var(--surface); color: var(--ink);
  font-size: 12px; font-weight: 500;
}
.rchip:hover { background: var(--creamdeep); }
.rchip.active { background: var(--ink); color: #fff; font-weight: 600; }

/* ---------- события ---------- */
.event-action { font-weight: 700; }
.event-action.on { color: var(--red); }
.event-action.off { color: var(--green); }

/* ---------- настройки ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-card { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.settings-card h3 { margin: 0 0 4px; font-size: 14px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.kv { display: flex; gap: 10px; font-size: 13px; }
.kv .k { width: 220px; flex: none; color: var(--ink2); }
.kv .v { min-width: 0; word-break: break-all; }

/* ---------- пустые состояния / предупреждения ---------- */
.empty {
  padding: 40px 20px; text-align: center; color: var(--ink2); font-size: 13px;
}
.notice {
  background: var(--orangesoft); color: var(--orange-ink);
  border-radius: 10px; padding: 12px 16px; font-size: 13px; font-weight: 600;
}

@media (max-width: 1200px) {
  .content-row { flex-direction: column; }
  .side-panel { width: 100%; }
  .settings-grid { grid-template-columns: 1fr; }
}
