/* Админка управляющего — адаптив desktop ↔ tablet ↔ mobile */
body {
  background: #F3F5F0;
  min-height: 100dvh;
  margin: 0;
}

/* === SHELL === */
.admin-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100dvh;
  position: relative;
}

/* Мобильный режим: side превращается в drawer */
@media (max-width: 880px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-topbar { display: flex; }
  .admin-side {
    position: fixed; top: 0; left: 0; bottom: 0; width: 280px; z-index: 200;
    transform: translateX(-100%); transition: transform 0.25s ease-out;
    box-shadow: 0 0 40px rgba(0,0,0,0.3);
  }
  .admin-side.open { transform: translateX(0); }
  .admin-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 150;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
  }
  .admin-backdrop.open { opacity: 1; pointer-events: auto; }
  .admin-main { padding-top: 76px; }
}
@media (min-width: 881px) {
  .admin-topbar { display: none; }
}

/* === SIDEBAR === */
.admin-side {
  background: #1B4332; color: #fff; padding: 22px 16px;
  display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto;
}
.admin-brand { display: flex; gap: 10px; align-items: center; font-size: 18px; font-weight: 800; }
.admin-brand-mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--c-accent);
  display: grid; place-items: center; color: #1A1D24; font-size: 22px; flex-shrink: 0;
}
.admin-side .muted { color: rgba(255,255,255,0.55); font-size: 12px; }
.admin-select-group { display: flex; flex-direction: column; gap: 8px; }
.admin-select-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: rgba(255,255,255,0.45);
}
.point-select, .loc-select {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  color: #fff; padding: 10px 12px; border-radius: 10px; width: 100%; font-size: 14px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px;
}
.point-select option, .loc-select option { background: #1B4332; color: #fff; }

.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px;
  color: rgba(255,255,255,0.78); font-weight: 500; font-size: 14px; cursor: pointer;
  text-decoration: none;
}
.side-link.active { background: rgba(255,255,255,0.12); color: #fff; }
.side-link:hover:not(.active) { background: rgba(255,255,255,0.06); color: #fff; }
.side-bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.08); }

