:root {
  --bg: #f4f1e8;
  --surface: #fffdfa;
  --surface-alt: #efe4cf;
  --text: #241f18;
  --muted: #72685b;
  --primary: #136f63;
  --primary-dark: #0e584f;
  --danger: #c44536;
  --success: #2a8f45;
  --border: #dccfb8;
  --shadow: 0 18px 40px rgba(36, 31, 24, 0.08);
  --radius: 18px;
  --touch: 48px;
  --max-width: 1100px;
  /* New Mobile Theme Variables */
  --mobile-primary: #2563eb;
  --mobile-dark: #0f172a;
  --mobile-bg: #f1f5f9;
  --mobile-card: #ffffff;
  --mobile-nav-height: 70px;
}

/* Enterprise navy refresh and document/POS additions */
:root {
  --brand-navy: #071a2f;
  --brand-navy-2: #0f2f4a;
  --brand-cyan: #16b8d6;
  --brand-gold: #f5b642;
  --brand-panel: rgba(255, 255, 255, 0.92);
}

/* ซ่อนระบบและข้อมูลของ รายการผ่อนชำระ ทั้งหมด */
#dashboardInstallmentPanel,
#adminInstallmentCard,
button[data-page="installmentsPage"],
button[data-page="installmentListPage"],
button[data-dashboard-target="installments"],
button[onclick*="installment"] {
  display: none !important;
}

body {
  font-size: 15px;
  background:
    radial-gradient(circle at 8% 0%, rgba(22, 184, 214, 0.14), transparent 28%),
    radial-gradient(circle at 90% 8%, rgba(245, 182, 66, 0.14), transparent 24%),
    linear-gradient(145deg, #f4f8fb 0%, #e8eef6 48%, #dfe8f2 100%);
}

.topbar {
  background: rgba(7, 26, 47, 0.82) !important;
  backdrop-filter: blur(16px) saturate(120%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(120%) !important;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow:
    0 4px 30px rgba(0, 0, 0, 0.1),
    inset 0 1px 1px rgba(255, 255, 255, 0.15) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


.brand-heading {
  display: flex !important;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px;
}

.topbar .eyebrow,
.topbar h1 {
  color: #ffffff;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-areas:
    "nav main";
  gap: 18px;
  max-width: 1680px;
}

.topbar {
  display: none !important;
}

.main-content {
  grid-area: main;
}

.bottom-nav {
  grid-area: nav;
  position: sticky;
  top: 18px;
  align-self: start;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 18px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 54px rgba(15, 47, 74, 0.16);
}









.nav-group-label {
  margin: 16px 10px 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bottom-nav button {
  justify-content: flex-start;
  border-radius: 16px;
  min-height: 46px;
}

.bottom-nav button.active {
  background: linear-gradient(135deg, var(--brand-navy), #0e5470);
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(7, 26, 47, 0.26);
}

.bottom-nav button.nav-accent {
  position: relative;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 28px rgba(7, 26, 47, 0.22);
}

.bottom-nav button.nav-accent .nav-icon {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.bottom-nav button.nav-accent::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  background: #ffd43b;
}

.bottom-nav button.nav-accent-repair {
  background: linear-gradient(135deg, #0f766e, #06b6d4);
}

.bottom-nav button.nav-accent-sale {
  background: linear-gradient(135deg, #166534, #22c55e);
}

.bottom-nav button.nav-accent.active {
  box-shadow: 0 14px 30px rgba(7, 26, 47, 0.28);
}

.nav-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(22, 184, 214, 0.12);
  color: var(--brand-cyan);
}

.bottom-nav button.active .nav-icon {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.card,
.list-item,
.stat-card {
  background: var(--brand-panel);
  border: 1px solid rgba(15, 47, 74, 0.1);
  box-shadow: 0 18px 42px rgba(15, 47, 74, 0.08);
}

.list-item select {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 47, 74, 0.15);
  background: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

h1 {
  font-size: clamp(32px, 4vw, 52px);
}

h2 {
  font-size: clamp(20px, 2.2vw, 28px);
}

.dashboard-command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.dashboard-filter-bar {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(7, 26, 47, 0.06), rgba(22, 184, 214, 0.1));
  border: 1px solid rgba(15, 47, 74, 0.1);
}

.dashboard-filter-bar strong,
.dashboard-filter-bar span,
.dashboard-filter-bar label {
  display: block;
}

.dashboard-filter-bar>div span,
.dashboard-filter-bar label span {
  color: #64748b;
  font-size: 12px;
}

.dashboard-filter-bar select {
  min-width: 170px;
  min-height: 42px;
  padding-block: 10px;
}

.dashboard-panel {
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.88));
  border: 1px solid rgba(15, 47, 74, 0.1);
}

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

.activity-row {
  display: flex !important;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid rgba(15, 47, 74, 0.08);
}

.activity-row strong,
.activity-row span {
  display: block;
}

.activity-row span {
  color: #64748b;
  font-size: 13px;
}

.activity-row b {
  white-space: nowrap;
  color: var(--brand-navy);
}

.alert-row {
  border-left: 4px solid var(--brand-gold);
}

.report-period-card {
  margin-top: 18px;
}

.period-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.period-breakdown-grid h3 {
  margin: 0 0 10px;
  color: var(--brand-navy);
  font-size: 16px;
}

.compact-row {
  align-items: flex-start;
}

.compact-row .report-rank {
  min-width: 92px;
}

.inline-actions {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.compact-filter {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: #071a2f;
}

.compact-filter select {
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(9, 37, 66, 0.18);
  background: #fff;
  color: #071a2f;
  font: inherit;
  font-weight: 800;
  padding: 0 14px;
}

.sale-group-card {
  border-left: 4px solid #19a8b7;
}

.compact-sale-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.compact-sale-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 1px solid rgba(9, 37, 66, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  color: #071a2f;
  font: inherit;
  padding: 10px 12px;
  text-align: left;
}

.compact-sale-row strong {
  white-space: nowrap;
}

#repairList.list-grid {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.calc-preview {
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(7, 26, 47, 0.06), rgba(22, 184, 214, 0.1));
  border: 1px solid rgba(22, 184, 214, 0.2);
  color: #0f172a;
  line-height: 1.7;
}

.full-span {
  grid-column: 1 / -1;
}

.document-card {
  overflow: hidden;
}

.document-thumb {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-radius: 18px;
  margin-bottom: 12px;
  background: #e2e8f0;
}

.document-thumb-placeholder {
  display: grid;
  place-items: center;
  color: #64748b;
  font-weight: 800;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .bottom-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
    margin: 12px 0;
  }

  .side-brand,
  .nav-group-label {
    display: none;
  }

  .dashboard-command-grid,
  .period-breakdown-grid,
  #repairList.list-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-filter-bar {
    display: grid;
    align-items: stretch;
  }

  .dashboard-filter-bar select {
    width: 100%;
  }
}

@media screen and (min-width: 768px) and (max-width: 1180px) {

  /* ซ่อนส่วนของรายการผ่อนชำระสำหรับแท็บเล็ต */
  #dashboardInstallmentPanel,
  button[data-page="installmentsPage"],
  button[data-page="installmentListPage"] {
    display: none !important;
  }

  body {
    font-size: 14px;
  }

  .app-shell {
    grid-template-columns: 118px minmax(0, 1fr) !important;
    gap: 14px !important;
    padding: 14px !important;
    align-items: start;
  }

  .topbar {
    padding: 14px 16px !important;
    border-radius: 24px !important;
    min-height: 118px;
  }

  .brand-heading {
    gap: 10px;
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }

  .brand-copy .eyebrow {
    font-size: 0.74rem;
  }

  .brand-copy h1 {
    font-size: 1.85rem;
    line-height: 1.08;
  }

  .topbar-meta-line {
    font-size: 0.82rem;
  }

  .topbar-right {
    gap: 10px;
    align-items: stretch;
  }

  .topbar-status-chips {
    gap: 8px;
  }

  .topbar-actions {
    gap: 8px;
    width: 100%;
  }

  .topbar-actions .btn {
    min-height: 48px;
    padding-inline: 16px;
  }

  .bottom-nav {
    padding: 12px 10px !important;
    gap: 8px !important;
    border-radius: 24px !important;
    max-height: calc(100vh - 28px);
    overflow-y: auto;
  }

  .bottom-nav::before,
  .nav-group-label {
    display: none !important;
  }



  .side-brand-mark {
    width: 44px;
    height: 44px;
  }



  .bottom-nav button {
    min-height: 74px !important;
    padding: 10px 8px !important;
    border-radius: 18px !important;
    justify-content: center !important;
    align-items: center !important;
    flex-direction: column !important;
    gap: 7px !important;
    text-align: center !important;
    font-size: 0.78rem !important;
    line-height: 1.15 !important;
  }

  .bottom-nav button span:not(.nav-icon) {
    display: block;
    width: 100%;
    white-space: normal;
  }

  .bottom-nav .nav-icon {
    width: 34px !important;
    height: 34px !important;
    font-size: 1rem;
    flex: 0 0 auto;
  }

  .card,
  .dashboard-panel,
  .list-item {
    border-radius: 22px !important;
  }

  #salesPage .stack-header,
  #createRepairPage .stack-header,
  #productPickerModal .stack-header,
  #saleQuickProductModal .stack-header,
  #installmentPaymentModal .stack-header,
  #closeRepairPage .stack-header {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 10px;
  }

  #salesPage .stack-header>.btn,
  #createRepairPage .stack-header>.btn,
  #closeRepairPage .stack-header>.btn {
    width: 100%;
    justify-content: center;
  }

  .form-grid {
    gap: 12px;
  }

  #salesPage .form-pair,
  #createRepairPage .form-pair,
  #closeRepairPage .form-pair,
  #saleQuickProductModal .form-pair,
  #installmentPaymentModal .form-pair {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .repair-form-layout {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .repair-panel {
    padding: 16px !important;
    gap: 12px !important;
    border-radius: 22px !important;
  }

  .repair-panel h3 {
    font-size: 1rem;
    margin-bottom: 2px;
  }

  .repair-money-box {
    gap: 12px !important;
    padding: 14px !important;
    border-radius: 18px !important;
  }

  .pos-layout {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .pos-summary {
    position: static !important;
    order: -1;
  }

  .picker-field .btn,
  #openSaleProductPickerBtn,
  #repairSubmitBtn,
  #savePrintRepairBtn,
  #toggleQuickProductBtn,
  #quickProductSubmitBtn {
    min-height: 50px !important;
  }

  .sale-cart {
    gap: 12px;
  }

  .sale-cart-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 12px !important;
    border-radius: 18px !important;
  }

  .sale-cart-main {
    gap: 8px;
  }

  .sale-cart-line-detail {
    font-size: 0.84rem !important;
    line-height: 1.35;
  }

  .sale-cart-editors {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .sale-cart-editors label:last-child {
    grid-column: 1 / -1;
  }

  .sale-cart-side {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100%;
  }

  .sale-cart-line-total {
    font-size: 1.05rem;
  }

  .modal-overlay {
    padding: 10px !important;
    align-items: stretch;
  }

  .modal-card,
  .product-picker-modal,
  .installment-payment-modal {
    width: calc(100vw - 20px) !important;
    max-width: none !important;
    max-height: calc(100vh - 20px) !important;
    min-height: calc(100vh - 20px);
    padding: 18px 16px !important;
    border-radius: 22px !important;
  }

  #productPickerModal .stack-header,
  #saleQuickProductModal .stack-header,
  #installmentPaymentModal .stack-header {
    position: sticky;
    top: -18px;
    z-index: 3;
    background: #ffffff;
    padding-bottom: 10px;
    margin-bottom: 10px;
  }

  #productPickerModal .action-row,
  #saleQuickProductModal .action-row,
  #installmentPaymentModal .action-row {
    position: sticky;
    bottom: -18px;
    z-index: 3;
    background: #ffffff;
    padding-top: 10px;
    margin-top: 10px;
  }

  #productPickerModal .action-row .btn,
  #saleQuickProductModal .action-row .btn,
  #installmentPaymentModal .action-row .btn {
    min-height: 50px;
  }

  .product-picker-list,
  #installmentPaymentSchedulePreview {
    max-height: none !important;
  }

  .product-card-grid,
  .product-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .product-card,
  .product-picker-card {
    grid-template-columns: 86px minmax(0, 1fr) !important;
    gap: 12px !important;
    padding: 12px !important;
    min-height: 0 !important;
    border-radius: 20px !important;
  }

  .product-image-wrap {
    width: 86px !important;
    height: 86px !important;
    border-radius: 18px !important;
  }

  .product-card-actions,
  .action-row,
  .inline-actions {
    gap: 10px !important;
    flex-wrap: wrap;
  }

  .product-card-actions .btn,
  .action-row .btn,
  .inline-actions .btn {
    min-height: 48px;
  }

  .items-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  #repairList.list-grid,
  #saleList.list-grid {
    grid-template-columns: 1fr !important;
  }
}

