/* =====================================================
   Siliscia POS – Design System
   Hub Tech — dark slate + sky/indigo (all hosts)
   ===================================================== */

:root {
  --bg: #070B14;
  --bg-soft: #0F172A;
  --bg-elevated: #111827;
  --bg-card: #1E293B;
  --accent: #0EA5E9;
  --accent-soft: rgba(14, 165, 233, 0.16);
  --accent-dark: #0284C7;
  --accent-2: #6366F1;
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --border: rgba(148, 163, 184, 0.22);
  --tech-line: #38BDF8;
  --success: #34D399;
  --danger: #F87171;
  --warning: #FBBF24;
  --info: #38BDF8;
  --radius: 1rem;
  --radius-sm: 0.75rem;
  --shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 0 1px rgba(56, 189, 248, 0.12), 0 18px 40px -16px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1000px 520px at 8% -12%, rgba(56, 189, 248, 0.12), transparent 55%),
    radial-gradient(800px 420px at 100% 0%, rgba(99, 102, 241, 0.14), transparent 50%);
  background-attachment: fixed;
}

.logo-font {
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
  user-select: none;
  will-change: transform;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #0EA5E9 0%, #6366F1 100%);
  color: white;
  box-shadow: 0 10px 24px -10px rgba(14, 165, 233, 0.55);
}
.btn-primary:hover {
  filter: brightness(1.06);
  background: linear-gradient(135deg, #38BDF8 0%, #818CF8 100%);
}

.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover {
  background: var(--accent-dark);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  background: rgba(148, 163, 184, 0.1);
  border-color: var(--accent);
  color: #E0F2FE;
}

.btn-success {
  background: var(--success);
  color: #052e1c;
}

.btn-danger {
  background: var(--danger);
  color: #450a0a;
}

.btn-lg {
  padding: 18px 32px;
  font-size: 17px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- Cards ---------- */
.card {
  background: rgba(30, 41, 59, 0.88);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(10px);
  animation: sil-fade-up 0.35s ease both;
}

/* ---------- Form elements ---------- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  background: rgba(2, 6, 23, 0.65);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

/* ---------- Layout helpers ---------- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-new { background: #E3F2FD; color: #1565C0; }
.badge-preparing { background: #FFF8E1; color: #F57F17; }
.badge-ready { background: #E8F5E9; color: #2E7D32; }
.badge-completed { background: #F5F5F5; color: #616161; }
.badge-cancelled { background: #FFEBEE; color: #C62828; }

/* ---------- Tablet optimizations ---------- */
@media (min-width: 768px) {
  .btn {
    min-height: 48px; /* better touch target */
  }
}

/* Touch-friendly product cards */
.product-tile {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  user-select: none;
}
.product-tile:active {
  transform: scale(0.97);
}

/* Prevent text selection on interactive elements */
.no-select {
  user-select: none;
  -webkit-user-select: none;
}


/* Stock count flag states on POS header button */
#stock-count-btn.stock-count-flag-1,
button#stock-count-btn.stock-count-flag-1.btn-outline {
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
  color: #dc2626 !important;
}
#stock-count-btn.stock-count-flag-2,
button#stock-count-btn.stock-count-flag-2.btn-outline {
  background: #fecaca !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
}
#stock-count-btn.stock-count-flag-3,
button#stock-count-btn.stock-count-flag-3.btn-outline {
  background: #f87171 !important;
  border-color: #dc2626 !important;
  color: #7f1d1d !important;
  font-weight: 600 !important;
}

#pos-transfers-btn.pos-transfers-recount {
  background-color: #fef3c7 !important;
  border-color: #f59e0b !important;
  color: #92400e !important;
}

#pos-transfers-recount-flag {
  color: #f59e0b !important;
  font-weight: 900 !important;
  font-size: 16px !important;
  line-height: 1 !important;
}
#pos-transfers-btn.pos-transfers-recount {
  background-color: #fef3c7 !important;
  border-color: #f59e0b !important;
  color: #92400e !important;
}

/* =====================================================
   Mobile-first responsive patterns
   ===================================================== */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Touch targets */
@media (max-width: 767px) {
  .btn {
    min-height: 44px;
    padding: 12px 18px;
    font-size: 14px;
  }
  .btn-outline,
  .btn-primary,
  .btn-success,
  .btn-accent {
    touch-action: manipulation;
  }
  .form-input,
  select.form-input,
  textarea.form-input {
    min-height: 44px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }
}

/* Tables: horizontal scroll on small screens */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-responsive table {
  min-width: 560px;
}

