/* ============================================================
   MOYSKLAD AGENT — OFFICIAL MOBILE APPLICATION DESIGN SYSTEM
   Pixel-perfect iOS / Android Native Mobile Architecture
   ============================================================ */

:root, [data-theme="light"] {
  --fs-ratio: 1;
    --bg-canvas: #e9eef4;
  --bg-app: #f4f6f9;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;

  --ms-blue: #1858d4;
  --ms-blue-hover: #1347ad;
  --ms-blue-light: #ebf3fe;
  --ms-blue-border: rgba(24, 88, 212, 0.25);

  --accent-green: #16a34a;
  --accent-green-light: #dcfce7;
  --accent-amber: #d97706;
  --accent-amber-light: #fef3c7;
  --accent-purple: #7e22ce;
  --accent-purple-light: #f3e8ff;
  --accent-red: #dc2626;
  --accent-red-light: #fee2e2;

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;

  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --header-bg: #ffffff;
  --bottom-nav-bg: #ffffff;
  --status-bar-color: #000000;
  --device-bezel: #1e2430;
}

[data-theme="dark"] {
  --bg-canvas: #090d16;
  --bg-app: #0f172a;
  --bg-card: #1e293b;
  --bg-elevated: #334155;
  --border-color: #334155;
  --border-subtle: #1e293b;

  --ms-blue: #3b82f6;
  --ms-blue-hover: #2563eb;
  --ms-blue-light: rgba(59, 130, 246, 0.15);
  --ms-blue-border: rgba(59, 130, 246, 0.35);

  --accent-green: #22c55e;
  --accent-green-light: rgba(34, 197, 94, 0.15);
  --accent-amber: #f59e0b;
  --accent-amber-light: rgba(245, 158, 11, 0.15);
  --accent-purple: #a855f7;
  --accent-purple-light: rgba(168, 85, 247, 0.15);
  --accent-red: #ef4444;
  --accent-red-light: rgba(239, 68, 68, 0.15);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  --header-bg: #1e293b;
  --bottom-nav-bg: #1e293b;
  --status-bar-color: #ffffff;
  --device-bezel: #111827;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  margin: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────────────────────────
   DESKTOP TOP TOOLBAR (Switcher between Phone & Wide, RU & UZ, Theme)
   ───────────────────────────────────────────────────────────── */
.desktop-control-strip {
  width: 100%;
  max-width: 1100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  font-size: calc(13px * var(--fs-ratio, 1));
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .desktop-control-strip {
  background: rgba(15, 23, 42, 0.85);
  border-bottom-color: var(--border-color);
}

.control-strip-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ms-official-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--ms-blue);
  letter-spacing: -0.2px;
}

.ms-official-badge img, .ms-official-badge i {
  font-size: calc(18px * var(--fs-ratio, 1));
}

.live-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-green-light);
  color: var(--accent-green);
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}

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

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.control-strip-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-btn:hover {
  border-color: var(--ms-blue);
  color: var(--ms-blue);
}

.control-btn.active {
  background: var(--ms-blue);
  border-color: var(--ms-blue);
  color: #fff;
}

/* ─────────────────────────────────────────────────────────────
   DEVICE FRAME / SMARTPHONE MOCKUP (Desktop container)
   ───────────────────────────────────────────────────────────── */
.device-container {
  padding: 24px 0 36px;
  display: flex;
  justify-content: center;
  width: 100%;
}

.device-frame {
  width: 420px;
  height: 870px;
  background-color: var(--bg-app);
  border-radius: 48px;
  border: 11px solid var(--device-bezel);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.4), 
              0 0 0 1px rgba(255, 255, 255, 0.15), 
              inset 0 0 4px rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanded Tablet / Wide Mode */
.device-frame.expanded {
  width: 760px;
  height: 870px;
  border-radius: 36px;
}

/* ─────────────────────────────────────────────────────────────
   MOBILE SIMULATOR TOP: STATUS BAR & DYNAMIC ISLAND
   ───────────────────────────────────────────────────────────── */
.phone-status-bar {
  height: 44px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: calc(13px * var(--fs-ratio, 1));
  font-weight: 600;
  color: var(--status-bar-color);
  background-color: var(--header-bg);
  flex-shrink: 0;
  z-index: 99;
  user-select: none;
}

.phone-time {
  font-size: calc(14px * var(--fs-ratio, 1));
  font-weight: 700;
  letter-spacing: -0.3px;
}

.phone-notch {
  width: 110px;
  height: 24px;
  background-color: #000000;
  border-radius: 20px;
  margin: 0 auto;
}

.phone-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: calc(12px * var(--fs-ratio, 1));
}

/* ─────────────────────────────────────────────────────────────
   APP VIEWPORT (Inside the phone screen)
   ───────────────────────────────────────────────────────────── */
.app-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-app);
}

/* ─────────────────────────────────────────────────────────────
   NATIVE APP HEADER (NavigationBar)
   ───────────────────────────────────────────────────────────── */
.native-header {
  height: 52px;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 90;
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.app-logo-box {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--ms-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(14px * var(--fs-ratio, 1));
  box-shadow: 0 2px 6px rgba(24, 88, 212, 0.35);
  flex-shrink: 0;
}

.header-title-box {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.header-main-title {
  font-size: calc(15px * var(--fs-ratio, 1));
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.header-sub-title {
  font-size: calc(10.5px * var(--fs-ratio, 1));
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.agent-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--border-subtle);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 2px 7px 2px 3px;
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-chip span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50px;
}

.agent-chip-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ms-blue);
  color: #fff;
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(12px * var(--fs-ratio, 1));
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.header-icon-btn:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
}

/* ─────────────────────────────────────────────────────────────
   SCROLLABLE SCREEN CONTENT AREA
   ───────────────────────────────────────────────────────────── */
.screen-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 125px;
  -webkit-overflow-scrolling: touch;
}