.brand-copy {
  display: grid;
  gap: 4px;
}

/* --- Mobile Bottom Navigation --- */
.mobile-bottom-nav {
  display: none;
  /* Hide on Desktop */
}

@media screen and (max-width: 980px) {
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    height: var(--mobile-nav-height);
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.05);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 2000;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
  }

  .mobile-bottom-nav button {
    background: none;
    border: none;
    color: #64748b;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 8px 0;
    flex: 1;
    cursor: pointer;
    transition: all 0.3s;
  }

  .mobile-bottom-nav button.active {
    color: var(--mobile-primary);
  }

  .mobile-bottom-nav button i {
    font-size: 1.3rem;
  }

  .mobile-bottom-nav .fab-center {
    width: 56px;
    height: 56px;
    background: var(--mobile-primary);
    border-radius: 50%;
    color: #ffffff;
    margin-top: -45px;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
    border: 5px solid var(--mobile-bg);
    justify-content: center;
    display: flex !important;
  }

  /* Hide sidebar on mobile */
  .bottom-nav {
    display: none !important;
  }

  .app-shell {
    display: block !important;
    padding: 0 !important;
  }

  .main-content {
    padding: 10px 15px 100px !important;
    /* Space for bottom nav */
  }

  .topbar {
    border-radius: 0 0 25px 25px !important;
    margin-bottom: 20px !important;
  }
}

.topbar-right {
  display: grid;
  gap: 12px;
  justify-items: end;
  align-self: center;
}

.topbar-meta-line {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.92rem;
  font-weight: 600;
}

.topbar-status-chips {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-chip {
  display: grid;
  gap: 2px;
  min-width: 112px;
  padding: 8px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  color: #ffffff;
}

.topbar-chip-label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(139, 227, 238, 0.92);
  text-transform: uppercase;
}

.topbar-chip strong {
  font-size: 0.96rem;
  line-height: 1.1;
}

.topbar-actions {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1200px) {
  .topbar {
    flex-wrap: wrap;
  }

  .topbar-right {
    width: 100%;
    justify-items: stretch;
  }

  .topbar-status-chips,
  .topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .topbar-status-chips {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-chip {
    min-width: 0;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .btn {
    flex: 1 1 140px;
  }
}

/* Workflow refinements */
.bottom-nav button span:not(.nav-icon) {
  color: #102033;
  font-weight: 850;
  letter-spacing: 0.01em;
}

.bottom-nav button.active span:not(.nav-icon),
.bottom-nav button.active .nav-icon {
  color: #ffffff;
}

.bottom-nav button:not(.active):hover {
  background: rgba(8, 47, 73, 0.08);
  border-color: rgba(8, 47, 73, 0.18);
}

.dashboard-link-card {
  appearance: none;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.dashboard-link-card:hover,
.activity-button:hover,
.report-button:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 116, 144, 0.34);
  box-shadow: 0 18px 38px rgba(7, 26, 47, 0.14);
}

.activity-button,
.report-button {
  width: 100%;
  appearance: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.finance-two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.finance-column {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 47, 74, 0.1);
}

.finance-column h3 {
  margin: 0 0 6px;
  color: #071a2f;
}

.report-row.is-income {
  border-left: 4px solid #0f766e;
}

.report-row.is-expense {
  border-left: 4px solid #dc2626;
}

.danger-badge {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}

.defect-map-field {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(7, 26, 47, 0.05), rgba(22, 184, 214, 0.08));
  border: 1px solid rgba(15, 47, 74, 0.1);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(2, 8, 23, 0.62);
  backdrop-filter: blur(10px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(960px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  padding: 24px;
  border-radius: 28px;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 28px 80px rgba(2, 8, 23, 0.34);
}

.defect-modal-card {
  display: grid;
  gap: 18px;
}

.defect-device-canvas {
  position: relative;
  min-height: 430px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 8%, rgba(14, 165, 233, 0.16), transparent 18%),
    linear-gradient(145deg, #eaf2f9, #f8fafc);
  border: 1px dashed rgba(15, 47, 74, 0.24);
  overflow: hidden;
  cursor: crosshair;
}

.device-outline {
  position: absolute;
  inset: 42px 32%;
  border: 6px solid #071a2f;
  border-radius: 38px;
  background: linear-gradient(180deg, rgba(7, 26, 47, 0.06), rgba(22, 184, 214, 0.08));
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.72);
}

.device-outline::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  width: 64px;
  height: 8px;
  border-radius: 999px;
  background: #071a2f;
  transform: translateX(-50%);
}

.device-outline::after {
  content: "";
  position: absolute;
  bottom: 14px;
  left: 50%;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 4px solid rgba(7, 26, 47, 0.8);
  transform: translateX(-50%);
}

.defect-device-canvas[data-device="tablet"] .device-outline,
.defect-device-canvas[data-device="notebook"] .device-outline {
  inset: 64px 18%;
  border-radius: 28px;
}

.defect-device-canvas[data-device="airpods"] .device-outline {
  inset: 80px 30%;
  border-radius: 80px 80px 36px 36px;
}

.defect-pin {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: #dc2626;
  border: 3px solid #ffffff;
  box-shadow: 0 8px 18px rgba(220, 38, 38, 0.32);
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 900;
}

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

.defect-list-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

@media (min-width: 981px) {
  .app-shell {
    padding: 18px 22px 26px;
  }

  .topbar {
    position: static !important;
    padding: 18px 24px;
    min-height: 96px;
  }

  .bottom-nav {
    min-width: 0;
  }
}

@media (max-width: 980px) {
  .finance-two-columns {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    padding: 10px;
    border-radius: 20px;
  }

  .bottom-nav button {
    min-width: 132px;
  }

  .defect-map-field {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .brand-logo {
    width: 56px;
    height: 56px;
    border-radius: 18px;
  }

  .topbar {
    padding: 16px;
  }

  .topbar h1 {
    font-size: clamp(26px, 9vw, 38px);
  }

  .defect-device-canvas {
    min-height: 360px;
  }

  .device-outline {
    inset: 44px 24%;
  }
}

/* Header size pass: compact top title bar and stop it from following scroll. */
.topbar {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
  min-height: 0 !important;
  padding: 10px 16px !important;
  margin: 0 0 12px !important;
  align-items: center !important;
  border-radius: 20px !important;
}

.topbar::after {
  display: none !important;
}

.brand-logo {
  width: 44px !important;
  height: 44px !important;
  border-radius: 14px !important;
  padding: 4px !important;
}

.brand-heading {
  gap: 10px !important;
}

.topbar h1 {
  font-size: clamp(1.35rem, 2.2vw, 1.85rem) !important;
  line-height: 1.05 !important;
  letter-spacing: -0.025em !important;
}

.topbar .eyebrow {
  font-size: 0.72rem !important;
  letter-spacing: 0.16em !important;
  margin-bottom: 2px !important;
}

.topbar .btn {
  min-height: 38px !important;
  padding: 8px 14px !important;
  font-size: 0.86rem !important;
}

/* Readability pass: make secondary text darker across the app. */
:root {
  --text: #0b1220;
  --muted: #334155;
  --border: #cbd5e1;
}

body,
input,
select,
textarea,
button {
  color: #0b1220;
}

.hint,
.list-meta,
.activity-row span,
.stat-card span,
.report-row span,
.sale-cart-row span,
.empty-state,
label span,
.topbar .eyebrow,


.topbar .eyebrow,
.topbar h1,
.side-brand,


input::placeholder,
textarea::placeholder {
  color: #64748b;
  opacity: 1;
}

.bottom-nav button {
  color: #1e293b;
}

.bottom-nav button span:not(.nav-icon) {
  color: #0b1220;
  font-weight: 900;
}

.bottom-nav button:not(.active) {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 23, 42, 0.1);
}

.bottom-nav button:not(.active) .nav-icon {
  background: rgba(7, 89, 133, 0.14);
  color: #064e7a;
  font-weight: 900;
}

.bottom-nav button.active span:not(.nav-icon),
.bottom-nav button.active .nav-icon {
  color: #ffffff;
}

.nav-group-label {
  color: #1f2937;
  font-weight: 950;
  opacity: 1;
}

.badge {
  color: #0f172a;
}

.card h2,
.list-item strong,
.report-row strong,
.activity-row strong,
.stat-card strong {
  color: #071a2f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(19, 111, 99, 0.14), transparent 30%),
    linear-gradient(180deg, #f8f3ea 0%, #f4f1e8 100%);
  color: var(--text);
}

body {
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 16px 96px;
}

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

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}

h2 {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  margin-bottom: 14px;
}

.main-content {
  display: grid;
  gap: 16px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.card {
  background: rgba(255, 253, 250, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(10px);
}

.auth-card {
  width: min(90%, 420px);
  margin: 0 auto;
  border-radius: 32px;
  padding: 40px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.08), 0 10px 25px rgba(0, 0, 0, 0.03);
}

#loginPage.active {
  display: flex !important;
}

#loginPage {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background:
    radial-gradient(circle at 10% 10%, rgba(19, 111, 99, 0.08), transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(14, 165, 233, 0.08), transparent 40%),
    linear-gradient(135deg, #fdfbf7 0%, #f4f7f6 100%);
}

/* ซ่อนไอคอนปฏิทินที่อาจโผล่มาเองบน Tablet/Mobile */
#loginPage input::-webkit-calendar-picker-indicator,
#loginPage input::-webkit-inner-spin-button,
#loginPage input::-webkit-clear-button,
#loginPage input::-ms-clear {
  display: none !important;
  -webkit-appearance: none !important;
  margin: 0 !important;
}



.full-width {
  grid-column: 1 / -1;
}

.hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.form-grid,
.items-grid,
.list-grid {
  display: grid;
  gap: 12px;
}

.repair-form-layout {
  display: grid;
  gap: 16px;
}

.repair-panel {
  display: grid;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 28px;
  border-top-width: 8px;
  padding: 18px;
  box-shadow: 0 8px 20px rgba(36, 31, 24, 0.05);
}

.repair-panel h3 {
  margin: 0 0 4px;
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 1.02rem;
}

.repair-panel h3 span {
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 0.8rem;
}

.repair-panel-blue {
  border-top-color: #0ea5e9;
}

.repair-panel-blue h3 {
  color: #0369a1;
}

.repair-panel-blue h3 span {
  background: #e0f2fe;
}

.repair-panel-red {
  border-top-color: #ef4444;
}

.repair-panel-red h3 {
  color: #dc2626;
}

.repair-panel-red h3 span {
  background: #fee2e2;
}

.repair-panel-dark {
  border-top-color: #1e293b;
}

.repair-panel-dark h3 {
  color: #1e293b;
}

.repair-panel-dark h3 span {
  background: #e2e8f0;
}

.form-pair {
  display: grid;
  gap: 12px;
}

.repair-money-box {
  display: grid;
  gap: 14px;
  background: #0f172a;
  color: #fff;
  border-radius: 22px;
  padding: 16px;
}

.repair-money-box label span {
  color: #fff;
}

.repair-money-box input {
  background: transparent;
  border-color: #334155;
  color: #fff;
  font-weight: 800;
}

.inline-product-box {
  border: 1px dashed var(--primary);
  border-radius: 20px;
  padding: 14px;
  background: rgba(19, 111, 99, 0.06);
}

.inline-product-box h3 {
  margin: 0;
  font-size: 1rem;
}

.btn-wide {
  width: 100%;
}

.print-only {
  display: none !important;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  font-size: 0.94rem;
  font-weight: 600;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--primary);
}

