/* UniQm Design Refresh — свежий, чистый UI поверх style.css */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --bg: #080a0f;
  --bg-elevated: #0e1118;
  --bg-accent: radial-gradient(ellipse 90% 60% at 10% -10%, rgba(99, 140, 255, .16), transparent 55%),
               radial-gradient(ellipse 70% 40% at 90% 0%, rgba(167, 139, 250, .08), transparent 50%);
  --surface: #12151e;
  --surface2: #1a1f2c;
  --surface-hover: #232938;
  --border: rgba(255, 255, 255, .07);
  --border-light: rgba(255, 255, 255, .12);
  --text: #f2f4f8;
  --text-muted: #8b93a7;
  --primary: #6b8cff;
  --primary-hover: #5a7bf0;
  --primary-soft: rgba(107, 140, 255, .14);
  --primary-glow: rgba(107, 140, 255, .28);
  --success: #3dd68c;
  --warning: #f5c14a;
  --danger: #ff6b7a;
  --info: #4cc9f0;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 16px 48px rgba(0, 0, 0, .45);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, .28);
  --shadow-glow: 0 0 0 1px var(--border), 0 8px 32px rgba(0, 0, 0, .35);
  --transition: .22s cubic-bezier(.4, 0, .2, 1);
  --sidebar-w: 288px;
  --header-h: 60px;
  --bottom-nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font: 'DM Sans', Inter, system-ui, -apple-system, sans-serif;
  --glass: rgba(18, 21, 30, .78);
  --glass-strong: rgba(12, 14, 20, .92);
}

[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-elevated: #ffffff;
  --bg-accent: radial-gradient(ellipse 80% 50% at 20% -10%, rgba(99, 140, 255, .12), transparent);
  --surface: #ffffff;
  --surface2: #eef1f7;
  --surface-hover: #e4e9f2;
  --border: rgba(15, 23, 42, .08);
  --border-light: rgba(15, 23, 42, .14);
  --text: #0f172a;
  --text-muted: #475569;
  /* Семантика: тёмнее, чтобы текст на светлых фонах читался */
  --primary: #3b5bdb;
  --primary-hover: #2f4ac4;
  --primary-soft: rgba(59, 91, 219, .1);
  --primary-glow: rgba(59, 91, 219, .18);
  --success: #059669;
  --warning: #b45309;
  --danger: #dc2626;
  --info: #0369a1;
  --glass: rgba(255, 255, 255, .82);
  --glass-strong: rgba(255, 255, 255, .94);
  --shadow: 0 16px 40px rgba(15, 23, 42, .08);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, .06);
  --shadow-glow: 0 0 0 1px var(--border), 0 8px 24px rgba(15, 23, 42, .06);
}

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image: var(--bg-accent);
  background-attachment: fixed;
  min-height: 100dvh;
}

body.drawer-open {
  overflow: hidden;
}

/* ─── Login (desktop split + polished card) ─── */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 40px);
  background: var(--bg);
  background-image: var(--bg-accent);
  background-attachment: fixed;
}

.login-shell {
  width: 100%;
  max-width: 980px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: stretch;
}

.login-brand {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(28px, 4vw, 40px) clamp(22px, 3vw, 36px);
  background: var(--glass-strong, var(--surface));
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.login-card__head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.login-logo-img {
  width: 56px;
  height: 56px;
  margin: 0;
  border-radius: 16px;
  box-shadow: 0 12px 32px var(--primary-glow);
  flex-shrink: 0;
}

.login-card__titles {
  min-width: 0;
  text-align: left;
}

.login-card h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -.03em;
  text-align: left;
  background: linear-gradient(135deg, var(--primary), #a78bfa 70%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.login-subtitle {
  text-align: left;
  color: var(--text-muted);
  font-size: .9rem;
  margin: 4px 0 0;
  line-height: 1.4;
}

.lang-switch-login {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 18px 0 20px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
}

.lang-switch-login .lang-btn {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 34px;
  padding: 6px 12px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .82rem;
  cursor: pointer;
  transition: var(--transition);
}

.lang-switch-login .lang-btn:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.lang-switch-login .lang-btn.active,
.lang-switch-login .lang-btn[aria-pressed="true"] {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
  color: var(--primary);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 30%, transparent);
}

