:root {
  --bg: #0e101c;
  --bg-elevated: #121528;
  --surface: #161b2d;
  --surface-2: #1a2035;
  --surface-hover: #222840;
  --text: #ffffff;
  --text-secondary: #cbd5e1;
  --muted: #6b7280;
  --line: rgba(255, 255, 255, 0.05);
  --line-strong: rgba(255, 255, 255, 0.09);
  --accent: #0088ff;
  --accent-soft: rgba(0, 136, 255, 0.15);
  --green: #2ecc71;
  --green-soft: rgba(46, 204, 113, 0.15);
  --red: #e74c3c;
  --red-soft: rgba(231, 76, 60, 0.15);
  --amber: #f39c12;
  --amber-soft: rgba(243, 156, 18, 0.15);
  --purple: #8e44ad;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 260px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #4da3ff; }

code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* Layout */
.app { display: flex; min-height: 100vh; }

.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.main {
  flex: 1;
  padding: 1.25rem 1.5rem 2rem;
  max-width: 1400px;
  width: 100%;
}

.main-dashboard {
  max-width: none;
  padding: 1.35rem 1.75rem 2rem;
}

.main-odamlar {
  max-width: none;
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.main-toyxonalar {
  max-width: none;
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar);
  background: var(--bg-elevated);
  border-right: 1px solid var(--line);
  padding: 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  padding: 0 0.5rem 1.25rem;
  margin-bottom: 0.25rem;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0088ff, #00c6ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 136, 255, 0.35);
}

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }

.nav-group { border: none; }

.nav-group-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.nav-group-title::-webkit-details-marker { display: none; }

.nav-group-title::after {
  content: "›";
  margin-left: auto;
  font-size: 14px;
  color: var(--muted);
  transition: transform 0.2s;
}

.nav-group[open] .nav-group-title::after { transform: rotate(90deg); }

.nav-group-title:hover { background: var(--surface); }

.nav-ico {
  display: flex;
  align-items: center;
  color: var(--muted);
}

.nav-sub {
  display: block;
  padding: 0.45rem 0.65rem 0.45rem 2.35rem;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin: 2px 0;
  transition: background 0.12s, color 0.12s;
}

.nav-sub:hover { color: var(--text-secondary); background: rgba(255, 255, 255, 0.03); }

.nav-sub.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0, 136, 255, 0.35);
}

.sidebar-nav-flat {
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}

.nav-item .nav-ico {
  display: flex;
  align-items: center;
  color: inherit;
  opacity: 0.7;
}

.nav-item:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(0, 136, 255, 0.35);
}

.nav-item.active .nav-ico { opacity: 1; }

.sidebar-foot {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.85rem 0.5rem 0;
  border-top: 1px solid var(--line);
  margin-top: 0.5rem;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0); }
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 13px;
}

.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text-secondary); }
.bc-sep { color: var(--muted); font-size: 12px; }
.bc-current { color: var(--text-secondary); font-weight: 500; }

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text-secondary);
  border-color: var(--line-strong);
}

/* KPI gradient cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }

.kpi-card {
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.12), transparent 55%);
  pointer-events: none;
}

.kpi-blue { background: linear-gradient(135deg, #0066cc 0%, #0088ff 50%, #00b4ff 100%); }
.kpi-purple { background: linear-gradient(135deg, #6c3483 0%, #8e44ad 50%, #a569bd 100%); }
.kpi-orange { background: linear-gradient(135deg, #d68910 0%, #f39c12 50%, #f8c471 100%); }
.kpi-red { background: linear-gradient(135deg, #c0392b 0%, #e74c3c 50%, #ec7063 100%); }

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.85);
}

.kpi-info {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  cursor: help;
  line-height: 1;
}

.kpi-value {
  display: block;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.kpi-ratio {
  display: flex;
  align-items: baseline;
  gap: 0.05em;
}

.kpi-sep {
  font-size: 1.5rem;
  font-weight: 500;
  opacity: 0.7;
}

.kpi-hint { font-size: 11px; color: rgba(255, 255, 255, 0.7); margin-top: 0.35rem; display: block; }

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.panel-head h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.panel-sub { font-size: 12px; color: var(--muted); }
.panel-sub-sm { font-size: 11px; color: var(--muted); margin-top: 0.15rem; }

.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.page-desc { font-size: 13px; color: var(--muted); margin-top: 0.25rem; }

/* Chart panels */
.panel-chart-main { padding: 1.25rem 1.35rem 1.35rem; }