input,
textarea,
select {
  width: 100%;
  min-height: var(--touch);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.btn,
.nav-card,
.bottom-nav button {
  min-height: var(--touch);
  border-radius: 16px;
  border: 0;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.btn:disabled,
.nav-card:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn:active,
.nav-card:active,
.bottom-nav button:active {
  transform: scale(0.98);
}

.btn {
  padding: 12px 16px;
  font-weight: 700;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
}

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

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

.dashboard-grid {
  display: grid;
  gap: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: linear-gradient(135deg, rgba(19, 111, 99, 0.12), rgba(255, 255, 255, 0.96));
  border: 1px solid rgba(19, 111, 99, 0.14);
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 6px;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.stat-card strong {
  font-size: clamp(1.35rem, 5vw, 2rem);
}

.nav-card {
  background: linear-gradient(135deg, rgba(19, 111, 99, 0.1), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(19, 111, 99, 0.16);
  padding: 18px;
  text-align: left;
  display: grid;
  gap: 6px;
}

.nav-card strong {
  font-size: 1.05rem;
}

.nav-card span,
.info-box,
.feedback,
.list-meta,
.badge {
  color: var(--muted);
}

.stack-header,
.action-row {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.filter-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.search-block {
  margin-bottom: 12px;
}

.feedback {
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff4db;
  border: 1px solid #f1d9a0;
}

.feedback.is-error {
  background: #fde7e4;
  border-color: #f3b5ac;
  color: #82281d;
}

.feedback.is-success {
  background: #e6f6eb;
  border-color: #b8e1c4;
  color: #1f5e31;
}

.list-item,
.receipt-card,
.item-row {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

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

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

.product-thumb {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.list-actions {
  display: flex !important;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  background: var(--surface-alt);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.info-box,
.empty-state {
  padding: 14px;
  background: var(--surface-alt);
  border-radius: 16px;
  border: 1px dashed var(--border);
}

.item-row {
  display: grid;
  gap: 10px;
}

.receipt-card {
  display: grid;
  gap: 12px;
}

.receipt-card.thermal-receipt {
  width: min(100%, 360px);
  margin: 0 auto 14px;
  border-radius: 12px;
  border-color: #d8dee8;
  background: #ffffff;
  color: #0b1220;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
  font-family: "Noto Sans Thai", "IBM Plex Sans Thai", Tahoma, sans-serif;
  font-size: 0.86rem;
  line-height: 1.45;
}

.thermal-head {
  display: grid;
  gap: 2px;
  text-align: center;
}

.thermal-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  margin: 0 auto 4px;
  display: block;
}

.thermal-head strong {
  font-size: 1.35rem;
  letter-spacing: 0.08em;
}

.thermal-head span,
.thermal-footer span {
  color: #334155;
  font-size: 0.82rem;
}

.thermal-meta {
  display: grid;
  gap: 4px;
}

.thermal-meta div,
.thermal-summary-line,
.thermal-item-detail {
  display: flex !important;
  justify-content: space-between;
  gap: 10px;
}

.thermal-meta strong,
.thermal-summary-line strong,
.thermal-item-detail strong {
  text-align: right;
}

.thermal-rule {
  border-top: 1px dashed #94a3b8;
  margin: 8px 0;
}

.thermal-items,
.thermal-summary,
.thermal-footer {
  display: grid;
  gap: 6px;
}

.thermal-item-name {
  color: #0f172a;
  font-weight: 800;
  word-break: break-word;
}

.thermal-item-detail {
  color: #475569;
}

.thermal-summary-line.is-total {
  border-top: 1px solid #0f172a;
  margin-top: 4px;
  padding-top: 8px;
  font-size: 1.04rem;
  font-weight: 900;
}

.thermal-footer {
  margin-top: 10px;
  text-align: center;
}

.receipt-line {
  display: flex !important;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 8px;
}

.receipt-line:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(36, 31, 24, 0.3);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 999;
}

.spinner-card {
  background: #fff;
  border-radius: 18px;
  padding: 18px 20px;
  display: grid;
  gap: 12px;
  place-items: center;
  min-width: 220px;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(19, 111, 99, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 250, 0.95);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 8px;
}

.bottom-nav button.active {
  background: var(--surface-alt);
  color: var(--primary);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media screen {
  :root {
    --bg: #eef2f6;
    --surface: #ffffff;
    --surface-alt: #f3f6fa;
    --surface-strong: #e8eef5;
    --text: #132033;
    --muted: #697789;
    --primary: #0f766e;
    --primary-dark: #0b5f59;
    --primary-soft: #e4f3f1;
    --accent: #c8922b;
    --danger: #b42318;
    --danger-soft: #fff0ee;
    --success: #16803c;
    --success-soft: #e8f7ee;
    --warning-soft: #fff7e3;
    --border: #d9e1ea;
    --border-strong: #bac7d6;
    --shadow: 0 22px 70px rgba(19, 32, 51, 0.1);
    --shadow-soft: 0 10px 30px rgba(19, 32, 51, 0.07);
    --radius: 22px;
    --radius-sm: 14px;
    --touch: 48px;
    --max-width: 1280px;
  }

  html,
  body {
    font-family: "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", "Segoe UI", sans-serif;
    background:
      linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 30%),
      radial-gradient(circle at 88% 8%, rgba(200, 146, 43, 0.18), transparent 24%),
      linear-gradient(180deg, #f7f9fc 0%, var(--bg) 58%, #e8edf4 100%);
    color: var(--text);
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
      linear-gradient(rgba(19, 32, 51, 0.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(19, 32, 51, 0.035) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 62%);
  }

  .app-shell {
    padding: 18px 16px 104px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    align-items: center;
    margin: -2px -4px 18px;
    padding: 14px 14px;
    border: 1px solid rgba(217, 225, 234, 0.78);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(20px);
  }

  .topbar>div {
    display: grid;
    gap: 4px;
  }

  .eyebrow {
    color: var(--primary);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
  }

  h1 {
    color: var(--text);
    font-size: clamp(1.55rem, 3.8vw, 2.75rem);
    line-height: 1.08;
    letter-spacing: -0.04em;
  }

  h2 {
    color: var(--text);
    font-size: clamp(1.14rem, 2.2vw, 1.55rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
  }

  .main-content {
    gap: 18px;
  }

  .page.active {
    animation: pageEnter 0.28s ease both;
  }

  .card {
    position: relative;
    overflow: hidden;
    padding: clamp(18px, 2.4vw, 28px);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(250, 252, 255, 0.93));
    border: 1px solid rgba(217, 225, 234, 0.92);
    border-radius: 28px;
    box-shadow: var(--shadow);
  }

  .card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #1f9e8e, var(--accent));
    opacity: 0.9;
  }

  .auth-card {
    padding: 48px;
  }

  .auth-card h2 {
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
    text-align: center;
  }


  .hint {
    color: var(--muted);
    line-height: 1.6;
  }

  label span {
    color: #35445a;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.01em;
  }

  input,
  textarea,
  select {
    background: #fbfcfe;
    border-color: var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  }

  input:hover,
  textarea:hover,
  select:hover {
    border-color: var(--border-strong);
    background: #fff;
  }

  input:focus,
  textarea:focus,
  select:focus {
    outline: 0;
    border-color: rgba(15, 118, 110, 0.65);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
  }

  input[readonly] {
    color: var(--muted);
    background: var(--surface-alt);
  }

  .btn,
  .nav-card,
  .bottom-nav button {
    border-radius: 999px;
    transition:
      transform 0.18s ease,
      box-shadow 0.18s ease,
      border-color 0.18s ease,
      background 0.18s ease,
      color 0.18s ease;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    font-weight: 850;
    letter-spacing: -0.01em;
  }

  .btn:hover,
  .nav-card:hover {
    transform: translateY(-1px);
  }

  .btn-primary {
    background: linear-gradient(135deg, var(--primary), #159987);
    box-shadow: 0 14px 28px rgba(15, 118, 110, 0.22);
  }

  .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  }

  .btn-secondary {
    background: #fff;
    border-color: var(--border);
    color: #27364a;
    box-shadow: 0 8px 18px rgba(19, 32, 51, 0.06);
  }

  .btn-secondary:hover {
    border-color: rgba(15, 118, 110, 0.35);
    color: var(--primary-dark);
  }

  .btn-success {
    background: linear-gradient(135deg, #16803c, #22a55a);
    box-shadow: 0 14px 28px rgba(22, 128, 60, 0.2);
  }

  .btn-danger {
    background: linear-gradient(135deg, var(--danger), #d92d20);
    box-shadow: 0 14px 28px rgba(180, 35, 24, 0.18);
  }

  .stats-grid {
    gap: 12px;
    margin-bottom: 14px;
  }

  .stat-card {
    position: relative;
    overflow: hidden;
    min-height: 96px;
    padding: 14px 16px;
    background:
      linear-gradient(135deg, #ffffff 0%, #f5f9fb 100%);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
  }

  .stat-card::after {
    content: "";
    position: absolute;
    right: -18px;
    top: -20px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(15, 118, 110, 0.1);
  }

  .stat-card:nth-child(2)::after {
    background: rgba(200, 146, 43, 0.16);
  }

  .stat-card:nth-child(3)::after {
    background: rgba(22, 128, 60, 0.13);
  }

  .stat-card:nth-child(4)::after {
    background: rgba(180, 35, 24, 0.1);
  }

  .stat-card span {
    position: relative;
    z-index: 1;
    color: var(--muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .stat-card strong {
    position: relative;
    z-index: 1;
    font-size: clamp(1.7rem, 4vw, 2.35rem);
    line-height: 1;
    letter-spacing: -0.05em;
  }

  .dashboard-grid {
    gap: 14px;
  }

  .nav-card {
    position: relative;
    min-height: 116px;
    overflow: hidden;
    padding: 20px;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(244, 248, 252, 0.96));
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
  }

  .nav-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 18px;
    bottom: 18px;
    width: 5px;
    border-radius: 0 999px 999px 0;
    background: var(--primary);
  }

  .nav-card::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 18px;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background:
      linear-gradient(135deg, rgba(15, 118, 110, 0.18), rgba(15, 118, 110, 0.04));
  }

  .nav-card strong {
    color: var(--text);
    font-size: 1.15rem;
    letter-spacing: -0.02em;
  }

  .nav-card span {
    max-width: 78%;
    line-height: 1.5;
  }

  .stack-header {
    align-items: center;
    margin-bottom: 14px;
  }

  .stack-header h2 {
    margin-bottom: 0;
  }

  .filter-grid,
  .search-block {
    padding: 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-soft);
  }

  .feedback {
    color: #7a4b00;
    background: var(--warning-soft);
    border-color: #f2d68b;
    box-shadow: var(--shadow-soft);
  }

  .feedback.is-error {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #ffc9c2;
  }

  .feedback.is-success {
    color: var(--success);
    background: var(--success-soft);
    border-color: #bce8cb;
  }

  .list-grid {
    gap: 14px;
  }

  .list-item,
  .receipt-card,
  .item-row {
    background: rgba(255, 255, 255, 0.94);
    border-color: var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-soft);
  }

  .list-item {
    position: relative;
    overflow: hidden;
    gap: 14px;
    padding: 16px;
  }

  .list-item::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(var(--primary), rgba(15, 118, 110, 0.1));
  }

  .list-item header strong {
    display: inline-block;
    margin-bottom: 4px;
    color: var(--text);
    font-size: 1.02rem;
  }

  .list-item header p,
  .list-meta {
    color: var(--muted);
    line-height: 1.55;
  }

  .list-meta {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 0.92rem;
  }

  .badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    color: var(--primary-dark);
    background: var(--primary-soft);
    border: 1px solid rgba(15, 118, 110, 0.18);
    font-weight: 850;
    white-space: nowrap;
  }

  .info-box,
  .empty-state {
    color: #556377;
    background:
      linear-gradient(135deg, rgba(232, 238, 245, 0.9), rgba(255, 255, 255, 0.78));
    border-color: var(--border);
    border-style: solid;
    border-radius: 20px;
  }

  .product-thumb {
    width: 76px;
    height: 76px;
    border-radius: 20px;
    background:
      linear-gradient(135deg, var(--surface-strong), #fff);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
  }

  .repair-form-layout {
    gap: 18px;
  }

  .repair-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-top-width: 1px;
    border-radius: 28px;
    background:
      linear-gradient(180deg, #ffffff, #f8fafc);
    box-shadow: var(--shadow-soft);
  }

  .repair-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: var(--primary);
  }

  .repair-panel h3 {
    color: var(--text);
    font-size: 1.02rem;
    letter-spacing: -0.01em;
  }

  .repair-panel h3 span {
    color: #fff;
    background: var(--primary);
    border-radius: 999px;
    font-weight: 900;
  }

  .repair-panel-blue::before,
  .repair-panel-blue h3 span {
    background: #0f766e;
  }

  .repair-panel-red::before,
  .repair-panel-red h3 span {
    background: #b42318;
  }

  .repair-panel-dark::before,
  .repair-panel-dark h3 span {
    background: #132033;
  }

  .repair-money-box {
    background:
      radial-gradient(circle at top right, rgba(200, 146, 43, 0.24), transparent 42%),
      linear-gradient(135deg, #142033, #24354f);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 16px 34px rgba(19, 32, 51, 0.18);
  }

  .repair-money-box input {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
  }

  .inline-product-box {
    padding: 16px;
    background:
      linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.92));
    border-color: rgba(15, 118, 110, 0.3);
    border-style: solid;
    border-radius: 24px;
  }

  .inline-product-box h3 {
    color: var(--primary-dark);
    letter-spacing: -0.02em;
  }

  .item-row {
    padding: 14px;
  }

  .receipt-card {
    padding: clamp(18px, 2.4vw, 28px);
  }

  .receipt-line {
    border-bottom-color: var(--border);
    color: #2a384b;
  }

  .action-row,
  .list-actions {
    gap: 10px;
  }

  .loading-overlay {
    background: rgba(19, 32, 51, 0.36);
    backdrop-filter: blur(4px);
  }

  .spinner-card {
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  .bottom-nav {
    left: 10px;
    right: 10px;
    bottom: 10px;
    gap: 6px;
    border: 1px solid rgba(217, 225, 234, 0.8);
    border-radius: 24px;
    box-shadow: var(--shadow);
  }

  .bottom-nav button {
    border-radius: 999px;
  }

  .bottom-nav button.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #159987);
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.2);
  }
}

@media (min-width: 700px) {
  .app-shell {
    padding: 24px 24px 32px;
  }

  .stats-grid,
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-grid {
    grid-template-columns: 2fr 1fr;
    align-items: end;
  }

  .form-grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .repair-form-layout {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }

  .form-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottom-nav {
    position: static;
    grid-template-columns: repeat(5, max-content);
    justify-content: center;
    background: transparent;
    border-top: 0;
    padding: 0;
    margin-top: 8px;
  }
}

@media screen and (min-width: 700px) {
  .app-shell {
    padding: 24px 28px 38px;
  }

  .topbar {
    margin-bottom: 20px;
    padding: 18px 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid .nav-card:first-child {
    grid-column: span 2;
  }

  .filter-grid {
    padding: 16px;
  }

  .list-item {
    padding: 18px 18px 18px 20px;
  }

  .list-item header {
    align-items: center;
  }

  .list-actions {
    justify-content: flex-end;
  }

  .bottom-nav {
    position: sticky;
    bottom: 16px;
    width: fit-content;
    max-width: 100%;
    margin: 18px auto 0;
    padding: 8px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(217, 225, 234, 0.86);
    border-radius: 999px;
    backdrop-filter: blur(18px);
  }

  .bottom-nav button {
    padding: 10px 18px;
  }
}

@media screen and (min-width: 1040px) {
  .app-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .repair-form-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.05fr) minmax(320px, 0.9fr);
  }

  #productForm {
    grid-template-columns: 1.2fr 1fr 1fr 1fr;
    align-items: end;
  }

  #productForm>label:first-of-type,
  #productForm .form-pair,
  #productForm .action-row {
    grid-column: span 2;
  }

  #closeRepairForm {
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
    align-items: start;
  }

  #closeRepairInfo,
  #closeRepairForm>div:first-of-type,
  #quickProductBox,
  #toggleQuickProductBtn,
  #closeRepairForm>button[type="submit"] {
    grid-column: 1 / -1;
  }

  #usersPage .card .form-grid {
    grid-template-columns: 1fr 1fr 220px;
    align-items: end;
  }

  #usersPage .checkbox-row,
  #usersPage .action-row {
    grid-column: span 3;
  }
}

