/* Responsive admin workspace. Keep financial actions and status visible at every size. */
.customer-pagination { display:flex; flex-wrap:wrap; gap:12px 18px; align-items:center; padding-block:12px; }
.customer-pagination-bottom { border-top:1px solid var(--border-color); }
.user-results-summary { color:var(--text-secondary); font-size:12px; margin-right:auto; }
.user-page-size-label { display:flex; gap:8px; align-items:center; color:var(--text-secondary); font-size:12px; }
.user-page-size-label .form-select { width:auto; min-width:64px; padding:7px 26px 7px 10px; }
.user-page-controls { display:flex; gap:10px; align-items:center; }
.user-page-status { color:var(--text-secondary); font-size:12px; white-space:nowrap; }
@media(max-width:640px) {
  .customer-pagination-top .user-results-summary { flex-basis:100%; }
  .user-page-controls { flex:1; justify-content:space-between; }
  .user-page-controls .btn { min-height:44px; }
  .user-page-size-label .form-select { min-height:44px; font-size:16px; }
  .customer-pagination-top .user-page-controls { flex-basis:100%; }
}
.topbar-status-group { display:flex; align-items:center; gap:8px; min-width:0; }
.topbar-status-group .live-indicator span:last-child { display:inline; }
.content-view > *, .panel, .panel > *, .modal-body > *, .form-group { min-width:0; }
.content-view { overflow-x:visible; }
.main-wrapper { overflow-x:clip; }
.form-input, .form-select, .form-textarea { max-width:100%; box-sizing:border-box; }
.sync-status-stale { color:var(--warning); }
.sync-status-stale .dot-pulse { background:var(--warning); animation:none; }
:is(button, a, input, select, textarea):focus-visible { outline:2px solid var(--primary); outline-offset:3px; }
.table-container:focus-visible { outline:2px solid var(--primary); outline-offset:3px; }
.table-scroll-help { color:var(--text-secondary); font-size:12px; margin:6px 0 0; }