.login-card .form-group {
  margin-bottom: 14px;
}

.login-card .form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .01em;
}

.login-card .form-control {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
  background: var(--bg-elevated, var(--surface2));
  border: 1px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-card .form-control:hover {
  border-color: var(--border-light);
}

.login-card .form-control:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.login-btn {
  width: 100%;
  justify-content: center;
  border-radius: 12px;
  min-height: 50px;
  font-weight: 650;
  font-size: 1rem;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--primary), #8b7cf0 90%);
  border: none;
  box-shadow: 0 8px 24px var(--primary-glow);
}

.login-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px var(--primary-glow);
}

.login-footer-link {
  margin: 20px 0 0;
  text-align: center;
  font-size: .8rem;
}

.login-footer-link a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.login-footer-link a:hover {
  color: var(--primary);
  border-bottom-color: color-mix(in srgb, var(--primary) 40%, transparent);
}

.login-hint {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--warning) 8%, var(--surface2));
  border: 1px solid color-mix(in srgb, var(--warning) 22%, var(--border));
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Desktop: split brand + form */
@media (min-width: 900px) {
  .login-shell {
    grid-template-columns: 1.05fr 0.95fr;
    max-width: 1040px;
    border: 1px solid var(--border);
    border-radius: 28px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--primary) 8%, transparent);
  }

  .login-brand {
    display: flex;
    position: relative;
    min-height: 560px;
    padding: 48px 40px;
    background:
      radial-gradient(ellipse 90% 70% at 10% 0%, rgba(107, 140, 255, .28), transparent 55%),
      radial-gradient(ellipse 70% 50% at 90% 100%, rgba(167, 139, 250, .18), transparent 50%),
      linear-gradient(160deg, #0c101a 0%, #12151e 50%, #0a0d14 100%);
    color: #f2f4f8;
    overflow: hidden;
  }

  .login-brand__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
    opacity: .55;
  }
  .login-brand__glow--1 {
    width: 220px;
    height: 220px;
    top: -40px;
    right: -30px;
    background: rgba(107, 140, 255, .45);
  }
  .login-brand__glow--2 {
    width: 180px;
    height: 180px;
    bottom: 10%;
    left: -40px;
    background: rgba(167, 139, 250, .35);
  }

  .login-brand__inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 360px;
  }

  .login-brand__logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(107, 140, 255, .35);
    margin-bottom: 28px;
  }

  .login-brand__kicker {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #8aa4ff;
    margin: 0 0 12px;
  }

  .login-brand__title {
    margin: 0 0 28px;
    font-size: clamp(1.55rem, 2.2vw, 1.95rem);
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.25;
    color: #f2f4f8;
  }

  .login-brand__points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
  }

  .login-brand__points li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: .95rem;
    color: #b8bfd4;
    line-height: 1.4;
  }

  .login-brand__points li::before {
    content: '';
    width: 8px;
    height: 8px;
    margin-top: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(135deg, #6b8cff, #a78bfa);
    box-shadow: 0 0 10px rgba(107, 140, 255, .5);
  }

  .login-card {
    max-width: none;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: var(--surface);
    backdrop-filter: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 44px;
  }

  .login-card__head {
    margin-bottom: 4px;
  }

  /* On desktop brand panel already has logo — compact head is fine */
  .login-logo-img {
    width: 52px;
    height: 52px;
  }
}

/* ─── Shop categories (Visiotech-like) ─── */
.shop-layout {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.shop-main {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#page-shop,
#page-shop .card,
#page-shop .card-body {
  max-width: 100%;
  min-width: 0;
}
#shop-table {
  width: 100%;
  min-width: 640px;
}
.shop-cats {
  position: sticky;
  top: 72px;
  max-height: calc(100dvh - 100px);
  overflow: auto;
}
.shop-cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 500;
}
.shop-cat-item:hover {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface2));
}
.shop-cat-item.active {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}
.shop-cat-count {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}
.shop-cat-children {
  margin: 2px 0 6px 10px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}
