:root {
  --page-max: 980px; /* единна максимална ширина на списъчните екрани (Служители, Контакти) */
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --navy: #1B212A;
  --navy-soft: #3B485C;
  --brand-blue: #19B8F2;
  --accent: #097BA4;
  --accent-dark: #076587;
  --ok: #1E9E6B;
  --ok-bg: #E4F7EE;
  --warn: #D98F1E;
  --warn-bg: #FCF0DC;
  --idle: #7C8798;
  --idle-bg: #EDEFF3;
  --danger: #D64545;
  --border: #E2E5EA;
  --text: #1B2130;
  --text-mute: #667085;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(27,33,42,0.06), 0 4px 16px rgba(27,33,42,0.06);
  font-synthesis: none;
}

* { box-sizing: border-box; }
table { border-spacing: 0; }
td, th { padding: 0; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; }

a { color: inherit; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,106,57,0.08), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(22,35,62,0.06), transparent 45%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 36px 32px;
  border: 1px solid var(--border);
}
.login-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--navy);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px;
  margin-bottom: 18px;
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -0.01em; }
.login-card p.sub { color: var(--text-mute); font-size: 13.5px; margin: 0 0 24px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-mute); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.field input, .field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14.5px;
  background: #fff;
  outline: none;
  transition: border-color .15s;
}
.field input:focus, .field select:focus { border-color: var(--navy-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px;
  padding: 11px 18px;
  font-size: 14.5px; font-weight: 600;
  cursor: pointer;
  transition: transform .05s, background .15s, opacity .15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--navy); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--navy-soft); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--text-mute); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--idle-bg); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid #F3C6C6; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.error-msg {
  background: #FDEDED; color: var(--danger);
  border: 1px solid #F3C6C6; border-radius: 8px;
  padding: 10px 12px; font-size: 13.5px; margin-bottom: 14px;
}