@media (max-width:1280px) {
  .topbar-center { display:none; }
  .topbar { padding-inline:16px; }
}
@media (min-width:1025px) and (max-width:1600px) {
  .topbar { height:auto; flex-wrap:wrap; gap:8px; padding-block:10px; }
  .topbar-center { display:block; min-width:100px; margin:0; }
  .topbar-right { display:contents; }
  .topbar-status-group { order:10; flex-basis:100%; justify-content:flex-end; }
}
@media (max-width:1024px) {
  .topbar { display:grid; grid-template-columns:minmax(0,1fr) auto auto auto auto; height:auto; gap:8px; padding:10px 14px; }
  .topbar-right { display:contents; }
  .topbar-left { grid-column:1; grid-row:1; gap:8px; }
  .topbar-breadcrumb { min-width:0; overflow:hidden; }
  .bc-page { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #btn-master-mode-toggle { grid-column:2; grid-row:1; min-height:44px; }
  #btn-refresh-all { grid-column:3; grid-row:1; }
  #btn-sound-toggle { grid-column:4; grid-row:1; }
  #btn-theme-toggle { grid-column:5; grid-row:1; }
  .topbar .btn-icon-only, .mobile-toggle { min-width:44px; min-height:44px; }
  .topbar-status-group { grid-column:1 / -1; grid-row:2; overflow-x:auto; max-width:100%; padding-block:2px 4px; scrollbar-width:thin; }
  .topbar-status-group > * { flex:0 0 auto; }
  .sidebar { width:min(290px,calc(100vw - 48px)); height:100dvh; padding-bottom:env(safe-area-inset-bottom); }
  .sidebar-nav .nav-item { min-height:44px; }
  .main-wrapper { min-height:100dvh; }
  .panel-header { gap:12px; flex-wrap:wrap; }
}
@media (max-width:768px) {
  .content-view { padding:16px 12px 32px; }
  .panel { padding:16px; margin-bottom:16px; }
  .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:10px; margin-bottom:18px; }
  .stat-card { padding:14px; }
  .stat-value { font-size:clamp(22px,5vw,28px); overflow-wrap:anywhere; }
  .stat-header { gap:6px; }
  .stat-title { font-size:12px; }
  .stat-icon, .stat-icon-rev, .stat-icon-profit, .stat-icon-orders, .stat-icon-users { width:30px; height:30px; flex-shrink:0; }
  .stat-lkr, .stat-footer { overflow-wrap:anywhere; }
  .stat-trend-row { flex-direction:column; align-items:flex-start; gap:6px; }
  .stat-sub { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; line-height:1.5; }
  .dash-greeting { font-size:24px; }
  .dash-hero-right, #dash-period-tabs { width:100%; }
  #dash-period-tabs { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); }
  #dash-period-tabs .tab-btn { justify-content:center; min-height:44px; padding:8px 4px; font-size:11px; white-space:nowrap; }
  #dash-period-tabs svg { display:none; }
  .content-view [style*="grid-template-columns"], .modal-body [style*="grid-template-columns"] { grid-template-columns:minmax(0,1fr) !important; }
  .content-view div[style*="width: 240px"], .content-view div[style*="width: 260px"],
  .content-view div[style*="width: 280px"], .content-view div[style*="width: 300px"] { width:100% !important; min-width:0 !important; flex-basis:100%; }
  .content-view [style*="min-width: 240px"] { min-width:0 !important; }
  .panel-header > *, .dash-hero > * { max-width:100%; }
  .panel-title { flex-wrap:wrap; }
  .filter-tabs { max-width:100%; flex-wrap:wrap; gap:4px; }
  .filter-tabs .tab-btn { min-height:40px; }
  .promo-tier-row { flex-wrap:wrap; }
  .promo-tier-row input { min-width:0; flex:1 1 90px; }
  .supplier-card { padding:14px; }
  .content-view pre, .content-view code, .modal-body pre, .modal-body code { overflow-wrap:anywhere; white-space:pre-wrap; }
  .modal-overlay { padding:10px; align-items:center; }
  .modal-card { width:100% !important; max-width:100% !important; max-height:calc(100dvh - 20px); margin:0 !important; padding:0 !important; }
  .modal-header, .modal-body, .modal-footer { padding:16px; }
  .modal-body { min-height:0; overscroll-behavior:contain; overflow-x:hidden; }
  .modal-body [style*="min-width"] { min-width:0 !important; }
  .modal-body [style*="width: 400px"], .modal-body [style*="width: 500px"] { width:100% !important; }
  .modal-header { gap:10px; }
  .modal-close, .btn-sm { min-height:44px; }
  .modal-close { min-width:44px; }
  .modal-footer { flex-wrap:wrap; padding-bottom:max(16px,env(safe-area-inset-bottom)); }
  .login-wrap { overflow-y:auto; padding:max(16px,env(safe-area-inset-top)) 16px; }
  .login-card { padding:24px; max-height:100%; }
  .login-card input { font-size:16px; }
  /* Sticky action cells can cover all visible data on narrow screens. */
  .table-container th:last-child, .table-container td:last-child:not([colspan]), .th-actions, .td-actions { position:static; box-shadow:none; }
}
@media (max-width:640px) {
  #master-mode-text { display:none; }
  #btn-master-mode-toggle { width:44px; padding:8px !important; justify-content:center; }
  .topbar { padding-inline:10px; gap:5px; }
  .topbar-status-group { gap:6px; }
  .topbar-status-group .balance-pill { font-size:11px; padding:5px 8px; }
  .topbar-status-group .live-indicator span:last-child { display:inline; }
  .table-container:has(.mobile-card-table) { border:0; background:transparent; overflow:visible; }
  .mobile-card-table { min-width:0; width:100%; border-collapse:separate; }
  .mobile-card-table thead { position:absolute; width:1px; height:1px; margin:-1px; clip-path:inset(50%); overflow:hidden; }
  .mobile-card-table tbody { display:grid; gap:12px; }
  .mobile-card-table tr { display:grid; background:var(--card); border:1px solid var(--border-color); border-radius:10px; padding:10px 12px; min-width:0; }
  .mobile-card-table td { display:grid; grid-template-columns:92px minmax(0,1fr); gap:10px; min-width:0; width:auto !important; padding:9px 0; border:0 !important; border-bottom:1px solid var(--border-color) !important; text-align:left !important; overflow-wrap:anywhere; }
  .mobile-card-table td:last-child { border-bottom:0 !important; background:transparent !important; }
  .mobile-card-table td::before { content:attr(data-label); color:var(--text-secondary); font-size:11px; font-weight:600; }
  .mobile-card-table td > * { min-width:0; max-width:100%; }
  .mobile-card-table td > *:nth-child(n+2) { grid-column:2; }
  .mobile-card-table td > div[style*="display: flex"] { flex-wrap:wrap; justify-content:flex-start !important; }
  .mobile-card-table td[colspan] { display:block; border:0 !important; }
  .mobile-card-table td[colspan]::before { content:none; }
  .mobile-card-table td .btn { min-height:44px; max-width:100%; white-space:normal; }
  .mobile-card-table tr:hover td { background:transparent; }
  #dash-chart-container { gap:4px !important; }
  .chart-bar-col { min-width:0; }
  .chart-bar-col:nth-child(-n+3) .chart-tooltip { left:0; }
  .chart-bar-col:nth-last-child(-n+3) .chart-tooltip { right:0; }
}
.chart-bar-col:focus .chart-tooltip { opacity:1; transform:translateY(0); }
@media (max-width:359px) {
  .stats-grid { grid-template-columns:minmax(0,1fr) !important; }
  .mobile-card-table td { grid-template-columns:78px minmax(0,1fr); gap:8px; }
  .topbar-left { gap:2px; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; animation:none !important; transition:none !important; }
}