.shop-cat-item.level-2 { font-size: .84rem; padding: 6px 8px; }
.shop-cat-item.level-3 { font-size: .8rem; padding: 5px 8px; color: var(--text-muted); }
.shop-cat-item.level-3.active { color: var(--primary); }
.shop-breadcrumbs a {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}
.shop-breadcrumbs a:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .shop-layout { grid-template-columns: 1fr; }
  .shop-cats {
    position: relative;
    top: 0;
    max-height: 220px;
  }
}

/* Light theme login tweaks */
[data-theme="light"] .login-brand {
  background:
    radial-gradient(ellipse 90% 70% at 10% 0%, rgba(59, 91, 219, .16), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 100%, rgba(167, 139, 250, .12), transparent 50%),
    linear-gradient(160deg, #eef2ff 0%, #f8fafc 55%, #eef1f8 100%);
  color: #0f172a;
}
[data-theme="light"] .login-brand__title { color: #0f172a; }
[data-theme="light"] .login-brand__points li { color: #475569; }
[data-theme="light"] .login-brand__kicker { color: #3b5bdb; }
[data-theme="light"] .login-shell {
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .1);
}
[data-theme="light"] .login-card {
  background: #fff;
}

/* ─── Shell: full-width main, drawer menu ─── */
.app-shell {
  min-height: 100dvh;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 280;
  background: rgba(4, 6, 12, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility .25s ease;
}

.nav-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Drawer (replaces fixed desktop sidebar) */
.sidebar,
.sidebar.desktop-only {
  display: flex !important;
  width: min(var(--sidebar-w), 88vw);
  background: var(--glass-strong);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transform: translateX(-105%);
  transition: transform .3s cubic-bezier(.32, .72, 0, 1);
  z-index: 300;
  padding-top: var(--safe-top);
}

.sidebar.open {
  transform: translateX(0);
}

.logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.app-brand {
  position: relative;
  padding-right: 44px;
}

.app-brand-icon {
  border-radius: 14px;
  box-shadow: 0 6px 18px var(--primary-glow);
}

.drawer-close-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.logo h1 {
  font-size: 1.2rem;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav {
  padding: 12px 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-item {
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: .9rem;
  font-weight: 500;
  margin-bottom: 2px;
  color: var(--text-muted);
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  box-shadow: none;
  position: relative;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  opacity: .9;
}

.sidebar-footer {
  padding: 14px 18px;
  font-size: .75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* Full-width main (no permanent sidebar offset) */
.main {
  margin-left: 0 !important;
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
}

/* ─── Header ─── */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-h);
  padding: 10px 16px;
  padding-top: calc(10px + var(--safe-top));
  gap: 10px;
  justify-content: flex-start;
  background: var(--glass);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
}

.header-left {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  margin-right: 0;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.burger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), transform .15s;
  -webkit-tap-highlight-color: transparent;
}

.burger-btn:hover {
  border-color: var(--border-light);
  background: var(--surface-hover);
}

.burger-btn:active {
  transform: scale(.96);
}

.burger-btn svg {
  width: 22px;
  height: 22px;
}

.header-page-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.025em;
}

.header-app-icon {
  display: none;
}

.notif-bell {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
}

.content {
  padding: 20px 20px 32px;
  max-width: 1280px;
  margin: 0 auto;
}

@media (min-width: 769px) {
  .header {
    padding: 12px 28px;
    padding-top: calc(12px + var(--safe-top));
  }
  .content {
    padding: 28px 32px 48px;
  }
  .header-page-title {
    font-size: 1.15rem;
  }
}

/* ─── Buttons ─── */
.btn {
  border-radius: 11px;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: transform .12s, box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.btn:active:not(:disabled) {
  transform: scale(.98);
}

.btn-primary {
  background: linear-gradient(145deg, var(--primary) 0%, #7c6cf0 100%);
  border: none;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(145deg, var(--primary-hover) 0%, #6b5ce0 100%);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-light);
}

.btn-sm {
  border-radius: 9px;
  font-size: .82rem;
}

/* ─── Forms ─── */
.form-control {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  min-height: 44px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}

label {
  font-weight: 500;
  font-size: .85rem;
  color: var(--text-muted);
}

/* ─── Cards ─── */
.card,
.object-card,
.stat-card,
.fuel-stat-card,
.dash-extra-card,
.shifts-summary-panel,
.shifts-my-payout,
.kb-section,
.receipt-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.object-card {
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.object-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}

.object-card-compact {
  border-radius: 12px;
  padding: 9px 11px;
  min-height: 0;
}

.object-card-dense {
  border-radius: 12px;
}

.objects-grid,
.dash-objects-grid {
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
}

.object-card-title {
  font-weight: 700;
  letter-spacing: -.02em;
}

.object-card-status {
  border-radius: 999px;
  font-size: .62rem;
  letter-spacing: .02em;
  text-transform: none;
}

@media (min-width: 1100px) {
  .objects-grid,
  .dash-objects-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (min-width: 1400px) {
  .objects-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }
}

/* ─── Dashboard ─── */
.dash-chip {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), border-color var(--transition);
}

.dash-chip:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  transform: translateY(-2px);
}

.dash-quick-btn {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-weight: 600;
}

.dash-quick-btn:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: var(--primary-soft);
  color: var(--primary);
}

.dash-greeting h2 {
  font-weight: 700;
  letter-spacing: -.03em;
}

/* ─── Badges ─── */
.badge {
  border-radius: 999px;
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .02em;
  padding: 4px 10px;
}

/* ─── Modal ─── */
.modal-overlay {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background: rgba(4, 6, 12, .55);
}

.modal {
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 18px;
  background: var(--surface);
}

.modal-header h3 {
  font-weight: 700;
  letter-spacing: -.02em;
}

.modal-footer {
  border-top: 1px solid var(--border);
  padding: 14px 18px;
  gap: 8px;
}

/* ─── Bottom nav ─── */
.bottom-nav {
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  padding: 6px 8px var(--safe-bottom);
  background: var(--glass-strong);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .2);
  gap: 2px;
}

.bottom-nav-item {
  border-radius: 12px;
  gap: 3px;
  font-size: .62rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.75;
}

.bottom-nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}

.bottom-nav-item.active::before {
  display: none;
}

/* ─── More sheet ─── */
.more-sheet-panel {
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px 16px calc(20px + var(--safe-bottom));
}

.more-sheet-panel::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: var(--border-light);
  margin: 0 auto 14px;
}