@media screen and (max-width: 699px) {
  .topbar {
    border-radius: 20px;
  }

  .topbar .btn {
    min-height: 42px;
    padding-inline: 12px;
    font-size: 0.86rem;
  }

  .card {
    border-radius: 24px;
  }

  .stack-header {
    align-items: stretch;
  }

  .stack-header,
  .action-row {
    flex-wrap: wrap;
  }

  .stack-header>.btn,
  .action-row>.btn,
  .list-actions .btn {
    flex: 1 1 140px;
  }

  .list-item header {
    display: grid;
  }

  .badge {
    width: fit-content;
  }

  .bottom-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding-inline: 8px;
  }

  .bottom-nav button {
    min-height: 44px;
    padding: 8px 4px;
    font-size: 0.78rem;
  }
}

@media screen {
  .app-shell {
    padding-bottom: 38px;
  }

  .topbar {
    margin-bottom: 10px;
  }

  .bottom-nav {
    position: sticky !important;
    top: 92px !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    z-index: 35;
    display: flex !important;
    grid-template-columns: none;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0 0 18px;
    padding: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(217, 225, 234, 0.9);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
    scrollbar-width: thin;
  }

  .bottom-nav button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: max-content;
    min-height: 46px;
    padding: 9px 14px;
    color: #526174;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 850;
  }

  .bottom-nav button:hover {
    color: var(--primary-dark);
    background: rgba(15, 118, 110, 0.07);
    border-color: rgba(15, 118, 110, 0.12);
  }

  .bottom-nav button.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #159987);
    box-shadow: 0 12px 26px rgba(15, 118, 110, 0.22);
  }

  .nav-icon {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: var(--primary-dark);
    background: rgba(15, 118, 110, 0.12);
    font-size: 0.95rem;
    line-height: 1;
    font-weight: 900;
  }

  .bottom-nav button.active .nav-icon {
    color: var(--primary-dark);
    background: rgba(255, 255, 255, 0.92);
  }

  .nav-card {
    padding-right: 72px;
  }

  .card-icon {
    position: absolute;
    right: 18px;
    top: 18px;
    z-index: 1;
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 16px;
    color: var(--primary-dark);
    background:
      linear-gradient(135deg, rgba(15, 118, 110, 0.18), rgba(15, 118, 110, 0.06));
    border: 1px solid rgba(15, 118, 110, 0.14);
    font-size: 1.25rem;
    font-weight: 900;
  }

  .nav-card::after {
    display: none;
  }

  .nav-card:nth-child(2) .card-icon {
    color: #9a6500;
    background: linear-gradient(135deg, rgba(200, 146, 43, 0.22), rgba(200, 146, 43, 0.07));
    border-color: rgba(200, 146, 43, 0.18);
  }

  .nav-card:nth-child(3) .card-icon {
    color: #25568c;
    background: linear-gradient(135deg, rgba(37, 86, 140, 0.18), rgba(37, 86, 140, 0.06));
    border-color: rgba(37, 86, 140, 0.14);
  }

  .nav-card:nth-child(4) .card-icon {
    color: #80511d;
    background: linear-gradient(135deg, rgba(128, 81, 29, 0.18), rgba(128, 81, 29, 0.06));
    border-color: rgba(128, 81, 29, 0.14);
  }

  .nav-card:nth-child(5) .card-icon {
    color: #604c8d;
    background: linear-gradient(135deg, rgba(96, 76, 141, 0.18), rgba(96, 76, 141, 0.06));
    border-color: rgba(96, 76, 141, 0.14);
  }
}

@media screen and (min-width: 700px) {
  .bottom-nav {
    top: 104px !important;
    width: 100%;
    max-width: 100%;
    margin: 0 0 22px;
  }

  .bottom-nav button {
    padding: 10px 18px;
  }
}

@media screen and (max-width: 699px) {
  .bottom-nav {
    top: 82px !important;
    border-radius: 20px;
  }

  .bottom-nav button {
    min-height: 42px;
    padding: 8px 12px;
    font-size: 0.84rem;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
    font-size: 0.85rem;
  }
}