.chart-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.chart-toolbar-left h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
}

.chart-toolbar-sm .panel-head { margin-bottom: 0; }
.chart-toolbar-sm h2 { margin-bottom: 0; }

.chart-legend-inline {
  display: flex;
  gap: 1rem;
  font-size: 11px;
  color: var(--muted);
}

.chart-legend-inline span { display: flex; align-items: center; gap: 0.35rem; }

.leg {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.leg-blue { background: #0088ff; }
.leg-red { background: #e74c3c; }

/* EcMAI dashboard layout */
.chart-head-ecmai {
  margin-bottom: 1rem;
}

.chart-title-lg {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
}

.chart-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chart-filters-row .select-dark {
  min-width: 100px;
  padding: 0.35rem 1.75rem 0.35rem 0.65rem;
  font-size: 11px;
  border-radius: 6px;
  background-color: var(--surface-2);
}

.select-sm {
  min-width: 110px !important;
  font-size: 10px !important;
  padding: 0.3rem 1.5rem 0.3rem 0.55rem !important;
}

.chart-box-main { height: 340px; }
.chart-box-area { height: 260px; }
.chart-box-donut { height: 260px; }

.chart-legend-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  font-size: 11px;
  color: var(--muted);
}

.chart-legend-bottom span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-legend-sm { justify-content: flex-start; }

.chart-bottom-ecmai {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1rem;
  margin-bottom: 0;
}

.chart-bottom-ecmai .panel { margin-bottom: 0; }

.chart-toolbar-donut {
  align-items: flex-start !important;
}

.panel-donut .chart-toolbar-sm h2 { font-size: 11px; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--line-strong);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.25rem;
  overflow: hidden;
}

.chart-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.select-dark {
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  background: var(--surface-2) 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='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.55rem center;
  color: var(--text-secondary);
  appearance: none;
  cursor: pointer;
  min-width: 120px;
}

.select-dark:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.chart-box {
  position: relative;
  height: 280px;
  width: 100%;
}

.chart-box canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.chart-box-xl { height: 320px; }
.chart-box-md { height: 240px; }
.chart-box-sm { height: 180px; }
.chart-box-lg { height: 260px; }

.chart-donut-wrap { display: flex; align-items: center; justify-content: center; }

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

.chart-empty[hidden] {
  display: none !important;
}

.chart-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.chart-badge-green { background: var(--green-soft); color: var(--green); }
.chart-badge-purple { background: rgba(139, 92, 246, 0.15); color: var(--purple); }

.line-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.chart-bottom-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 1100px) {
  .chart-bottom-ecmai { grid-template-columns: 1fr; }
  .chart-bottom-grid { grid-template-columns: 1fr; }
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.chart-grid-2 { grid-template-columns: 2fr 1fr; }
.panel-wide { grid-column: 1 / -1; }
.panel-chart { margin-bottom: 0; }

/* Filters */
.odamlar-filter { margin-bottom: 1.25rem; padding: 1rem 1.15rem; }
.filter-bar { margin-bottom: 1.25rem; padding: 0.85rem 1rem; }

.filter-bar-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.filter-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  flex: 1;
  min-width: 0;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 130px;
}

.filter-field span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.filter-field select,
.filter-field input[type="date"] {
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text-secondary);
  height: 34px;
}

.filter-field-date { min-width: 150px; }

.filter-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1rem;
}

.filter-row label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 140px;
}

.filter-row select {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text-secondary);
  min-width: 160px;
}

.filter-live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.table-scroll { max-height: 360px; overflow-y: auto; }

.tbl-modern {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
}

.tbl-modern th,
.tbl-modern td {
  text-align: left;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
}

.tbl-modern th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 1;
}

.tbl-modern tbody tr:last-child td { border-bottom: none; }
.tbl-modern tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.tbl-compact th, .tbl-compact td { padding: 0.45rem 0.75rem; font-size: 12px; }

