:root {
  --brand-primary: #FF5A1F;
  --brand-secondary: #0F172A;
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border-color: #E2E8F0;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #0284C7;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
}

/* Dynamic Multi-Tenant Storefront Theme Presets */
[data-theme="coffee"] {
  --brand-primary: #6F4E37;
  --brand-secondary: #D4A373;
  --bg-page: #FAF6F0;
  --bg-card: #FFFFFF;
  --text-main: #2C1E16;
  --text-muted: #785A46;
  --border-color: #E6D7C3;
}

[data-theme="milktea"] {
  --brand-primary: #C08457;
  --brand-secondary: #582F0E;
  --bg-page: #FDF8F5;
  --bg-card: #FFFFFF;
  --text-main: #3B2314;
  --text-muted: #7C5841;
  --border-color: #EEDDD3;
}

[data-theme="laundry"] {
  --brand-primary: #0284C7;
  --brand-secondary: #38BDF8;
  --bg-page: #F0F9FF;
  --bg-card: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #475569;
  --border-color: #BAE6FD;
}

[data-theme="online_store"] {
  --brand-primary: #FF5A1F;
  --brand-secondary: #1E293B;
  --bg-page: #FFF8F6;
  --bg-card: #FFFFFF;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --border-color: #FED7AA;
}

[data-theme="pisowifi"] {
  --brand-primary: #10B981;
  --brand-secondary: #0F172A;
  --bg-page: #0B1120;
  --bg-card: #1E293B;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --border-color: #334155;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Modern Web Guidance: Native <dialog> scroll containment & backdrop styling */
dialog:modal {
  overscroll-behavior: contain;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text-main);
  padding: 1.5rem;
  max-width: 520px;
  width: calc(100% - 2rem);
  margin: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
}

/* Header & Navigation */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-main);
  text-decoration: none;
}

.svg-icon {
  display: inline-block;
  vertical-align: -0.18em;
  flex-shrink: 0;
}

.brand-badge {
  background: var(--brand-primary);
  color: #fff;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.container {
  max-width: 1340px;
  margin: 0 auto;
  padding: 1.25rem;
}

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--brand-primary);
  color: #ffffff;
}

.btn-secondary {
  background: var(--brand-secondary);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-color);
  color: var(--text-main);
}

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

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

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand-primary);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

/* Cards & Grid */
.grid {
  display: grid;
  gap: 1.15rem;
}

.grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Hero Banner for Storefront */
.store-hero {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.store-hero h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

/* Category Pills */
.category-pills {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
}

.category-pill {
  white-space: nowrap;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.category-pill.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

/* Vendor POS Sidebar Layout */
.pos-dashboard-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.35rem;
  align-items: start;
}

.pos-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.9rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 4.85rem;
}

.pos-sidebar-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.35rem 0.65rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pos-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pos-sidebar-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.72rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.pos-sidebar-link:hover {
  background: rgba(148, 163, 184, 0.12);
  border-color: var(--border-color);
}

.pos-sidebar-link.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.22);
}

.pos-sidebar-link-main {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.pos-sidebar-link-main span {
  line-height: 1.3;
}

.pos-sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  background: rgba(148, 163, 184, 0.18);
  color: var(--text-main);
  white-space: nowrap;
  flex-shrink: 0;
}

.pos-sidebar-link.active .pos-sidebar-badge {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.pos-main-content {
  min-width: 0;
}

@media (max-width: 920px) {
  .pos-dashboard-layout {
    grid-template-columns: 1fr;
  }
  .pos-sidebar {
    position: static;
  }
  .pos-sidebar-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.45rem;
  }
}