@media screen {
  :root {
    --bg: #e9eef6;
    --surface: #ffffff;
    --surface-alt: #eef4fb;
    --surface-strong: #dce8f5;
    --text: #0b1729;
    --muted: #64748b;
    --primary: #0b2a4a;
    --primary-dark: #061b33;
    --primary-soft: #e6f0fb;
    --accent: #d6a84f;
    --accent-soft: #fff4d7;
    --cyan: #1aa6b7;
    --cyan-soft: #dff8fb;
    --danger: #b42318;
    --danger-soft: #fff1ef;
    --success: #0f8f72;
    --success-soft: #e6f7f3;
    --border: #cdd9e8;
    --border-strong: #9fb3ca;
    --shadow: 0 24px 72px rgba(8, 27, 51, 0.15);
    --shadow-soft: 0 12px 34px rgba(8, 27, 51, 0.09);
  }

  html,
  body {
    background:
      radial-gradient(circle at 8% 0%, rgba(26, 166, 183, 0.2), transparent 28%),
      radial-gradient(circle at 92% 4%, rgba(214, 168, 79, 0.2), transparent 24%),
      linear-gradient(180deg, #f6f9fd 0%, #e9eef6 48%, #dfe7f2 100%);
    color: var(--text);
  }

  body::before {
    background-image:
      linear-gradient(rgba(11, 42, 74, 0.045) 1px, transparent 1px),
      linear-gradient(90deg, rgba(11, 42, 74, 0.045) 1px, transparent 1px);
    background-size: 34px 34px;
  }

  .topbar {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background:
      linear-gradient(135deg, rgba(6, 27, 51, 0.98), rgba(11, 42, 74, 0.96) 56%, rgba(13, 65, 102, 0.95));
    box-shadow: 0 24px 70px rgba(6, 27, 51, 0.28);
  }

  .topbar::after {
    content: "";
    position: absolute;
    right: 24px;
    bottom: -36px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background:
      radial-gradient(circle, rgba(26, 166, 183, 0.26), transparent 66%);
    pointer-events: none;
  }

  .topbar h1,
  .topbar .eyebrow {
    color: #fff;
  }

  .topbar .eyebrow {
    color: #8be3ee;
  }

  .topbar .btn-secondary {
    position: relative;
    z-index: 1;
    color: #eff8ff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: none;
  }

  .topbar .btn-secondary:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(139, 227, 238, 0.55);
  }

  .bottom-nav {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(241, 247, 252, 0.9));
    border-color: rgba(159, 179, 202, 0.72);
    box-shadow: 0 18px 50px rgba(8, 27, 51, 0.12);
  }

  .bottom-nav button {
    color: #475569;
  }

  .bottom-nav button:hover {
    color: var(--primary);
    background: rgba(11, 42, 74, 0.06);
    border-color: rgba(11, 42, 74, 0.1);
  }

  .bottom-nav button.active {
    color: #fff;
    background:
      linear-gradient(135deg, #061b33, #0b2a4a 62%, #0d4166);
    box-shadow: 0 16px 34px rgba(11, 42, 74, 0.28);
  }

  .nav-icon {
    color: #0d4166;
    background: #e7f5fb;
  }

  .bottom-nav button.active .nav-icon {
    color: #061b33;
    background: linear-gradient(135deg, #ffffff, #c9f5fb);
  }

  .card {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 253, 0.95));
    border-color: rgba(205, 217, 232, 0.92);
    box-shadow: var(--shadow);
  }

  .card::before {
    height: 5px;
    background:
      linear-gradient(90deg, #0b2a4a 0%, #1aa6b7 52%, #d6a84f 100%);
  }

  .btn-primary {
    color: #fff;
    background:
      linear-gradient(135deg, #061b33, #0b2a4a 60%, #0d4166);
    box-shadow: 0 16px 34px rgba(11, 42, 74, 0.26);
  }

  .btn-primary:hover {
    background:
      linear-gradient(135deg, #041427, #09223d 58%, #0b3558);
  }

  .btn-secondary {
    color: #16304f;
    background: #ffffff;
    border-color: rgba(159, 179, 202, 0.72);
    box-shadow: 0 10px 24px rgba(8, 27, 51, 0.08);
  }

  .btn-secondary:hover {
    color: #061b33;
    border-color: rgba(26, 166, 183, 0.55);
    box-shadow: 0 14px 30px rgba(8, 27, 51, 0.12);
  }

  .btn-success {
    background:
      linear-gradient(135deg, #0f7a64, #12a58a);
    box-shadow: 0 16px 34px rgba(15, 143, 114, 0.22);
  }

  .btn-danger {
    background:
      linear-gradient(135deg, #9f1f17, #d92d20);
  }

  input,
  textarea,
  select {
    color: #10233c;
    background: #fbfdff;
    border-color: rgba(159, 179, 202, 0.74);
  }

  input:focus,
  textarea:focus,
  select:focus {
    border-color: rgba(26, 166, 183, 0.76);
    box-shadow: 0 0 0 4px rgba(26, 166, 183, 0.14);
  }

  label span {
    color: #213a5b;
  }

  .stat-card {
    background:
      linear-gradient(135deg, #ffffff 0%, #f2f7fc 100%);
    border-color: rgba(205, 217, 232, 0.92);
  }

  .stat-card::after {
    background: rgba(11, 42, 74, 0.1);
  }

  .stat-card:nth-child(2)::after {
    background: rgba(26, 166, 183, 0.16);
  }

  .stat-card:nth-child(3)::after {
    background: rgba(15, 143, 114, 0.14);
  }

  .stat-card:nth-child(4)::after {
    background: rgba(214, 168, 79, 0.18);
  }

  .nav-card {
    color: var(--text);
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 252, 0.96));
    border-color: rgba(205, 217, 232, 0.95);
  }

  .nav-card::before,
  .repair-panel-blue::before,
  .repair-panel-blue h3 span {
    background: #0b2a4a;
  }

  .nav-card strong {
    color: #0b1729;
  }

  .card-icon {
    color: #061b33;
    background:
      linear-gradient(135deg, #dff8fb, #eef7ff);
    border-color: rgba(26, 166, 183, 0.28);
  }

  .nav-card:nth-child(2) .card-icon {
    color: #7a520f;
    background:
      linear-gradient(135deg, #fff4d7, #fffaf0);
    border-color: rgba(214, 168, 79, 0.34);
  }

  .nav-card:nth-child(3) .card-icon {
    color: #0b2a4a;
    background:
      linear-gradient(135deg, #e6f0fb, #f8fbff);
    border-color: rgba(11, 42, 74, 0.2);
  }

  .nav-card:nth-child(4) .card-icon {
    color: #0f766e;
    background:
      linear-gradient(135deg, #e6f7f3, #f7fffd);
    border-color: rgba(15, 143, 114, 0.22);
  }

  .badge {
    color: #0b2a4a;
    background:
      linear-gradient(135deg, #e6f0fb, #f7fbff);
    border-color: rgba(11, 42, 74, 0.14);
  }

  .list-item,
  .receipt-card,
  .item-row {
    border-color: rgba(205, 217, 232, 0.95);
    box-shadow: var(--shadow-soft);
  }

  .list-item::before {
    width: 5px;
    background:
      linear-gradient(180deg, #0b2a4a, #1aa6b7 62%, #d6a84f);
  }

  .filter-grid,
  .search-block,
  .info-box,
  .empty-state {
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(238, 244, 251, 0.86));
    border-color: rgba(205, 217, 232, 0.95);
  }

  .repair-panel {
    background:
      linear-gradient(180deg, #ffffff, #f4f8fc);
    border-color: rgba(205, 217, 232, 0.95);
  }

  .repair-panel-red::before,
  .repair-panel-red h3 span {
    background: #1aa6b7;
  }

  .repair-panel-dark::before,
  .repair-panel-dark h3 span {
    background: #d6a84f;
  }

  .repair-money-box {
    background:
      radial-gradient(circle at top right, rgba(214, 168, 79, 0.26), transparent 42%),
      linear-gradient(135deg, #061b33, #0b2a4a 60%, #0d4166);
  }

  .inline-product-box {
    background:
      linear-gradient(135deg, rgba(26, 166, 183, 0.1), rgba(255, 255, 255, 0.96));
    border-color: rgba(26, 166, 183, 0.32);
  }

  .inline-product-box h3 {
    color: #0b2a4a;
  }

  .feedback {
    color: #6b460d;
    background: var(--accent-soft);
    border-color: rgba(214, 168, 79, 0.42);
  }

  .feedback.is-error {
    color: var(--danger);
    background: var(--danger-soft);
  }

  .feedback.is-success {
    color: #0b6f5a;
    background: var(--success-soft);
    border-color: rgba(15, 143, 114, 0.28);
  }
}

@media screen and (max-width: 699px) {
  .topbar {
    padding: 18px;
  }

  .bottom-nav {
    background: rgba(255, 255, 255, 0.92);
  }
}

.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
  gap: 22px;
  align-items: start;
}

.sale-picker {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 110px 140px auto;
  gap: 14px;
  align-items: end;
}

.sale-cart {
  display: grid;
  gap: 10px;
}

.sale-cart-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.88));
}

.sale-cart-row>div {
  display: grid;
  gap: 4px;
}

.sale-cart-row>div:last-child {
  justify-items: end;
}

.sale-cart-row span {
  color: var(--muted);
  font-size: 0.92rem;
}

.btn-small {
  min-height: 36px;
  padding: 8px 14px;
  font-size: 0.88rem;
}

.pos-summary {
  position: sticky;
  top: 18px;
  border-top: 5px solid var(--accent);
  background:
    radial-gradient(circle at top right, rgba(202, 146, 43, 0.14), transparent 35%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.sale-repair-preview {
  background: rgba(202, 146, 43, 0.08);
  border: 1px dashed var(--accent);
  border-radius: 12px;
  padding: 12px;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.5;
  color: #1e293b;
}

.sale-repair-preview strong {
  display: block;
  font-size: 15px;
  color: var(--accent);
  margin-bottom: 4px;
}

.sale-repair-preview .preview-issue {
  background: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 8px;
  border-left: 3px solid var(--accent);
  font-style: italic;
}

.total-line {
  border-top: 2px solid rgba(15, 23, 42, 0.12);
  margin-top: 8px;
  padding-top: 14px;
}

.total-line strong {
  color: var(--brand);
  font-size: 1.35rem;
}

.category-tabs {
  display: flex !important;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
}

.category-tabs button {
  border: 1px solid rgba(205, 217, 232, 0.95);
  border-radius: 999px;
  padding: 10px 16px;
  color: #0b2a4a;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(238, 244, 251, 0.86));
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.category-tabs button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(11, 42, 74, 0.1);
}

.category-tabs button.active {
  color: #ffffff;
  background: linear-gradient(135deg, #071d36, #0b2a4a 58%, #0d7890);
  border-color: rgba(26, 166, 183, 0.45);
  box-shadow: 0 18px 34px rgba(11, 42, 74, 0.2);
}

.product-category-section {
  display: grid;
  gap: 14px;
  margin-bottom: 28px;
}

.product-category-heading {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.product-category-heading h3 {
  margin: 0;
  color: #071d36;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.product-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.product-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  min-height: 150px;
  padding: 14px;
  border: 1px solid rgba(205, 217, 232, 0.95);
  border-radius: 26px;
  background:
    radial-gradient(circle at top right, rgba(26, 166, 183, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(244, 248, 252, 0.94));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  position: relative;
}

.product-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, #0b2a4a, #1aa6b7 62%, #d6a84f);
}

.product-card:not(:has(.product-image-wrap)),
.product-card-no-image {
  grid-template-columns: 1fr !important;
  min-height: auto;
}

.product-image-wrap {
  width: 112px;
  height: 112px;
  border-radius: 24px;
  overflow: hidden;
  background: #eef4fb;
  border: 1px solid rgba(205, 217, 232, 0.95);
}

.product-image {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  object-fit: cover;
}

.product-image-placeholder {
  color: #1aa6b7;
  font-size: 2rem;
  background:
    radial-gradient(circle at 30% 20%, rgba(214, 168, 79, 0.2), transparent 30%),
    linear-gradient(135deg, #eaf2f9, #ffffff);
}

.product-card-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.product-card-body strong {
  display: block;
  color: #071d36;
  font-size: 1.08rem;
  line-height: 1.25;
}

.product-card-body p {
  margin: 4px 0 0;
  color: #66758a;
}

.product-card-meta {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: #53647a;
  font-size: 0.92rem;
}

.camera-upload {
  display: grid;
  gap: 12px;
}

.camera-upload-actions {
  display: flex !important;
  gap: 10px;
  flex-wrap: wrap;
}

.camera-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.camera-upload-btn {
  width: fit-content;
  min-width: 150px;
  justify-content: center;
}

.camera-upload-btn span {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  margin-right: 6px;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, #0b2a4a, #1aa6b7);
}

.permission-summary {
  grid-column: 1 / -1;
  padding: 14px 16px;
  border: 1px solid rgba(14, 116, 144, 0.2);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.1), rgba(255, 255, 255, 0.84));
  color: #0f2742;
  font-weight: 700;
  line-height: 1.55;
}

.permission-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.permission-group {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(205, 217, 232, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.permission-group legend {
  padding: 0 8px;
  color: #0b2a4a;
  font-weight: 900;
}

.permission-check {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  color: #1f344d;
  font-weight: 800;
}

.permission-check input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.permission-check input:disabled+span {
  opacity: 0.7;
}

.product-preview {
  width: min(260px, 100%);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 22px;
  border: 1px solid rgba(205, 217, 232, 0.95);
  background: #eef4fb;
  box-shadow: 0 16px 34px rgba(8, 27, 51, 0.12);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  align-items: start;
}

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

.report-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(205, 217, 232, 0.95);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(244, 248, 252, 0.9));
}

.report-rank {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 14px;
  color: #ffffff;
  background: linear-gradient(135deg, #0b2a4a, #1aa6b7);
  font-weight: 900;
}

.report-row strong {
  color: #071d36;
}

.report-row p {
  margin: 3px 0 0;
  color: #66758a;
  font-size: 0.92rem;
}

.report-row b {
  color: #0b2a4a;
  white-space: nowrap;
}

@media (max-width: 900px) {

  .pos-layout,
  .sale-picker {
    grid-template-columns: 1fr;
  }

  .pos-summary {
    position: static;
  }

  .product-card {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .product-image-wrap {
    width: 92px;
    height: 92px;
    border-radius: 20px;
  }
}

@media screen and (min-width: 900px) {
  .app-shell {
    width: 100%;
    max-width: none;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    gap: 18px;
    padding: 18px 24px 28px;
  }

  .topbar {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 18px;
    z-index: 20;
    margin-bottom: 0;
  }

  .main-content {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
  }

  .bottom-nav {
    grid-column: 1;
    grid-row: 1 / span 2;
    position: sticky;
    top: 18px;
    align-self: start;
    height: calc(100vh - 36px);
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    overflow-y: auto;
    padding: 16px;
    border-radius: 28px;
    background:
      linear-gradient(180deg, rgba(7, 23, 45, 0.96), rgba(10, 38, 70, 0.96)),
      radial-gradient(circle at top left, rgba(37, 99, 235, 0.35), transparent 36%);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
  }



  .bottom-nav button {
    width: 100%;
    justify-content: flex-start;
    gap: 12px;
    min-height: 48px;
    color: #dbeafe;
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
  }

  .bottom-nav button:hover {
    background: rgba(219, 234, 254, 0.1);
    border-color: rgba(147, 197, 253, 0.2);
  }

  .bottom-nav button.active {
    background: linear-gradient(135deg, #1d4ed8, #0891b2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 18px 36px rgba(8, 145, 178, 0.24);
  }

  .bottom-nav .nav-icon {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(219, 234, 254, 0.12);
    color: inherit;
  }
}

.expense-badge {
  background: #fee2e2;
  color: #991b1b;
}

.report-row.is-income {
  border-left: 4px solid #16a34a;
}

.report-row.is-expense {
  border-left: 4px solid #dc2626;
}

.contract-body {
  display: grid;
  gap: 12px;
  line-height: 1.8;
  font-size: 1rem;
}

.contract-print {
  min-height: auto;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  body {
    background: #fff;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .topbar,
  .bottom-nav,
  .action-row,
  #globalFeedback,
  .loading-overlay {
    display: none !important;
  }

  body.is-printing-job-sheet .app-shell {
    display: none !important;
  }

  body:not(.is-printing-job-sheet) .page {
    display: none !important;
  }

  body:not(.is-printing-job-sheet) #receiptPage {
    display: block !important;
  }

  body:not(.is-printing-job-sheet) .receipt-card {
    box-shadow: none;
    border: 0;
  }

  .print-active {
    display: block !important;
    width: 100% !important;
    max-width: 210mm !important;
    margin: 0 auto !important;
    padding: 10mm 15mm !important;
    box-sizing: border-box !important;
    background: white !important;
  }

  .print-container {
    display: block !important;
    width: 100% !important;
    height: 86mm !important;
    padding: 5mm 8mm !important;
    box-sizing: border-box !important;
    margin-bottom: 5.5mm !important;
    overflow: hidden !important;
    page-break-inside: avoid !important;
    border: 2px solid #94a3b8;
    border-radius: 12px;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: #000000 !important;
  }

  .print-container:last-child {
    margin-bottom: 0 !important;
  }

  .job-sheet-header {
    display: flex !important;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    border-bottom: 2px solid #94a3b8;
    padding-bottom: 6px;
    margin-bottom: 8px;
  }

  .job-sheet-header strong {
    display: block;
    font-size: 22px;
    color: #000 !important;
  }

  .job-sheet-header span {
    display: block;
    font-size: 13px;
    color: #000 !important;
  }

  .job-sheet-header>div:last-child {
    text-align: right;
  }

  .job-sheet-copy {
    display: inline-block !important;
    color: #fff !important;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px !important;
    font-weight: 800;
    margin-bottom: 4px;
  }

  .job-sheet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 8px;
  }

  .job-sheet-pass {
    color: #ef4444;
    margin-left: 12px;
  }

  .job-sheet-issue {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px;
  }

  .job-sheet-issue strong {
    color: #dc2626;
  }

  .job-sheet-bottom {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 10px;
    font-size: 12px;
    line-height: 1.4;
  }

  .job-sheet-note {
    color: #000 !important;
  }

  .job-sheet-note b,
  .job-sheet-money strong {
    color: #dc2626;
  }

  .job-sheet-money {
    text-align: right;
    font-size: 12px;
  }

  .job-sheet-money strong {
    display: inline-block;
    margin-top: 3px;
    font-size: 14px;
  }

  .job-sheet-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    text-align: center;
    font-size: 10px;
    margin-top: 16px;
  }

  .job-sheet-signatures span {
    border-top: 1px dashed #94a3b8;
    padding-top: 4px;
  }

  .job-sheet-internal {
    margin-top: 16px;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 5px;
    text-align: center;
    font-size: 10px;
    color: #64748b;
    font-weight: 800;
  }
}

/* Final navy enterprise overrides: keep these after legacy rules. */
body {
  font-size: 15px;
  background:
    radial-gradient(circle at 8% 0%, rgba(22, 184, 214, 0.14), transparent 28%),
    radial-gradient(circle at 90% 8%, rgba(245, 182, 66, 0.14), transparent 24%),
    linear-gradient(145deg, #f4f8fb 0%, #e8eef6 48%, #dfe8f2 100%);
  color: #0f172a;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-areas:
    "nav topbar"
    "nav main";
  gap: 18px;
  max-width: 1680px;
}

.topbar {
  grid-area: topbar;
  background: linear-gradient(135deg, #071a2f 0%, #0f2d4e 100%);
  z-index: 9999;
}

/* ซ่อนไอคอนปฏิทินและไอคอนอื่น ๆ ของเบราว์เซอร์ในหน้า Login สำหรับ Tablet/Mobile */
#loginPage input::-webkit-calendar-picker-indicator,
#loginPage input::-webkit-inner-spin-button,
#loginPage input::-webkit-clear-button {
  display: none !important;
  -webkit-appearance: none !important;
  margin: 0 !important;
}

.topbar {
  grid-area: topbar;
  background: linear-gradient(135deg, #071a2f, #0f2f4a);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 48px rgba(7, 26, 47, 0.22);
}

.main-content {
  grid-area: main;
}

.brand-heading {
  display: flex !important;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px;
}

.topbar .eyebrow,
.topbar h1 {
  color: #ffffff;
}

.bottom-nav {
  grid-area: nav;
  position: sticky;
  top: 18px;
  left: auto;
  right: auto;
  bottom: auto;
  align-self: start;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 18px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 54px rgba(15, 47, 74, 0.16);
}









.nav-group-label {
  margin: 16px 10px 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bottom-nav button {
  justify-content: flex-start;
  border-radius: 16px;
  min-height: 46px;
}

.bottom-nav button.active {
  background: linear-gradient(135deg, #071a2f, #0e5470);
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(7, 26, 47, 0.26);
}

.nav-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(22, 184, 214, 0.12);
  color: #16b8d6;
}

.bottom-nav button.active .nav-icon {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.card,
.list-item,
.stat-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 47, 74, 0.1);
  box-shadow: 0 18px 42px rgba(15, 47, 74, 0.08);
}

.dashboard-command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.dashboard-filter-bar {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(7, 26, 47, 0.06), rgba(22, 184, 214, 0.1));
  border: 1px solid rgba(15, 47, 74, 0.1);
}

.dashboard-filter-bar strong,
.dashboard-filter-bar span,
.dashboard-filter-bar label {
  display: block;
}

.dashboard-filter-bar>div span,
.dashboard-filter-bar label span {
  color: #64748b;
  font-size: 12px;
}

.dashboard-filter-bar select {
  min-width: 170px;
  min-height: 42px;
  padding-block: 10px;
}

.dashboard-panel {
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.88));
  border: 1px solid rgba(15, 47, 74, 0.1);
}

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

.activity-row {
  display: flex !important;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid rgba(15, 47, 74, 0.08);
}

.activity-row strong,
.activity-row span {
  display: block;
}

.activity-row span {
  color: #64748b;
  font-size: 13px;
}

.activity-row b {
  white-space: nowrap;
  color: #071a2f;
}

.alert-row {
  border-left: 4px solid #f5b642;
}

.report-period-card {
  margin-top: 18px;
}

.period-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.period-breakdown-grid h3 {
  margin: 0 0 10px;
  color: #071a2f;
  font-size: 16px;
}

.compact-row {
  align-items: flex-start;
}

.compact-row .report-rank {
  min-width: 92px;
}

#repairList.list-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.calc-preview {
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(7, 26, 47, 0.06), rgba(22, 184, 214, 0.1));
  border: 1px solid rgba(22, 184, 214, 0.2);
  color: #0f172a;
  line-height: 1.7;
}

.full-span {
  grid-column: 1 / -1;
}

.document-thumb {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-radius: 18px;
  margin-bottom: 12px;
  background: #e2e8f0;
}

.document-thumb-placeholder {
  display: grid;
  place-items: center;
  color: #64748b;
  font-weight: 800;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .bottom-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
    margin: 12px 0;
  }

  .side-brand,
  .nav-group-label {
    display: none;
  }

  .dashboard-command-grid,
  .period-breakdown-grid,
  #repairList.list-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-filter-bar {
    display: grid;
    align-items: stretch;
  }

  .dashboard-filter-bar select {
    width: 100%;
  }
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 80px minmax(0, 1fr);
}

.sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.app-shell.sidebar-collapsed .bottom-nav button span:not(.nav-icon) {
  display: none;
}

.app-shell.sidebar-collapsed .nav-group-label {
  text-align: center;
  font-size: 0;
}

.app-shell.sidebar-collapsed .nav-group-label::after {
  content: "---";
  font-size: 10px;
}

.app-shell.sidebar-collapsed .app-shell.sidebar-collapsed {
  grid-template-columns: 80px minmax(0, 1fr) !important;
}

.app-shell.sidebar-collapsed .bottom-nav button {
  justify-content: center;
}

/* === INJECTED CSS FROM INDEX12 === */

body {
  font-family: 'Kanit', sans-serif;
  background: #f4f7fb;
  color: #1e293b;
}

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

body[data-role="user"] .admin-only {
  display: none !important;
}

.input-group {
  background-color: white;
  padding: 1.5rem;
  border-radius: 2rem;
  border: 2px solid transparent;
  transition: all 0.3s;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}

.input-group:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

.input-pro {
  width: 100%;
  padding: 1rem;
  background-color: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 1rem;
  outline: none;
  transition: all 0.2s;
  color: #0f172a;
  font-weight: 500;
}

.input-pro:focus {
  border-color: #3b82f6;
  background-color: white;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 900;
  color: #64748b;
  margin-bottom: 0.5rem;
  margin-left: 0.25rem;
  text-transform: uppercase;
}

.menu-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 1px solid #e2e8f0;
}

.menu-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border-color: transparent;
}

.table-pro th {
  background-color: #1e293b;
  color: white;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
  text-align: center;
}

.table-pro td {
  padding: 0.75rem 1rem;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
}

.summary-box {
  background-color: #0f172a;
  color: white;
  padding: 1.25rem;
  border-radius: 1rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.suggestion-box {
  position: absolute;
  z-index: 50;
  background-color: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  margin-top: 0.25rem;
  max-height: 12rem;
  overflow-y: auto;
  width: 100%;
  font-size: 0.875rem;
}

.print-only {
  display: none !important;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm !important;
  }

  html,
  body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body>*:not(.print-active) {
    display: none !important;
  }

  /* Ã Â¸Â¥Ã Â¹â€¡Ã Â¸Â­Ã Â¸â€žÃ Â¸â€šÃ Â¸â„¢Ã Â¸Â²Ã Â¸â€Ã Â¸ÂÃ Â¸Â£Ã Â¸Â°Ã Â¸â€Ã Â¸Â²Ã Â¸Â©Ã Â¸â€”Ã Â¸ÂµÃ Â¹Ë†Ã Â¸â€¢Ã Â¸Â±Ã Â¸Â§Ã Â¸â€žÃ Â¸Â­Ã Â¸â„¢Ã Â¹â‚¬Ã Â¸â€”Ã Â¸â„¢Ã Â¹â‚¬Ã Â¸â„¢Ã Â¸Â­Ã Â¸Â£Ã Â¹Å’Ã Â¸Å¾Ã Â¸Â´Ã Â¸Â¡Ã Â¸Å¾Ã Â¹Å’Ã Â¹ÂÃ Â¸â€”Ã Â¸â„¢ (Ã Â¹â‚¬Ã Â¸â€¹Ã Â¸Å¸Ã Â¸ÂÃ Â¸Â§Ã Â¹Ë†Ã Â¸Â²) */
  .print-active {
    display: block !important;
    width: 100% !important;
    max-width: 210mm !important;
    /* Ã Â¸Å¡Ã Â¸Â±Ã Â¸â€¡Ã Â¸â€žÃ Â¸Â±Ã Â¸Å¡Ã Â¸â€šÃ Â¸â„¢Ã Â¸Â²Ã Â¸â€Ã Â¸ÂÃ Â¸Â§Ã Â¹â€°Ã Â¸Â²Ã Â¸â€¡Ã Â¹â€žÃ Â¸Â¡Ã Â¹Ë†Ã Â¹â‚¬Ã Â¸ÂÃ Â¸Â´Ã Â¸â„¢ A4 */
    margin: 0 auto !important;
    padding: 10mm 15mm !important;
    box-sizing: border-box !important;
    background: white !important;
  }

  /* Ã Â¸Â¥Ã Â¹â€¡Ã Â¸Â­Ã Â¸â€žÃ Â¸â€žÃ Â¸Â§Ã Â¸Â²Ã Â¸Â¡Ã Â¸ÂªÃ Â¸Â¹Ã Â¸â€¡Ã Â¸â€šÃ Â¸Â­Ã Â¸â€¡Ã Â¹Æ’Ã Â¸Å¡Ã Â¸Â£Ã Â¸Â±Ã Â¸Å¡Ã Â¸â€¹Ã Â¹Ë†Ã Â¸Â­Ã Â¸Â¡Ã Â¹Æ’Ã Â¸Â«Ã Â¹â€° 3 Ã Â¸ÂÃ Â¸Â¥Ã Â¹Ë†Ã Â¸Â­Ã Â¸â€¡Ã Â¸Å¾Ã Â¸Â­Ã Â¸â€Ã Â¸Âµ A4 */
  .print-container {
    border: 1.5px solid #94a3b8 !important;
    border-radius: 12px !important;
    width: 100% !important;
    height: 86mm !important;
    /* Ã Â¸Â¥Ã Â¹â€¡Ã Â¸Â­Ã Â¸â€žÃ Â¸â€žÃ Â¸Â§Ã Â¸Â²Ã Â¸Â¡Ã Â¸ÂªÃ Â¸Â¹Ã Â¸â€¡Ã Â¸ÂÃ Â¸Â¥Ã Â¹Ë†Ã Â¸Â­Ã Â¸â€¡Ã Â¸Â¥Ã Â¸Â° 86mm */
    padding: 5mm 8mm !important;
    box-sizing: border-box !important;
    margin-bottom: 5.5mm !important;
    overflow: hidden !important;
    page-break-inside: avoid !important;
  }

  .print-container:last-child {
    margin-bottom: 0 !important;
  }

  /* Ã Â¸â€ºÃ Â¸Â£Ã Â¸Â±Ã Â¸Å¡Ã Â¹Æ’Ã Â¸Å¡Ã Â¹â‚¬Ã Â¸ÂªÃ Â¸â„¢Ã Â¸Â­Ã Â¸Â£Ã Â¸Â²Ã Â¸â€žÃ Â¸Â²Ã Â¹Æ’Ã Â¸Â«Ã Â¹â€°Ã Â¸Å Ã Â¸Â´Ã Â¸â€Ã Â¸â€šÃ Â¸Â­Ã Â¸Å¡Ã Â¸Å¾Ã Â¸Â­Ã Â¸â€Ã Â¸ÂµÃ Â¸â€¢Ã Â¸Â­Ã Â¸â„¢Ã Â¸â€ºÃ Â¸Â£Ã Â¸Â´Ã Â¹â€°Ã Â¸â„¢ */
  #print-area-quotation #quotation-page {
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }
}


/* Installment Detail Modal Premium Layout */
.installment-modal-card {
  max-width: 1100px !important;
  width: 95% !important;
  max-height: 92vh !important;
  padding: 0 !important;
  overflow: hidden;
  display: flex !important;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: 1.25rem;
  position: relative;
}

.modal-header-premium {
  padding: 1rem 1.25rem 0.75rem;
  background: linear-gradient(135deg, #071a2f, #0e5470);
  color: white;
  display: flex !important;
  flex-direction: column;
  gap: 0.6rem;
  flex-shrink: 0;
}

.modal-header-top {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.modal-header-content {
  flex: 1;
  min-width: 0;
}

.header-actions-premium {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  row-gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.6rem;
}

.modal-header-premium>.btn-close-circle {
  position: static;
  flex-shrink: 0;
}

/* ปุ่มใน header ต้องมองเห็นบน gradient เข้ม */
.header-actions-premium .btn {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  font-size: 0.85rem;
}

.header-actions-premium .btn:hover {
  background: rgba(255, 255, 255, 0.28) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

.header-actions-premium .btn.btn-primary {
  background: rgba(255, 255, 255, 0.9) !important;
  color: #071a2f !important;
  border-color: transparent !important;
  font-weight: 700;
}

.header-actions-premium .btn.btn-primary:hover {
  background: #ffffff !important;
}

.modal-header-premium h2 {
  margin: 0;
  color: white;
  font-size: 1.5rem;
}

.modal-header-premium .hint {
  color: rgba(255, 255, 255, 0.8);
  margin: 0.25rem 0 0 0;
}

.btn-close-circle {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-close-circle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.installment-detail-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-body);
}

@media (max-width: 900px) {
  .installment-detail-grid {
    grid-template-columns: 1fr;
  }
}

.installment-info-section {
  display: flex !important;
  flex-direction: column;
  gap: 1rem;
}

.installment-tables-section {
  display: flex !important;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  max-height: calc(90vh - 120px);
}

.summary-card-premium {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

.summary-card-premium:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.summary-card-premium span {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.summary-card-premium strong {
  display: block;
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.summary-card-premium small {
  color: var(--primary-color);
  font-weight: 500;
}

.modal-action-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.table-legend {
  display: flex !important;
  gap: 1rem;
  font-size: 0.85rem;
}

.legend-item {
  display: flex !important;
  align-items: center;
  gap: 0.4rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-paid {
  background: var(--success-color);
}

.dot-pending {
  background: var(--primary-color);
}

.dot-overdue {
  background: var(--error-color);
}

/* New Installment Detail Layout */
.installment-detail-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 2rem;
  padding: 2rem;
  background: #f8fafc;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.installment-sidebar {
  display: flex !important;
  flex-direction: column;
  gap: 1.5rem;
}

.installment-content {
  display: flex !important;
  flex-direction: column;
  gap: 2rem;
  overflow-y: auto;
  max-height: calc(92vh - 180px);
  min-height: 0;
}

.table-card {
  display: flex !important;
  flex-direction: column;
  max-height: 340px;
  overflow: hidden;
  flex-shrink: 0;
}

.table-card .table-responsive {
  overflow-y: auto;
  overflow-x: auto;
  flex: 1;
  min-height: 0;
}


.clickable-card {
  cursor: pointer;
  transition: all 0.2s ease;
}

.clickable-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.table-responsive {
  overflow-x: auto;
  width: 100%;
}

.allocation-summary {
  font-size: 0.9rem;
  line-height: 1.6;
}

@media (max-width: 1024px) {
  .installment-detail-layout {
    grid-template-columns: 1fr;
  }

  .installment-content {
    max-height: none;
    overflow-y: visible;
  }
}



/* --- Mobile Bottom Navigation --- */
.mobile-bottom-nav {
  display: none;
}

@media screen and (max-width: 980px) {
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    height: var(--mobile-nav-height);
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.05);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 2000;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
  }

  .mobile-bottom-nav button {
    background: none;
    border: none;
    color: #64748b;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 8px 0;
    width: 20%;
    cursor: pointer;
    transition: all 0.3s;
  }

  .mobile-bottom-nav button.active {
    color: var(--mobile-primary);
  }

  .mobile-bottom-nav button i {
    font-size: 1.3rem;
  }

  .mobile-bottom-nav .fab-center {
    width: 56px;
    height: 56px;
    background: var(--mobile-primary);
    border-radius: 50%;
    color: #ffffff;
    margin-top: -45px;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
    border: 5px solid var(--mobile-bg);
    justify-content: center;
    display: flex !important;
  }

  /* Hide sidebar on mobile */
  #bottomNav {
    display: none !important;
  }

  .app-shell {
    display: block !important;
    padding: 0 !important;
  }

  .main-content {
    padding: 10px 15px 100px !important;
  }

  .topbar {
    border-radius: 0 0 25px 25px !important;
    margin-bottom: 20px !important;
  }
}


/* --- Fix: Hide old buttons but keep layout --- */
@media screen and (max-width: 980px) {

  /* ซ่อนปุ่มเดิมใน Sidebar */
  #bottomNav button,
  #bottomNav .nav-group-label,
  #bottomNav #bottomNav {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    pointer-events: none !important;
    height: 0 !important;
  }

  /* ดัน Bottom Nav ใหม่ให้ลอยเด่น */
  .mobile-bottom-nav {
    display: flex !important;
    z-index: 9999999 !important;
    background: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
}

/* --- New Mobile FAB System --- */
.fab-container {
  display: none;
}

@media screen and (max-width: 980px) {
  .fab-container {
    display: block;
    position: fixed;
    right: 20px;
    bottom: 100px;
    z-index: 10000000;
  }

  .main-fab {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 24px;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .fab-container.open .main-fab {
    transform: rotate(135deg);
    background: #ef4444;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
  }

  .fab-menu {
    position: absolute;
    bottom: 75px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom right;
  }

  .fab-container.open .fab-menu {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  .fab-menu button {
    background: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    color: #1e293b;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
  }

  .fab-menu button i {
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
  }

  .fab-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    z-index: 9999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
  }

  .fab-overlay.open {
    opacity: 1;
    visibility: visible;
  }

  /* Refine bottom nav (remove FAB gap) */
  .mobile-bottom-nav .fab-center {
    display: none !important;
  }
}

/* --- Cleanup Top Header on Mobile --- */
@media screen and (max-width: 980px) {
  .topbar-right {
    display: none !important;
  }

  .topbar {
    padding: 15px 20px !important;
    min-height: auto !important;
    height: auto !important;
  }

  .brand-heading {
    justify-content: center;
    width: 100%;
  }

  .brand-copy {
    text-align: center;
  }
}

/* --- Fix Dashboard Filter Bar --- */
@media screen and (max-width: 980px) {
  .dashboard-filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 15px !important;
  }

  .dashboard-filter-bar div:first-child {
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
  }

  .dashboard-filter-bar strong {
    display: block !important;
    font-size: 1.1rem !important;
  }
}

/* --- Hide Nav at Login --- */
#loginPage.active~.mobile-bottom-nav,
#loginPage.active~.fab-container,
body:has(#loginPage.active) .mobile-bottom-nav,
body:has(#loginPage.active) .fab-container {
  display: none !important;
}

/* --- Filter FAB System --- */
.filter-fab-container {
  display: none;
}

@media screen and (max-width: 980px) {
  .filter-fab-container {
    display: block;
    position: fixed;
    left: 20px;
    bottom: 100px;
    z-index: 10000000;
  }

  .filter-fab {
    width: 50px;
    height: 50px;
    background: #ffffff;
    border-radius: 50%;
    border: 2px solid #2563eb;
    color: #2563eb;
    font-size: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .filter-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 30px 30px 0 0;
    padding: 30px 25px;
    z-index: 10000001;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
  }

  .filter-sheet.open {
    transform: translateY(0);
  }

  .filter-sheet h3 {
    margin: 0 0 20px;
    text-align: center;
    color: #1e293b;
  }

  .filter-sheet .form-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  /* Hide original filter bar content on mobile */
  .dashboard-filter-bar {
    display: none !important;
  }
}

/* --- Premium Dashboard Cards --- */
@media screen and (max-width: 980px) {
  #dashboardPage #dashboardStats.stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    padding: 10px 0 !important;
  }

  #dashboardPage #dashboardStats .stat-card {
    position: relative;
    overflow: hidden;
    border: none !important;
    border-radius: 28px !important;
    padding: 22px 15px !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 120px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
    transition: transform 0.2s;
  }

  #dashboardPage #dashboardStats .stat-card:active {
    transform: scale(0.95);
  }

  /* Icons for cards */
  #dashboardPage #dashboardStats .stat-card::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 60px;
    opacity: 0.1;
    transform: rotate(-15deg);
  }

  /* Specific Card Styles */
  /* งานทั้งหมด */
  [data-dashboard-target="allRepairs"] {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd) !important;
    color: #0369a1 !important;
  }

  [data-dashboard-target="allRepairs"]::before {
    content: "\f0ad";
  }

  /* รอดำเนินการ */
  [data-dashboard-target="pendingRepairs"] {
    background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
    color: #b45309 !important;
  }

  [data-dashboard-target="pendingRepairs"]::before {
    content: "\f251";
  }

  /* ปิดงานแล้ว */
  [data-dashboard-target="doneRepairs"] {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0) !important;
    color: #15803d !important;
  }

  [data-dashboard-target="doneRepairs"]::before {
    content: "\f058";
  }

  /* สินค้าใกล้หมด */
  [data-dashboard-target="lowStock"] {
    background: linear-gradient(135deg, #fee2e2, #fecaca) !important;
    color: #b91c1c !important;
  }

  [data-dashboard-target="lowStock"]::before {
    content: "\f071";
  }

  /* บิลขายวันนี้ */
  [data-dashboard-target="salesCount"] {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe) !important;
    color: #4338ca !important;
  }

  [data-dashboard-target="salesCount"]::before {
    content: "\f53a";
  }

  /* ยอดขายวันนี้ */
  [data-dashboard-target="salesTotal"] {
    background: linear-gradient(135deg, #ccfbf1, #99f6e4) !important;
    color: #0f766e !important;
  }

  [data-dashboard-target="salesTotal"]::before {
    content: "\f153";
  }

  /* ยอดผ่อนในไลน์ */
  [data-dashboard-target="lineInstallments"] {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7) !important;
    color: #6a1b9a !important;
  }

  [data-dashboard-target="lineInstallments"]::before {
    content: "\f086";
  }

  #dashboardPage #dashboardStats .stat-card span {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    margin-bottom: 8px !important;
    opacity: 0.8;
  }

  #dashboardPage #dashboardStats .stat-card strong {
    font-size: 1.8rem !important;
    letter-spacing: -0.02em !important;
  }
}