/* ---------- App shell ---------- */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 92px; overflow-y: auto; scrollbar-width: none; padding-bottom: 96px !important; /* място за превключвателя на езика и "Помощ" */
  background: var(--navy);
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 0;
  flex-shrink: 0;
}
.sidebar .mark {
  width: 44px; height: 44px; border-radius: 10px;
  background: #fff; padding: 6px; object-fit: contain;
  margin-bottom: 16px; box-shadow: var(--shadow);
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar .nav-group {
  width: 72px; margin: 8px 0 3px; padding-top: 7px; border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center; font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #7D88A3;
}
.sidebar .nav-item {
  width: 76px; padding: 6px 0; margin-bottom: 2px;
  border-radius: 8px; text-align: center; font-size: 11px; font-weight: 600;
  color: #A7B0C3; cursor: pointer; letter-spacing: 0.02em;
}
.sidebar .nav-item.active { background: rgba(255,106,57,0.14); color: var(--accent); }
.sidebar .nav-item:hover { color: #fff; }
.sidebar .spacer { flex: 1; }
.sidebar .logout { width: 76px; padding: 9px 0; text-align: center; font-size: 10.5px; color: #A7B0C3; cursor: pointer; }
.sidebar .logout:hover { color: var(--danger); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.topbar h2 { font-size: 16px; margin: 0; letter-spacing: -0.01em; }
.topbar .who { font-size: 13px; color: var(--text-mute); }

.content { flex: 1; overflow: hidden; display: flex; }

/* Admin split view: list + map */
.split { flex: 1; display: flex; min-width: 0; }
.list-pane {
  width: 420px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surface);
  display: flex; flex-direction: column;
}
.map-pane { flex: 1; position: relative; z-index: 1; }
#map { position: absolute; inset: 0; }

.toolbar {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.toolbar .grow { flex: 1; }

.chip {
  padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em; display: inline-block;
}
.chip-unassigned { background: var(--idle-bg); color: var(--idle); }
.chip-assigned { background: var(--warn-bg); color: var(--warn); }
.chip-out_for_delivery { background: #E3ECFB; color: #2E5FCC; }
.chip-delivered { background: var(--ok-bg); color: var(--ok); }
.chip-failed { background: #FDEDED; color: var(--danger); }

.order-row {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; display: flex; gap: 10px; align-items: flex-start;
}
.order-row:hover { background: var(--bg); }
.order-row.selected { background: #FFF0EA; }
.order-row input[type=checkbox] { margin-top: 3px; }
.order-row .info { flex: 1; min-width: 0; }
.order-row .name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.order-row .addr { font-size: 12.5px; color: var(--text-mute); margin-bottom: 2px; }
.order-row .meta { font-size: 11.5px; color: var(--text-mute); display: flex; gap: 8px; align-items: center; margin-top: 4px; }

.badge-geo-failed { color: var(--danger); font-size: 11px; font-weight: 600; }

.empty-state { padding: 40px 20px; text-align: center; color: var(--text-mute); font-size: 13.5px; }

/* Driver mobile view */
.driver-shell { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); padding-bottom: 84px; }
.rep-actions { display: flex; gap: 5px; flex-shrink: 0; }
.rep-actions .btn { background: #fff; padding: 7px 0; min-width: 38px; font-size: 15px; text-align: center; }
.driver-header {
  background: var(--navy); color: #fff; padding: 18px 18px 22px;
  border-radius: 0 0 18px 18px;
}
.driver-header .greet { font-size: 13px; color: #A7B0C3; margin-bottom: 2px; }
.driver-header h1 { font-size: 19px; margin: 0; }
.driver-tabs {
  display: flex; gap: 6px; margin: -14px 14px 0; position: relative; z-index: 2;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.driver-tabs::-webkit-scrollbar { display: none; }
.driver-tab {
  flex: 0 0 auto; text-align: center; padding: 10px 14px; border-radius: 10px; white-space: nowrap;
  background: var(--surface); box-shadow: var(--shadow); font-size: 13px; font-weight: 700;
  color: var(--text-mute); cursor: pointer;
}
.driver-tab.active { background: var(--navy); color: #fff; }

.driver-list { padding: 20px 16px 90px; }
.order-card {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px;
}
.order-card .top-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-card .name { font-size: 15.5px; font-weight: 700; }
.order-card .addr { font-size: 13.5px; color: var(--text-mute); margin-bottom: 10px; line-height: 1.4; }
.order-card .actions { display: flex; gap: 8px; margin-top: 12px; }
.order-card .actions .btn { flex: 1; padding: 10px; font-size: 13px; }
.order-card .call-link { display: inline-flex; align-items: center; gap: 4px; color: var(--navy-soft); font-size: 13px; font-weight: 600; text-decoration: none; }

/* Signature modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(22,35,62,0.5);
  display: flex; align-items: flex-end; justify-content: center; z-index: 5000;
}
.modal-sheet {
  background: var(--surface); width: 100%; max-width: 480px;
  border-radius: 18px 18px 0 0; padding: 20px; max-height: 92vh; overflow-y: auto;
}
.modal-sheet h3 { margin: 0 0 4px; font-size: 17px; }
.modal-sheet p.sub { color: var(--text-mute); font-size: 13px; margin: 0 0 16px; }
.sig-pad-wrap {
  border: 1.5px dashed var(--border); border-radius: 10px; overflow: hidden;
  background: #fafbfc; margin-bottom: 10px; touch-action: none;
}
#sigCanvas, .sig-canvas { width: 100%; height: 180px; display: block; touch-action: none; }
.geo-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 10px 12px; border-radius: 8px;
  background: var(--idle-bg); color: var(--text-mute); margin-bottom: 14px;
}
.geo-status.ok { background: var(--ok-bg); color: var(--ok); }
.geo-status.error { background: #FDEDED; color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.import-drop {
  border: 1.5px dashed var(--border); border-radius: 12px; padding: 24px;
  text-align: center; color: var(--text-mute); font-size: 13.5px; cursor: pointer;
  margin-bottom: 12px; background: #fafbfc;
}
.import-drop:hover { border-color: var(--navy-soft); }

.addr-suggest-dropdown {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); max-height: 220px; overflow-y: auto; z-index: 10;
}
.addr-suggest-item {
  padding: 9px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--border);
  line-height: 1.4;
}
.addr-suggest-item:last-child { border-bottom: none; }
.addr-suggest-item:hover, .addr-suggest-item.active { background: var(--bg); }
.addr-suggest-loading { padding: 9px 12px; font-size: 12.5px; color: var(--text-mute); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow); z-index: 10000; max-width: min(92vw, 640px);
}
.toast.error { background: var(--danger); }

.leaflet-popup-content b { display: block; margin-bottom: 3px; }
.leaflet-popup-content { font-size: 13px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D5D9E0; border-radius: 4px; }

/* ==================== Мобилен изглед на админ панела ==================== */

.mobile-topbar { display: none; }
.mobile-drawer-overlay { display: none; }
.mobile-drawer { display: none; }
.mobile-subtabs { display: none; }

@media (max-width: 860px) {
  /* Компактен хедър горе вместо страничния sidebar с икони */
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    height: 54px; padding: 0 8px 0 4px;
    background: var(--navy); color: #fff; flex-shrink: 0;
    position: sticky; top: 0; z-index: 30;
  }
  .mobile-topbar h2 { font-size: 16px; margin: 0; letter-spacing: -0.01em; }
  .mobile-menu-btn, .mobile-logout-btn {
    background: none; border: none; color: #fff; font-size: 20px;
    width: 42px; height: 42px; border-radius: 8px; cursor: pointer;
  }
  .mobile-menu-btn:active, .mobile-logout-btn:active { background: rgba(255,255,255,0.12); }

  .mobile-drawer-overlay.open {
    display: block; position: fixed; inset: 0; background: rgba(22,35,62,0.5); z-index: 40;
  }
  .mobile-drawer {
    display: block; position: fixed; top: 0; left: 0; bottom: 0; width: 250px;
    background: var(--surface); z-index: 41; box-shadow: var(--shadow);
    transform: translateX(-100%); transition: transform .2s ease; padding: 16px 0 120px; overflow-y: auto;
  }
  .mobile-drawer.open { transform: translateX(0); }
  .mobile-drawer-item {
    padding: 13px 20px; font-size: 14.5px; font-weight: 600; color: var(--text);
    cursor: pointer; display: flex; align-items: center; gap: 10px;
  }
  .mobile-drawer-item.active { background: var(--bg); color: var(--accent-dark); }
  .mobile-drawer-item.danger { color: var(--danger); }
  .mobile-drawer-divider { height: 1px; background: var(--border); margin: 10px 0; }
  .mobile-drawer-group { padding: 14px 20px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-mute); }

  /* Скриваме desktop навигацията - функцията ѝ вече е в мобилния хедър/чекмедже */
  .sidebar { display: none; }
  .topbar { display: none; }
  .app-shell { height: calc(100vh - 54px); }

  /* Поръчки: списък и карта стават отделни екрани с превключване, вместо едновременно
     показани един до друг (не се събират разумно на тесен екран) - same модел като
     приложението на шофьорите. */
  .mobile-subtabs {
    display: flex; gap: 6px; padding: 10px 12px 0;
  }
  .mobile-subtab {
    flex: 1; text-align: center; padding: 9px; border-radius: 8px;
    background: var(--bg); font-size: 13px; font-weight: 700; color: var(--text-mute); cursor: pointer;
  }
  .mobile-subtab.active { background: var(--navy); color: #fff; }

  .split { flex-direction: column; }
  .list-pane { width: 100%; border-right: none; }
  .map-pane { width: 100%; }
  .split:not(.mobile-show-map) .map-pane { display: none; }
  .split.mobile-show-map .list-pane { display: none; }
  .split.mobile-show-map .map-pane { display: block; }

  .toolbar { flex-wrap: wrap; }

  /* Формуляри/списъци на пълна ширина, без прекалено голям страничен отстъп */
  #driversView, #settingsView, #contactsView { padding: 16px !important; }
  #driversView > div, #settingsView > div, #contactsView > div { max-width: 100% !important; }

  .modal-sheet { max-height: 88vh; }
}

@media (max-width: 460px) {
  .toolbar { padding: 10px 12px; }
  .order-row .meta { flex-wrap: wrap; row-gap: 4px; }
}


/* ---------- Правила за бутоните ----------
   btn-accent (син)  = ЕДНО главно действие на екран (напр. "+ Нов контакт");
   btn-ghost (светъл) = второстепенни действия; редките се събират в меню "⋯" (виж Контакти);
   btn-danger         = необратими действия. Ширината на списъчните екрани е var(--page-max). */

/* ---------- Анализи ---------- */
.a-tabs { display: flex; gap: 6px; margin: 18px 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.a-tabs::-webkit-scrollbar { display: none; }
.a-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px; margin-bottom: -1px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-mute); cursor: pointer; white-space: nowrap; }
.a-tab:hover { color: var(--text); }
.a-tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.a-h { margin: 0; font-size: 15px; }
.a-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.a-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; margin-top: 16px; }
.a-card { padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); min-width: 0; }
.a-card h4 { margin: 0 0 10px; font-size: 14px; }
.a-chart { position: relative; height: 240px; }
.a-chart-wide { height: 320px; }
@media (max-width: 860px) { .a-chart-wide { height: 260px; } }
@media (max-width: 760px) { .ps-brands-card { grid-column: auto !important; } }
@media (max-width: 560px) {
  .a-kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .a-kpis > div { padding: 10px 12px !important; }
  .a-kpis > div > div:nth-child(2) { font-size: 18px !important; }
}

/* ========== Начало: liquid glass табло ========== */
#homeView.home-glass { position: relative; isolation: isolate; background: linear-gradient(135deg, #EAF6FC 0%, #F3EEFB 50%, #FDF1E6 100%); background-size: 200% 200%; animation: hgShift 24s ease-in-out infinite; }
@keyframes hgShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.hg-bg { position: sticky; top: -24px; height: 0; margin: 0; z-index: 0; pointer-events: none; }
.hg-bg i { position: absolute; display: block; width: 46vmin; height: 46vmin; filter: blur(48px); opacity: .55; mix-blend-mode: multiply; will-change: transform, border-radius; animation: hgBlob 18s ease-in-out infinite, hgMorph 11s ease-in-out infinite; }
.hg-bg i:nth-child(1) { top: -4vmin; left: 4vmin; background: #19B8F2; }
.hg-bg i:nth-child(2) { top: -2vmin; right: 4vmin; background: #9B7BE8; animation-duration: 23s, 13s; animation-delay: -6s, -3s; }
.hg-bg i:nth-child(3) { top: 12vmin; left: 38vw; background: #FFB267; animation-duration: 27s, 9s; animation-delay: -11s, -5s; }
.hg-bg i:nth-child(4) { top: 22vmin; left: -4vmin; background: #5DD6B0; width: 34vmin; height: 34vmin; animation-duration: 21s, 15s; animation-delay: -2s, -8s; }
@keyframes hgBlob { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(9vmin, 6vmin) scale(1.12); } 66% { transform: translate(-6vmin, 10vmin) scale(.92); } }
@keyframes hgMorph { 0%, 100% { border-radius: 58% 42% 55% 45% / 48% 56% 44% 52%; } 50% { border-radius: 42% 58% 40% 60% / 58% 42% 58% 42%; } }

#homeView.home-glass > :not(.hg-bg) { position: relative; z-index: 1; }
#homeView.home-glass h2 { font-size: 26px; letter-spacing: -.01em; background: linear-gradient(90deg, #1B212A, #097BA4 60%, #7B5BD6); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% 100%; animation: hgText 10s ease-in-out infinite; width: fit-content; }
@keyframes hgText { 0%, 100% { background-position: 0% 0; } 50% { background-position: 100% 0; } }

.gcard, #homeView.home-glass #homePinnedTasks > div > div[style*="border-radius:8px"] {
  position: relative; overflow: hidden;
  background: linear-gradient(145deg, rgba(255,255,255,.62), rgba(255,255,255,.28));
  backdrop-filter: blur(22px) saturate(1.7); -webkit-backdrop-filter: blur(22px) saturate(1.7);
  border: 1px solid rgba(255,255,255,.65) !important;
  box-shadow: 0 8px 32px rgba(40,60,100,.12), inset 0 1px 0 rgba(255,255,255,.9), inset 0 -1px 0 rgba(255,255,255,.25);
}
.gcard { cursor: pointer; border-radius: 20px; padding: 18px; opacity: 0; transform: translateY(14px) scale(.97); animation: hgIn .7s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: calc(var(--i, 0) * 70ms); transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s; }
@keyframes hgIn { to { opacity: 1; transform: none; } }
/* движещ се "течен" отблясък, следва курсора */
.gcard::before { content: ''; position: absolute; inset: 0; background: radial-gradient(180px circle at var(--mx, 50%) var(--my, 0%), rgba(255,255,255,.85), transparent 60%); opacity: 0; transition: opacity .3s; pointer-events: none; }
.gcard:hover { transform: translateY(-4px) scale(1.015); box-shadow: 0 16px 44px rgba(40,60,100,.2), inset 0 1px 0 #fff; }
.gcard:hover::before { opacity: 1; }
.gcard:active { transform: scale(.985); transition-duration: .1s; }
/* бавно преминаваща светлинна ивица */
.gcard::after { content: ''; position: absolute; top: -60%; left: -40%; width: 40%; height: 220%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent); transform: translateX(-120%) rotate(8deg); animation: hgSheen 7s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 450ms + 1.5s); pointer-events: none; }
@keyframes hgSheen { 0% { transform: translateX(-120%) rotate(8deg); } 22%, 100% { transform: translateX(520%) rotate(8deg); } }
.gcard .g-num { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.gcard .g-label { font-size: 13px; color: var(--text-mute); margin-top: 4px; }
.gcard.urgent { background: linear-gradient(145deg, rgba(255,236,200,.78), rgba(255,214,150,.34)); animation: hgIn .7s cubic-bezier(.2,.8,.2,1) forwards, hgGlow 3.6s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 70ms), calc(var(--i, 0) * 70ms + .7s); }
.gcard.urgent .g-num { color: var(--warn); }
@keyframes hgGlow { 0%, 100% { box-shadow: 0 8px 32px rgba(40,60,100,.12), 0 0 0 0 rgba(242,170,60,0), inset 0 1px 0 rgba(255,255,255,.9); } 50% { box-shadow: 0 8px 32px rgba(40,60,100,.12), 0 0 28px 2px rgba(242,170,60,.38), inset 0 1px 0 rgba(255,255,255,.9); } }
.gcard.flash { animation: hgFlash .9s ease-out; }
@keyframes hgFlash { 0% { box-shadow: 0 0 0 0 rgba(25,184,242,.55); } 100% { box-shadow: 0 0 0 22px rgba(25,184,242,0); } }

#homeView.home-glass #homePinnedTasks > div > div[style*="border-radius:8px"] { border-radius: 14px !important; padding: 10px 14px !important; opacity: 0; transform: translateY(10px); animation: hgIn .6s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: .5s; }

/* плавна смяна между екраните: преливане + леко размиване */
@keyframes viewIn { from { opacity: 0; } to { opacity: 1; } }
#homeView, #ordersView, #employeesView, #visitsView, #teamView, #tasksView, #hrView, #stockView, #salesView, #materialsView, #vehiclesView, #knowledgeView, #analyticsView, #settingsView, #contactsView, #agreementsView, #heatmapView, #auditLogView { animation-name: viewIn; animation-duration: .45s; animation-timing-function: cubic-bezier(.2,.8,.2,1); animation-fill-mode: backwards; }
#homeView.home-glass { animation: viewIn .45s cubic-bezier(.2,.8,.2,1) backwards, hgShift 24s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .hg-bg i, .gcard, .gcard::after, #homeView.home-glass, #homeView.home-glass h2 { animation: none !important; }
  .gcard, #homeView.home-glass #homePinnedTasks > div > div[style*="border-radius:8px"] { opacity: 1 !important; transform: none !important; }
}
@media (max-width: 700px) { .hg-bg i { filter: blur(36px); } .gcard { padding: 14px; border-radius: 16px; } .gcard .g-num { font-size: 26px; } }

/* Мобилно: без хоризонтален излишък, широките таблици скролират в себе си */
html, body { max-width: 100%; overflow-x: hidden; }
.main, .main > * { min-width: 0; max-width: 100%; }
@media (max-width: 900px) {
  .main table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .main img, .main canvas, .main svg { max-width: 100%; }
}

/* Балончето на помощника не трябва да закрива бутони в отворен прозорец */
body:has(.modal-overlay) #kbChatBubble { display: none !important; }