/* Sticky mobile action bar helper */
.mobile-sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

/* Compact product grid on phones */
@media (max-width: 639px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    gap: 10px !important;
  }
  .product-tile .p-3 {
    padding: 0.5rem !important;
  }
}

/* POS tools panel full-width sheet on small screens */
@media (max-width: 767px) {
  #pos-tools-panel {
    left: 0.75rem !important;
    right: 0.75rem !important;
    top: auto !important;
    bottom: calc(0.75rem + env(safe-area-inset-bottom)) !important;
    min-width: 0 !important;
    max-height: 70vh;
    overflow-y: auto;
  }
}

/* Admin layout: collapsible modules drawer */
.admin-shell {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.admin-aside {
  width: 18rem;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.admin-sub-menu {
  width: 16rem;
  background: #fff;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem;
  flex-shrink: 0;
}

@media (max-width: 1023px) {
  .admin-aside {
    position: fixed;
    top: 4rem;
    left: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-105%);
    box-shadow: var(--shadow-lg);
    width: min(20rem, 88vw);
  }
  .admin-aside.open {
    transform: translateX(0);
  }
  .admin-aside-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: 4rem;
    background: rgba(0, 0, 0, 0.35);
    z-index: 40;
  }
  .admin-aside-backdrop.open {
    display: block;
  }
  .admin-sub-menu {
    width: 100%;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .admin-main-split {
    flex-direction: column !important;
  }
  #content-area {
    padding: 1rem !important;
  }
  .admin-header-actions .btn span.hide-sm {
    display: none;
  }
}

@media (max-width: 639px) {
  header.h-16 {
    height: 3.5rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  #content-area {
    padding: 0.75rem !important;
  }
  .card {
    border-radius: 1rem;
  }
  /* Stack page headers */
  .page-header-row {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.75rem;
  }
}

/* Modal: full-screen sheet on phones */
@media (max-width: 639px) {
  .modal-sheet,
  [id$="-modal"] > div.bg-white {
    max-height: 92dvh;
    border-radius: 1.25rem 1.25rem 0 0;
  }
}

/* Filter rows wrap */
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: flex-end;
}
.filters-row .form-input,
.filters-row select {
  min-width: 0;
  flex: 1 1 140px;
}

/* Hide scrollbar visually but keep scroll */
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Landscape phone: tighter cart */
@media (max-width: 900px) and (orientation: landscape) {
  .cart-panel.open {
    max-height: 70vh;
  }
}


/* Responsive data tables → cards on small screens */
@media (max-width: 767px) {
  .responsive-data-table thead {
    display: none !important;
  }
  .responsive-data-table tbody tr {
    display: block;
    background: rgba(30, 41, 59, 0.92);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    padding: 0.65rem 0.85rem;
    box-shadow: var(--shadow);
  }
  /* Override Tailwind hidden / sm:table-cell so every field shows in cards */
  .responsive-data-table tbody td,
  .responsive-data-table tbody td.hidden,
  .responsive-data-table tbody td[class*="sm:table-cell"],
  .responsive-data-table tbody td[class*="md:table-cell"],
  .responsive-data-table tbody td[class*="lg:table-cell"] {
    display: flex !important;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border: none;
    text-align: right;
    font-size: 0.875rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .responsive-data-table tbody td::before {
    content: attr(data-label);
    font-weight: 500;
    color: #9ca3af;
    text-align: left;
    flex: 0 0 5.5rem;
    max-width: 5.5rem;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    padding-top: 0.15rem;
  }
  .responsive-data-table tbody td > * {
    min-width: 0;
    max-width: calc(100% - 6rem);
    text-align: right;
  }
  /* Product cell: label on top, image + name full width below */
  .responsive-data-table tbody td[data-label="Product"] {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid #F0EEF2;
    margin-bottom: 0.15rem;
  }
  .responsive-data-table tbody td[data-label="Product"]::before {
    flex: none;
    max-width: none;
  }
  .responsive-data-table tbody td[data-label="Product"] > * {
    max-width: 100%;
    text-align: left;
  }
  .responsive-data-table tbody td[data-label="Product"] .prod-card-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
  }
  .responsive-data-table tbody td[data-label="Product"] .prod-card-main img {
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    border-radius: 0.5rem;
    object-fit: cover;
  }
  .responsive-data-table tbody td[data-label="Product"] .prod-card-text {
    min-width: 0;
    flex: 1;
  }
  .responsive-data-table tbody td[data-label="Product"] .prod-card-text .font-medium {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
  }
  .responsive-data-table tbody td.td-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    padding-top: 0.65rem;
    margin-top: 0.35rem;
    border-top: 1px solid var(--border);
    gap: 0.4rem;
  }
  .responsive-data-table tbody td.td-actions::before {
    display: none !important;
  }
  .responsive-data-table tbody td.td-actions > * {
    max-width: 100%;
  }
}