/* --- PC Cleanup: Hide Mobile Elements --- */
@media screen and (min-width: 981px) {

  .mobile-bottom-nav,
  .fab-container,
  .fab-overlay,
  .filter-fab-container,
  .filter-sheet {
    display: none !important;
  }
}

/* Ensure filter-sheet is not in the flow even on mobile */
.filter-sheet {
  position: fixed !important;
  z-index: 9999 !important;
}



.side-brand-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.side-brand-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-subtitle {
  display: block;
  font-size: 0.65rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: -2px;
}

.sidebar-user-tag {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.75rem;
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
}

.sidebar-toggle-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.app-shell.sidebar-collapsed .sidebar-user-tag {
  padding: 4px;
  font-size: 0;
  width: 32px;
  height: 32px;
  margin: 0 auto;
}

.app-shell.sidebar-collapsed .brand-subtitle,



/* --- REFINED SIDEBAR BRANDING --- */
.side-brand {
  display: flex;
  flex-direction: column;
  padding: 12px 18px !important;
  background: #071a2f;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: auto !important;
}

.side-brand-top {
  display: flex;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100%;
}

.side-brand-main {
  display: flex;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px;
  width: auto !important;
}

.side-brand-text {
  display: none !important;
}

.side-brand-mark {
  background: rgba(255, 255, 255, 0.05);
  padding: 10px;
  border-radius: 16px;
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.side-brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.side-brand-text {
  display: flex;
  flex-direction: column;
}

.side-brand strong {
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  /* Prevent "i - GADGETS" from breaking */
}

.brand-subtitle {
  color: #94a3b8;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.sidebar-user-tag {
  margin-top: 15px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px 12px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

/* Barcode Scanner UI */
.input-group {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
}

.input-group input {
  flex: 1 !important;
}

#barcodeScannerModal {
  z-index: 10000 !important;
}

#barcodeReader {
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

/* Barcode Scanner UI */
.input-group {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
  margin-top: 5px;
}

.input-group input {
  flex: 1 !important;
}

#barcodeScannerModal {
  z-index: 10000 !important;
}