/* Custom sleek scrollbar */
.screen-scroll::-webkit-scrollbar {
  width: 4px;
}
.screen-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

/* Tabs visibility */
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: fadeInPane 0.18s ease-in-out;
}

@keyframes fadeInPane {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────────────────────
   NATIVE CARDS & COMPONENTS
   ───────────────────────────────────────────────────────────── */

/* Summary Header Card (Bosh sahifa) */
.kpi-hero-card {
  background: linear-gradient(135deg, var(--ms-blue) 0%, #10419e 100%);
  color: #ffffff;
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 8px 20px rgba(24, 88, 212, 0.25);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.kpi-hero-card::after {
  content: '';
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.kpi-period-row {
  display: flex;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 20px;
  padding: 3px;
  margin-bottom: 12px;
  gap: 3px;
  position: relative;
  z-index: 2;
}

.kpi-period-pill {
  flex: 1;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  user-select: none;
}

.kpi-period-pill:hover {
  color: #ffffff;
}

.kpi-period-pill.active {
  background: #ffffff;
  color: #1858d4;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.kpi-hero-card.kassa-card .kpi-period-pill.active {
  color: #059669;
}

@keyframes kpi-num-pop {
  0% { transform: scale(0.95); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

.kpi-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 600;
  opacity: 0.9;
}

.kpi-date-pill {
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 9px;
  border-radius: 12px;
  font-size: calc(11px * var(--fs-ratio, 1));
}

.kpi-main-sum {
  font-size: calc(26px * var(--fs-ratio, 1));
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 10px;
}

.kpi-sub-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 500;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 10px;
}

.kpi-stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-stat-item b {
  font-weight: 700;
}

/* Quick Action Tiles (Grid) */
.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.action-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition: all 0.2s ease;
  text-align: center;
}

.action-tile:hover, .action-tile:active {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--ms-blue);
}

.action-tile-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(16px * var(--fs-ratio, 1));
}

.action-tile-icon.blue { background: var(--ms-blue-light); color: var(--ms-blue); }
.action-tile-icon.green { background: var(--accent-green-light); color: var(--accent-green); }
.action-tile-icon.amber { background: var(--accent-amber-light); color: var(--accent-amber); }
.action-tile-icon.purple { background: var(--accent-purple-light); color: var(--accent-purple); }

.action-tile-label {
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

/* Section Header */
.section-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 2px 8px;
}

.section-title {
  font-size: calc(14px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.section-link {
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 600;
  color: var(--ms-blue);
  cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────
   NATIVE SEARCH BAR & FILTER PILLS
   ───────────────────────────────────────────────────────────── */
.search-container {
  position: relative;
  margin-bottom: 10px;
  width: 100%;
}

.search-input-box {
  width: 100%;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0 38px 0 36px;
  font-size: calc(13px * var(--fs-ratio, 1));
  color: var(--text-primary);
  outline: none;
  box-shadow: var(--card-shadow);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.search-input-box:focus {
  border-color: var(--ms-blue);
  box-shadow: 0 0 0 3px rgba(24, 88, 212, 0.12);
}

.search-icon-left {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: calc(13px * var(--fs-ratio, 1));
  pointer-events: none;
}

.search-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border-color);
  color: var(--text-muted);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: calc(11px * var(--fs-ratio, 1));
  cursor: pointer;
  border: none;
  z-index: 2;
}

.search-voice-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ms-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(14px * var(--fs-ratio, 1));
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
  padding: 0;
}

.search-voice-btn:hover {
  background: var(--border-subtle);
}

.search-container.has-voice .search-input-box {
  padding-right: 68px;
}

.search-container.has-voice .search-voice-btn {
  right: 10px;
}

.search-container.has-voice .search-clear-btn {
  right: 38px;
}

/* Filter Horizontal Pills Strip */
.filter-pills-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-pills-bar::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  padding: 5px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--card-shadow);
  flex-shrink: 0;
}

.filter-pill.active {
  background: var(--ms-blue);
  color: #ffffff;
  border-color: var(--ms-blue);
  box-shadow: 0 2px 6px rgba(24, 88, 212, 0.3);
}

.crm-icon-subtabs {
  display: flex !important;
  width: 100%;
  gap: 6px;
  overflow: hidden;
}

.crm-icon-subtabs .filter-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  font-size: 16px;
  border-radius: 12px;
}

/* ─────────────────────────────────────────────────────────────
   NATIVE ORDER CARD (Like official MoySklad App)
   ───────────────────────────────────────────────────────────── */
.order-cell-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}