/* ========== Stable modal window sizes (responsive) ==========
   Desktop: fixed footprint so tabs/tables don't resize the frame.
   Mobile: bottom-sheet, dvh, safe-area — height flexible within a max. */

.modal-shell-lg,
.modal-shell,
.modal-shell-sm {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  background: #0F172A !important;
  color: #F1F5F9 !important;
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.08), 0 25px 50px -12px rgba(0, 0, 0, 0.55);
  /* prevent iOS rubber-band from scrolling the page behind */
  overscroll-behavior: contain;
}

.modal-shell-header,
.modal-shell-toolbar,
.modal-shell-tabs,
.modal-shell-footer {
  flex-shrink: 0;
}

.modal-shell-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.modal-shell-body .modal-empty {
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ----- Mobile: fixed footprint bottom sheets (no resize when tabs/content change) ----- */
.modal-shell-lg,
.modal-shell,
.modal-shell-sm {
  max-width: 100%;
  border-radius: 1.25rem 1.25rem 0 0;
  margin: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  /* fixed height — body scrolls inside */
  height: min(92dvh, 100%);
  max-height: min(92dvh, 100%);
}

.modal-shell-lg {
  height: min(92dvh, 100%);
  max-height: min(92dvh, 100%);
}

.modal-shell {
  height: min(90dvh, 100%);
  max-height: min(90dvh, 100%);
}

.modal-shell-sm {
  height: min(82dvh, 100%);
  max-height: min(82dvh, 100%);
}

/* Overlay: bottom-align sheets on small screens (padding handled per breakpoint below) */

/* Landscape phone: leave room for browser chrome */
@media (max-width: 900px) and (orientation: landscape) {
  .modal-shell-lg,
  .modal-shell,
  .modal-shell-sm {
    max-height: min(88dvh, 100%);
  }
  .modal-shell-lg {
    height: min(88dvh, 100%);
  }
}

/* ----- Tablet / desktop: stable fixed footprint ----- */
@media (min-width: 768px) {
  .modal-shell-lg,
  .modal-shell,
  .modal-shell-sm {
    border-radius: 1.5rem;
    margin: auto;
    padding-bottom: 0;
  }

  .modal-shell-lg {
    max-width: 72rem;
    height: min(90vh, 920px);
    max-height: 90vh;
  }

  .modal-shell {
    max-width: 42rem;
    height: min(88vh, 800px);
    max-height: 88vh;
  }

  .modal-shell-sm {
    max-width: 28rem;
    /* fixed footprint — content scrolls inside, window does not resize */
    height: min(72vh, 520px);
    max-height: min(80vh, 560px);
  }

  /* When md:items-center is used, center the shell */
  .fixed.inset-0.flex.md\:items-center {
    padding: 1rem;
  }
}

/* Wide desktop: slightly taller large shell */
@media (min-width: 1280px) {
  .modal-shell-lg {
    height: min(90vh, 960px);
  }
}

/* Admin main workspace */
@media (min-width: 768px) {
  #content-area {
    min-height: calc(100vh - 8rem);
  }
}

/* Kill conflicting inline height on shells when on mobile */
@media (max-width: 767px) {
  .modal-shell-lg[style],
  .modal-shell[style],
  .modal-shell-sm[style] {
    height: auto !important;
    max-height: min(92dvh, 100%) !important;
  }
  .modal-shell-lg[style] {
    height: min(92dvh, 100%) !important;
  }
}


/* ========== My Zone mobile layout ========== */
#myzone-modal {
  z-index: 50;
}
#myzone-modal .modal-shell-lg {
  width: 100%;
}

/* KPI grid tighter on small screens */
#myzone-kpis {
  gap: 0.5rem;
}
#myzone-kpis .card {
  padding: 0.5rem 0.65rem;
}
#myzone-kpis .card .text-lg {
  font-size: 0.95rem;
  line-height: 1.25;
}
#myzone-kpis .card .text-base {
  font-size: 0.85rem;
}

