:root {
  --primary-color: oklch(0.603 0.176 40.5);
  --primary-color-dark: oklch(0.533 0.158 39.1);
  --sidebar-expanded: 210px;
  --sidebar-collapsed: 180px;
  --sidebar-shift: 60px;
}

body, html {
  font-family: "Anuphan", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

.txt-highlight {
  color: var(--primary-color);
}

input, button, textarea, select {
  font-family: "Anuphan", sans-serif;
}

.dashboard-container { margin: 20px; }
.dashboard-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.heading { margin-bottom: 6px; font-size: 28px; }
.dashboard-subheading { color: #6b7280; font-size: 14px; }
.range-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.range-btn {
  padding: 10px 18px;
  border: 1px solid #bbb;
  border-radius: 6px;
  background: #fff;
  text-decoration: none;
  color: #333;
  font-size: 15px;
}
.range-btn.active {
  background: #eee;
  font-weight: 700;
}
.dashboard-kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 20px; }
.stat-card { border: 1px solid #e5e7eb; border-radius: 12px; padding: 18px; background: #fff; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02); }
.stat-label { font-size: 13px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 600; color: #111827; }
.stat-meta { margin-top: 8px; color: #6b7280; font-size: 13px; }

.dashboard-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 18px; }
.dashboard-panel { border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; padding: 18px; }
.dashboard-panel-wide { margin-bottom: 18px; }
.dashboard-panel-chart { min-height: 360px; }
.panel-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.panel-title { font-size: 16px; font-weight: 600; color: #111827; }
.panel-subtitle { font-size: 13px; color: #6b7280; margin-top: 4px; }
.panel-link { font-size: 13px; text-decoration: none; color: var(--primary-color); }
.panel-link:hover { text-decoration: underline; }
.panel-body { width: 100%; }
.chart-wrapper { height: 260px; }

.dashboard-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.dashboard-list-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; border: 1px solid #f3f4f6; border-radius: 10px; padding: 12px 14px; background: #fafafa; }
.list-title { font-weight: 600; color: #111827; }
.list-meta { font-size: 12px; color: #6b7280; margin-top: 2px; }
.list-value { font-weight: 600; color: #111827; }
.empty-state { color: #6b7280; font-size: 14px; background: #f9fafb; border-radius: 10px; padding: 14px; border: 1px dashed #e5e7eb; }

.dashboard-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dashboard-table th { text-align: left; color: #6b7280; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 12px 0 8px; }
.dashboard-table thead th.text-right {
  text-align: right;
}
.dashboard-table td { padding: 12px 0; border-bottom: 1px solid #f3f4f6; }
.dashboard-table tbody tr:last-child td { border-bottom: none; }
.table-link { color: var(--primary-color); text-decoration: none; font-size: 13px; }
.table-link:hover { text-decoration: underline; }

.dashboard-col-total,
.dashboard-col-updated {
  text-align: right;
  width: 140px;
}

.status-pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; }
.status-draft { background: #fef3c7; color: #92400e; }
.status-quote { background: #fef3c7; color: #4b520b; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-to_be_delivered { background: #fef3c7; color: #92400e; }
.status-delivered { background: oklch(0.603 0.176 40.5 / 0.2); color: oklch(0.533 0.158 39.1); }
.status-cancelled { background: #fee2e2; color: #991b1b; }
.status-paid { background: #d1fae5; color: #065f46; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-finalized { background: #dcfce7; color: #166534; }

.quick-actions { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.quick-action { display: block; padding: 10px 12px; border-radius: 10px; border: 1px solid #e5e7eb; background: #f9fafb; text-decoration: none; color: #111827; font-size: 13px; font-weight: 600; text-align: center; }
.quick-action:hover { background: #f3f4f6; }

/* Inventory Health */
.inventory-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.inventory-header-meta { display: flex; align-items: center; gap: 12px; }
.inventory-pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; background: #f3f4f6; border-radius: 999px; font-size: 12px; color: #374151; border: 1px solid #e5e7eb; }

.quantity-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.quantity-pill-positive { background: #d1fae5; color: #065f46; }
.quantity-pill-negative { background: #fee2e2; color: #991b1b; }
.quantity-pill-warning { background: #fef3c7; color: #92400e; }

/* POS New Order */
.pos-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.pos-products {
  flex: 3;
}

.pos-search-header {
  margin-bottom: 10px;
}

.pos-search-block {
  display: block;
  width: 100%;
}

.pos-search-row {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
}

.pos-search-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.pos-search-input {
  flex: 1;
  min-width: 180px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  background: #fff;
}

.pos-search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px okLch(0.603 0.176 40.5 / 0.12);
}

.pos-search-btn,
.pos-clear-btn {
  white-space: nowrap;
}

.pos-search-btn {
  margin-left: 6px;
}

.pos-search-btn {
  background: oklch(0.603 0.176 40.5);
  border: 1px solid oklch(0.533 0.158 39.1);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 14px oklch(0.603 0.176 40.5 / 0.18);
}

.pos-search-btn:hover {
  background: oklch(0.533 0.158 39.1);
}

.pos-search-btn:active {
  transform: translateY(1px);
}

.pos-search-btn.btn-secondary {
  border-color: oklch(0.533 0.158 39.1);
}

.pos-search-toggle input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid #cbd5f5;
  background: #fff;
  display: inline-grid;
  place-items: center;
  margin: 0;
}

.pos-search-toggle input[type="checkbox"]::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: #1d4ed8;
  transform: scale(0);
  transition: transform 120ms ease;
}

.pos-search-toggle input[type="checkbox"]:checked::after {
  transform: scale(1);
}

.pos-search-toggle input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(29, 78, 216, 0.4);
  outline-offset: 2px;
}

.pos-search-toggle span {
  font-weight: 600;
}

.payment-qr-modal {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(92vw, 420px);
  max-width: 100%;
}

.payment-qr-modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.payment-qr-modal__body {
  padding: 20px;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.payment-qr-modal__title {
  margin: 0;
  font-size: 18px;
}

.payment-qr-modal__image {
  width: min(78vw, 320px);
  height: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.payment-qr-modal__hint {
  margin: 0;
  color: #4b5563;
  font-size: 13px;
}

.payment-qr-modal__payload {
  width: 100%;
  display: block;
  padding: 10px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow-wrap: anywhere;
  white-space: normal;
  font-size: 12px;
}

.payment-qr-modal__actions {
  width: 100%;
  display: flex;
  justify-content: center;
}

.pos-search-pills {
  display: none;
  margin-top: 6px;
  width: 100%;
}

.pos-category-bar {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-bottom: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.pos-category-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  flex: 0 0 auto;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.pos-category-pill:hover {
  background: #e2e8f0;
}

.pos-category-pill.is-active {
  background: oklch(0.603 0.176 40.5);
  border-color: oklch(0.533 0.158 39.1);
  color: #fff;
  box-shadow: 0 6px 14px oklch(0.603 0.176 40.5 / 0.18);
}

.pos-search-options {
  margin-bottom: 8px;
}

.pos-search-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-size: 13px;
}

.pos-cart {
  flex: 2;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.pos-cart-header h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.pos-cart-subtitle {
  margin: 0 0 12px;
  color: #64748b;
  font-size: 13px;
}

.pos-cart-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  border: 1px dashed #e2e8f0;
  border-radius: 12px;
  padding: 10px;
  background: #f8fafc;
}

.pos-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 60%);
  margin-bottom: 12px;
}

/* Alerts */
.alerts-bell-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  text-decoration: none;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.alerts-bell-link:hover {
  background: #f1f5f9;
}

.alerts-bell-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
}

.alerts-bell-icon svg {
  width: 16px;
  height: 16px;
}

.alerts-bell-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 23px;
  height: 23px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: #ef4444;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #b91c1c;
}

.alerts-bell-badge.is-hidden {
  display: none;
}

.alerts-bell-badge.has-unread {
  animation: alerts-badge-pulse 1.4s infinite;
}

@keyframes alerts-badge-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.alerts-nav-count {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 7px;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: #dc2626;
  box-shadow: inset 0 0 0 1px #991b1b;
}

.alerts-page {
  margin: 20px;
}

.alerts-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.alerts-unread-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  color: #334155;
}

.alerts-filters {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-bottom: 14px;
}

.alerts-panel {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.alerts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alerts-list-compact {
  gap: 8px;
}

.alerts-list-item {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 10px;
  padding: 9px 10px;
}

.alerts-list-item.is-unread {
  border-left: 4px solid var(--primary-color);
}

.alerts-main {
  min-width: 0;
}

.alerts-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.alerts-time {
  font-size: 12px;
  color: #64748b;
}

.alerts-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: flex-end;
}

.alerts-actions-inline {
  align-items: center;
}

.alerts-actions form {
  margin: 0;
}

.alerts-order-link {
  margin-top: 4px;
}

.alerts-toast-stack {
  position: fixed;
  right: 16px;
  top: 68px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.alerts-toast {
  min-width: 280px;
  max-width: 360px;
  border-radius: 12px;
  padding: 10px 12px;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.15);
  transition: opacity 200ms ease, transform 200ms ease;
}

.alerts-toast.priority-high {
  border-left: 4px solid #d97706;
}

.alerts-toast.priority-critical {
  border-left: 4px solid #dc2626;
}

.alerts-toast.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
}

.alerts-toast-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.alerts-toast-message {
  font-size: 13px;
  color: #334155;
}

.alerts-toast-link {
  pointer-events: auto;
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
}

.alerts-toast-link:hover {
  text-decoration: underline;
}

.status-normal {
  background: #e2e8f0;
  color: #0f172a;
}

.status-high {
  background: #fef3c7;
  color: #92400e;
}

.status-critical {
  background: #fee2e2;
  color: #991b1b;
}

/* Customer portal */
.customer-auth-panel {
  max-width: 520px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-weight: 600;
  color: #111827;
}

.form-actions {
  display: flex;
  gap: 10px;
}

.flash {
  margin: 12px 20px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
}

.flash-notice {
  color: #065f46;
  background: #d1fae5;
  border-color: #10b98133;
}

.flash-alert {
  color: #991b1b;
  background: #fee2e2;
  border-color: #ef444433;
}

.customer-auth-layout {
  min-height: 100vh;
  background: linear-gradient(170deg, #fffaf5 0%, #ffedd5 100%);
}

.customer-auth-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 14px 28px;
}

.customer-auth-header {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.customer-auth-brand {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  text-decoration: none;
}

.customer-auth-admin-link {
  color: #0f172a;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #94a3b8;
  border-radius: 999px;
  padding: 6px 11px;
  background: #f8fafc;
  font-size: 12px;
}

.customer-auth-admin-link:hover {
  background: #e2e8f0;
}

.customer-auth-main .flash {
  margin: 0 auto 12px;
  max-width: 420px;
}

.cp-banner {
  margin: 12px 20px;
  width: auto;
  max-width: none;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid #d4d4d8;
  background: #f4f4f5;
  color: #18181b;
  font-size: 13px;
  padding: 9px 11px;
}

.cp-banner.is-neutral {
  border-color: #d6d3d1;
  background: #f5f5f4;
}

.cp-banner.is-danger {
  border-color: #e4c4c4;
  background: #f8eded;
  color: #7f1d1d;
}

.customer-auth-main .cp-banner {
  margin: 0 auto 12px;
  max-width: 420px;
}

.buyer-auth-wrap {
  margin: 0 auto;
  max-width: 420px;
}

.buyer-auth-card {
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 40px -28px rgba(15, 23, 42, 0.5);
  padding: 18px;
}

.buyer-auth-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: #c2410c;
  font-weight: 700;
}

.buyer-auth-card h1 {
  margin: 8px 0 6px;
  font-size: clamp(24px, 8vw, 32px);
  line-height: 1.16;
  color: #0f172a;
}

.buyer-auth-intro {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.55;
}

.buyer-auth-form {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.buyer-auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.buyer-auth-field label {
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
}

.buyer-auth-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  padding: 12px 13px;
  font-size: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.buyer-auth-input:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

.buyer-auth-otp {
  text-align: center;
  letter-spacing: 0.22em;
  font-weight: 700;
}

.buyer-auth-field small {
  color: #64748b;
  font-size: 12px;
}

.buyer-auth-submit {
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, #f97316 0%, #ea580c 100%);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}

.buyer-auth-submit:hover {
  box-shadow: 0 10px 20px -12px rgba(194, 65, 12, 0.7);
}

.buyer-auth-submit:active {
  transform: translateY(1px);
}

.buyer-auth-footnote {
  margin: 14px 0 0;
  color: #475569;
  font-size: 13px;
}

.buyer-auth-footnote a {
  color: #c2410c;
  font-weight: 600;
  text-decoration: none;
}

.buyer-auth-footnote a:hover {
  text-decoration: underline;
}

.buyer-auth-mobile {
  margin: 0 auto;
  max-width: 440px;
}

.buyer-auth-mobile-card {
  border-radius: 18px;
  border: 1px solid #cbd5e1;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 36px -24px rgba(15, 23, 42, 0.45);
  padding: 16px;
}

.buyer-auth-mobile-kicker {
  margin: 0;
  color: #c2410c;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 700;
}

.buyer-auth-mobile-card h1 {
  margin: 8px 0 6px;
  font-size: clamp(24px, 9vw, 32px);
  line-height: 1.15;
  color: #0f172a;
}

.buyer-auth-mobile-copy {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.5;
}

.buyer-auth-mobile-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.buyer-auth-mobile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.buyer-auth-mobile-field label {
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
}

.buyer-auth-mobile-field small {
  color: #64748b;
  font-size: 12px;
}

.buyer-auth-mobile-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  padding: 12px 13px;
  font-size: 16px;
}

.buyer-auth-mobile-input:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

.buyer-auth-mobile-otp {
  text-align: center;
  letter-spacing: 0.2em;
  font-weight: 700;
}

.buyer-auth-mobile-submit {
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, #f97316 0%, #ea580c 100%);
  cursor: pointer;
}

.buyer-auth-mobile-footnote {
  margin: 14px 0 0;
  color: #475569;
  font-size: 13px;
}

.buyer-auth-mobile-footnote a {
  color: #c2410c;
  font-weight: 600;
  text-decoration: none;
}

.buyer-auth-mobile-footnote a:hover {
  text-decoration: underline;
}

@media (min-width: 861px) {
  .customer-auth-shell {
    padding-top: 28px;
  }

  .customer-auth-brand {
    font-size: 18px;
  }

  .customer-auth-admin-link {
    font-size: 13px;
    padding: 8px 14px;
  }

  .buyer-auth-card {
    padding: 26px;
  }
}

.pos-total-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}

.pos-total-amount {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 700;
  color: #0f172a;
}

.pos-total-value {
  font-size: 20px;
}

.pos-total-currency {
  font-size: 12px;
  color: #64748b;
  letter-spacing: 0.08em;
}

.pos-cart-list:empty::before {
  content: "Add items from the list to start a cart.";
  color: #94a3b8;
  font-size: 12px;
}

.pos-cart-list li {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.pos-cart-list li.pos-cart-item-enter {
  animation: posCartItemEnter 180ms ease-out;
}

.pos-cart-list li.pos-cart-item-bump {
  animation: posCartItemBump 180ms ease-out;
}

.pos-cart-list li.pos-cart-item-leave {
  pointer-events: none;
  animation: posCartItemLeave 240ms ease-in forwards;
}

.pos-cart-fly-token {
  position: fixed;
  z-index: 1200;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #ffffff, #fed7aa 62%, #fb923c 100%);
  border: 1px solid #fdba74;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.28), 0 0 0 4px rgba(251, 146, 60, 0.18);
  color: #7c2d12;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
  pointer-events: none;
}

.pos-cart-target-pulse {
  animation: posCartTargetPulse 300ms ease-out;
}

@keyframes posCartItemEnter {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes posCartItemBump {
  0% {
    transform: scale(1);
    border-color: #e5e7eb;
    background: #fff;
  }
  40% {
    transform: scale(1.01);
    border-color: #fdba74;
    background: #fff7ed;
  }
  100% {
    transform: scale(1);
    border-color: #e5e7eb;
    background: #fff;
  }
}

@keyframes posCartItemLeave {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}

@keyframes posCartTargetPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(251, 146, 60, 0);
  }
  55% {
    transform: scale(1.02);
    box-shadow: 0 0 0 8px rgba(251, 146, 60, 0.2);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(251, 146, 60, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pos-cart-list li.pos-cart-item-enter,
  .pos-cart-list li.pos-cart-item-bump,
  .pos-cart-list li.pos-cart-item-leave,
  .pos-cart-target-pulse {
    animation: none;
  }
}

.pos-cart-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pos-form-section {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.pos-form-section label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.pos-field {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 14px;
  background: #fff;
  color: #0f172a;
  margin-top: 6px;
}

.pos-field:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px oklch(0.603 0.176 40.5 / 0.15);
}

.pos-field-action {
  margin-top: 8px;
}

.pos-create-btn {
  margin-top: 6px;
  width: 100%;
  justify-content: center;
}

.pos-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.pos-table thead th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  padding: 8px 0;
}

.pos-table thead th:nth-child(2),
.pos-table thead th:nth-child(3) {
  text-align: right;
}

.pos-table thead th:nth-child(4) {
  text-align: center;
}

.pos-table tbody td {
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.pos-table-shell {
  overflow-x: auto;
}

.pos-table th:first-child,
.pos-table td:first-child {
  width: 52%;
}

.pos-table th:nth-child(2),
.pos-table td:nth-child(2) {
  width: 18%;
}

.pos-table th:nth-child(3),
.pos-table td:nth-child(3) {
  width: 14%;
}

.pos-table th:nth-child(4),
.pos-table td:nth-child(4) {
  width: 16%;
}

.pos-product-name {
  max-width: 0;
}

.pos-product-name-text {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos-pagination {
  margin-top: 10px;
}

/* POS Mobile Variant */
.pos-mobile-page {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pos-mobile-header h1 {
  margin: 0;
  font-size: 24px;
}

.pos-mobile-header p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 13px;
}

.pos-mobile-products {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.pos-product-cards {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.pos-mobile-page .pos-product-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pos-product-cards-list {
  display: contents;
}

.pos-product-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pos-product-card-cover-trigger {
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.pos-product-card-cover-trigger:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 10px;
}

.pos-product-card-cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  overflow: hidden;
  background: #e2e8f0;
}

.pos-product-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pos-product-card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #64748b;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
}

.pos-product-card h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
}

.pos-product-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pos-product-label {
  display: block;
  color: #64748b;
  font-size: 11px;
  margin-bottom: 2px;
}

.pos-products-layout {
  display: grid;
  gap: 10px;
}

.pos-layout-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 4px;
}

.pos-layout-switch-btn {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  background: transparent;
  cursor: pointer;
}

.pos-layout-switch-btn.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.pos-product-cards-desktop {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.pos-hidden {
  display: none !important;
}

.pos-mobile-submit {
  margin-top: 8px;
}

.pos-infinite-sentinel {
  height: 1px;
  width: 100%;
  grid-column: 1 / -1;
}

.pos-infinite-status {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 12px;
  color: #64748b;
  min-height: 18px;
}

.pos-mobile-page {
  padding-bottom: 96px;
}

.pos-mobile-cart-trigger {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 75;
  border: 1px solid #f2b487;
  background: linear-gradient(90deg, #f3d8c0, #f4c6a3);
  border-radius: 999px;
  min-height: 56px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  color: #822915;
}

.pos-mobile-trigger-label {
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.pos-mobile-trigger-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}

.pos-mobile-cart-trigger strong {
  font-size: 18px;
  font-weight: 800;
}

.pos-mobile-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 78;
}

.pos-mobile-cart-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.pos-mobile-cart-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  transform: translateY(100%);
  transition: transform 180ms ease;
  border-radius: 18px 18px 0 0;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -20px 42px rgba(15, 23, 42, 0.2);
  padding: 12px 12px calc(env(safe-area-inset-bottom, 0px) + 14px);
  max-height: min(84vh, 760px);
  overflow-y: auto;
}

.pos-mobile-cart-drawer.is-open {
  transform: translateY(0);
}

.pos-mobile-cart-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pos-mobile-cart-drawer-header h3 {
  margin: 0;
  font-size: 18px;
}

.pos-mobile-cart-close {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pagination {
  margin-top: 14px;
}

.pagination .pagy-nav,
.pagination .pagy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.pagination .pagy-nav a,
.pagination .pagy a,
.pagination .pagy-nav span,
.pagination .pagy span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.pagination .pagy-nav a:hover,
.pagination .pagy a:hover {
  background: #f1f5f9;
}

.pagination .pagy-nav .current,
.pagination .pagy .current {
  background: #e2e8f0;
  border-color: #cbd5f5;
  color: #0f172a;
}

.pagination .pagy-nav .gap,
.pagination .pagy .gap {
  border-color: transparent;
  background: transparent;
  color: #94a3b8;
}

.pagination .pagy-nav .disabled,
.pagination .pagy .disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 980px) {
  .pos-layout {
    flex-direction: column;
  }

  .pos-mobile-page {
    max-width: none;
  }

  .pos-product-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pos-mobile-cart-trigger {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
  .pos-cart {
    width: 100%;
  }
  .pos-search-row {
    flex-direction: column;
    align-items: stretch;
  }
  .pos-search-form {
    width: 100%;
  }
  .pos-search-btn,
  .pos-clear-btn {
    width: 100%;
  }
  .pos-table th:first-child,
  .pos-table td:first-child {
    width: 54%;
  }
  .pos-table th:nth-child(2),
  .pos-table td:nth-child(2) {
    width: 20%;
  }
  .pos-table th:nth-child(3),
  .pos-table td:nth-child(3) {
    width: 14%;
  }
  .pos-table th:nth-child(4),
  .pos-table td:nth-child(4) {
    width: 12%;
  }
}

/* Form styling */
.madmin-form-shell { max-width: 980px; margin: 20px auto; padding: 0 12px; }
.madmin-form-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; padding: 20px 22px; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04); }
.form-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.form-card-title { font-size: 20px; font-weight: 700; color: #0f172a; }
.form-card-subtitle { font-size: 13px; color: #64748b; margin-top: 6px; }
.form-card-body { display: flex; flex-direction: column; gap: 18px; }
.form-card-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.form-section { padding: 16px; border: 1px solid #e5e7eb; border-radius: 12px; background: #f8fafc; }
.form-section-title { font-size: 14px; font-weight: 600; color: #0f172a; margin-bottom: 12px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.address-card { background: #fff; }
.shop-settings-branding-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.shop-settings-branding-panel { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; }
.shop-settings-subsection-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 10px;
}
@media (min-width: 980px) {
  .shop-settings-branding-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.form-control {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  color: #0f172a;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px oklch(0.603 0.176 40.5 / 0.15);
}
.form-group label { font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; display: inline-block; }
.form-description { margin-top: 6px; font-size: 12px; color: #64748b; }

.madmin-form-card .form-group { display: flex; flex-direction: column; gap: 6px; }
.madmin-form-card .form-group input:not([type="checkbox"]):not([type="radio"]),
.madmin-form-card .form-group select,
.madmin-form-card .form-group textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  color: #0f172a;
}
.madmin-form-card .form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.madmin-form-card .form-group select:focus,
.madmin-form-card .form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px oklch(0.603 0.176 40.5 / 0.15);
}

.notice-card {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.notice-card-info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
}
.notice-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.notice-body { font-size: 13px; }
.notice-actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }

.table-actions { white-space: nowrap; }
.btn-xs { padding: 4px 8px; font-size: 12px; }

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Compact overview tables for high-density record scanning */
.compact-index-table th,
.compact-index-table td {
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.25;
}

.table-scroll > table.compact-index-table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.compact-index-table td {
  vertical-align: middle;
}

.compact-index-table .status-pill {
  padding: 2px 8px;
  font-size: 11px;
}

.compact-index-table .inline-actions {
  gap: 4px;
  flex-wrap: wrap;
}

.compact-index-table .btn-xs {
  padding: 4px 10px;
  font-size: 12px;
}

.compact-index-table .table-actions {
  min-width: 140px;
  text-align: right;
}

.compact-index-table .compact-meta-time {
  color: #64748b;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.pos-btn {
  font-size: 18px;
  padding: 8px 12px;
  margin-left: 6px;
  border-radius: 4px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  cursor: pointer;
  display: inline-block;
}

.pos-btn:active {
  background: #e0e0e0;
}

.pos-remove {
  background: #ffe5e5;
  border: 1px solid #ff9999;
  font-size: 18px;
  padding: 8px 12px;
}

.pos-main-btn {
  font-size: 18px;
  padding: 10px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: #f0f0f0;
  border: 1px solid #ccc;
}

.pos-main-btn:active {
  background: #e0e0e0;
}

.pos-add-btn {
  background: #e7eaff;
  border: 1px solid #b9c4ff;
  margin-left: 8px;
}

.pos-add-btn:active {
  background: #d6ddff;
}

.pos-create-btn {
  background: var(--primary-color);
  border: 1px solid var(--primary-color-dark);
  color: white;
  font-weight: 500;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.pos-create-btn:active {
  background: var(--primary-color-dark);
}

.pos-cancel-btn {
  background: #ef4444;
  border: 1px solid #dc2626;
  color: white;
  font-weight: 500;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.pos-cancel-btn:active {
  background: #dc2626;
}

.text-right {
  text-align: right;
}

/* Order Summary Styles */
.order-summary-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.order-summary-header {
  border-bottom: 2px solid #000;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.order-summary-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.order-summary-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: #6b7280;
}

.order-summary-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.order-summary-info {
  font-size: 0.875rem;
}

.order-summary-remark {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.order-items-container {
  margin-bottom: 1.5rem;
}

.order-items-table {
  width: 100%;
  border-collapse: collapse;
}

.order-items-table thead tr {
  border-bottom: 2px solid #e5e7eb;
}

.order-items-table th {
  padding: 0.75rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.order-items-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
}

.order-items-table td {
  padding: 0.75rem 0.5rem;
}

.order-item-name {
  font-weight: 500;
}

.order-item-detail {
  font-size: 0.75rem;
  color: #6b7280;
}

.order-totals-section {
  margin-bottom: 1.5rem;
  padding-top: 1rem;
  border-top: 2px solid #e5e7eb;
}

.order-total-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.order-total-content {
  width: 200px;
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
}

.order-total-final {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.5rem;
  border-top: 1px solid #e5e7eb;
}

.order-total-final-content {
  width: 200px;
  display: flex;
  justify-content: space-between;
  font-size: 1.125rem;
  font-weight: 700;
}

.order-status-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid #e5e7eb;
}

.order-status-section-top {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.order-status-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.order-status-badges {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.order-status-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.order-status-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-status-label {
  font-weight: 600;
}

.order-status-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
}

.order-status-badge-draft {
  background-color: #fef3c7;
  color: #92400e;
}

.order-status-badge-quote {
  background-color: #fef3c7;
  color: #4b520b;
}

.order-status-badge-pending {
  background-color: #fef3c7;
  color: #92400e;
}

.order-status-badge-to_be_delivered {
  background-color: #fef3c7;
  color: #92400e;
}

.order-status-badge-completed {
  background-color: #d1fae5;
  color: #065f46;
}

.order-status-badge-paid {
  background-color: #d1fae5;
  color: #065f46;
}

.order-status-badge-delivered {
  background-color: oklch(0.603 0.176 40.5 / 0.2);
  color: oklch(0.533 0.158 39.1);
}

.order-status-badge-cancelled {
  background-color: #fee2e2;
  color: #991b1b;
}

.order-status-badge-payment-failure,
.order-status-badge-failed {
  background-color: #fee2e2;
  color: #991b1b;
}

.order-status-badge-verified {
  background-color: #d1fae5;
  color: #065f46;
}

.order-status-timestamp {
  font-size: 0.75rem;
  color: #6b7280;
}

.order-status-no-bill {
  color: #6b7280;
  font-size: 0.875rem;
}

.order-action-form {
  margin: 0;
}

.order-payment-failure-investigate {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.payment-attempt-details {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 1rem;
  align-items: flex-start;
}

.payment-slip-preview {
  max-width: 100%;
  max-height: 320px;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

.payment-attempt-payload pre {
  margin: 0.5rem 0 0;
  max-height: 320px;
  overflow: auto;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.75rem;
  font-size: 0.75rem;
}

@media (max-width: 768px) {
  .payment-attempt-details {
    grid-template-columns: 1fr;
  }
}

/* Madmin sidebar: collapsed by default, expands on hover/focus without pushing content */
main {
  position: relative;
}

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-collapsed, 120px);
  overflow: hidden;
  z-index: 50;
  transition: width 160ms ease;
  background-color: white;
  display: flex;
  flex-direction: column;
}

main > div {
  margin-left: 0;
  transform: translateX(calc(-1 * var(--sidebar-shift, 120px)));
}

#sidebar:hover,
#sidebar:focus-within {
  width: var(--sidebar-expanded);
}

@media (max-width: 768px) {
  #sidebar {
    width: var(--sidebar-shift, 120px);
  }
  main > div {
    margin-left: 0;
    transform: translateX(calc(-1 * var(--sidebar-shift, 120px)));
    margin-right: calc(var(--sidebar-shift, 120px));
  }
}

.madmin-brand {
  padding: 12px 0;
  font-weight: 600;
}

.madmin-brand a {
  background: transparent !important;
  display: block;
}

.madmin-brand:hover,
.madmin-brand:focus,
.madmin-brand:active,
.madmin-brand a:hover,
.madmin-brand a:focus,
.madmin-brand a:active {
  background: transparent !important;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 12px 12px;
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section-title,
#sidebar h4 {
  margin: 8px 10px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 500;
}

#sidebar nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
}

#sidebar nav a:hover {
  background: #f1f5f9;
  color: #0f172a;
}

#sidebar nav a.active {
  background: #e2e8f0;
  color: #0f172a;
}

.nav-section-signout {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

.nav-section-signout form {
  margin: 0;
}

.sign_out-btn {
  width: 100%;
  border: 1px solid #fecaca;
  background: #fff;
  color: #991b1b;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.sign_out-btn:hover {
  background: #fee2e2;
}

/* Responsive Madmin overrides */
#navbar {
  display: none;
}

main {
  display: block;
  overflow: visible;
  padding: 0;
  min-height: 100vh;
}

body.variant-mobile main {
  width: 100%;
  max-width: 100vw;
  margin: 0;
  overflow-x: hidden;
}

main > div.main-content {
  min-width: 0;
  width: calc(100% - var(--sidebar-collapsed, 180px));
  max-width: calc(100% - var(--sidebar-collapsed, 180px));
  margin-left: var(--sidebar-collapsed, 180px);
  padding: 16px 20px 24px;
  box-sizing: border-box;
  transform: none;
}

main > div.main-content.main-content-mobile {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  padding: 12px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.actions .search {
  flex: 1 1 280px;
  min-width: 220px;
}

.actions .search input[type="search"] {
  width: 100%;
}

.actions.actions-index {
  flex-wrap: nowrap;
  align-items: center;
}

.actions.actions-index .search {
  flex: 1 1 auto;
  min-width: 0;
}

.actions.actions-index > .btn,
.actions.actions-index > form.button_to {
  flex: 0 0 auto;
}

.scopes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.table-scroll > table {
  width: 100%;
  min-width: 680px;
}

.table-scroll > table.is-responsive-table {
  min-width: 0;
}

.table-scroll td,
.table-scroll th {
  vertical-align: middle;
}

.table-actions {
  min-width: 160px;
}

.inline-actions form {
  margin: 0;
}

.expense-nested-card {
  margin-bottom: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.expense-form-receipt-preview {
  max-height: 140px;
  width: auto;
  border-radius: 6px;
}

.expense-grand-total-card {
  background: #fff7ed;
  border-color: #fed7aa;
}

.expense-list-item-start {
  align-items: flex-start;
}

.expense-receipt-preview {
  max-height: 120px;
  width: auto;
  border-radius: 6px;
}

.expense-mobile-page {
  max-width: 520px;
}

.expense-mobile-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.expense-mobile-actions > .btn,
.expense-mobile-actions > form.button_to {
  width: 100%;
}

.expense-mobile-actions > form.button_to .btn {
  width: 100%;
}

.expense-mobile-card {
  align-items: flex-start;
}

.expense-mobile-card-footer {
  width: 100%;
  display: grid;
  gap: 8px;
}

.expense-mobile-page .madmin-form-shell {
  max-width: none;
  margin: 0;
  padding: 0;
}

@media (max-width: 980px) {
  #navbar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 60;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 10px;
  }

  #hamburger-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #0f172a;
  }

  #sidebar {
    width: min(82vw, 320px);
    transform: translateX(-100%);
    transition: transform 160ms ease;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.16);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  main > div.main-content {
    margin-left: 0;
    padding: 12px;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .actions {
    width: 100%;
    align-items: stretch;
  }

  .actions .search {
    flex: 1 1 100%;
    min-width: 0;
  }

  .actions.actions-index {
    align-items: center;
    flex-wrap: nowrap;
  }

  .actions.actions-index .search {
    flex: 1 1 auto;
    min-width: 0;
  }

  .actions.actions-index > .btn,
  .actions.actions-index > form.button_to {
    flex: 0 0 auto;
  }

  .actions > .btn,
  .actions > form.button_to {
    flex: 1 1 calc(50% - 4px);
  }

  .actions > form.button_to .btn {
    width: 100%;
  }

  .scopes {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .scopes .btn {
    flex: 0 0 auto;
  }

  .dashboard-container {
    margin: 12px;
  }

  .customer-auth-header {
    align-items: center;
  }

  .dashboard-header,
  .inventory-header,
  .panel-header,
  .dashboard-list-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-table {
    min-width: 640px;
  }

  .order-summary-container {
    margin: 1rem 0;
    padding: 1rem;
  }

  .order-summary-meta,
  .order-status-row,
  .order-status-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .order-total-content,
  .order-total-final-content {
    width: 100%;
    max-width: 260px;
  }

  .madmin-form-shell {
    margin: 12px auto;
    padding: 0 8px;
  }

  .madmin-form-card {
    padding: 16px;
  }

  .form-card-header {
    flex-direction: column;
    gap: 10px;
  }

  .form-card-actions > * {
    flex: 1 1 auto;
  }

  .expense-nested-card .btn {
    width: 100%;
  }
}

@media (max-width: 768px) {
  table.is-responsive-table {
    width: 100%;
    min-width: 0 !important;
    border: 0;
  }

  table.is-responsive-table thead {
    display: none;
  }

  table.is-responsive-table tbody {
    display: grid;
    gap: 10px;
  }

  table.is-responsive-table tbody tr {
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    padding: 10px;
  }

  table.is-responsive-table tbody th {
    display: none;
  }

  table.is-responsive-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    border: 0;
    border-top: 1px solid #f1f5f9;
    padding: 8px 0;
    text-align: left !important;
    min-height: 30px;
  }

  table.is-responsive-table tbody td:first-child {
    border-top: 0;
    padding-top: 0;
  }

  table.is-responsive-table tbody td:last-child {
    padding-bottom: 0;
  }

  table.is-responsive-table tbody td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    flex: 0 0 42%;
    max-width: 42%;
    text-align: left;
  }

  table.is-responsive-table tbody td[data-label=""]::before {
    content: none;
    flex-basis: 0;
    max-width: 0;
  }

  table.is-responsive-table tbody td .inline-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .actions > .btn,
  .actions > form.button_to {
    flex: 1 1 100%;
  }

  .table-scroll > table:not(.is-responsive-table) {
    min-width: 560px;
  }

  .table-scroll > table.compact-index-table {
    min-width: 0 !important;
    width: 100%;
  }

  .pos-table:not(.is-responsive-table) {
    min-width: 560px;
  }
}

/* Product media editor */
.form-card-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-publish-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.product-publish-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.product-media-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.product-media-item {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.product-media-item-cover {
  max-width: 220px;
}

.product-media-preview {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.product-media-actions {
  padding: 8px;
  border-top: 1px solid #e5e7eb;
  background: #f8fafc;
}

.product-media-remove-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}

.product-media-remove-check {
  width: 16px;
  height: 16px;
}

.product-media-item:has(.product-media-remove-check:checked) {
  border-color: #ef4444;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25);
}

.product-media-item:has(.product-media-remove-check:checked) .product-media-preview {
  opacity: 0.55;
}

.product-media-item:has(.product-media-remove-check:checked) .product-media-remove-choice span::after {
  content: " (will remove)";
  color: #b91c1c;
  font-weight: 600;
}

.product-show-media {
  margin-bottom: 14px;
}

.product-show-media-title {
  margin-bottom: 6px;
}

.product-show-media-footer {
  margin-top: 12px;
}

/* Madmin mobile cards */
.mobile-header-stack {
  align-items: stretch;
}

.mobile-actions-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-search-form {
  width: 100%;
}

.mobile-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.madmin-mobile-list {
  display: grid;
  gap: 10px;
}

.madmin-mobile-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.madmin-mobile-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.madmin-mobile-card-header h3 {
  margin: 0;
  font-size: 16px;
}

.madmin-mobile-meta {
  color: #4b5563;
  font-size: 13px;
  display: grid;
  gap: 4px;
}

.madmin-mobile-card-actions {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.compact-mobile-list {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  padding: 6px 2px 10px;
  box-sizing: border-box;
}

.compact-mobile-row {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.compact-mobile-row-main {
  min-width: 0;
}

.compact-mobile-row-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-mobile-row-sub {
  margin-top: 2px;
  font-size: 12px;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-mobile-row-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #64748b;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.compact-mobile-row-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

@media (max-width: 768px) {
  .dashboard-header,
  .panel-header,
  .inventory-header,
  .actions-index {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-container {
    margin: 10px;
  }

  .dashboard-table {
    font-size: 13px;
  }

  .dashboard-col-total,
  .dashboard-col-updated {
    width: auto;
  }

  .product-media-grid {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  }

  .product-media-preview {
    height: 92px;
  }

  .mobile-form-shell .form-card-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