.more-sheet-item {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface2);
  padding: 14px 8px;
  font-weight: 500;
}

.more-sheet-item:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  background: var(--primary-soft);
}

.more-sheet-logout {
  border-radius: 12px;
  font-weight: 600;
}

/* ─── Toolbar / filters ─── */
.toolbar {
  gap: 10px;
  margin-bottom: 16px;
}

.filter-btn {
  border-radius: 999px;
  font-weight: 600;
  font-size: .82rem;
}

.filter-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent;
}

/* ─── Chat (Telegram-style) ─── */
.chat-tg.chat-layout,
.chat-layout.chat-tg {
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(99, 140, 255, .07), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(61, 214, 140, .05), transparent 50%),
    var(--bg);
}

.chat-tg .chat-messages {
  padding: 10px 10px 14px;
  gap: 2px;
  background: transparent;
}

.chat-tg .chat-date-sep {
  margin: 12px 0 8px;
  justify-content: center;
}

.chat-tg .chat-date-sep::before,
.chat-tg .chat-date-sep::after {
  display: none;
}

.chat-tg .chat-date-sep span {
  background: rgba(0, 0, 0, .35);
  color: #e8ecf4;
  border: none;
  padding: 4px 12px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}

[data-theme="light"] .chat-tg .chat-date-sep span {
  background: rgba(15, 23, 42, .12);
  color: var(--text);
}

