/* Shared phone/tablet presentation. Business values and desktop layouts stay in their modules. */
.nb-mobile-menu-toggle { display: none; }
.nb-mobile-inline-controls { display: none; }

@media (max-width: 900px) {
  html, html.compact-workspace { zoom: 1; -webkit-text-size-adjust: 100%; }
  body, html.compact-workspace body { width: 100%; min-width: 0; min-height: 100dvh; overflow: auto; }
  .app, html.compact-workspace .app { width: 100%; min-width: 0; max-width: none; min-height: 0; max-height: none; margin-left: 0; padding: 12px; overflow: visible; }
  #view, #view > *, .card, .unit-store-card, .delivery-store-card, .finance-store-card { min-width: 0; max-width: 100%; }

  .sidebar, html.compact-workspace .sidebar {
    position: sticky; inset: auto; top: 0; z-index: 35; width: 100%; min-height: 0;
    padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line);
    overflow: visible; background: var(--bg); box-shadow: 0 5px 20px rgba(24, 64, 110, .09);
  }
  body.theme-light .sidebar { background: rgba(246, 251, 255, .98); }
  .sidebar .brand { display: flex; align-items: center; gap: 8px; margin: 0; }
  .sidebar .brand > div:nth-child(2) { flex: 1; min-width: 0; }
  .brand-mark { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 11px; font-size: 12px; }
  .brand-title { font-size: 16px; line-height: 1.15; }
  .brand-sub { font-size: 10px; line-height: 1.25; }
  .nb-mobile-menu-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    max-width: 125px; min-height: 44px; padding: 8px 10px; flex: 0 0 auto;
    border: 1px solid var(--line); border-radius: 12px; color: var(--text);
    background: var(--panel); font: inherit; font-size: 12px; font-weight: 750; cursor: pointer;
  }
  .nb-mobile-menu-icon { font-size: 17px; }
  .nb-mobile-menu-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.theme-light .nb-mobile-menu-toggle { background: white; }
  .sidebar #nav { display: none; }
  .sidebar .account-status-card { display: none; }
  .sidebar.mobile-nav-open { max-height: 90dvh; overflow-y: auto; }
  .sidebar.mobile-nav-open #nav {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
    max-height: 54dvh; overflow: auto; margin: 10px 0 0; padding: 0;
  }
  .sidebar.mobile-nav-open .account-status-card { display: block; margin: 10px 0 0; padding: 10px; }
  .sidebar #nav .nav-btn {
    width: 100%; min-width: 0; max-width: none; height: auto; min-height: 44px;
    padding: 8px; gap: 7px; border-radius: 12px; font-size: 12px; text-align: left;
  }
  .sidebar #nav .nav-btn span:last-child { white-space: normal; overflow: visible; line-height: 1.25; }
  .sidebar #nav .nav-icon { width: 26px; height: 26px; flex: 0 0 26px; font-size: 9px; border-radius: 9px; }
  .nav-btn:hover { transform: none; }

  .topbar, body.theme-light .topbar {
    position: static; display: flex; flex-direction: column; align-items: stretch;
    width: 100%; margin: 0 0 14px; padding: 0; gap: 9px; background: transparent; border: 0; backdrop-filter: none;
  }
  .topbar h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.4px; }
  .topbar p { display: none; }
  .top-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 6px; width: 100%; padding: 0; overflow: visible; }
  .top-actions .profile-chip { order: 0; flex: 1 0 calc(100% - 52px); max-width: none; min-width: 0; min-height: 44px; margin: 0; padding: 6px 10px; gap: 8px; border-radius: 14px; }
  .profile-neuro-loader { width: 30px; height: 30px; flex-basis: 30px; }
  .profile-chip-text { min-width: 0; line-height: 1.2; }
  .profile-chip-text strong { font-size: 14px; overflow-wrap: anywhere; }
  .profile-chip-text small { font-size: 11px; }
  .top-actions .section-help-btn { order: 1; width: 44px; height: 44px; flex: 0 0 44px; margin: 0; }
  .top-actions .global-tariffs-btn { order: 2; min-width: 74px; width: auto; min-height: 44px; padding: 6px 9px; gap: 5px; border-radius: 12px; font-size: 12px; }
  .global-tariffs-icon { width: 23px; height: 23px; font-size: 14px; }
  .top-actions .global-telegram-btn { order: 3; width: 44px; height: 44px; flex: 0 0 44px; }
  .top-actions .global-ai-btn { order: 4; width: 44px; height: 44px; min-width: 44px; padding: 0; }
  .top-actions #refreshBtn { order: 5; }
  .top-actions #logoutBtn { order: 6; }
  .top-actions #returnAdminBtn { order: 7; position: static; top: auto; left: auto; transform: none; flex: 1 0 100%; width: 100%; margin: 0; }
  .top-actions .admin-favorites-quick { order: 8; max-width: 100%; width: 100%; flex-basis: 100%; margin: 0; overflow-x: auto; }
  .top-actions .glass-btn { width: auto; min-width: 0; min-height: 44px; padding: 8px 10px; font-size: 12px; border-radius: 12px; }
  .status-dot { display: none; }

  .card { padding: 14px; border-radius: 18px; }
  .card h2 { font-size: 20px; line-height: 1.25; }
  .card h3 { font-size: 17px; line-height: 1.3; }
  .card-head, .admin-hero, .admin-toolbar, .delivery-page-head { align-items: stretch; flex-direction: column; gap: 10px; }
  .card-head > *, .admin-toolbar > * { min-width: 0; max-width: 100%; }
  .toolbar, .toolbar-actions, .unit-page-actions, .unit-store-toolbar, .finance-store-actions, .delivery-head-actions {
    display: flex; flex-wrap: wrap; gap: 7px; max-width: 100%; min-width: 0; justify-content: flex-start; overflow: visible;
  }
  .glass-btn, .glass-btn.small, .icon-gear-btn, .admin-tab { min-height: 44px; padding: 9px 12px; font-size: 13px; }
  .toolbar select, .toolbar input { min-width: 0; max-width: 100%; }
  .purchase-price-toolbar { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .purchase-price-toolbar > * { width: 100%; min-width: 0; }
  .purchase-price-toolbar #purchasePriceAccount { grid-column: 1 / -1; }
  .purchase-price-toolbar .glass-btn { white-space: normal; line-height: 1.3; text-align: center; }
  .toolbar-grid, .form-grid, .two-col, .settings-mini-grid { grid-template-columns: minmax(0, 1fr) !important; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: 44px; max-width: 100%; font-size: 16px; }
  input[type="checkbox"], input[type="radio"] { min-height: 0; width: 18px; height: 18px; flex: 0 0 18px; }
  label { min-width: 0; }
  .kpi-grid, .admin-kpis.kpi-grid, .delivery-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .kpi { padding: 13px; min-height: 94px; }
  .kpi-label, .kpi-foot { font-size: 12px; line-height: 1.35; }
  .kpi-value, .delivery-kpi-card strong { font-size: clamp(20px, 5.8vw, 27px); line-height: 1.15; overflow-wrap: anywhere; }
  .delivery-kpi-card { min-width: 0; padding: 14px; min-height: 110px; }
  .delivery-kpi-card span, .delivery-kpi-card small { line-height: 1.35; font-size: 12px; }
  .delivery-kpi-icon { width: 30px; height: 30px; font-size: 11px; }
  .delivery-store-grid, .dashboard-stock-list, .settings-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .delivery-mini-stats { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .dashboard-stock-row, .dashboard-stock-metrics { min-width: 0; }
  .dashboard-chart-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .dashboard-month-picker { min-width: 0; width: 100%; }
  .dashboard-month-picker select { width: 100%; }
  .dashboard-stock-title { flex-direction: column; align-items: flex-start; gap: 4px; }
  .dashboard-stock-title span { max-width: 100%; font-size: 11px; }
  .dashboard-stock-row { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
  .dashboard-stock-metrics, .dashboard-stock-metrics.split { grid-template-columns: repeat(2, minmax(0, 1fr)); justify-items: stretch; width: 100%; gap: 8px; }
  .dashboard-stock-metric-group { min-width: 0; justify-items: start; text-align: left; }
  .dashboard-stock-metrics b { font-size: 17px; overflow-wrap: anywhere; }
  .finance-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-summary-grid strong { font-size: 18px; overflow-wrap: anywhere; }
  .finance-month-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .finance-month-metrics strong { font-size: 15px; overflow-wrap: anywhere; }
  .finance-monthly-launch { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .finance-monthly-launch > button { min-width: 0; width: 100%; }
  .finance-report-head > *, .finance-store-head > * { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .finance-store-head, .finance-report-head, .unit-store-head, .delivery-store-head { flex-wrap: wrap; gap: 9px; padding: 12px; }
  .finance-store-head h2, .unit-store-head h3, .delivery-store-head h2 { font-size: 18px; }
  .admin-tabs { max-width: 100%; gap: 5px; }
  .admin-tab { flex: 1 1 auto; padding: 8px; font-size: 12px; }
  .guest-plan-card { gap: 10px; padding: 14px; }
  .guest-plan-card h2 { margin: 4px 0; }
  .guest-plan-card p { font-size: 13px; line-height: 1.5; }

  .card:has(.table), .card:has(.chart), .unit-store-card { overflow: visible; }
  .nb-mobile-data-scroll { display: block; width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: thin; }
  .nb-mobile-data-scroll:focus-visible { outline: 2px solid #258dff; outline-offset: 2px; }
  .nb-mobile-table-scroll::before { content: "↔ Прокрутите таблицу влево или вправо"; display: block; position: sticky; left: 0; width: 100%; margin: 5px 0 9px; color: var(--muted); font-size: 11px; line-height: 1.4; }
  .nb-mobile-table-scroll[data-editable="true"]::before { content: "↔ Прокрутка влево и вправо. Для правки нажмите на значение."; }
  .nb-mobile-table-scroll table { width: 100%; min-width: 100%; font-size: 13px; }
  .nb-mobile-table-scroll[data-wide="true"] table { min-width: 640px; }
  .nb-mobile-table-scroll table th, .nb-mobile-table-scroll table td { padding: 10px 9px; line-height: 1.35; }
  .nb-mobile-table-scroll table th { font-size: 11px; white-space: normal; }
  .nb-mobile-table-scroll[data-sticky-name="true"] table th:first-child,
  .nb-mobile-table-scroll[data-sticky-name="true"] table td:first-child { position: sticky; left: 0; z-index: 2; min-width: 170px; max-width: 220px; white-space: normal; background: var(--panel-strong); }
  body.theme-light .nb-mobile-table-scroll[data-sticky-name="true"] table th:first-child,
  body.theme-light .nb-mobile-table-scroll[data-sticky-name="true"] table td:first-child { background: #f5f9ff; box-shadow: 1px 0 0 rgba(70, 112, 168, .15); }
  .nb-mobile-table-scroll .product-name-cell { min-width: 170px; }
  .nb-mobile-table-scroll .item { grid-template-columns: 34px minmax(0, 1fr) !important; gap: 7px; }
  .nb-mobile-table-scroll .thumb { width: 34px; height: 34px; }
  .nb-mobile-table-scroll .row-actions { flex-wrap: nowrap; }
  details:not([open]) > .nb-mobile-data-scroll { display: none; }
  .nb-mobile-inline-controls { display: flex; gap: 6px; margin-top: 6px; }
  .nb-mobile-inline-controls .glass-btn { min-height: 44px; padding: 8px; font-size: 12px; }
  .nb-mobile-table-scroll[data-admin-cards="true"] { overflow: visible; }
  .nb-mobile-table-scroll[data-admin-cards="true"]::before { display: none; }
  .nb-mobile-table-scroll[data-admin-cards="true"] table { display: block; width: 100%; min-width: 0; }
  .nb-mobile-table-scroll[data-admin-cards="true"] thead { display: none; }
  .nb-mobile-table-scroll[data-admin-cards="true"] tbody { display: grid; gap: 12px; }
  .nb-mobile-table-scroll[data-admin-cards="true"] tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; }
  .nb-mobile-table-scroll[data-admin-cards="true"] td { width: auto; min-width: 0; max-width: 100%; padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
  .nb-mobile-table-scroll[data-admin-cards="true"] td::before { content: attr(data-mobile-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
  .nb-mobile-table-scroll[data-admin-cards="true"] td[data-mobile-title="true"] { order: -1; grid-column: 1 / -1; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .nb-mobile-table-scroll[data-admin-cards="true"] td[data-mobile-title="true"]::before { display: none; }
  .nb-mobile-table-scroll[data-admin-cards="true"] td[data-mobile-full="true"] { grid-column: 1 / -1; }
  .nb-mobile-table-scroll[data-admin-cards="true"] td:last-child > div { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; min-width: 0; }
  .nb-mobile-table-scroll[data-admin-cards="true"] td:last-child button { min-height: 44px; flex: 1 1 auto; }
  .nb-mobile-table-scroll[data-admin-cards="true"] td[data-mobile-title="true"] button { min-height: 44px; }
  .nb-mobile-table-scroll[data-admin-cards="true"] .admin-favorite-btn { min-width: 44px; flex: 0 0 44px; }
  .nb-mobile-chart-scroll { margin-top: 8px; }
  .nb-mobile-chart-scroll .chart { min-width: 720px; height: 250px; }
  .nb-mobile-chart-scroll .bar-day { height: 195px; }
  .nb-mobile-chart-scroll .bar-value { font-size: 11px; }
  .nb-mobile-chart-scroll .day-label { font-size: 10px; }
  .delivery-product-list { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .product360-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product360-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .product360-head-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .product360-head-metrics span { min-width: 0; padding: 9px 5px; }
  .product360-sidebar, .product360-list-item, .product360-hero-main { min-width: 0; }
  .product360-list { max-height: 300px; }
  .product360-filters { grid-template-columns: minmax(0, 1fr); }
  .product360-hero-card { grid-template-columns: 68px minmax(0, 1fr); gap: 10px; }
  .product360-hero-photo { width: 68px; height: 68px; }
  .product360-hero-main h2 { font-size: 17px; overflow-wrap: anywhere; }
  .product360-list-open, .product360-list-ai { min-height: 44px; }
  .product360-checks { grid-template-columns: minmax(0, 1fr); }
  .product360-checks > div { min-width: 0; grid-template-columns: 24px minmax(0, 1fr); }
  .product360-checks strong, .product360-checks small { overflow-wrap: anywhere; }
  .global-ai-panel button { min-height: 44px; }

  .ozon-fbo-stock-card .card-head h2 { font-size: 18px; }
  .ozon-fbo-content-head { flex-wrap: wrap; gap: 8px; }
  .ozon-fbo-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 10px 10px; gap: 7px; }
  .ozon-fbo-metric { min-width: 0; padding: 10px; }
  .ozon-fbo-metric span { font-size: 12px; line-height: 1.3; }
  .ozon-fbo-metric b { font-size: 20px; }
  .ozon-fbo-account > summary, .ozon-fbo-product > summary, .ozon-fbo-cluster > summary { flex-wrap: wrap; padding: 11px; gap: 8px; }
  .ozon-fbo-account-counts { width: 100%; margin-left: 0; white-space: normal; }
  .ozon-fbo-product-main { flex: 1 0 100%; min-width: 0; }
  .ozon-fbo-product-main > span { min-width: 0; overflow-wrap: anywhere; }
  .ozon-fbo-product-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; margin-left: 0; gap: 6px; }
  .ozon-fbo-product-metrics span { min-width: 0; line-height: 1.3; font-size: 11px; }
  .ozon-fbo-product-metrics b { display: block; font-size: 17px; }
  .ozon-fbo-products, .ozon-fbo-clusters { padding: 0 8px 8px; }
  .ozon-fbo-cluster-totals { margin-left: 0; white-space: normal; }

  .modal-backdrop { padding: 10px; }
  .modal-card, .section-help-modal { width: 100%; max-width: 100%; max-height: calc(100dvh - 20px); padding: 16px; overflow-x: hidden; overflow-y: auto; border-radius: 20px; }
  .modal-card .form-grid { gap: 12px; }
  .modal-card h2 { font-size: 21px; }
  .unit-expense-list, .profile-blocks-grid, .role-permission-grid { grid-template-columns: minmax(0, 1fr); }
  .section-tabs { flex-wrap: wrap; gap: 6px; max-width: 100%; }
  .site-legal-footer { position: static; width: auto; max-width: 100%; margin: 18px 0 0; padding: 8px 0; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
  .cookie-notice { left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); width: auto; max-width: none; padding: 12px; border-radius: 16px; gap: 9px; }
  .cookie-notice p { font-size: 12px; line-height: 1.4; margin: 5px 0; }
  .cookie-notice-actions { display: flex; justify-content: flex-end; gap: 8px; }

  body.auth-screen .sidebar, body.auth-screen .topbar { display: none; }
  body.auth-screen .app { min-height: 100dvh; max-height: none; overflow: visible; padding: 0; }
  body.auth-screen #view { min-height: 0; }
  body.auth-screen .auth-wrap {
    display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
    width: 100%; min-height: 100dvh; padding: 12px; gap: 16px; background-position: center; overflow: visible;
  }
  .auth-wrap .auth-card { order: 0; width: 100%; max-width: 480px; max-height: none; margin: 0 auto; padding: 20px; border-radius: 22px; overflow: visible; transform: none; }
  .auth-card .auth-brand { margin-bottom: 16px; gap: 10px; }
  .auth-card .auth-logo-mark { width: 44px; height: 44px; flex: 0 0 44px; }
  .auth-card .auth-brand-copy { min-width: 0; }
  .auth-card .auth-brand-copy h2 { font-size: 21px; line-height: 1.15; }
  .auth-card .auth-brand-copy span { font-size: 11px; line-height: 1.3; }
  .auth-card .auth-heading { margin-bottom: 14px; }
  .auth-card .auth-heading h3 { font-size: 27px; margin-bottom: 4px; }
  .auth-card .auth-heading p { font-size: 14px; }
  .auth-card .section-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; }
  .auth-card .section-tabs .glass-btn { min-height: 42px; width: 100%; font-size: 14px; }
  .auth-card .auth-registration-closed { padding: 10px 12px; border-radius: 13px; margin: 0 0 12px; font-size: 12px; line-height: 1.4; }
  .auth-card .form-grid { gap: 12px; }
  .auth-card .form-grid label { display: grid; gap: 5px; min-height: 0; font-size: 13px; }
  .auth-card .form-grid input, .auth-card .form-grid select, .auth-card .form-grid textarea { min-height: 46px; padding: 11px 12px; font-size: 16px; border-radius: 12px; }
  .auth-card .form-grid label small:empty, .auth-card .field-error:empty, .auth-card .auth-form-status:empty { display: none; }
  .auth-card .form-grid > .glass-btn[type="submit"] { min-height: 46px; margin: 3px 0 0; padding: 11px; font-size: 16px; border-radius: 13px; }
  .auth-card .auth-forgot-link { min-height: 36px; font-size: 13px; }
  .auth-card .auth-hint { font-size: 11px; line-height: 1.4; }
  .auth-card .auth-consent { grid-template-columns: 18px minmax(0, 1fr); align-items: start; }
  .auth-card .auth-consent input { min-height: 0; padding: 0; }
  .auth-card .auth-consent .field-error { grid-column: 1 / -1; }
  .auth-wrap .auth-pitch { order: 1; position: static; width: 100%; max-width: 480px; margin: 0 auto; padding: 20px; transform: none; border-left: 0; border-radius: 20px; }
  .auth-pitch h1 { font-size: 33px; line-height: 1.06; letter-spacing: -1px; }
  .auth-pitch-lead { font-size: 16px; line-height: 1.45; }
  .auth-pitch-description, .auth-pitch-points small { font-size: 13px; line-height: 1.45; }
  body.auth-screen .site-legal-footer { position: static; margin: 0 12px; padding: 12px 0 20px; max-width: none; font-size: 11px; }
}

@media (min-width: 601px) and (max-width: 900px) {
  .kpi-grid, .admin-kpis.kpi-grid, .delivery-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .app { padding: 16px; }
}

@media (max-width: 360px) {
  .app { padding: 10px; }
  .brand-title { font-size: 14px; }
  .nb-mobile-menu-toggle { max-width: 100px; padding: 7px 8px; }
  .auth-wrap .auth-card { padding: 16px; }
  .auth-card .auth-brand-copy h2 { font-size: 19px; }
  .finance-month-metrics { grid-template-columns: minmax(0, 1fr); }
}
