/* [v136] Dashboard on phones (only html.vm-admin, the store is not touched).
   The base text was raised to 19px under 768px, which made every label and button about 20% bigger, so buttons
   wrapped onto 2–3 lines and the top bar ran off the screen. Back to 16px, a top bar that fits, one-line buttons. */
@media (max-width: 768px) {
  html.vm-admin { font-size: 16px; }
}
@media (max-width: 1023px) {
  /* top bar (phones and tablets): logo + icons on the first row, the period and currency boxes share a second row */
  html.vm-admin header .h-16 { height: auto; min-height: 3.5rem; padding-block: 6px; gap: 8px; align-items: flex-start; }
  html.vm-admin header .h-16 > div:first-child { flex: none; padding-top: 2px; }
  html.vm-admin header .h-16 > div:last-child { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; column-gap: 2px; }
  html.vm-admin header .h-16 > div:last-child > button,
  html.vm-admin header .h-16 > div:last-child > a,
  html.vm-admin header .h-16 > div:last-child > div.relative > button { padding: 6px; }
  html.vm-admin header .h-16 > div:last-child > div.bg-slate-50 { order: 10; flex: 1 1 calc(50% - 4px); min-width: 0; justify-content: center; padding: 5px 6px; }
  html.vm-admin header .h-16 > div:last-child > div.bg-slate-50 select { min-width: 0; max-width: 100%; font-size: 12px; }
}
@media (max-width: 767px) {
  /* [v137] on phones the top bar leaves out the POS (calculator) icon, the refresh button and the currency box;
     found by their icons, so it works in Arabic and English */
  html.vm-admin header .h-16 > div:last-child > button:has(svg.lucide-calculator),
  html.vm-admin header .h-16 > div:last-child > button:has(svg.lucide-refresh-cw),
  html.vm-admin header .h-16 > div:last-child > div.bg-slate-50:has(svg.lucide-dollar-sign) { display: none !important; }
  html.vm-admin header .h-16 > div:last-child > div.bg-slate-50:has(svg.lucide-calendar) { flex: 1 1 100%; }
  /* [v138] the live visitors icon (👥 with the number) shows on phones too; the language button moves to the side menu */
  html.vm-admin header .h-16 > div:first-child > button.hidden:has(svg.lucide-users) { display: flex !important; }
  html.vm-admin header #vm-lang-toggle { display: none !important; }
}
/* [v142] computers: every dashboard table fits the page (no sideways slider): tighter cells, smaller text, headers
   that may wrap onto two lines, badges and buttons a little smaller */
@media (min-width: 1024px) {
  html.vm-admin main table { font-size: 12px; }
  html.vm-admin main table th, html.vm-admin main table td { padding: 8px 7px !important; }
  html.vm-admin main table th { font-size: 11px; line-height: 1.3; white-space: normal !important; vertical-align: bottom; }
  html.vm-admin main table td { line-height: 1.35; }
  html.vm-admin main table td .rounded-full, html.vm-admin main table td .rounded-lg.px-2 { padding: 2px 7px; font-size: 11px; }
  html.vm-admin main table td button.p-1\.5 { padding: 4px; }
  html.vm-admin main table td img.w-8 { width: 28px; height: 28px; }
  html.vm-admin main table [class*="min-w-["] { min-width: 0 !important; }
  html.vm-admin main table.min-w-full, html.vm-admin main table[class*="min-w-"] { min-width: 0 !important; }
}
/* the side menu's language item is for phones only */
html.vm-admin .vm-lang-menu { display: none !important; }
@media (max-width: 767px) { html.vm-admin .vm-lang-menu { display: flex !important; } }
@media (min-width: 641px) and (max-width: 1023px) {
  html.vm-admin header .h-16 > div:last-child > div.bg-slate-50 { flex: 0 1 auto; }
}
@media (max-width: 640px) {

  /* page edges */
  html.vm-admin main { padding-inline: 12px !important; }
  html.vm-admin main .p-5, html.vm-admin main .p-6 { padding: 14px; }
  html.vm-admin main .rounded-2xl { border-radius: 16px; }
}
@media (max-width: 1023px) {
  /* buttons and tabs stay on one line; a row of them wraps onto the next line instead (phones and tablets) */
  html.vm-admin main button, html.vm-admin main a.rounded-xl { white-space: nowrap; }
  html.vm-admin main .flex:has(> button + button), html.vm-admin main .flex:has(> a + button), html.vm-admin main .flex:has(> button + a) { flex-wrap: wrap; }
  /* tab bars (grey pill with buttons): one row that slides sideways, each tab sized to its words */
  html.vm-admin main .bg-slate-100.p-1:has(> button + button), html.vm-admin main .bg-slate-50.p-1:has(> button + button) { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; justify-content: flex-start; }
  html.vm-admin main .bg-slate-100.p-1:has(> button + button)::-webkit-scrollbar { display: none; }
  html.vm-admin main .bg-slate-100.p-1 > button, html.vm-admin main .bg-slate-50.p-1 > button { flex: 1 0 auto; padding-inline: 10px; }
  html.vm-admin main button.px-4, html.vm-admin main button.px-5, html.vm-admin main button.px-6 { padding-inline: 12px; }
  html.vm-admin main button.py-2\.5, html.vm-admin main button.py-3 { padding-block: 8px; }
}
@media (max-width: 640px) {
  html.vm-admin main h1, html.vm-admin main h2.text-xl, html.vm-admin main h2.text-2xl { font-size: 1.15rem; line-height: 1.4; }
  html.vm-admin main .text-3xl { font-size: 1.5rem; }
  html.vm-admin main .text-2xl { font-size: 1.3rem; }

  /* wide tables scroll inside their box instead of being cut */
  html.vm-admin main table { min-width: max-content; }
  html.vm-admin main div:has(> table) { overflow-x: auto; max-width: 100%; }

  /* windows (dialogs) fit the screen */
  html.vm-admin .fixed.inset-0 > div.max-w-lg, html.vm-admin .fixed.inset-0 > div.max-w-xl, html.vm-admin .fixed.inset-0 > div.max-w-2xl,
  html.vm-admin .fixed.inset-0 > div.max-w-3xl, html.vm-admin .fixed.inset-0 > div.max-w-4xl { max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto; }
  html.vm-admin input, html.vm-admin select, html.vm-admin textarea { max-width: 100%; }
}