/* Floating Cart Bar */
.floating-cart {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 560px;
  background: var(--brand-primary);
  color: #fff;
  padding: 0.9rem 1.25rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  z-index: 35;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pending { background: #FEF3C7; color: #92400E; }
.status-preparing { background: #E0F2FE; color: #075985; }
.status-ready { background: #D1FAE5; color: #065F46; }
.status-completed { background: #DCFCE7; color: #166534; }
.status-cancelled { background: #FEE2E2; color: #991B1B; }

/* Analytics KPI Cards & Tables */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--brand-primary);
  margin-top: 0.25rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

/* 58mm / 80mm POS Thermal Receipt Preview */
.thermal-receipt {
  font-family: 'Courier New', Courier, monospace;
  background: #ffffff;
  color: #000000;
  width: 300px;
  margin: 0 auto;
  padding: 1rem;
  border: 1px dashed #94A3B8;
  font-size: 12px;
  line-height: 1.4;
}

.thermal-receipt.size-58mm {
  width: 220px;
  font-size: 11px;
}

.thermal-receipt.size-80mm {
  width: 300px;
  font-size: 12px;
}

.thermal-divider {
  border-top: 1px dashed #000;
  margin: 0.5rem 0;
}

@media print {
  body.printing-receipt > *:not(#receiptDialog) {
    display: none !important;
  }
  body.printing-receipt #receiptDialog {
    position: static !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    max-width: none !important;
    background: #fff !important;
  }
  body.printing-receipt .no-print {
    display: none !important;
  }
  body.printing-receipt .thermal-receipt {
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

.hidden {
  display: none !important;
}


/* =======================================================================
   CELLPHONE (≤640px)
   Walang ganitong panuntunan dati, kaya sa cellphone ay gumagalaw pakanan
   ang buong pahina: ang mga pindutan sa itaas (Wallet, Account Settings,
   My Orders, Vendor POS Login) ay tumatakas sa labas ng screen at hindi
   maabot ng suki. Dito sila ibinababa sa sariling linya.
   ======================================================================= */
@media (max-width: 640px) {
  .container {
    padding: 0.85rem;
  }

  .top-nav {
    /* Hindi na nakadikit sa itaas: 136px ang taas nito sa cellphone kapag
       dalawang linya ang pindutan — 1/6 ng screen na permanenteng nawawala.
       Pinapaalis natin ito sa pag-scroll; may floating cart naman para sa
       pag-order. */
    position: static;
    flex-wrap: wrap;
    padding: 0.7rem 0.85rem;
    gap: 0.6rem;
  }

  /* Ang mahabang "shop.aranestech.com" ay hindi na nagtutulak sa iba —
     pinuputol na lang ito kung masikip. */
  .brand-logo {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1rem;
    gap: 0.45rem;
  }
  .brand-logo > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Palamuti lang ang tatak ng tema ("Marketplace", "Coffee & Cafe Theme")
     at kinakain nito ang kalahati ng unang linya sa cellphone. */
  .top-nav .brand-badge {
    display: none;
  }

  /* Buong linya na ang hanay ng pindutan, at pantay-pantay ang lapad. */
  .top-nav > div:last-child {
    width: 100%;
    justify-content: flex-start;
  }
  .top-nav > div:last-child > .btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* Mas malaking tapakan para sa hinlalaki. */
  .btn-sm {
    padding: 0.5rem 0.7rem;
    font-size: 0.8rem;
  }

  .store-hero {
    padding: 1.1rem;
    gap: 0.8rem;
  }
  .store-hero h1 {
    font-size: 1.35rem;
  }
  .store-hero > div {
    width: 100%;
  }
  /* Nakaipit sa kanan ang hanay ng pindutan dahil sa inline na
     align-items:flex-end — sa cellphone ay dapat buong lapad. */
  .store-hero > div:last-child {
    align-items: stretch !important;
  }
  .store-hero > div:last-child .btn {
    justify-content: center;
  }

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .grid {
    gap: 0.85rem;
  }
  .card {
    padding: 1rem;
  }

  /* Ini-swipe na lang pakanan ang kategorya at ang salaan sa halip na
     ipilit ang lahat sa isang linya. */
  .category-pills {
    max-width: 100%;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .category-pills::-webkit-scrollbar {
    display: none;
  }
  .category-pill {
    flex: 0 0 auto;
  }

  dialog:modal {
    padding: 1.1rem;
    width: calc(100% - 1.5rem);
    max-height: 88vh;
  }

  .floating-cart {
    width: calc(100% - 1.25rem);
    padding: 0.8rem 1rem;
    bottom: 0.85rem;
  }

  /* Walang larawan o talahanayan ang dapat lumagpas sa screen. */
  img,
  svg,
  table {
    max-width: 100%;
  }
}

/* Napakaliit na screen (hal. 360px pababa) */
@media (max-width: 400px) {
  .brand-logo {
    font-size: 0.92rem;
  }
  .store-hero h1 {
    font-size: 1.2rem;
  }
  .btn-sm {
    padding: 0.45rem 0.55rem;
    font-size: 0.76rem;
  }
}