/* Message rows */
.chat-tg .chat-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  max-width: min(88%, 520px);
  margin: 1px 0;
  padding: 0 4px;
}

.chat-tg .chat-row.peer {
  align-self: flex-start;
  flex-direction: row;
}

.chat-tg .chat-row.own {
  align-self: flex-end;
  flex-direction: row-reverse;
  margin-left: auto;
}

.chat-tg .chat-row.group-start {
  margin-top: 8px;
}

.chat-tg .chat-avatar,
.chat-tg .chat-avatar-spacer {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.chat-tg .chat-row .chat-avatar.user-avatar-img,
.chat-tg .chat-row .chat-avatar.user-avatar-fallback {
  width: 32px;
  height: 32px;
  font-size: .65rem;
}

.chat-tg .chat-avatar-spacer {
  display: block;
}

/* Bubbles */
.chat-tg .chat-bubble {
  position: relative;
  max-width: 100%;
  flex: 0 1 auto;
  min-width: 0;
  padding: 6px 10px 4px;
  border: none;
  border-radius: 16px 16px 16px 4px;
  background: var(--surface2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}

.chat-tg .chat-bubble.own {
  border-radius: 16px 16px 4px 16px;
  background: linear-gradient(145deg, #3d6cf5 0%, #2f7aed 100%);
  color: #fff;
  box-shadow: 0 1px 3px rgba(47, 122, 237, .35);
}

.chat-tg .chat-bubble.peer {
  background: var(--surface);
  border: 1px solid var(--border);
}

.chat-tg .chat-author {
  font-size: .78rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 2px;
  line-height: 1.2;
}

.chat-tg .chat-bubble.own .chat-author {
  display: none;
}

.chat-tg .chat-text {
  font-size: .92rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding-right: 2px;
}

.chat-tg .chat-bubble.own .chat-text {
  color: #fff;
}

.chat-tg .chat-object-link {
  display: inline-flex;
  margin: 0 0 4px;
  padding: 2px 8px;
  font-size: .72rem;
  border-radius: 8px;
  background: rgba(76, 201, 240, .15);
  color: var(--info);
}

.chat-tg .chat-bubble.own .chat-object-link {
  background: rgba(255, 255, 255, .18);
  color: #e8f4ff;
}

.chat-tg .chat-photos {
  margin-top: 6px;
  gap: 4px;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
}

.chat-tg .chat-photo {
  border-radius: 10px;
  border: none;
  aspect-ratio: 1;
}

.chat-tg .chat-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
  min-height: 16px;
}

.chat-tg .chat-time {
  font-size: .68rem;
  opacity: .65;
  line-height: 1;
  white-space: nowrap;
}

.chat-tg .chat-bubble.own .chat-time {
  color: rgba(255, 255, 255, .8);
  opacity: 1;
}

.chat-tg .chat-delete-btn,
.chat-tg .chat-edit-btn {
  font-size: .68rem;
  opacity: .55;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.chat-tg .chat-delete-btn:hover {
  opacity: 1;
  color: var(--danger);
}

.chat-tg .chat-bubble.own .chat-delete-btn:hover {
  color: #ffd0d0;
}

/* Collapsible toolbar */
.chat-toolbar {
  flex-shrink: 0;
  background: var(--glass-strong);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  padding: 0;
}

.chat-panel-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: .84rem;
  font-weight: 600;
  text-align: left;
}

.chat-panel-toggle:hover {
  background: var(--surface2);
}

.chat-panel-toggle.has-filter .chat-panel-toggle-label {
  color: var(--primary);
}

.chat-filter-meta-inline {
  margin: 0;
  padding: 0;
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
}

.chat-panel-chevron {
  margin-left: auto;
  transition: transform .2s ease;
  color: var(--text-muted);
  font-size: .85rem;
}

.chat-toolbar.is-open .chat-panel-chevron,
.chat-toolbar:not(.collapsed) .chat-panel-chevron {
  transform: rotate(180deg);
}

.chat-toolbar-body {
  max-height: 220px;
  overflow: hidden;
  transition: max-height .28s ease, opacity .2s ease, padding .2s ease;
  opacity: 1;
  padding: 0 12px 10px;
}

.chat-toolbar.collapsed .chat-toolbar-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.chat-toolbar .chat-filter-bar {
  padding: 0 0 6px;
}

/* Compose bar like Telegram */
.chat-compose {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  padding: 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .12);
  z-index: 20;
}

.chat-compose-extras {
  max-height: 200px;
  overflow: hidden;
  transition: max-height .28s ease, opacity .2s ease, padding .2s ease;
  opacity: 1;
  padding: 10px 12px 0;
  border-bottom: 1px solid var(--border);
}

.chat-compose.collapsed .chat-compose-extras {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom: none;
  pointer-events: none;
}

.chat-compose-options {
  display: flex;
  gap: 8px;
  margin-bottom: 0;
  flex-wrap: wrap;
}

.chat-compose-options .form-control {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  font-size: .84rem;
}

.chat-work-date {
  flex: 0 0 auto !important;
  max-width: 150px;
}

.chat-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chat-template-btn {
  border-radius: 999px;
  font-weight: 600;
  font-size: .74rem;
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
}

.chat-template-btn:hover {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  background: var(--primary-soft);
}

.chat-compose-bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
}