.tbl-title { display: block; font-weight: 600; color: var(--text); }
.tbl-meta { display: block; font-size: 11px; color: var(--muted); margin-top: 0.1rem; }

.num { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.num-lg { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Pills */
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.pill-on { background: var(--green-soft); color: var(--green); }
.pill-off { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.pill-warn { background: var(--amber-soft); color: var(--amber); }
.pill-alert { background: var(--red-soft); color: var(--red); }
.pill-sm { font-size: 10px; padding: 0.15rem 0.45rem; }

/* Cards — toyxonalar */
.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.toolbar-text { color: var(--muted); font-size: 13px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.cards-kamera {
  align-content: start;
}

.toyxonalar-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.toyxonalar-page .page-toolbar {
  flex-shrink: 0;
  margin-bottom: 0.85rem;
}

.toyxonalar-grid-scroll {
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 180px);
  padding: 0 0.15rem 0.15rem 0;
}

.main-toyxonalar .cards-kamera {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

@media (min-width: 1400px) {
  .main-toyxonalar .cards-kamera {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.15rem;
  }

  .main-toyxonalar .kadr,
  .main-toyxonalar .kadr-empty,
  .main-toyxonalar .kadr-placeholder {
    height: 190px;
  }
}

@media (min-width: 1800px) {
  .main-toyxonalar .cards-kamera {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.25rem;
  }

  .main-toyxonalar .kadr,
  .main-toyxonalar .kadr-empty,
  .main-toyxonalar .kadr-placeholder {
    height: 220px;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.card-venue { display: flex; flex-direction: column; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.card h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.meta { font-size: 12px; color: var(--muted); margin-top: 0.15rem; }

.venue-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.65rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.venue-stat { text-align: center; }
.venue-stat-val { display: block; font-size: 1.1rem; font-weight: 700; color: var(--text); }
.venue-stat-toy.is-active { color: var(--red); }
.venue-stat-agent {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 1.35rem;
}
.agent-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.agent-dot.is-on {
  background: var(--green);
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.55);
}
.agent-dot.is-off {
  background: var(--red);
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.45);
}
.venue-stat-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.kadr-wrap { margin: 0.25rem 0 0.65rem; }

.kadr-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  position: relative;
  cursor: zoom-in;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.kadr-btn:hover .kadr-zoom { opacity: 1; }

.kadr, .kadr-preview {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #0a0d12;
  display: block;
  border: 1px solid var(--line);
}

.kadr-clickable { transition: transform 0.15s ease; }
.kadr-btn:hover .kadr-clickable { transform: scale(1.02); }

.kadr-zoom {
  position: absolute;
  left: 50%;
  bottom: 0.55rem;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.kadr-eski { opacity: 0.75; filter: grayscale(0.3); }

.kadr-empty, .kadr-placeholder {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line-strong);
}

.info-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.75rem;
  font-size: 12px;
}

.info-dl dt { color: var(--muted); font-weight: 500; }
.info-dl dd { margin: 0; word-break: break-word; color: var(--text-secondary); }

/* Lightbox */
body.modal-open,
body.lightbox-open { overflow: hidden; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  max-height: min(92vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-panel-wide {
  width: min(100%, 520px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.modal-head h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text-secondary);
}

.modal-body {
  padding: 1rem 1.15rem 1.15rem;
  overflow-y: auto;
}

.modal-body .form { margin-top: 0; }

.modal-body .toyxona-pick-grid {
  max-height: 180px;
  overflow-y: auto;
}

.modal-ok {
  color: var(--green);
  font-size: 14px;
  margin: 0 0 0.85rem;
}

.token-value {
  font-size: 13px;
  color: var(--text-secondary);
  word-break: break-all;
  margin: 0.35rem 0 0.75rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lightbox[hidden] { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 1100px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.lightbox-img {
  max-width: 100%;
  max-height: calc(92vh - 3rem);
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  background: #0a0d12;
}

.lightbox-caption {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.lightbox-close {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }

.toolbar-hint {
  margin: 0.15rem 0 0;
  font-size: 12px;
  color: var(--muted);
}

.kadr-tarix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.kadr-tarix-slot {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.kadr-tarix-slot--bor {
  padding: 0;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.kadr-tarix-slot--bor:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.kadr-tarix-slot--bor img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.kadr-tarix-slot--bo-sh {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  opacity: 0.55;
}

.kadr-tarix-soat {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.35rem 0.5rem;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}

.kadr-tarix-slot--bo-sh .kadr-tarix-soat {
  position: static;
  background: none;
  color: var(--muted);
}

.kadr-tarix-empty {
  font-size: 18px;
  color: var(--muted);
}

/* Timeline */
.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Odamlar sahifasi */
.odamlar-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.filter-field-chips { min-width: 220px; }

.davr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 34px;
  align-items: center;
}

.chip-btn {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.chip-btn.active {
  background: var(--accent-soft);
  border-color: rgba(0, 136, 255, 0.45);
  color: #7ec8ff;
}

.odamlar-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.odamlar-panel-live,
.odamlar-panel-tarix,
.odamlar-panel-hodisa {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}

.odamlar-panel-live .table-wrap,
.odamlar-panel-tarix .scroll-box,
.odamlar-panel-hodisa .scroll-box {
  flex: 1;
  min-height: 0;
}

.odamlar-table-live { max-height: 280px; overflow-y: auto; }
.odamlar-table-scroll,
.odamlar-timeline {
  max-height: 360px;
}

/* Scroll konteyner */
.scroll-box {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
}

.scroll-box .table-wrap {
  border: none;
  border-radius: 0;
  background: transparent;
}

.scroll-box::before,
.scroll-box::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 28px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.scroll-box::before {
  top: 0;
  background: linear-gradient(to bottom, var(--surface-2) 15%, transparent);
}

.scroll-box::after {
  bottom: 0;
  right: 0;
  background: linear-gradient(to top, var(--surface-2) 20%, transparent);
}

.scroll-box.scrollable.scroll-top::before { opacity: 1; }
.scroll-box.scrollable.scroll-bottom::after { opacity: 1; }

.scroll-area {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) rgba(255, 255, 255, 0.04);
}

.scroll-area::-webkit-scrollbar {
  width: 7px;
}

.scroll-area::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  margin: 6px 0;
}

.scroll-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.scroll-area::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
  background-clip: padding-box;
}

.scroll-area::-webkit-scrollbar-thumb:active {
  background: rgba(0, 136, 255, 0.45);
  background-clip: padding-box;
}

.odamlar-table-scroll .tbl-modern thead th {
  top: 0;
  box-shadow: 0 1px 0 var(--line);
}

.odamlar-timeline {
  display: block;
  padding: 0.65rem 0.5rem 0.65rem 0.75rem;
}

.odamlar-timeline #hodisa-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.odamlar-timeline .timeline-item {
  margin: 0;
}

.row-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.45rem;
  vertical-align: middle;
  flex-shrink: 0;
}

.row-dot-on { background: var(--green); box-shadow: 0 0 6px rgba(46, 204, 113, 0.5); }
.row-dot-off { background: var(--muted); opacity: 0.5; }

.tbl-modern td:first-child .row-dot {
  float: left;
  margin-top: 0.4rem;
}

.tbl-modern td:first-child .tbl-title,
.tbl-modern td:first-child .tbl-meta {
  display: block;
  margin-left: 1.1rem;
}

.tbl-modern tr.row-offline { opacity: 0.72; }

.timeline:not(.scroll-area) {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 320px;
  overflow-y: auto;
}

.timeline-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--line-strong);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
}

.timeline-item time {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.timeline-body p { font-size: 12px; margin-top: 0.2rem; color: var(--text-secondary); }

.timeline-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.timeline-toy_bor { border-left-color: var(--red); }
.timeline-monitoring_boshlandi,
.timeline-monitoring_tugadi { border-left-color: var(--accent); }

/* Buttons & forms */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:hover { background: #0069d9; color: #fff; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 12px; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line-strong);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text-secondary);
  border-color: var(--line-strong);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--line-strong);
}

.btn-outline:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: rgba(0, 136, 255, 0.45);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(231, 76, 60, 0.35);
}

.btn-danger:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  margin-top: 0.5rem;
  padding: 0;
}

.btn-link:hover { color: var(--red); }

.card-form { max-width: 420px; }
.card-form-wide { max-width: 480px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.venue-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.venue-actions-end {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.venue-actions form { margin: 0; }

.token-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: -0.35rem;
  margin-bottom: 0.25rem;
}

.token-yarat-form {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.form { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 0.85rem; }

.form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form input {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.empty, .empty-state, .empty-msg {
  color: var(--muted);
  font-size: 13px;
  padding: 1.5rem;
  text-align: center;
}

.empty a { color: var(--accent); }
.empty-state .btn { margin-top: 0.75rem; }

.ok { color: var(--green); font-size: 14px; margin-bottom: 0.5rem; }

.login-error {
  color: var(--red);
  background: var(--red-soft);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.85rem;
  font-size: 13px;
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1.5rem;
}

.login-wrap { width: 100%; max-width: 400px; }

.login-card { padding: 1.75rem 1.5rem; }

.login-brand {
  text-align: center;
  margin-bottom: 1.25rem;
}

.login-brand h1 {
  font-size: 1.35rem;
  margin-top: 0.65rem;
}

.login-brand p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 0.25rem;
}

.login-brand .logo-mark {
  display: inline-flex;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0088ff, #00c6ff);
  align-items: center;
  justify-content: center;
  color: #fff;
}

.login-form .login-btn { width: 100%; margin-top: 0.35rem; }

.form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.form select {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
}

.checkbox-label {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
}

.checkbox-label input { width: auto; }

.toyxona-pick {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.toyxona-pick legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 0.35rem;
}

.toyxona-pick .form-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

.toyxona-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.45rem;
}

.toyxona-pick-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.toyxona-pick-item:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.toyxona-pick-item input {
  width: auto;
  accent-color: var(--accent);
}

.toyxona-pick-item span {
  font-size: 13px;
  color: var(--text-secondary);
}

.toyxona-pick-item:has(input:checked) {
  border-color: rgba(0, 136, 255, 0.45);
  background: var(--accent-soft);
}

.toyxona-pick-item:has(input:checked) span {
  color: var(--text);
}

.topbar-user-menu {
  position: relative;
}

.topbar-avatar-btn {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  line-height: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.topbar-avatar-btn:hover .topbar-avatar,
.topbar-user-menu.open .topbar-avatar {
  box-shadow: 0 0 0 3px var(--accent-soft), 0 2px 12px rgba(0, 136, 255, 0.35);
}

.topbar-avatar-btn:active {
  transform: scale(0.96);
}

.topbar-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: linear-gradient(145deg, var(--accent) 0%, #6366f1 100%);
  box-shadow: 0 2px 10px rgba(0, 136, 255, 0.28);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  transition: box-shadow 0.15s ease;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 148px;
  padding: 0.35rem;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 200;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.topbar-user-menu.open .user-menu-dropdown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.user-menu-dropdown[hidden] {
  display: block;
}

.topbar-user-menu:not(.open) .user-menu-dropdown[hidden] {
  display: none;
}

.user-menu-logout { margin: 0; }

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.user-menu-item svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.user-menu-item:hover {
  background: var(--red-soft);
  color: var(--red);
}

.user-menu-item:hover svg {
  opacity: 1;
}

.tbl td .venue-actions-end {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.block-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.block-hint { font-size: 12px; color: var(--muted); }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

/* Responsive */
@media (max-width: 960px) {
  .kpi-grid, .kpi-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .chart-grid, .chart-grid-2, .split-grid { grid-template-columns: 1fr; }
  .panel-wide { grid-column: auto; }
  .filter-live { margin-left: 0; width: 100%; }
  .filter-bar-top { flex-direction: column; align-items: stretch; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1; }
  .filter-field { min-width: 100%; }
}

@media (max-width: 640px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 1rem;
  }
  .sidebar-nav { flex-direction: column; }
  .sidebar-foot { display: none; }
  .main { padding: 1rem; }
  .topbar { padding: 0.75rem 1rem; }
  .kpi-grid, .kpi-grid-5 { grid-template-columns: 1fr 1fr; }
  .filter-row label { min-width: 100%; }
  .filter-row select { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
}
