/*
  CS Order PRO additions on top of CS Dental PRO's browser theme (desktop-theme.css / desktop-pages.css):
  grouped menu with badges, tabs, command palette, sign-in, quick order and the Control Panel.
*/

/* ---------- shell ---------- */
.op-shell { grid-template-columns: 256px minmax(0, 1fr); }
.op-shell.op-collapsed { grid-template-columns: 84px minmax(0, 1fr); }
.op-shell .app-sidebar { width: auto; padding: 18px 10px 12px; }
.op-brand-tile { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 13px; background: var(--dp-gradient); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 0 18px rgba(var(--cs-p-light-rgb), .45); }
.op-brand-logo { width: 42px; height: 42px; flex: 0 0 42px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25)); }
.op-brand-logo.big { width: 64px; height: 64px; flex-basis: 64px; }
.cp-brand .op-brand-logo { width: 36px; height: 36px; flex-basis: 36px; }
.op-brand-tile.big { width: 56px; height: 56px; font-size: 26px; border-radius: 15px; }
.op-shell .sidebar-brand { background: transparent; margin-bottom: 8px; }
.op-shell .sidebar-nav { gap: 2px; flex: 1 1 auto; }
.op-group-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 4px; font-size: 10.5px; font-weight: 700; color: #5F7389; cursor: pointer; user-select: none; letter-spacing: .02em; }
.op-chevron { font-size: 9px; }
.op-sep { height: 1px; margin: 10px 14px; background: rgba(255, 255, 255, .08); }
.op-shell .sidebar-link { position: relative; }
.op-badge { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--dp-danger); color: #fff; font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.op-collapsed .op-badge { position: absolute; right: 6px; top: 4px; margin: 0; }
.op-collapsed .op-group-head { display: none; }
.op-user { margin-top: 8px; padding: 10px; border-radius: 14px; background: var(--dp-sidebar-card); border: 1px solid rgba(255, 255, 255, .08); }
.op-user-row { display: flex; align-items: center; gap: 10px; }
.op-avatar { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 19px; background: var(--dp-gradient); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.op-user-text { display: flex; flex-direction: column; min-width: 0; }
.op-user-text strong { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-user-text span { color: var(--dp-sidebar-text); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-user-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin-top: 8px; }
.op-icon-btn { position: relative; width: 32px; height: 32px; border: 0; border-radius: 9px; background: transparent; color: var(--dp-sidebar-text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.op-icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.op-dot { position: absolute; top: 0; right: 0; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px; background: var(--dp-danger); color: #fff; font-size: 9px; font-weight: 700; line-height: 14px; }
.app-main-wrap { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- tabs ---------- */
.op-tabbar { display: flex; align-items: flex-end; gap: 8px; padding: 10px 20px 0; border-bottom: 1px solid var(--dp-border); background: transparent; }
.op-tabbar > .dp-btn { margin-bottom: 6px; }
.op-tabbar .op-icon-btn { color: var(--dp-muted); margin-bottom: 6px; }
.op-tabs { display: flex; align-items: flex-end; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.op-tab { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 12px; margin-bottom: -1px; border: 1px solid transparent; border-bottom: 0; border-radius: 9px 9px 0 0; color: var(--dp-muted); font-size: 12.5px; cursor: pointer; white-space: nowrap; user-select: none; }
.op-tab:hover { background: var(--dp-hover); }
.op-tab.active { background: var(--dp-surface); border-color: var(--dp-border); color: var(--dp-text); font-weight: 600; }
.op-tab-title { max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.op-tab-icon { opacity: .85; font-size: 13px; }
.op-tab-close { width: 20px; height: 20px; border: 0; border-radius: 5px; background: transparent; color: var(--dp-muted); font-size: 9px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.op-tab-close:hover { background: var(--dp-danger-soft); color: var(--dp-danger); }
.op-tab-add { width: 30px; height: 30px; margin: 0 0 2px 4px; border: 0; border-radius: 8px; background: transparent; color: var(--dp-muted); cursor: pointer; flex: 0 0 auto; }
.op-tab-add:hover { background: var(--dp-primary-soft); color: var(--dp-primary); }
.op-kbd { background: #F1F5F9; border: 1px solid var(--dp-border-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; font-size: 11px; color: var(--dp-muted); font-family: inherit; }
.op-content { padding: 18px 28px 24px; min-width: 0; flex: 1 1 auto; }
.op-click-catcher { position: fixed; inset: 0; z-index: 999; }
.op-mobile-only { display: none !important; }

/* ---------- command palette ---------- */
.op-palette-overlay { position: fixed; inset: 0; z-index: 1100; background: rgba(11, 19, 36, .45); display: flex; justify-content: center; align-items: flex-start; padding: 90px 16px 16px; }
.op-palette { width: 640px; max-width: 100%; max-height: 560px; display: flex; flex-direction: column; background: var(--dp-surface); border-radius: 18px; box-shadow: var(--dp-shadow-raised); overflow: hidden; }
.op-palette-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--dp-border); color: var(--dp-primary); font-size: 18px; }
.op-palette-head input { flex: 1 1 auto; border: 0; outline: none; font-size: 16px; color: var(--dp-text); background: transparent; }
.op-palette-list { overflow: auto; padding: 8px; }
.op-palette-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.op-palette-item:hover { background: var(--dp-hover); }
.op-palette-item.selected { background: var(--dp-selection); }
.op-palette-icon { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; background: var(--dp-selection); color: var(--dp-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.op-palette-text { display: flex; flex-direction: column; min-width: 0; }
.op-palette-text strong { color: var(--dp-text); font-size: 13.5px; }
.op-palette-text small { color: var(--dp-muted); font-size: 11.5px; }

/* ---------- sign-in ---------- */
.op-loading { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.op-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--dp-bg); }
.op-login-card { width: 860px; max-width: 100%; min-height: 540px; display: grid; grid-template-columns: 360px 1fr; background: var(--dp-surface); border-radius: 20px; box-shadow: var(--dp-shadow-raised); overflow: hidden; }
.op-login-brand { padding: 36px; color: #fff; background: linear-gradient(135deg, #0A1424 0%, var(--cs-p-deep) 55%, var(--cs-p) 100%); display: flex; flex-direction: column; }
.op-login-brand h1 { margin: 22px 0 0; font-size: 30px; font-weight: 700; color: #fff; }
.op-login-brand p { margin: 8px 0 0; color: var(--cs-p-tint); font-size: 14px; }
.op-login-notes { margin-top: auto; display: grid; gap: 6px; color: var(--cs-p-tint); font-size: 12px; }
.op-login-form { padding: 0 56px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.op-login-form h2 { margin: 0; font-size: 26px; font-weight: 600; }
.op-login-form .dp-field input { height: 42px; }
.op-login-submit { height: 44px; font-size: 14px; }

/* ---------- small pieces ---------- */
.op-row-actions { border-bottom: 1px solid var(--dp-border); }
.op-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.op-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.op-tile { padding: 14px 16px; border-radius: 14px; background: var(--dp-surface); border: 1px solid var(--dp-border); box-shadow: var(--dp-shadow-soft); }
.op-tile span { display: block; font-size: 12px; color: var(--dp-muted); }
.op-tile strong { display: block; font-size: 22px; font-weight: 700; margin-top: 2px; }
.op-tile small { color: var(--dp-muted); }
.op-tile.danger strong { color: var(--dp-danger); }
.op-tile.success strong { color: var(--dp-success); }
.op-tile.warning strong { color: var(--dp-warning); }
.op-section-title { margin: 18px 0 8px; font-size: 15px; font-weight: 700; }
.op-modal-overlay { position: fixed; inset: 0; z-index: 1050; background: rgba(11, 19, 36, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.op-modal { width: 560px; max-width: 100%; max-height: calc(100vh - 32px); overflow: auto; background: var(--dp-surface); border-radius: 16px; box-shadow: var(--dp-shadow-raised); }
.op-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--dp-border); }
.op-modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.op-modal-body { padding: 16px 18px; display: grid; gap: 12px; }
.op-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--dp-border); }
.op-iframe { width: 100%; height: calc(100vh - 170px); border: 1px solid var(--dp-border); border-radius: 14px; background: #fff; }

/* ---------- quick order (OMS «Արագ պատվեր») ---------- */
.qo { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.qo-client { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; }
.qo-client .qo-client-copy { flex: 1 1 auto; min-width: 0; }
.qo-client small { display: block; color: var(--dp-muted); font-size: 11px; }
.qo-client strong { display: block; font-size: 17px; }
.qo-client .muted { color: var(--dp-muted); font-size: 12.5px; }
.qo-client .debt { color: var(--dp-danger); font-weight: 600; }
.qo-client .action { color: var(--dp-primary); font-weight: 600; }
.qo-search { position: relative; margin: 12px 0 8px; }
.qo-search input { width: 100%; height: 42px; padding: 0 12px 0 36px; border: 1px solid var(--dp-border-strong); border-radius: 11px; font-size: 14px; background: var(--dp-surface); }
.qo-search input:focus { outline: none; border-color: var(--dp-primary); box-shadow: 0 0 0 3px rgba(var(--cs-p-rgb), .18); }
.qo-search .glyph { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--dp-muted); }
.qo-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 92px; overflow: auto; }
.qo-chip { border: 1px solid var(--dp-border-strong); background: var(--dp-surface); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--dp-text); cursor: pointer; white-space: nowrap; }
.qo-chip.active { background: var(--dp-gradient); border-color: transparent; color: #fff; }
.qo-head { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 8px; }
.qo-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.qo-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.qo-products.cards { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.qo-products.list { grid-template-columns: 1fr; gap: 0; background: var(--dp-surface); border: 1px solid var(--dp-border); border-radius: 14px; overflow: hidden; }
.qo-product { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--dp-surface); border: 1px solid var(--dp-border); border-radius: 14px; box-shadow: var(--dp-shadow-soft); min-width: 0; }
.qo-product.in-cart { border-color: var(--dp-primary); }
.qo-product.blocked { background: #F8FAFC; cursor: default; }
.qo-product.blocked .qo-name, .qo-product.blocked .qo-price { color: var(--dp-muted); }
.qo-product.blocked .qo-stock { color: var(--dp-danger); font-weight: 600; }
.qo-plus:disabled, .qo-step:disabled { opacity: .35; cursor: not-allowed; }
.qo-products.cards .qo-product { flex-direction: column; align-items: stretch; }
.qo-products.list .qo-product { border: 0; border-bottom: 1px solid var(--dp-border); border-radius: 0; box-shadow: none; padding: 8px 12px; }
.qo-img { width: 84px; height: 84px; flex: 0 0 84px; border-radius: 10px; background: var(--dp-surface-alt); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--dp-border-strong); font-size: 28px; }
.qo-products.cards .qo-img { width: 100%; height: 130px; flex-basis: auto; }
.qo-products.list .qo-img { width: 40px; height: 40px; flex-basis: 40px; font-size: 16px; }
.qo-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.qo-info { flex: 1 1 auto; min-width: 0; }
.qo-name { font-weight: 600; font-size: 13.5px; line-height: 1.3; max-height: 2.6em; overflow: hidden; }
.qo-price { font-size: 13px; }
.qo-price small { color: var(--dp-muted); }
.qo-stock { font-size: 11.5px; color: var(--dp-success); }
.qo-stock.out { color: var(--dp-danger); }
.qo-expiry { font-size: 11.5px; color: var(--dp-muted); }
.qo-expiry.warn { color: var(--dp-warning); font-weight: 600; }
.qo-expiry.danger { color: var(--dp-danger); font-weight: 600; }
.qo-qty { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.qo-qty input { width: 54px; height: 34px; text-align: center; border: 1px solid var(--dp-border-strong); border-radius: 9px; }
.qo-plus { width: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--dp-gradient); color: #fff; font-size: 20px; cursor: pointer; flex: 0 0 auto; }
.qo-step { width: 32px; height: 34px; border: 1px solid var(--dp-border-strong); border-radius: 9px; background: var(--dp-surface); font-size: 16px; cursor: pointer; }
.qo-step.plus { background: var(--dp-gradient); color: #fff; border-color: transparent; }
.qo-more { display: flex; justify-content: center; margin: 12px 0; }
.qo-panel { position: sticky; top: 8px; display: flex; flex-direction: column; max-height: calc(100vh - 110px); padding: 16px; }
.qo-panel h3 { margin: 0; font-size: 17px; font-weight: 700; }
.qo-lines { flex: 1 1 auto; overflow: auto; margin: 10px 0; display: grid; gap: 8px; align-content: start; }
.qo-line { display: flex; align-items: center; gap: 6px; }
.qo-line .qo-line-info { flex: 1 1 auto; min-width: 0; font-size: 12.5px; }
.qo-line .qo-line-info strong { display: block; }
.qo-line .qo-line-info small { color: var(--dp-muted); }
.qo-line input { width: 54px; height: 30px; text-align: center; border: 1px solid var(--dp-border-strong); border-radius: 8px; }
.qo-x { width: 28px; height: 28px; border: 1px solid #FECDD3; border-radius: 8px; background: transparent; color: var(--dp-danger); cursor: pointer; }
.qo-summary { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; color: var(--dp-muted); }
.qo-summary strong { color: var(--dp-text); font-size: 18px; }
.qo-warn { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--dp-warning-soft); color: var(--dp-warning); font-size: 12.5px; }
.qo-success { position: fixed; inset: 0; z-index: 1050; background: rgba(11, 19, 36, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.qo-success-card { width: 620px; max-width: 100%; padding: 32px; text-align: center; background: var(--dp-surface); border-radius: 18px; box-shadow: var(--dp-shadow-raised); }
.qo-success-icon { width: 64px; height: 64px; margin: 0 auto; border-radius: 32px; background: var(--dp-success-soft); color: var(--dp-success); font-size: 30px; display: flex; align-items: center; justify-content: center; }
.qo-success-card h2 { margin: 12px 0 4px; font-size: 22px; font-weight: 700; }
.qo-success-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.qo-picker-item { width: 100%; text-align: left; border: 1px solid var(--dp-border); border-radius: 12px; background: var(--dp-surface); padding: 10px 12px; cursor: pointer; }
.qo-picker-item:hover, .qo-picker-item.selected { background: var(--dp-selection); border-color: var(--dp-primary); }
.qo-picker-item strong { display: block; }
.qo-picker-item small { display: block; color: var(--dp-muted); }

/* ---------- control panel (OMS cp-*) ---------- */
.cp { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 18px; align-items: start; }
.cp-nav { position: sticky; top: 8px; padding: 14px 8px 12px 12px; max-height: calc(100vh - 110px); overflow: auto; }
.cp-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cp-brand .op-brand-tile { width: 36px; height: 36px; flex-basis: 36px; font-size: 16px; }
.cp-brand strong { display: block; font-size: 14px; }
.cp-brand small { display: block; color: var(--dp-muted); font-size: 11px; }
.cp-section-label { margin: 12px 0 4px 6px; font-size: 10.5px; font-weight: 700; color: var(--dp-muted); text-transform: uppercase; }
.cp-link { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 9px; color: var(--dp-text); text-decoration: none; font-size: 13px; cursor: pointer; }
.cp-link:hover { background: var(--dp-hover); color: var(--dp-text); }
.cp-link.active { background: var(--dp-selection); color: var(--dp-primary-hover); font-weight: 600; }
.cp-link.danger { color: var(--dp-danger); }
.cp-link .glyph { width: 22px; color: var(--dp-muted); }
.cp-status { display: flex; flex-wrap: wrap; gap: 14px; margin: 16px 0 6px; }
.cp-status-card { width: 262px; padding: 12px 16px; border-radius: 14px; background: var(--dp-surface); border: 1px solid var(--dp-border); box-shadow: var(--dp-shadow-soft); }
.cp-status-card span { display: block; font-size: 10.5px; font-weight: 700; color: var(--dp-muted); text-transform: uppercase; }
.cp-status-card strong { display: block; font-size: 18px; margin-top: 4px; }
.cp-status-card.ok strong { color: var(--dp-success); }
.cp-status-card.bad { background: var(--dp-danger-soft); border-color: var(--dp-danger); }
.cp-status-card.bad strong { color: var(--dp-danger); }
.cp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 12px; }
.cp-card { display: flex; gap: 12px; padding: 16px; min-height: 108px; border-radius: 14px; background: var(--dp-surface); border: 1px solid var(--dp-border); box-shadow: var(--dp-shadow-soft); color: var(--dp-text); text-decoration: none; cursor: pointer; }
.cp-card:hover { border-color: var(--dp-primary); color: var(--dp-text); }
.cp-card.danger { border-color: var(--dp-danger-soft); }
.cp-card-ico { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; background: var(--dp-selection); color: var(--dp-primary); display: flex; align-items: center; justify-content: center; font-size: 17px; }
.cp-card.danger .cp-card-ico { background: var(--dp-danger-soft); color: var(--dp-danger); }
.cp-card small.sec { display: block; font-size: 10px; font-weight: 700; color: var(--dp-muted); text-transform: uppercase; }
.cp-card strong { display: block; font-size: 14px; margin: 2px 0; }
.cp-card.danger strong { color: var(--dp-danger); }
.cp-card small.desc { display: block; font-size: 12px; color: var(--dp-muted); }

@media (max-width: 1100px) {
    .qo { grid-template-columns: minmax(0, 1fr); }
    .qo-panel { position: static; max-height: none; }
    .cp { grid-template-columns: minmax(0, 1fr); }
    .cp-nav { position: static; max-height: 260px; }
}
@media (max-width: 860px) {
    .op-shell, .op-shell.op-collapsed { grid-template-columns: minmax(0, 1fr); }
    .op-shell .app-sidebar { position: fixed; left: -280px; width: 256px; transition: left .2s ease; }
    .op-shell .app-sidebar.mobile-open { left: 0; }
    .op-mobile-only { display: inline-flex !important; }
    .op-desktop-only { display: none !important; }
    .op-content { padding: 12px; }
    .op-login-card { grid-template-columns: 1fr; }
    .op-login-brand { display: none; }
    .op-login-form { padding: 28px; }
}

/* A search box outside a toolbar must not grow vertically (dp-page is a column flexbox). */
.dp-page > .dp-search, .cp-nav .dp-search { flex: 0 0 auto; }

.op-json { max-height: 220px; overflow: auto; margin: 0; padding: 10px; border-radius: 10px; background: var(--dp-surface-alt); border: 1px solid var(--dp-border); font-size: 12px; white-space: pre-wrap; word-break: break-word; }

/* ---------- map (map.js) ---------- */
.op-map { position: relative; overflow: hidden; height: 460px; background: #e8ecef; border-radius: 10px; cursor: grab; touch-action: none; user-select: none; }
.op-map:active { cursor: grabbing; }
.op-map-tiles img { position: absolute; width: 256px; height: 256px; pointer-events: none; }
.op-map-lines { position: absolute; left: 0; top: 0; pointer-events: none; }
.op-map-pins { position: absolute; inset: 0; pointer-events: none; }
.op-map-pin { position: absolute; transform: translate(-50%, -50%); min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; border: 2px solid #fff; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer; pointer-events: auto; }
.op-map-attr { position: absolute; right: 0; bottom: 0; padding: 1px 6px; font-size: 10px; background: rgba(255,255,255,.8); color: #333; }
.op-map-zoom { position: absolute; left: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; }
.op-map-zoom button { width: 30px; height: 30px; border: 1px solid var(--dp-border-strong); border-radius: 7px; background: var(--dp-surface); font-size: 16px; cursor: pointer; }
.op-map-tip { position: absolute; transform: translate(-50%, calc(-100% - 16px)); max-width: 260px; padding: 7px 10px; border-radius: 8px; background: var(--dp-surface); color: var(--dp-text); box-shadow: 0 4px 14px rgba(0,0,0,.2); font-size: 12px; pointer-events: none; }
.op-map-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.op-map-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.op-map-legend i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }

/* a locked map (order card): a picture of the place — no zoom buttons, no dragging, the page scrolls over it */
.op-map.op-map-locked { touch-action: auto; cursor: default; }
.op-map.op-map-locked .op-map-zoom { display: none; }
/* ---------- order place (OMS orders/partials/location) ---------- */
.op-order-place { margin-top: 14px; }
.op-order-place-title { margin: 0 0 12px; font-size: 1.1rem; }
.op-order-place-map { border-radius: 8px; overflow: hidden; border: 1px solid var(--dp-border); }
.op-order-place-info { margin-top: 12px; display: grid; gap: 4px; font-size: .9rem; color: var(--dp-muted); }
.op-order-place-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- narrow screens (phones, small tablets): side-by-side layouts stack, wide tables scroll ---------- */
@media (max-width: 860px) {
    [style*="grid-template-columns:minmax(0,1fr) 320px"],
    [style*="grid-template-columns:minmax(0,1fr) 420px"],
    [style*="grid-template-columns:minmax(220px,300px) 1fr"],
    [style*="grid-template-columns:3fr 2fr"] { grid-template-columns: minmax(0, 1fr) !important; }
    /* the in-app navigation dialog: map on top, route below, the whole sheet scrolls */
    .dp-card[style*="grid-template-columns:minmax(0,1fr) 320px"],
    .dp-card[style*="grid-template-columns:3fr 2fr"] { grid-template-rows: 46vh auto; overflow: auto; width: 100vw !important; height: 100dvh !important; border-radius: 0; padding: 14px !important; }
    .dp-card-body > table, .dp-card > table { display: block; overflow-x: auto; max-width: 100%; min-width: 0 !important; }
    /* a title with its buttons: the buttons drop below the title instead of running off the screen */
    .op-head-row { flex-wrap: wrap; }
    .op-head-row > .dp-btn { white-space: normal; height: auto; min-height: 34px; }
}

/* Live-update toasts (bottom right), coloured by kind: new / info / alert. */
#op-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.op-toast { position: relative; background: #fff; border: 1px solid var(--dp-border, #e2e8f0); border-left: 4px solid var(--cs-p, #0D9488); border-radius: 10px; padding: 10px 30px 10px 12px; box-shadow: 0 8px 24px rgba(15, 23, 42, .16); cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-size: 13px; transition: opacity .35s, transform .35s; animation: op-toast-in .25s ease-out; }
.op-toast strong { color: #0f172a; font-size: 13.5px; }
.op-toast span { color: #475569; }
.op-toast.alert { border-left-color: var(--dp-danger, #dc2626); }
.op-toast.info { border-left-color: #2563eb; }
.op-toast.gone { opacity: 0; transform: translateX(20px); }
.op-toast-x { position: absolute; top: 4px; right: 6px; border: 0; background: transparent; font-size: 18px; line-height: 1; color: #94a3b8; cursor: pointer; }
@keyframes op-toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.op-icon-btn.op-muted { color: var(--dp-danger, #dc2626); }

/* ---------- comfort: search clear button, empty-result action, pager ---------- */
.dp-search input { padding-right: 34px; }
.dp-search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--dp-muted); cursor: pointer; font-size: 13px; }
.dp-search-clear:hover { background: var(--dp-surface-alt); color: var(--dp-text, #0f172a); }
.dp-empty-action { display: flex; justify-content: center; padding: 0 0 18px; }
.dp-pager span { margin-right: auto; }
@media (max-width: 620px) { .dp-pager { flex-wrap: wrap; } .dp-pager span { flex-basis: 100%; } }
/* Fingers need bigger targets than a mouse pointer. */
@media (hover: none) and (pointer: coarse) {
    .dp-btn { min-height: 40px; }
    .dp-pager .dp-btn { height: 40px; min-width: 44px; }
    table.dp-grid tbody td { padding-top: 12px; padding-bottom: 12px; }
    .dp-search input, .dp-field input, .dp-field select, .dp-field textarea, select, input[type=date] { min-height: 42px; font-size: 16px; }
}

/* ---------- quick order comfort ---------- */
.qo-search input { padding-right: 36px; }
.qo-keys { font-size: 11.5px; color: var(--dp-muted); margin: -2px 0 8px 2px; }
@media (hover: none) { .qo-keys { display: none; } }
.qo-product:not(.in-cart) { cursor: pointer; }
.qo-product:not(.in-cart):hover { border-color: var(--dp-primary); }
.qo-line-qty { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; }
.qo-line-qty input { width: 48px; height: 30px; text-align: center; border: 1px solid var(--dp-border-strong); border-radius: 8px; }
.qo-line-qty .qo-step { width: 28px; height: 30px; font-size: 14px; }
.qo-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qo-sheet-grip, .qo-sheet-close, .qo-sheet-shade { display: none; }
.qo-mobilebar { display: none; }
@media (max-width: 860px) {
    .qo-mobilebar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 960; /* above the order sheet: it opens and closes it */ gap: 10px; align-items: center;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--dp-surface, #fff); border-top: 1px solid var(--dp-border); box-shadow: 0 -6px 18px rgba(15, 23, 42, .08); }
    .qo-mobilebar-sum { flex: 1 1 auto; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; padding: 0; text-align: left; color: inherit; min-width: 0; }
    .qo-mobilebar-copy { display: flex; flex-direction: column; min-width: 0; }
    .qo-mobilebar-sum small { color: var(--dp-muted); font-size: 12px; }
    .qo-mobilebar-sum strong { font-size: 18px; }
    .qo-mobilebar .dp-btn.primary { height: 48px; padding: 0 24px; font-size: 15px; }
    .qo { padding-bottom: 84px; }

    /* 4.0 phones: the current order is a sheet that slides up over the catalogue (it was far below it). */
    .qo-cart-badge { position: relative; width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px; background: var(--dp-surface-alt); display: flex; align-items: center; justify-content: center; font-size: 20px; }
    .qo-cart-badge b { position: absolute; top: -5px; right: -5px; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 11px; background: var(--dp-muted); color: #fff; font-size: 12px; line-height: 21px; text-align: center; }
    .qo-cart-badge.on b { background: var(--dp-primary); }
    .qo-panel { position: fixed; left: 0; right: 0; top: auto; bottom: 0; z-index: 950; max-height: calc(100dvh - 70px); margin: 0; border-radius: 18px 18px 0 0;
        padding: 6px 16px calc(84px + env(safe-area-inset-bottom)); overflow: auto; transform: translateY(105%); transition: transform .22s ease; box-shadow: 0 -12px 32px rgba(15, 23, 42, .18); visibility: hidden; }
    .qo-panel.open { transform: none; visibility: visible; }
    .qo-sheet-shade { display: block; position: fixed; inset: 0; z-index: 940; background: rgba(15, 23, 42, .45); }
    .qo-sheet-grip { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--dp-border-strong); margin: 4px auto 10px; cursor: pointer; }
    .qo-sheet-close { display: inline-flex; }
    .qo-lines { overflow: visible; }
    .qo-line { padding: 6px 0; border-bottom: 1px solid var(--dp-border); }
    .qo-line .qo-line-info { font-size: 13.5px; }

    /* The search and the sections stay at the top while the catalogue scrolls (clip, unlike hidden, lets them stick). */
    .app-main-wrap { overflow: clip; }
    .qo-sticky { position: sticky; top: 0; z-index: 20; background: var(--dp-bg, var(--dp-surface-alt)); margin: 0 -4px; padding: 2px 4px 6px; }
    .qo-search { margin: 8px 0 6px; }
    .qo-search input { height: 46px; font-size: 16px; /* 16px: phones do not zoom in on the box */ }
    .qo-chips { flex-wrap: nowrap; overflow-x: auto; max-height: none; padding-bottom: 2px; scrollbar-width: none; }
    .qo-chips::-webkit-scrollbar { display: none; }
    .qo-chip { padding: 8px 14px; }
    .qo-head { margin: 8px 0 6px; gap: 8px; }
    .qo-head h3 { font-size: 14px; }
    .qo-client { padding: 10px 12px; }
    .qo-client strong { font-size: 16px; }

    /* Compact product rows: more of the catalogue on the screen, big + / − buttons. */
    .qo-products { grid-template-columns: 1fr; gap: 8px; }
    .qo-product { padding: 10px; gap: 10px; }
    .qo-img { width: 56px; height: 56px; flex-basis: 56px; font-size: 20px; }
    .qo-products.list .qo-product { padding: 10px 12px; }
    .qo-products.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .qo-products.cards .qo-img { height: 110px; }
    .qo-name { font-size: 14px; }
    .qo-price { font-size: 14px; }
    .qo-product .qo-qty input { width: 50px; }
    .op-modal .qo-search input { font-size: 16px; }
    .op-modal textarea, .op-modal input, .op-modal select { font-size: 16px; }
}
@media (hover: none) and (pointer: coarse) {
    .qo-step { width: 40px; height: 40px; }
    .qo-qty input, .qo-line-qty input { height: 40px; width: 56px; font-size: 16px; }
    .qo-line-qty .qo-step { width: 36px; height: 38px; }
    .qo-plus { min-width: 44px; min-height: 44px; }
}

/* No connection to the API server (3.7.4): the session is kept, «Վերամիանալ» tries again */
.op-offline { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--dp-warning-soft); color: #7C2D12; border-bottom: 1px solid var(--dp-border); font-size: 13px; }
.op-offline > span { flex: 1; }
.op-offline .glyph { color: var(--dp-warning); }