.chat-options-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-options-toggle:hover,
.chat-options-toggle.is-active {
  color: var(--primary);
  background: var(--primary-soft);
}

.chat-attach-group {
  flex-direction: row !important;
  gap: 2px !important;
}

.chat-attach-btn {
  width: 36px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-size: 1.05rem;
}

.chat-tg .chat-input,
.chat-compose-bar .chat-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  border-radius: 20px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--surface2);
  resize: none;
  line-height: 1.35;
}

.chat-tg .chat-input:focus {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.chat-tg .chat-send-btn,
.chat-compose-bar .chat-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.chat-photo-preview {
  padding: 0 12px;
}

.chat-compose.collapsed .chat-photo-preview:empty {
  display: none;
}

@media (max-width: 768px) {
  .chat-tg .chat-row {
    max-width: 92%;
  }
  .chat-tg .chat-messages {
    padding: 8px 6px 12px;
  }
  .chat-compose-bar {
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  }
}

/* ─── Shifts ─── */
.shifts-kpi {
  border-radius: 12px;
}

.shifts-worker-card {
  border-radius: 14px;
}

/* ─── Tables ─── */
table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}

/* ─── Empty states ─── */
.empty-state {
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-title {
  font-weight: 700;
  letter-spacing: -.02em;
}

/* ─── FAB / toasts ─── */
.toast {
  border-radius: 12px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* ─── Knowledge ─── */
.kb-article-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  transition: transform var(--transition), border-color var(--transition);
}

.kb-article-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

/* ─── Profile header ─── */
.header-profile {
  border-radius: 12px;
  border: 1px solid transparent;
}

.header-profile:hover {
  background: var(--surface2);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-muted) 40%, transparent);
  border-radius: 99px;
}

/* ─── Mobile layout overrides (cancel old hide-sidebar) ─── */
@media (max-width: 768px) {
  .sidebar {
    display: flex !important;
  }

  .main {
    margin-left: 0 !important;
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  }

  .header-left {
    display: flex !important;
  }

  .content {
    padding: 16px 14px 28px;
  }

  .objects-grid,
  .dash-objects-grid {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 7px;
  }
  .object-card-compact,
  .object-card-dense {
    padding: 8px 9px;
  }
}

/* Desktop: hide bottom nav, keep burger + drawer */
@media (min-width: 769px) {
  .bottom-nav.mobile-only {
    display: none !important;
  }

  .main {
    padding-bottom: 24px;
  }
}

/* Light theme glass */
[data-theme="light"] .header {
  background: var(--glass);
}