.order-cell-card:hover, .order-cell-card:active {
  transform: scale(0.995);
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.order-cell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.order-num-date {
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.order-num-date b {
  color: var(--text-primary);
  font-size: calc(13px * var(--fs-ratio, 1));
}

/* Status Badges */
.status-badge {
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 10px;
  letter-spacing: -0.1px;
}

.status-badge.new {
  background: var(--ms-blue-light);
  color: var(--ms-blue);
  border: 1px solid var(--ms-blue-border);
}

.status-badge.ready {
  background: var(--accent-amber-light);
  color: var(--accent-amber);
}

.status-badge.shipped {
  background: var(--accent-purple-light);
  color: var(--accent-purple);
}

.status-badge.delivered {
  background: #ede9fe;
  color: #6d28d9;
}

.status-badge.paid {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.order-client-name {
  font-size: calc(15px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}

.order-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.order-store-agent {
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-sum-box {
  text-align: right;
}

.order-sum-val {
  font-size: calc(15px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.order-items-count {
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 500;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────
   NATIVE PRODUCT / CATALOG ROW (Остатки и Цены)
   ───────────────────────────────────────────────────────────── */
.product-cell-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--card-shadow);
  gap: 10px;
}

.product-info-col {
  flex: 1;
  min-width: 0;
}

.product-cell-title {
  font-size: calc(13px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-sku-cat {
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--text-muted);
  margin-bottom: 4px;
}

.product-stock-tag {
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.product-stock-tag.in {
  color: var(--accent-green);
}

.product-stock-tag.out {
  color: var(--accent-red);
}

.product-action-col {
  text-align: right;
  flex-shrink: 0;
}

.product-cell-price {
  font-size: calc(14px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.product-add-cart-btn {
  background: var(--ms-blue-light);
  border: 1px solid var(--ms-blue-border);
  color: var(--ms-blue);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.product-add-cart-btn:hover, .product-add-cart-btn:active {
  background: var(--ms-blue);
  color: #fff;
}

/* ─────────────────────────────────────────────────────────────
   NATIVE CLIENT / COUNTERPARTY ROW (Контрагенты)
   ───────────────────────────────────────────────────────────── */
.client-cell-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--card-shadow);
}

.client-cell-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
}

.client-name-bold {
  font-size: calc(14px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.client-phone-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-green-light);
  color: var(--accent-green);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
}

.client-debt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid var(--border-subtle);
  font-size: calc(12px * var(--fs-ratio, 1));
}

.client-debt-label {
  color: var(--text-muted);
}

.client-debt-val {
  font-weight: 800;
  color: var(--accent-red);
}

.client-debt-val.zero {
  color: var(--accent-green);
}

.client-quick-order-btn {
  background: var(--ms-blue-light);
  border: 1px solid var(--ms-blue-border);
  color: var(--ms-blue);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
  cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────
   FLOATING ACTION BUTTON (FAB) — + Заказ
   ───────────────────────────────────────────────────────────── */
.fab-create-order {
  position: absolute;
  bottom: 90px;
  right: 14px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ms-blue) 0%, #10419e 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 14px rgba(24, 88, 212, 0.4);
  border: none;
  cursor: pointer;
  z-index: 85;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab-create-order:hover, .fab-create-order:active {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 28px rgba(24, 88, 212, 0.55);
}

/* ─────────────────────────────────────────────────────────────
   NATIVE BOTTOM NAVIGATION BAR (5 Tabs)
   ───────────────────────────────────────────────────────────── */
.native-bottom-nav {
  height: 62px;
  background-color: var(--bottom-nav-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
  z-index: 90;
  user-select: none;
}

.nav-tab-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 0;
  transition: all 0.15s ease;
  position: relative;
}

.nav-tab-cell.active {
  color: var(--ms-blue);
}

.nav-tab-icon {
  font-size: calc(19px * var(--fs-ratio, 1));
  position: relative;
}

.nav-tab-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: var(--ms-blue);
  color: #fff;
  font-size: calc(9px * var(--fs-ratio, 1));
  font-weight: 800;
  min-width: 15px;
  height: 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.nav-tab-label {
  font-size: 10px !important;
  font-weight: 700;
  letter-spacing: -0.1px;
}

/* ─────────────────────────────────────────────────────────────
   SIMULATED HOME INDICATOR BAR (iOS bar at bottom of phone)
   ───────────────────────────────────────────────────────────── */
.phone-home-indicator {
  height: 20px;
  background-color: var(--bottom-nav-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.home-bar-pill {
  width: 120px;
  height: 4px;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

[data-theme="dark"] .home-bar-pill {
  background-color: rgba(255, 255, 255, 0.3);
}

/* ─────────────────────────────────────────────────────────────
   NATIVE MODAL DRAWERS (Bottom Sheets)
   ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: flex-end;
}

.modal-overlay.active {
  display: flex;
  animation: fadeInOverlay 0.2s ease-out;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-sheet {
  width: 100%;
  max-height: 88%;
  background: var(--bg-card);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  animation: slideUpSheet 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes slideUpSheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle-row {
  padding: 8px 0 4px;
  display: flex;
  justify-content: center;
  cursor: grab;
  flex-shrink: 0;
}

.sheet-handle-bar {
  width: 40px;
  height: 4px;
  background: var(--border-color);
  border-radius: 4px;
}

.sheet-header {
  padding: 8px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sheet-title {
  font-size: calc(16px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
}

.sheet-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(13px * var(--fs-ratio, 1));
  cursor: pointer;
}

.sheet-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.sheet-footer {
  padding: 12px 18px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 10px;
  background: var(--bg-card);
}

/* Forms & Inputs in Modals */
.form-field-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: calc(13px * var(--fs-ratio, 1));
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--ms-blue);
}

.btn-primary-block {
  width: 100%;
  height: 44px;
  background: var(--ms-blue);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: calc(14px * var(--fs-ratio, 1));
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(24, 88, 212, 0.35);
  transition: all 0.15s ease;
}

.btn-primary-block:hover {
  background: var(--ms-blue-hover);
}

.btn-secondary-block {
  height: 44px;
  background: var(--border-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 12px;
  font-size: calc(14px * var(--fs-ratio, 1));
  font-weight: 700;
  padding: 0 16px;
  cursor: pointer;
}

/* Live Cart Items in Order Modal */
.cart-items-container {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-app);
  padding: 8px;
  margin-bottom: 14px;
  max-height: 200px;
  overflow-y: auto;
}

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 8px;
}

.cart-item-row:last-child {
  border-bottom: none;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price-sub {
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--text-muted);
}

.cart-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stepper-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: calc(14px * var(--fs-ratio, 1));
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.stepper-val {
  min-width: 24px;
  text-align: center;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 700;
}

/* Toast Message */
.toast-msg {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.95);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: slideDownToast 0.2s ease-out;
}

@keyframes slideDownToast {
  from { transform: translate(-50%, -10px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ─────────────────────────────────────────────────────────────
   NATIVE LOGIN SCREEN STYLES (Вход в МойСклад)
   ───────────────────────────────────────────────────────────── */
.login-screen-view {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px 20px;
  height: 100%;
  background: var(--bg-card);
  overflow-y: auto;
  z-index: 50;
}

.login-logo-box {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--ms-blue) 0%, #10419e 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(28px * var(--fs-ratio, 1));
  box-shadow: 0 8px 24px rgba(24, 88, 212, 0.35);
  margin-bottom: 16px;
}

.login-title {
  font-size: calc(20px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
  text-align: center;
}

.login-subtitle {
  font-size: calc(12px * var(--fs-ratio, 1));
  color: var(--text-muted);
  margin-bottom: 22px;
  text-align: center;
}

.login-form-box {
  width: 100%;
  max-width: 330px;
}

.login-input-wrapper {
  position: relative;
  margin-bottom: 12px;
}

.login-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: calc(13px * var(--fs-ratio, 1));
}

.login-input-field {
  width: 100%;
  height: 44px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0 40px 0 36px;
  font-size: calc(13px * var(--fs-ratio, 1));
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.login-input-field:focus {
  border-color: var(--ms-blue);
  box-shadow: 0 0 0 3px rgba(24, 88, 212, 0.15);
}

.login-eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: calc(14px * var(--fs-ratio, 1));
}

.login-error-banner {
  background: var(--accent-red-light);
  color: var(--accent-red);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 600;
  margin-bottom: 14px;
  text-align: center;
}

.quick-test-creds {
  margin-top: 18px;
  padding: 10px 14px;
  background: var(--ms-blue-light);
  border: 1px dashed var(--ms-blue-border);
  border-radius: 12px;
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--ms-blue);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.quick-test-creds:hover {
  background: rgba(24, 88, 212, 0.18);
}

.main-app-screen-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.perm-pill {
  font-size: calc(10px * var(--fs-ratio, 1));
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--ms-blue-light);
  color: var(--ms-blue);
  border: 1px solid var(--ms-blue-border);
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE: ON REAL SMARTPHONES (<= 640px)
   The phone bezel melts away completely into full-screen native!
   ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  body {
    background-color: var(--bg-app);
  }

  .desktop-control-strip {
    display: none !important;
  }

  .device-container {
    padding: 0;
    height: 100vh;
  }

  .device-frame {
    width: 100% !important;
    height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }

  .phone-status-bar {
    height: env(safe-area-inset-top, 24px);
    padding: 0 14px;
  }

  .phone-notch {
    display: none;
  }

  .phone-home-indicator {
    height: env(safe-area-inset-bottom, 16px);
  }
}

/* ─────────────────────────────────────────────────────────────
   AKT SVERKI MODAL & DEBT STYLES
   ───────────────────────────────────────────────────────────── */
.client-debt-val.negative {
  color: #dc2626 !important;
  font-weight: 800;
}
.client-debt-val.positive {
  color: #16a34a !important;
  font-weight: 800;
}

.client-cell-card {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.client-cell-card:active {
  transform: scale(0.99);
}

.act-client-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}
.act-client-name {
  font-size: calc(16px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.act-client-meta {
  font-size: calc(12px * var(--fs-ratio, 1));
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.act-client-meta a {
  color: var(--accent-green);
  text-decoration: none;
  font-weight: 600;
}

.act-debt-box {
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.act-debt-box.is-debt {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
.act-debt-box.is-advance {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}
.act-debt-box.is-zero {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.act-debt-title {
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.act-debt-amount {
  font-size: calc(18px * var(--fs-ratio, 1));
  font-weight: 900;
}

.act-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.act-stat-card {
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px;
}
.act-stat-label {
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.act-stat-val {
  font-size: calc(13px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
}

.act-actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.act-action-btn {
  flex: 1;
  padding: 9px 8px;
  border-radius: 10px;
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
  transition: all 0.2s ease;
}
.act-btn-share {
  background: #0284c7;
  color: #ffffff;
}
.act-btn-share:hover { background: #0369a1; }
.act-btn-order {
  background: var(--ms-blue-light);
  color: var(--ms-blue);
  border: 1px solid var(--ms-blue-border);
}
.act-btn-payment {
  background: var(--accent-green-light);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.act-tx-header {
  font-size: calc(13px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.act-tx-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.act-tx-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column !important;
  align-items: stretch !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}
.act-tx-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.act-tx-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(13px * var(--fs-ratio, 1));
  flex-shrink: 0;
}
.act-tx-icon.demand { background: rgba(24, 88, 212, 0.1); color: var(--ms-blue); }
.act-tx-icon.payment { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.act-tx-icon.return { background: rgba(245, 158, 11, 0.15); color: #d97706; }

.act-tx-info {
  display: flex;
  flex-direction: column;
}
.act-tx-title {
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--text-primary);
}
.act-tx-date {
  font-size: calc(10px * var(--fs-ratio, 1));
  color: var(--text-muted);
}
.act-tx-desc {
  font-size: calc(10px * var(--fs-ratio, 1));
  color: var(--text-secondary);
  margin-top: 1px;
}
.act-tx-right {
  text-align: right;
  flex-shrink: 0;
}
.act-tx-sum {
  font-size: calc(13px * var(--fs-ratio, 1));
  font-weight: 800;
}
.act-tx-sum.demand { color: var(--text-primary); }
.act-tx-sum.payment { color: #16a34a; }
.act-tx-sum.return { color: #d97706; }
.act-tx-tag {
  font-size: calc(9px * var(--fs-ratio, 1));
  font-weight: 700;
  text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────────────
   CRM, VISITS, GPS & NOTIFICATIONS STYLES
   ───────────────────────────────────────────────────────────── */

/* Notification Bell */
.notif-bell-btn {
  position: relative;
}
.notif-badge-pill {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #ef4444;
  color: #ffffff;
  font-size: calc(9px * var(--fs-ratio, 1));
  font-weight: 800;
  min-width: 15px;
  height: 15px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.5);
}

/* Active Visit Banner */
.crm-active-banner {
  background: linear-gradient(135deg, #064e3b, #047857);
  border: 1px solid #10b981;
  border-radius: 16px;
  padding: 14px;
  color: #ffffff;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
}
.crm-active-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.crm-live-pulse {
  width: 8px;
  height: 8px;
  background: #34d399;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  animation: pulseGreen 1.5s infinite;
}
@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.crm-active-title {
  font-size: calc(10px * var(--fs-ratio, 1));
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a7f3d0;
}
.crm-timer-badge {
  font-size: calc(13px * var(--fs-ratio, 1));
  font-weight: 900;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.25);
  padding: 3px 8px;
  border-radius: 8px;
}
.crm-active-client-name {
  font-size: calc(16px * var(--fs-ratio, 1));
  font-weight: 800;
  margin-bottom: 2px;
}
.crm-active-meta {
  font-size: calc(12px * var(--fs-ratio, 1));
  color: #d1fae5;
  margin-bottom: 10px;
}
.crm-active-btns {
  display: flex;
  gap: 8px;
}
.crm-checkout-btn {
  flex: 2;
  background: #ffffff;
  color: #065f46;
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.crm-add-order-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* GPS Status Card (Hidden from user, silent background service) */
.crm-gps-card {
  display: none !important;
}
.crm-gps-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.crm-gps-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9ca3af;
}
.crm-gps-dot.active {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}
.crm-gps-status-title {
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--text-primary);
}
.crm-gps-coords {
  font-size: calc(10px * var(--fs-ratio, 1));
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.crm-gps-refresh-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Auto-Visit GPS Geofence Card (Hidden from user, silent background service) */
.crm-autovisit-card {
  display: none !important;
}
.crm-autovisit-card.disabled {
  background: var(--bg-card);
  border-color: var(--border-color);
  opacity: 0.7;
}
.crm-autovisit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.crm-autovisit-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
}
.crm-radar-pulse {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #10b981;
  font-size: calc(13px * var(--fs-ratio, 1));
  flex-shrink: 0;
}
.crm-radar-pulse::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid #10b981;
  animation: radar-ripple 1.8s cubic-bezier(0, 0.2, 0.8, 1) infinite;
  opacity: 0.6;
}
@keyframes radar-ripple {
  0% { transform: scale(0.8); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}
.crm-autovisit-card.disabled .crm-radar-pulse {
  background: #9ca3af;
  color: #fff;
}
.crm-autovisit-card.disabled .crm-radar-pulse::before {
  display: none;
}
.crm-autovisit-title {
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.crm-autovisit-sub {
  font-size: calc(10px * var(--fs-ratio, 1));
  color: var(--text-muted);
  line-height: 1.2;
}
/* iOS-style toggle switch */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 20px;
}
.switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.switch-toggle input:checked + .switch-slider {
  background-color: #10b981;
}
.switch-toggle input:checked + .switch-slider:before {
  transform: translateX(16px);
}
.crm-autovisit-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(16, 185, 129, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.crm-nearest-radar-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: calc(10px * var(--fs-ratio, 1));
  color: var(--text-secondary);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.crm-nearest-radar-info i {
  color: #10b981;
  font-size: calc(11px * var(--fs-ratio, 1));
}
.crm-geofence-range-picker {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.range-pills {
  display: flex;
  gap: 2px;
  background: var(--bg-hover);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}
.range-pill {
  border: none;
  background: transparent;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: calc(9px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}
.range-pill.active {
  background: var(--ms-blue);
  color: #fff;
}
.zone-badge-pill {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* CRM Stats Grid */
.crm-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.crm-stat-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.crm-stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
  font-size: calc(12px * var(--fs-ratio, 1));
}
.crm-stat-icon.visits { background: rgba(24, 88, 212, 0.1); color: var(--ms-blue); }
.crm-stat-icon.time { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.crm-stat-icon.calls { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.crm-stat-val {
  font-size: calc(15px * var(--fs-ratio, 1));
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.1;
}
.crm-stat-name {
  font-size: calc(9px * var(--fs-ratio, 1));
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 3px;
  text-transform: uppercase;
}

/* Visit Cards */
.crm-visit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.crm-visit-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}
.crm-visit-client {
  font-size: calc(14px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
}
.crm-visit-duration {
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 800;
  color: #10b981;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 2px 7px;
  border-radius: 6px;
  font-family: var(--font-mono);
}
.crm-visit-meta {
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}
.crm-visit-outcome {
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--text-secondary);
  background: var(--bg-hover);
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1.4;
}

/* Call Cards */
.crm-call-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.crm-call-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.crm-call-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(2, 132, 199, 0.1);
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(14px * var(--fs-ratio, 1));
}
.crm-call-info {
  display: flex;
  flex-direction: column;
}
.crm-call-client {
  font-size: calc(13px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
}
.crm-call-meta {
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--text-muted);
}
.crm-call-outcome-tag {
  font-size: calc(10px * var(--fs-ratio, 1));
  font-weight: 700;
  color: #0284c7;
  margin-top: 2px;
}

/* Nearest Client Chips */
.checkin-nearest-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
}
.checkin-nearest-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.checkin-nearest-item:hover, .checkin-nearest-item.selected {
  border-color: var(--ms-blue);
  background: rgba(24, 88, 212, 0.06);
}
.checkin-dist-badge {
  font-size: calc(10px * var(--fs-ratio, 1));
  font-weight: 800;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 6px;
  border-radius: 6px;
}

/* Modals helper boxes */
.checkin-gps-box {
  background: rgba(24, 88, 212, 0.06);
  border: 1px solid rgba(24, 88, 212, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.checkin-gps-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.checkout-summary-box {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  margin-bottom: 14px;
}
.checkout-timer-pill {
  display: inline-block;
  background: #10b981;
  color: #ffffff;
  font-size: calc(16px * var(--fs-ratio, 1));
  font-weight: 900;
  padding: 5px 14px;
  border-radius: 20px;
  font-family: var(--font-mono);
}
.call-client-header {
  background: var(--bg-hover);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.notif-perm-card {
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notif-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.notif-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: calc(12px * var(--fs-ratio, 1));
}
.notif-item-icon.visit { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.notif-item-icon.order { background: rgba(24, 88, 212, 0.15); color: var(--ms-blue); }
.notif-item-icon.debt { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.notif-item-icon.alert { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.notif-item-title {
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
}
.notif-item-body {
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--text-secondary);
  margin-top: 2px;
}
.notif-item-time {
  font-size: calc(9px * var(--fs-ratio, 1));
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────────
   FLOATING CART BAR & IN-ORDER PRODUCT CARDS & QUANTITY MODAL
   ───────────────────────────────────────────────────────────── */
.catalog-floating-cart-bar {
  position: sticky;
  bottom: 8px;
  z-index: 50;
  margin: 10px 0 6px;
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  color: #fff;
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}
.catalog-floating-cart-bar:active {
  transform: scale(0.98);
}
.cart-floating-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cart-floating-badge {
  background: rgba(255, 255, 255, 0.25);
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 800;
  font-size: calc(13px * var(--fs-ratio, 1));
  display: flex;
  align-items: center;
  gap: 6px;
}
.cart-floating-title {
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 600;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.cart-floating-sum {
  font-size: calc(15px * var(--fs-ratio, 1));
  font-weight: 800;
  line-height: 1.1;
}
.cart-floating-action-btn {
  background: #fff;
  color: #047857;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.product-cell-card.in-order {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
}
.in-cart-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #dcfce7;
  color: #15803d;
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #bbf7d0;
  margin-top: 3px;
}
.card-qty-stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-card);
  border: 1.5px solid #10b981;
  border-radius: 10px;
  padding: 2px;
}
.card-qty-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-app);
  color: var(--text-primary);
  border-radius: 8px;
  font-weight: 800;
  font-size: calc(16px * var(--fs-ratio, 1));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}
.card-qty-btn:active {
  background: #e2e8f0;
}
.card-qty-val-btn {
  border: none;
  background: transparent;
  color: #10b981;
  font-weight: 800;
  font-size: calc(13px * var(--fs-ratio, 1));
  padding: 2px 6px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}
.stepper-big-btn {
  width: 48px;
  height: 50px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: calc(22px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stepper-big-btn:active {
  background: var(--border-color);
}
.qty-quick-chip {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.qty-quick-chip:hover, .qty-quick-chip:active {
  background: var(--ms-blue-light);
  border-color: var(--ms-blue);
  color: var(--ms-blue);
}
.product-pack-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  color: #334155;
  font-size: calc(10px * var(--fs-ratio, 1));
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  margin-top: 3px;
  border: 1px solid #cbd5e1;
}

/* ============================================================
   NATIVE MOBILE & STANDALONE APK FULLSCREEN DISPLAY
   When on a real mobile device or running inside Android APK,
   completely hide desktop controls, simulated phone status bar,
   and fake iPhone frame/bezels.
   The viewport (.app-viewport) fills 100% of the screen natively.
   ============================================================ */
@media (max-width: 680px), (display-mode: standalone), (display-mode: fullscreen) {
  html, body {
    width: 100% !important;
    height: 100% !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background-color: var(--bg-app) !important;
  }
  .desktop-control-strip {
    display: none !important;
  }
  .phone-status-bar {
    display: none !important;
  }
  .phone-home-indicator {
    display: none !important;
  }
  .device-container {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .device-frame {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    flex: 1 !important;
  }
  .app-viewport {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    flex: 1 !important;
    border-radius: 0 !important;
  }
}

html.standalone-app body,
body.standalone-app {
  width: 100% !important;
  height: 100% !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background-color: var(--bg-app) !important;
}
html.standalone-app .desktop-control-strip,
body.standalone-app .desktop-control-strip {
  display: none !important;
}
html.standalone-app .phone-status-bar,
body.standalone-app .phone-status-bar {
  display: none !important;
}
html.standalone-app .phone-home-indicator,
body.standalone-app .phone-home-indicator {
  display: none !important;
}
html.standalone-app .fab-create-order,
body.standalone-app .fab-create-order {
  bottom: 70px !important;
}
html.standalone-app .font-scale-shablon-corner,
body.standalone-app .font-scale-shablon-corner {
  bottom: 70px !important;
}
html.standalone-app .device-container,
body.standalone-app .device-container {
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}
html.standalone-app .device-frame,
body.standalone-app .device-frame {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 100% !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  flex: 1 !important;
}
html.standalone-app .app-viewport,
body.standalone-app .app-viewport {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  flex: 1 !important;
  border-radius: 0 !important;
}

/* ============================================================
   CRM OYLIK KPI DASHBOARD (INTEGRATED WITH STROYNA KPI)
   ============================================================ */
.kpi-container {
  --kpi-border: var(--border-color, #e2e8f0);
  --kpi-card: var(--bg-card, #ffffff);
  --kpi-text: var(--text-main, #0f172a);
  --kpi-muted: var(--text-muted, #64748b);
  --kpi-green: #16a34a;
  --kpi-red: #dc2626;
  --kpi-blue: #2563eb;
  --kpi-radius: 14px;
}

.kpi-header-ctrls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.kpi-emp-select {
  font-weight: 700;
  font-size: calc(13px * var(--fs-ratio, 1));
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--kpi-border);
  width: 100%;
  background: var(--kpi-card);
  color: var(--kpi-text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  outline: none;
}

.kpi-day-banner {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 12px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: calc(12px * var(--fs-ratio, 1));
  color: #1d4ed8;
  margin-bottom: 10px;
  line-height: 1.4;
  font-weight: 600;
}

.kpi-company-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-radius: 14px;
  padding: 12px 14px;
  color: #fff;
  margin-bottom: 12px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15);
  transition: transform 0.15s ease;
}

.kpi-company-banner:active {
  transform: scale(0.98);
}

.kpi-salary-card {
  background: var(--kpi-card);
  border: 1px solid var(--kpi-border);
  border-radius: var(--kpi-radius);
  padding: 16px 14px;
  text-align: center;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.kpi-salary-card .lbl {
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--kpi-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
}

.kpi-salary-card .amt {
  font-size: calc(28px * var(--fs-ratio, 1));
  font-weight: 900;
  color: var(--kpi-text);
  margin: 6px 0 4px;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.kpi-salary-card .amt span {
  font-size: calc(15px * var(--fs-ratio, 1));
  font-weight: 600;
  color: var(--kpi-muted);
}

.kpi-salary-card .plan100-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 700;
  color: #15803d;
  background: rgba(34, 197, 94, 0.12);
  padding: 4px 10px;
  border-radius: 20px;
  margin-top: 4px;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.kpi-salary-card .temp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 700;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.12);
  padding: 4px 10px;
  border-radius: 20px;
  margin-top: 4px;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.kpi-salary-card .fiksa {
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--kpi-muted);
  margin-top: 6px;
  font-weight: 600;
}

.kpi-rank-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: var(--kpi-radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.kpi-rank-card:active {
  transform: scale(0.98);
}

.kpi-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.kpi-sum-c {
  background: var(--kpi-card);
  border: 1px solid var(--kpi-border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.kpi-sum-c .slb {
  font-size: calc(10px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--kpi-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.kpi-sum-c .sv {
  font-size: calc(19px * var(--fs-ratio, 1));
  font-weight: 800;
  margin-top: 4px;
  line-height: 1.1;
}

.kpi-sum-c .ss {
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--kpi-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-pg-wrap {
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}

.kpi-pg-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s ease;
}

.kpi-sec {
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--kpi-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 16px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-item-card {
  background: var(--kpi-card);
  border: 1px solid var(--kpi-border);
  border-radius: var(--kpi-radius);
  margin-bottom: 9px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.kpi-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--kpi-border);
  background: rgba(0, 0, 0, 0.01);
}

.kpi-item-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(13px * var(--fs-ratio, 1));
  flex-shrink: 0;
  background: rgba(37, 99, 235, 0.1);
}

.kpi-item-head h3 {
  font-size: calc(13px * var(--fs-ratio, 1));
  font-weight: 700;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  color: var(--kpi-text);
}

.kpi-item-pct {
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}

.kpi-pct-ok {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}

.kpi-pct-warn {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

.kpi-item-body {
  padding: 10px 12px;
}

.kpi-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: calc(12px * var(--fs-ratio, 1));
}

.kpi-item-rl {
  color: var(--kpi-muted);
}

.kpi-item-rv {
  font-weight: 700;
  color: var(--kpi-text);
}

.kpi-grid4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 8px 0;
  padding: 7px 4px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--kpi-border);
  border-radius: 9px;
  text-align: center;
}

.kpi-grid4 .kg-lbl {
  font-size: calc(9px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--kpi-muted);
  display: block;
}

.kpi-grid4 .kg-val {
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 800;
  color: var(--kpi-text);
  margin-top: 2px;
  display: block;
}

.kpi-item-msg {
  font-size: calc(11px * var(--fs-ratio, 1));
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  line-height: 1.4;
  font-weight: 600;
}

.kpi-msg-ok {
  background: rgba(22, 163, 74, 0.08);
  color: #15803d;
}

.kpi-msg-warn {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}

.kpi-ext-link-card {
  background: var(--kpi-card);
  border: 1px solid var(--kpi-border);
  border-radius: var(--kpi-radius);
  padding: 12px 14px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: var(--kpi-text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.kpi-ext-link-card:active {
  background: rgba(0,0,0,0.02);
}

/* ============================================================
   INLINE PRODUCT SEARCH & VOICE RECOGNITION (ORDER MODAL)
   ============================================================ */
.order-inline-search-box:focus-within {
  border-color: var(--ms-blue) !important;
  box-shadow: 0 0 0 3px rgba(24, 88, 212, 0.12) !important;
  background: var(--bg-card) !important;
}

.order-voice-btn.listening {
  background: #ef4444 !important;
  color: #ffffff !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5) !important;
  animation: voice-btn-pulse 1.2s infinite alternate !important;
}

@keyframes voice-btn-pulse {
  0% { transform: scale(1); box-shadow: 0 0 4px rgba(239, 68, 68, 0.4); }
  100% { transform: scale(1.08); box-shadow: 0 0 14px rgba(239, 68, 68, 0.8); }
}

@keyframes voice-pulse-dot {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.voice-pulse-dot {
  animation: voice-pulse-dot 1s infinite ease-in-out;
}

.order-search-dropdown {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.order-search-dropdown::-webkit-scrollbar {
  width: 5px;
}
.order-search-dropdown::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.order-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: all 0.15s ease;
  cursor: pointer;
  gap: 8px;
}

.order-search-item:hover,
.order-search-item:active {
  background: var(--bg-app);
  border-color: var(--ms-blue-border);
}

.order-search-item-info {
  flex: 1;
  min-width: 0;
}

.order-search-item-title {
  font-size: calc(13px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-search-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--text-muted);
  margin-top: 3px;
  flex-wrap: wrap;
}

.order-search-item-price {
  font-weight: 800;
  color: var(--ms-blue);
  font-size: calc(13px * var(--fs-ratio, 1));
}

.order-search-item-btn {
  background: var(--ms-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: calc(12px * var(--fs-ratio, 1));
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.15s ease;
}

.order-search-item-btn:active {
  transform: scale(0.95);
  background: var(--ms-blue-hover);
}

.order-search-item-btn.added {
  background: #16a34a !important;
}

.stock-tag-green {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 700;
  font-size: calc(10px * var(--fs-ratio, 1));
}

.stock-tag-red {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 700;
  font-size: calc(10px * var(--fs-ratio, 1));
}






/* ─────────────────────────────────────────────────────────────
   DASHBOARD CATEGORY SALES RANKINGS & DEBTOR PLAN
   ───────────────────────────────────────────────────────────── */
.dash-category-ranks-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 12px;
  box-shadow: var(--card-shadow);
}

.dash-category-ranks-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  -webkit-overflow-scrolling: touch;
}

.dash-cat-rank-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--text-primary);
  transition: transform 0.15s ease;
}

.dash-cat-rank-pill:active {
  transform: scale(0.96);
}

.dash-cat-rank-badge {
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 800;
  font-size: calc(10px * var(--fs-ratio, 1));
}

.rank-gold {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.rank-silver {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.rank-bronze {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.rank-other {
  background: rgba(24, 88, 212, 0.08);
  color: var(--ms-blue);
  border: 1px solid var(--ms-blue-border);
}

/* ─────────────────────────────────────────────────────────────
   STOCK RESERVE (BUYURTMADA) BADGES
   ───────────────────────────────────────────────────────────── */
.stock-reserve-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: calc(10px * var(--fs-ratio, 1));
  font-weight: 700;
}

/* ─────────────────────────────────────────────────────────────
   AKT SVERKI ACCORDION EXPANSION (LINE ITEMS & COMMENTS)
   ───────────────────────────────────────────────────────────── */
.act-tx-card {
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  user-select: none;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  box-sizing: border-box !important;
  width: 100% !important;
  overflow: hidden;
}

.act-tx-card:hover {
  border-color: var(--ms-blue-border);
}

.act-tx-expand-btn {
  font-size: calc(11px * var(--fs-ratio, 1));
  color: var(--text-muted);
  transition: transform 0.2s ease;
  margin-left: 6px;
  flex-shrink: 0;
}

.act-tx-card.is-expanded .act-tx-expand-btn {
  transform: rotate(180deg);
  color: var(--ms-blue);
}

.act-tx-details-drawer {
  background: var(--bg-app);
  border-top: 1px dashed var(--border-color);
  padding: 10px 12px;
  margin-top: 8px;
  border-radius: 0 0 10px 10px;
  font-size: calc(11px * var(--fs-ratio, 1));
  animation: act-slide-down 0.2s ease;
  box-sizing: border-box !important;
  width: 100% !important;
  overflow-x: auto;
}

@keyframes act-slide-down {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.act-tx-comment-box {
  background: rgba(24, 88, 212, 0.06);
  border-left: 3px solid var(--ms-blue);
  padding: 6px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: calc(11px * var(--fs-ratio, 1));
}

.act-tx-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
}

.act-tx-table th {
  text-align: left;
  font-size: calc(10px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
}

.act-tx-table td {
  padding: 6px;
  font-size: calc(11px * var(--fs-ratio, 1));
  border-bottom: 1px solid rgba(0,0,0,0.04);
  color: var(--text-primary);
}

.act-tx-table tr:last-child td {
  border-bottom: none;
}

/* ─────────────────────────────────────────────────────────────
   TEAM CHAT ROOMS & MESSAGING SYSTEM
   ───────────────────────────────────────────────────────────── */
.chat-room-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 8px;
}

.chat-room-card:active {
  transform: scale(0.98);
  background: var(--bg-app);
}

.chat-room-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1858d4, #0284c7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(18px * var(--fs-ratio, 1));
  flex-shrink: 0;
}

.chat-room-avatar.private {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.chat-room-info {
  flex: 1;
  min-width: 0;
}

.chat-room-title {
  font-weight: 700;
  font-size: calc(14px * var(--fs-ratio, 1));
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-room-preview {
  font-size: calc(12px * var(--fs-ratio, 1));
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.chat-msg-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.chat-msg-row.mine {
  align-items: flex-end;
}

.chat-msg-row.theirs {
  align-items: flex-start;
}

.chat-msg-author {
  font-size: calc(10px * var(--fs-ratio, 1));
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 2px;
  padding: 0 4px;
}

.chat-msg-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: calc(13px * var(--fs-ratio, 1));
  line-height: 1.4;
  word-break: break-word;
  position: relative;
}

.chat-msg-bubble.mine {
  background: linear-gradient(135deg, #1858d4, #0284c7);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-msg-bubble.theirs {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-msg-time {
  font-size: calc(9px * var(--fs-ratio, 1));
  opacity: 0.7;
  margin-top: 3px;
  text-align: right;
}

.offline-alert-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f59e0b;
  color: #ffffff;
  font-size: calc(11px * var(--fs-ratio, 1));
  font-weight: 700;
  padding: 6px 12px;
  animation: pulse-warn 2s infinite;
}

@keyframes pulse-warn {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}


/* ─────────────────────────────────────────────────────────────
   FONT RESIZER SHABLON (100% / +5% / +10% - CHEGARA)
   Bir chetda, ixcham, hechnarsaga xalaqit qilmaydi
   ───────────────────────────────────────────────────────────── */
.font-scale-shablon-corner {
  position: absolute;
  bottom: 90px;
  left: 10px;
  z-index: 85;
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(203, 213, 225, 0.95);
  border-radius: 14px;
  padding: 1px 3px;
  gap: 1px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  user-select: none;
}

[data-theme="dark"] .font-scale-shablon-corner {
  background: rgba(30, 41, 59, 0.94);
  border-color: rgba(71, 85, 105, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.font-scale-shablon-desktop {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 20px;
  padding: 2px 4px;
  gap: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  user-select: none;
}

.fs-shablon-icon {
  font-size: 11px;
  color: #64748b;
  padding: 0 4px 0 6px;
}

.fs-pill-btn {
  background: transparent;
  border: none;
  font-size: 10px !important;
  font-weight: 700;
  color: var(--text-secondary, #64748b);
  padding: 3px 7px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.fs-pill-btn:hover {
  color: var(--ms-blue, #1858d4);
  background: rgba(24, 88, 212, 0.08);
}

.fs-pill-btn.active {
  background: var(--ms-blue, #1858d4) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(24, 88, 212, 0.3);
}