@media (max-width: 767px) {
  #myzone-modal {
    align-items: stretch !important;
    justify-content: stretch !important;
    padding: 0 !important;
  }
  #myzone-modal .modal-shell-lg {
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100% !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex !important;
    flex-direction: column !important;
  }
  /* Keep chrome compact */
  #myzone-modal .modal-shell-header {
    padding: 0.65rem 0.75rem !important;
  }
  #myzone-modal .modal-shell-header h3 {
    font-size: 1rem;
  }
  #myzone-modal .modal-shell-toolbar {
    padding: 0.5rem 0.75rem !important;
  }
  #myzone-modal .modal-shell-toolbar .form-input,
  #myzone-modal .modal-shell-toolbar select {
    font-size: 0.8125rem;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }
  /* KPI: single horizontal scroll row on narrow phones */
  #myzone-kpis {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 0.5rem !important;
    padding: 0.5rem 0.75rem !important;
    -webkit-overflow-scrolling: touch;
  }
  #myzone-kpis .card {
    flex: 0 0 auto;
    min-width: 7.5rem;
    max-width: 10rem;
    padding: 0.45rem 0.55rem !important;
  }
  #myzone-kpis .card .text-lg,
  #myzone-kpis .card .text-base {
    font-size: 0.9rem !important;
  }
  #myzone-kpis .card .text-\[10px\],
  #myzone-kpis .card .text-xs,
  #myzone-kpis .card [class*="uppercase"] {
    font-size: 0.6rem !important;
  }
  #myzone-tabs {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }
  #myzone-tabs .myzone-tab {
    font-size: 0.7rem;
    padding: 0.45rem 0.55rem;
    white-space: nowrap;
  }
  /* Body MUST take remaining space and scroll */
  #myzone-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0.5rem !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  #myzone-body .card {
    border-radius: 0.75rem;
  }
  #myzone-body table {
    min-width: 560px;
    font-size: 0.75rem;
  }
  #myzone-body table th,
  #myzone-body table td {
    padding: 0.4rem 0.5rem !important;
  }
  #myzone-modal .modal-shell-footer {
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem !important;
    font-size: 0.6rem;
  }
  #myzone-modal .modal-shell-footer span {
    flex: 1 1 100%;
    order: 2;
    line-height: 1.3;
  }
  #myzone-modal .modal-shell-footer .btn {
    order: 1;
    margin-left: auto;
    padding: 0.35rem 0.75rem;
  }
}

/* Do not force padding:0 on every items-end overlay — breaks md padding */
.fixed.inset-0.flex.items-end.md\:items-center {
  /* mobile: bottom sheet alignment comes from items-end */
}
@media (max-width: 767px) {
  .fixed.inset-0.flex.items-end {
    padding: 0;
  }
}
@media (min-width: 768px) {
  .fixed.inset-0.flex.items-end.md\:items-center {
    padding: 1rem;
    align-items: center;
  }
}


/* Floating back-to-top (all scrollable lists) */
#siliscia-back-to-top {
  position: fixed;
  left: 1rem;
  right: auto;
  bottom: 1.25rem;
  z-index: 40; /* below modals (280+) and tools sheet (70+) */
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1A1A1F;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
}
#siliscia-back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
#siliscia-back-to-top:hover {
  background: #6E6A75;
}
#siliscia-back-to-top:focus {
  outline: 2px solid #D4A5A5;
  outline-offset: 2px;
}
@media (max-width: 767px) {
  #siliscia-back-to-top {
    left: 0.75rem;
    right: auto;
    bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    width: 2.5rem;
    height: 2.5rem;
  }
}


/* Keep money / KPI values inside cards on all devices */
.kpi-money,
.stat-value,
#acc-pay-summary .card > div:last-child,
#acc-pay-summary .card .text-xl,
#myzone-kpis .card .text-lg,
#myzone-kpis .card .text-base,
#content-area .card .text-xl.font-semibold,
#content-area .card .text-2xl.font-semibold {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
  max-width: 100%;
  font-size: clamp(0.8rem, 2.8vw, 1.15rem);
}
#content-area .card,
#acc-pay-summary .card,
#myzone-kpis .card {
  overflow: hidden;
  min-width: 0;
}
#acc-pay-summary,
#myzone-kpis {
  min-width: 0;
}


/* Credentials dialog — fixed footprint on all devices */
.ui-cred-shell {
  min-height: 0;
}
@media (max-width: 639px) {
  .ui-cred-shell {
    max-height: min(92dvh, 100%);
  }
}