[data-theme="light"] .bottom-nav {
  background: var(--glass-strong);
  box-shadow: 0 -4px 24px rgba(15, 23, 42, .06);
}

[data-theme="light"] .sidebar {
  background: var(--glass-strong);
}

[data-theme="light"] .nav-backdrop {
  background: rgba(15, 23, 42, .35);
}

[data-theme="light"] .btn-primary {
  color: #fff;
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

/* Drawer section labels (optional grouping via JS) */
.nav-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 14px 14px 6px;
  opacity: .75;
}

/* Smooth page */
.page.active {
  animation: pageInSoft .28s ease;
}

@keyframes pageInSoft {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ─── Live cameras viewer ─── */
.live-cameras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.live-cam-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.live-cam-card.is-playing {
  border-color: color-mix(in srgb, var(--success) 50%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--success) 30%, transparent);
}

.live-cam-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #0a0c12;
  cursor: pointer;
  overflow: hidden;
}

.live-cam-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #0a0c12;
}

.live-cam-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .25);
  pointer-events: none;
  transition: opacity .2s;
}

.live-cam-card.is-playing .live-cam-overlay {
  background: transparent;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 8px;
}

.live-cam-play-icon {
  font-size: 1.6rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}

.live-cam-play-icon.is-live {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  background: rgba(239, 68, 68, .9);
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
}

.live-cam-error {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .75);
  color: #fecaca;
  font-size: .72rem;
  line-height: 1.35;
}

.live-cam-info {
  padding: 8px 10px 4px;
  min-width: 0;
}

.live-cam-title {
  display: block;
  font-size: .88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-cam-meta {
  display: block;
  font-size: .72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-cam-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 10px 10px;
}

.tools-live-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.tools-live-controls {
  margin-bottom: 4px;
}

.live-fullscreen-wrap {
  text-align: center;
}

.live-fullscreen-img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 12px;
  background: #0a0c12;
}

/* Camera programming (SADP-style) */
.prog-agent-banner {
  padding: 14px 16px;
  margin-bottom: 14px;
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: var(--primary-soft);
}

.prog-agent-banner strong {
  display: block;
  margin-bottom: 6px;
}

.prog-agent-code {
  margin: 8px 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: .75rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
}

.prog-defaults,
.prog-batch {
  padding: 14px 16px;
  margin-bottom: 14px;
}

.prog-table-wrap {
  margin: 12px 0;
  max-height: min(50vh, 480px);
  overflow: auto;
}

.prog-table {
  font-size: .82rem;
  width: 100%;
}

.prog-table th {
  position: sticky;
  top: 0;
  background: var(--surface2);
  z-index: 1;
}

.prog-actions {
  white-space: nowrap;
}

.prog-actions .btn {
  margin: 1px;
}

.prog-last-msg {
  font-size: .68rem;
  color: var(--text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prog-table tr.is-busy {
  opacity: .7;
}

/* Object activity feed (лента) */
.object-feed {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.object-feed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.object-feed-count {
  font-weight: 600;
  color: var(--text-muted);
  font-size: .85rem;
}

.object-feed-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.object-feed-filter {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
}

.object-feed-filter.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent;
}

.object-feed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.object-feed-item {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
}

.object-feed-item.hidden { display: none; }

.object-feed-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.object-feed-body {
  min-width: 0;
  flex: 1;
}

.object-feed-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.object-feed-type {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--primary);
}

.object-feed-when {
  font-size: .7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.object-feed-title {
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.object-feed-sub {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.object-feed-thumb {
  margin-top: 6px;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
}

.object-feed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.object-feed-empty {
  margin: 8px 0;
  font-size: .88rem;
}

.object-feed-open-days {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, .4);
  background: rgba(251, 191, 36, .1);
}

.object-feed-open-days strong {
  display: block;
  margin-bottom: 6px;
  font-size: .88rem;
}

.object-feed-open-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.object-feed-open-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
}

#object-panel-feed {
  padding: 4px 0 8px;
}

#object-panel-feed .object-feed {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