#barcodeReader {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

/* OCR Scanner Styles */
.ocr-action-bar {
  margin-bottom: 10px;
  display: flex;
  justify-content: flex-end;
}

.ocr-modal-card {
  max-width: 600px !important;
  width: 95% !important;
  padding: 15px !important;
}

.ocr-camera-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 15px;
}

#ocrVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ocr-guide-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.ocr-guide-rect {
  width: 85%;
  height: 60%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.ocr-guide-text {
  color: #fff;
  margin-top: 15px;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.ocr-status-msg {
  text-align: center;
  margin-bottom: 15px;
  color: var(--primary);
  font-weight: bold;
}

.btn-large {
  padding: 12px 30px !important;
  font-size: 1.1rem !important;
  border-radius: 50px !important;
}

.form-grid hr {
  grid-column: 1 / -1;
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 0;
  opacity: 0.5;
}

/* Force hide installment elements on all viewports, screens, and mobile bottom navigation bars */
.mobile-bottom-nav button[data-page="installmentListPage"],
.mobile-bottom-nav button[onclick*="installment"],
.mobile-bottom-nav button[data-page="installmentsPage"],
.mobile-bottom-nav button[data-dashboard-target="installments"] {
  display: none !important;
}

/* ============================================================
   SPLIT RIBBON HEADER — 2-Row Premium Design
   ============================================================ */
.content-header {
  background: #0f172a !important;
  border-radius: 16px !important;
  margin-bottom: 22px !important;
  padding: 0 !important;
  overflow: hidden !important;
  box-shadow: 0 4px 20px rgba(15,23,42,0.2) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  border: 1px solid rgba(255,255,255,0.06) !important;
}

/* ── Row 1: Brand + User ── */
.content-header-top {
  display: flex;
  align-items: center;
  padding: 11px 18px;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.ch-logo-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ch-logo-wrap img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.ch-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  line-height: 1;
}
.ch-brand-sub {
  font-size: 10.5px;
  color: rgba(255,255,255,0.3);
  margin-top: 2px;
  display: block;
}

.ch-top-spacer { flex: 1; }

.ch-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ch-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
}
.ch-role-badge {
  background: rgba(99,102,241,0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.ch-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Row 2: Page Title + Datetime + Status Chips ── */
.content-header-bottom {
  display: flex;
  align-items: center;
  padding: 9px 18px;
  gap: 10px;
  background: rgba(255,255,255,0.02);
  flex-wrap: wrap;
}

.content-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.content-header-left h1 {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: rgba(255,255,255,0.9) !important;
  margin: 0 !important;
  letter-spacing: 0 !important;
  line-height: 1 !important;
}

.ch-sep-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  flex-shrink: 0;
}

.ch-datetime {
  font-size: 11.5px;
  color: rgba(255,255,255,0.3);
  white-space: nowrap;
}

.content-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Status chips — overrides old chip style */
.content-header .topbar-status-chips {
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.content-header .topbar-chip {
  display: flex !important;
  align-items: center;
  gap: 5px;
  min-width: unset !important;
  padding: 4px 10px !important;
  border-radius: 8px !important;
  background: rgba(255,255,255,0.04) !important;
  border: 1px solid rgba(255,255,255,0.07) !important;
  box-shadow: none !important;
  color: rgba(255,255,255,0.45) !important;
  font-size: 11.5px;
  white-space: nowrap;
}

.content-header .topbar-chip.chip-ok {
  background: rgba(16,185,129,0.1) !important;
  border-color: rgba(16,185,129,0.2) !important;
  color: #6ee7b7 !important;
}

.content-header .topbar-chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
  flex-shrink: 0;
}

.content-header .topbar-chip-label {
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: inherit !important;
  text-transform: none !important;
}

.content-header .topbar-chip strong {
  font-size: 11.5px !important;
  line-height: 1;
  color: inherit !important;
}

/* Hide old meta line (now replaced by ch-datetime in row 2) */
.content-header .topbar-meta-line {
  display: none !important;
}

/* Hide action buttons in header (moved to FAB) */
.content-header .topbar-actions {
  display: none !important;
}

/* Mobile: stack row 2 */
@media (max-width: 768px) {
  .content-header-top {
    padding: 9px 14px;
  }
  .content-header-bottom {
    padding: 8px 14px;
    gap: 8px;
  }
  .content-header-right {
    width: 100%;
    margin-left: 0;
  }
  .ch-role-badge {
    display: none;
  }
}

/* Sidebar Logout Button */
.bottom-nav .btn-logout-sidebar {
  margin-top: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 6px 12px !important;
  background: rgba(239, 68, 68, 0.15) !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  font-size: 0.75rem !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  width: auto !important;
  box-shadow: none !important;
  transform: none !important;
  white-space: nowrap !important;
  align-self: center !important;
}

.bottom-nav .btn-logout-sidebar,
.bottom-nav .btn-logout-sidebar span,
.bottom-nav .btn-logout-sidebar i {
  color: #f87171 !important;
}

.bottom-nav .btn-logout-sidebar:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35) !important;
}