/* CRM search — reserved results area (no modal resize while typing) */
#crm-search-modal .modal-shell-sm {
  display: flex;
  flex-direction: column;
}
#crm-search-modal #crm-results {
  flex: 1 1 auto;
  min-height: 160px;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #E4E2E8;
  border-radius: 1rem;
  background: #F9F8FA;
  padding: 0;
}
#crm-search-modal #crm-results > .crm-results-table {
  margin: 0;
}
@media (max-width: 767px) {
  #crm-search-modal .modal-shell-sm {
    height: min(88dvh, 100%);
    max-height: min(92dvh, 100%);
  }
}


/* Modal scroll + sticky header gap fix (app-wide) */
.modal-shell,
.modal-shell-lg,
.modal-shell-sm {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal-shell-body,
.modal-shell > .overflow-y-auto,
.modal-shell-lg > .overflow-y-auto,
.modal-shell-sm > .overflow-y-auto {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Prefer fixed column headers outside the scroll area.
   If sticky thead is still used, pin it without leaving a visual gap. */
.modal-shell thead.sticky,
.modal-shell thead [class*="sticky"],
.modal-shell .sticky.top-0,
.modal-shell thead.sticky.top-0 {
  position: sticky;
  top: 0;
  z-index: 5;
  background-color: #fff;
  box-shadow: 0 1px 0 #E4E2E8;
}

.modal-shell table {
  border-collapse: separate;
  border-spacing: 0;
}


/* Force fixed window size for all major app modals on mobile */
@media (max-width: 767px) {
  [id$="-modal"]:not([data-ui-overlay]):not(.ui-dialog-overlay) > div.bg-white,
  [id$="-modal"] > div.modal-shell,
  [id$="-modal"] > div.modal-shell-lg,
  [id$="-modal"] > div.modal-shell-sm,
  [data-modal-type]:not([data-ui-overlay]):not(.ui-dialog-overlay) > div.bg-white:not(.ui-dialog-card) {
    height: min(90dvh, 100%) !important;
    max-height: min(90dvh, 100%) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  [id$="-modal"] > div > .overflow-y-auto,
  [id$="-modal"] .loc-tab-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}


/* Never show scroll-up arrow over open windows */
/* Lock background page scroll when modal stack is open */
html.has-modal-open,
body.has-modal-open {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none !important;
  height: 100% !important;
  width: 100% !important;
}
body.has-modal-open {
  position: fixed !important;
  left: 0;
  right: 0;
}
body.has-modal-open #pos-main,
body.has-modal-open #pos-product-scroll,
body.has-modal-open #pos-catalog-scroll {
  overflow: hidden !important;
  touch-action: none !important;
}

body.has-modal-open #siliscia-back-to-top,
body:has([data-modal-type]:not(.hidden)) #siliscia-back-to-top,
body:has(#pos-tools-panel:not(.hidden)) #siliscia-back-to-top,
body:has(#siliscia-modal-back[style*="inline-flex"]) #siliscia-back-to-top {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* ========== Sticky table column headers (all devices) ========== */
.table-scroll,
.overflow-x-auto,
.card.overflow-hidden > .overflow-x-auto {
  /* sticky thead needs a scrollport or page scroll */
}

table thead th,
.responsive-data-table thead th,
table thead td {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, #4C1D95 0%, #6D28D9 100%) !important;
  color: #F3E8FF !important;
  box-shadow: 0 1px 0 rgba(196, 181, 253, 0.35);
}

/* When table is inside a modal body, stick under modal chrome */
.modal-shell-body thead th,
.modal-shell thead th,
[id$="-modal"] thead th {
  position: sticky;
  top: 0;
  z-index: 6;
  background: linear-gradient(180deg, #4C1D95 0%, #6D28D9 100%) !important;
  color: #F3E8FF !important;
}

/* Admin content areas */
#admin-content thead th,
.admin-main thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, #4C1D95 0%, #6D28D9 100%) !important;
  color: #F3E8FF !important;
}

/* Darker header rows still sticky */
thead.bg-\[\#F7F6F8\] th,
thead[class*="bg-"] th {
  position: sticky;
  top: 0;
}

@media (max-width: 767px) {
  /* Card-layout tables hide thead — no sticky needed */
  .responsive-data-table thead th {
    position: static;
  }
}


/* Sticky table headers — solid bar, no gap under toolbars */
.table-sticky-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.table-sticky-head {
  flex-shrink: 0;
  background: linear-gradient(180deg, #4C1D95 0%, #6D28D9 100%) !important;
  border-bottom: 1px solid rgba(196, 181, 253, 0.35);
  color: #F3E8FF !important;
  z-index: 8;
}
.table-sticky-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Native sticky th inside a single scrollport */
.overflow-y-auto > table thead th,
.overflow-x-auto > table thead th,
.modal-shell-body > table thead th {
  position: sticky;
  top: 0;
  z-index: 8;
  background: linear-gradient(180deg, #4C1D95 0%, #6D28D9 100%) !important;
  color: #F3E8FF !important;
  box-shadow: 0 1px 0 rgba(196, 181, 253, 0.35);
  background-clip: padding-box;
}

/* Ensure thead itself doesn't create a transparent gap */
.overflow-y-auto > table thead,
.overflow-x-auto > table thead {
  position: sticky;
  top: 0;
  z-index: 8;
  background: linear-gradient(180deg, #4C1D95 0%, #6D28D9 100%) !important;
  color: #F3E8FF !important;
}


/* Compact in-app alert / confirm / prompt — never force full-screen height */
.ui-dialog-overlay {
  align-items: center !important;
  justify-content: center !important;
  padding: 1rem !important;
}
.ui-dialog-card,
[data-ui-overlay] > .ui-dialog-card,
[data-ui-overlay] > div.bg-white {
  height: auto !important;
  max-height: min(70vh, 420px) !important;
  min-height: 0 !important;
  width: min(340px, calc(100vw - 2rem)) !important;
  margin: auto !important;
  border-radius: 1rem !important;
  flex: none !important;
}


/* Admin/POS credentials dialog: keep password + actions visible on mobile */
.ui-cred-shell {
  max-height: min(92dvh, 640px) !important;
  display: flex !important;
  flex-direction: column !important;
}
.ui-cred-shell [data-ui-user-list] {
  max-height: min(28vh, 160px) !important;
  flex: 1 1 auto;
  min-height: 72px;
}
.ui-cred-shell [data-ui-pass],
.ui-cred-shell [data-ui-err] {
  flex-shrink: 0;
}


/* Refined Rose Tech utilities */
.text-accent { color: var(--accent) !important; }
.bg-accent { background-color: var(--accent) !important; }
.border-accent { border-color: var(--accent) !important; }
.bg-accent-soft { background-color: var(--accent-soft) !important; }
.text-info, .sync-live { color: var(--info) !important; }
.bg-info-soft { background-color: rgba(13, 148, 136, 0.12) !important; }


/* =====================================================
   Hub motion system
   ===================================================== */
@keyframes sil-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes sil-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes sil-scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes sil-spin {
  to { transform: rotate(360deg); }
}
@keyframes sil-pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@keyframes sil-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.sil-page-enter {
  animation: sil-fade-up 0.4s ease both;
}
.sil-modal-enter {
  animation: sil-scale-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.sil-fade-in {
  animation: sil-fade-in 0.25s ease both;
}

.sil-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 11, 20, 0.55);
  backdrop-filter: blur(4px);
  animation: sil-fade-in 0.2s ease both;
}
.sil-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(148, 163, 184, 0.25);
  border-top-color: #38BDF8;
  animation: sil-spin 0.75s linear infinite;
}
.sil-skeleton {
  background: linear-gradient(90deg, rgba(30,41,59,0.9) 25%, rgba(51,65,85,0.95) 37%, rgba(30,41,59,0.9) 63%);
  background-size: 200% 100%;
  animation: sil-shimmer 1.4s ease infinite;
  border-radius: 0.5rem;
}

/* Tables on dark */
table {
  color: var(--text);
}
thead {
  color: var(--text-muted);
}
tr {
  border-color: var(--border);
}

/* Product tiles press */
.product-tile {
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease !important;
  border: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.75);
}
.product-tile:hover {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 12px 28px -16px rgba(14, 165, 233, 0.45);
}
.product-tile:active {
  transform: scale(0.96) !important;
}

/* Module cards / admin */
.module-card {
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.module-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.45) !important;
  box-shadow: 0 16px 32px -18px rgba(14, 165, 233, 0.4);
}
.module-card:active {
  transform: translateY(0) scale(0.98);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.55);
}


/* mobile admin location modal */
@media (max-width: 767px) {
  #location-modal .modal-shell-lg {
    max-height: 92vh;
    display: flex;
    flex-direction: column;
  }
  #location-modal .loc-tab {
    font-size: 0.75rem;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }
  #location-modal .loc-tab i {
    margin-right: 0.25rem;
  }
  .safe-area-pb {
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }
}