/* === TOPBAR (mobile) === */
/* display управляется media-queries выше: flex на узких экранах, none на широких */
.admin-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px; padding: 0 14px;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
  align-items: center; gap: 12px;
}
.admin-burger {
  width: 40px; height: 40px; border-radius: 10px; background: var(--c-surface-2);
  display: grid; place-items: center; font-size: 20px;
}
.admin-topbar-title { font-weight: 700; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-topbar-sub { font-size: 11px; color: var(--c-text-2); }

/* === MAIN === */
.admin-main {
  padding: 24px 28px; max-width: 1400px; min-width: 0;
}
@media (max-width: 600px) { .admin-main { padding: 14px; } }

.page-head {
  display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-title { font-size: 24px; font-weight: 800; margin: 0; line-height: 1.15; }
@media (max-width: 600px) { .page-title { font-size: 20px; } }
.page-sub { color: var(--c-text-2); font-size: 13px; }

/* === KPI === */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi {
  background: var(--c-surface); border-radius: 14px; padding: 14px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.kpi-label { font-size: 11px; color: var(--c-text-2); text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; word-break: break-word; }
@media (max-width: 600px) { .kpi-value { font-size: 20px; } }
.kpi-delta { font-size: 11px; color: var(--c-success); }
.kpi-delta.bad { color: var(--c-danger); }

/* === SECTIONS === */
.section {
  background: var(--c-surface); border-radius: 14px; padding: 18px 20px;
  box-shadow: var(--shadow-sm); margin-bottom: 16px;
  overflow: hidden; min-width: 0;
}
@media (max-width: 600px) { .section { padding: 14px; border-radius: 12px; } }
.section h2 {
  font-size: 16px; font-weight: 700; margin: 0 0 14px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.section h2 .hint { font-size: 11px; color: var(--c-text-3); font-weight: 400; }

/* === SLOTS BAR === */
.slots-bar-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.slots-bar {
  display: flex; gap: 4px; align-items: flex-end; height: 140px; padding: 8px 0;
  min-width: 720px;
}
.slot-bar-item {
  flex: 1; min-width: 22px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; position: relative;
}
.slot-bar-fill {
  width: 100%; background: var(--c-primary-light); border-radius: 6px 6px 2px 2px;
  position: relative; overflow: hidden;
}
.slot-bar-fill .filled {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--c-primary);
  border-radius: 0 0 2px 2px; transition: height 0.3s;
}
.slot-bar-fill.high .filled { background: var(--c-warning); }
.slot-bar-fill.full .filled { background: var(--c-danger); }
.slot-bar-label { font-size: 10px; color: var(--c-text-3); font-variant-numeric: tabular-nums; }
.slot-bar-num { font-size: 10px; font-weight: 700; color: var(--c-text); }

/* === TABLES === */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.tbl { width: 100%; border-collapse: collapse; min-width: 480px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--c-border); font-size: 14px; }
.tbl th { color: var(--c-text-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.tbl tr:last-child td { border-bottom: none; }

/* === TOGGLE === */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute; cursor: pointer; inset: 0; background: #ccd;
  border-radius: 999px; transition: 0.2s;
}
.toggle .slider::before {
  position: absolute; content: ''; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .slider { background: var(--c-primary); }
.toggle input:checked + .slider::before { transform: translateX(20px); }

/* === ORDERS LIST === */
.order-row {
  display: grid;
  grid-template-columns: 70px 1fr 100px 80px 80px;
  gap: 12px; align-items: center;
  padding: 10px 12px; background: var(--c-surface-2);
  border-radius: 10px; margin-bottom: 6px;
}
@media (max-width: 720px) {
  .order-row {
    grid-template-columns: 60px 1fr;
  }
  .order-row .desktop-only { display: none; }
  .order-row .order-meta-line {
    display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px;
  }
}
@media (min-width: 721px) {
  .order-row .order-meta-line { display: none; }
}

.order-num-cell {
  font-weight: 800; font-size: 16px; color: var(--c-primary-dark);
  font-variant-numeric: tabular-nums; min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.order-state {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.order-state.queued { background: #E8EBF0; color: #5B6470; }
.order-state.cooking { background: #FFF3CD; color: #856404; }
.order-state.ready { background: var(--c-primary-light); color: var(--c-primary-dark); }
.order-state.done { background: #E5E7EB; color: var(--c-text-2); }
.order-state.cancelled { background: var(--c-danger-light); color: var(--c-danger); }

/* === STOP LIST === */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; border-radius: 999px; background: var(--c-surface-2);
  font-size: 12px; display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none; border: 1px solid transparent; transition: 0.15s;
}
.chip.off { background: var(--c-danger-light); color: var(--c-danger); border-color: var(--c-danger); }
.chip:hover { transform: translateY(-1px); }

/* === POINTS TILES === */
.points-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.point-tile {
  background: var(--c-surface); border-radius: 12px; padding: 14px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 6px;
  cursor: pointer; transition: 0.15s; border-left: 4px solid var(--c-success); min-width: 0;
}
.point-tile.offline { border-left-color: var(--c-danger); opacity: 0.7; }
.point-tile-emoji { font-size: 28px; }
.point-tile-name {
  font-weight: 700; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.point-tile-meta { font-size: 11px; color: var(--c-text-2); }
.point-tile-load { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.point-tile-load-bar {
  flex: 1; height: 4px; background: #E5E7EB; border-radius: 2px; overflow: hidden;
}
.point-tile-load-bar > div { height: 100%; background: var(--c-primary); }

/* === SLOTS TABLE === */
.limit-input {
  width: 70px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--c-border); font-size: 14px; text-align: center; font-weight: 700;
}

/* === LOCATIONS GRID === */
.locations-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px;
}
.location-tile {
  background: var(--c-surface); border-radius: 12px; padding: 16px;
  box-shadow: var(--shadow-sm); display: flex; gap: 12px; align-items: flex-start;
  cursor: pointer; transition: 0.15s; min-width: 0;
}
.location-tile.active { box-shadow: 0 0 0 2px var(--c-primary), var(--shadow-sm); }
.location-tile-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--c-surface-2); display: grid; place-items: center;
  font-size: 24px; flex-shrink: 0;
}
.location-tile-name { font-weight: 700; font-size: 15px; }
.location-tile-meta { font-size: 12px; color: var(--c-text-2); margin-top: 2px; }
.location-tile-stats { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