.bottom-nav .btn-logout-sidebar:hover,
.bottom-nav .btn-logout-sidebar:hover span,
.bottom-nav .btn-logout-sidebar:hover i {
  color: #ffffff !important;
}

.bottom-nav .btn-logout-sidebar:active {
  transform: scale(0.95) !important;
}

.bottom-nav .btn-logout-sidebar i {
  font-size: 0.85rem !important;
}

/* Hide sidebar logout button on mobile view (width <= 980px) */
@media (max-width: 980px) {
  .bottom-nav .btn-logout-sidebar {
    display: none !important;
  }
}

/* ============================================================
   PREMIUM TOAST NOTIFICATION STYLING (Glassmorphism & Slide-in)
   ============================================================ */
.slip-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 380px;
  width: calc(100% - 40px);
  pointer-events: none;
}

.slip-toast {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(15, 47, 74, 0.15);
  padding: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  animation: slip-toast-slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
}

.slip-toast.dismissing {
  animation: slip-toast-slide-out 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slip-toast-slide-in {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slip-toast-slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

.slip-toast-icon {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.slip-toast-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slip-toast-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f2f4a;
  margin: 0;
}

.slip-toast-amount {
  font-size: 1.4rem;
  font-weight: 800;
  color: #059669;
  margin: 2px 0;
  line-height: 1.2;
}

.slip-toast-details {
  font-size: 0.78rem;
  color: #5b758f;
  line-height: 1.4;
  margin: 0;
}

.slip-toast-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  font-size: 1.1rem;
  transition: color 0.2s ease;
  line-height: 1;
  align-self: flex-start;
  margin-top: -2px;
  margin-right: -4px;
}

.slip-toast-close:hover {
  color: #0f2f4a;
}

.slip-toast-save-btn {
  margin-top: 8px;
  width: 100%;
  padding: 7px 12px;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.slip-toast-save-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e40af, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29,78,216,0.3);
}

.slip-toast-save-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* --- secondhandList responsive design --- */
#secondhandList.list-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 700px) {
  #secondhandList.list-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  }
}

/* ============================================================
   SLIP ALERT MODAL - กลางจอ โดดเด่น คางจนกดยืนยัน
   ============================================================ */
.slip-alert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 26, 47, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: slip-overlay-in 0.25s ease forwards;
}
@keyframes slip-overlay-in { from { opacity: 0; } to { opacity: 1; } }
.slip-alert-card {
  background: #fff;
  border-radius: 24px;
  width: 100%;
  max-width: 380px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
  animation: slip-card-in 0.35s cubic-bezier(0.16,1,0.3,1) forwards;
}
@keyframes slip-card-in {
  from { transform: scale(0.85) translateY(30px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.slip-alert-header {
  background: linear-gradient(135deg,#0f172a 0%,#1e3a5f 100%);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.slip-alert-header-icon {
  width:44px;height:44px;
  background: linear-gradient(135deg,#10b981,#059669);
  border-radius:14px;display:flex;align-items:center;justify-content:center;
  font-size:20px;flex-shrink:0;box-shadow:0 4px 12px rgba(16,185,129,0.4);
}
.slip-alert-header-text { flex: 1; }
.slip-alert-header-text h3 { color:#fff;font-size:.95rem;font-weight:700;margin:0 0 2px; }
.slip-alert-header-text span { color:#6ee7b7;font-size:.72rem;font-weight:600; }
.slip-alert-pulse {
  width:12px;height:12px;background:#10b981;border-radius:50%;flex-shrink:0;
  animation: slip-pulse 1.5s infinite;
}
@keyframes slip-pulse {
  0%   { box-shadow: 0 0 0 0    rgba(16,185,129,0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0    rgba(16,185,129,0); }
}
.slip-alert-body { padding:20px; }
.slip-alert-amount-label { font-size:.72rem;font-weight:700;color:#94a3b8;letter-spacing:2px;text-transform:uppercase;margin-bottom:4px; }
.slip-alert-amount { font-size:2.8rem;font-weight:900;color:#059669;line-height:1;margin-bottom:16px;display:flex;align-items:baseline;gap:4px; }
.slip-alert-amount .slip-alert-baht { font-size:1.5rem;color:#1d4ed8; }
.slip-alert-info { display:flex;flex-direction:column;gap:10px;margin-bottom:20px;background:#f8fafc;border-radius:12px;padding:14px; }
.slip-alert-info-row { display:flex;gap:10px;align-items:flex-start; }
.slip-alert-info-icon { font-size:14px;width:24px;text-align:center;flex-shrink:0;margin-top:1px; }
.slip-alert-info-detail small { display:block;font-size:.68rem;color:#94a3b8;font-weight:600;text-transform:uppercase;letter-spacing:.5px; }
.slip-alert-info-detail strong { font-size:.88rem;color:#1e293b;font-weight:700; }
.slip-alert-actions { display:flex;flex-direction:column;gap:10px; }
.slip-alert-btn-confirm {
  width:100%;padding:14px;
  background:linear-gradient(135deg,#10b981,#059669);
  color:white;border:none;border-radius:12px;font-size:.95rem;font-weight:700;
  cursor:pointer;transition:all .2s;display:flex;align-items:center;
  justify-content:center;gap:8px;font-family:inherit;
  box-shadow:0 4px 14px rgba(16,185,129,0.35);
}
.slip-alert-btn-confirm:hover { transform:translateY(-1px);box-shadow:0 8px 20px rgba(16,185,129,0.45); }
.slip-alert-btn-confirm:disabled { opacity:.7;cursor:not-allowed;transform:none; }
.slip-alert-btn-close {
  width:100%;padding:11px;background:none;color:#64748b;
  border:1.5px solid #e2e8f0;border-radius:12px;font-size:.85rem;
  font-weight:600;cursor:pointer;transition:all .2s;font-family:inherit;
}
.slip-alert-btn-close:hover { background:#f1f5f9;border-color:#cbd5e1; }