/* CSS Variables & Design System */
:root {
  --primary-color: #ff5234;
  --primary-gradient: linear-gradient(135deg, #ff7e5f, #feb47b);
  --bg-color: #f7f8fa;
  --card-bg: #ffffff;
  --text-main: #2c3e50;
  --text-muted: #95a5a6;
  --border-color: #ebedf0;
  --danger-color: #e74c3c;
  --success-color: #2ecc71;
  --warning-color: #f39c12;
  --tab-inactive: #7f8c8d;
  --safe-bottom: env(safe-area-inset-bottom);
  --font-small: 11px;
  --font-normal: 13px;
  --font-medium: 14px;
  --font-large: 16px;
  --font-xl: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--font-normal);
  color: var(--text-main);
  background-color: var(--bg-color);
  line-height: 1.4;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Page container with transition */
.app-container {
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  background-color: var(--bg-color);
}

.view.active {
  display: flex;
}

/* Header styling */
.app-header {
  height: 48px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.app-header .header-left, .app-header .header-right {
  width: 40px;
  display: flex;
  align-items: center;
}

.app-header .header-title {
  font-size: var(--font-large);
  font-weight: bold;
  color: var(--text-main);
  text-align: center;
  flex-grow: 1;
}

.back-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-main);
  display: flex;
  align-items: center;
}

.auth-service-entry {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 82, 52, 0.1);
  color: var(--primary-color);
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
}

/* Tab content view scrollable area */
.view-content {
  flex-grow: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(60px + var(--safe-bottom));
}

/* Navigation Bar */
.nav-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: calc(50px + var(--safe-bottom));
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--tab-inactive);
  font-size: var(--font-small);
  padding: 4px 0;
  flex: 1;
}

.nav-item.active {
  color: var(--primary-color);
}

.nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

/* Cards and layout panels */
.card {
  background-color: var(--card-bg);
  border-radius: 12px;
  margin: 8px 12px;
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid var(--border-color);
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-normal);
  font-weight: bold;
  margin-bottom: 8px;
  color: var(--text-main);
}

.card-title-row span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.eye-icon {
  font-size: var(--font-normal);
  cursor: pointer;
  color: var(--text-muted);
}

.link-text {
  color: var(--text-muted);
  font-size: var(--font-small);
  text-decoration: none;
  font-weight: normal;
}

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 0;
}

.stat-label {
  font-size: var(--font-small);
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: var(--font-normal);
  font-weight: bold;
  color: var(--primary-color);
}

.stat-unit {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Orange Banner */
.banner {
  background: var(--primary-gradient);
  color: #ffffff;
  border-radius: 12px;
  margin: 12px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 10px rgba(255, 82, 52, 0.15);
  position: relative;
  overflow: hidden;
}

.banner-text h3 {
  font-size: var(--font-medium);
  font-weight: bold;
  margin-bottom: 4px;
}

.banner-text p {
  font-size: var(--font-small);
  opacity: 0.9;
}

.banner::after {
  content: '';
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 60px;
  height: 60px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}

/* Form Inputs */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  font-size: var(--font-small);
  font-weight: bold;
  margin-bottom: 4px;
  display: block;
  color: var(--text-main);
}

.form-label.required::before {
  content: '* ';
  color: var(--primary-color);
}

.form-control {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  border-radius: 8px;
  padding: 0 12px;
  font-size: var(--font-normal);
  outline: none;
  color: var(--text-main);
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--primary-color);
}

/* Buttons */
.btn {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: none;
  font-size: var(--font-normal);
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.2s;
}

.btn:active {
  opacity: 0.8;
}

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

.btn-secondary {
  background-color: #f0f2f5;
  color: var(--text-main);
}

/* Drawer/Bottom Modal */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drawer-overlay.active {
  display: block;
  opacity: 1;
}

.drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #ffffff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  z-index: 1001;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  padding-bottom: calc(16px + var(--safe-bottom));
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.drawer.active {
  transform: translateY(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-title {
  font-size: var(--font-medium);
  font-weight: bold;
}

.drawer-close {
  font-size: var(--font-large);
  color: var(--text-muted);
  cursor: pointer;
}

.drawer-content {
  padding: 12px 16px;
  overflow-y: auto;
  flex-grow: 1;
}

/* List items inside inventory */
.list-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.list-item:last-child {
  border-bottom: none;
}

.item-thumbnail {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  margin-right: 12px;
  background-color: #ebedf0;
  border: 1px solid var(--border-color);
}

.item-info {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-name {
  font-size: var(--font-normal);
  font-weight: bold;
  color: var(--text-main);
}

.item-meta {
  font-size: var(--font-small);
  color: var(--text-muted);
}

.item-price {
  font-size: var(--font-normal);
  color: var(--primary-color);
  font-weight: bold;
}

.item-right {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

/* Sidebar category layout */
.sidebar-layout {
  display: flex;
  height: calc(100vh - 108px - var(--safe-bottom)); /* Header(48) + BottomAction(60) + BottomNav(50) */
}

.sidebar {
  width: 80px;
  background-color: #f7f8fa;
  overflow-y: auto;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
}

.sidebar-item {
  padding: 12px 8px;
  text-align: center;
  font-size: var(--font-small);
  color: var(--text-main);
  cursor: pointer;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-item.active {
  background-color: #ffffff;
  color: var(--primary-color);
  border-left-color: var(--primary-color);
  font-weight: bold;
}

.main-panel {
  flex-grow: 1;
  background-color: var(--bg-color);
  overflow-y: auto;
  padding: 0 12px;
}

/* Sticky action bar above nav */
.action-bar {
  position: absolute;
  bottom: calc(50px + var(--safe-bottom));
  left: 0;
  width: 100%;
  height: 52px;
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 10px;
  z-index: 90;
  gap: 8px;
}

#view-print-settings .print-settings-content {
  padding-bottom: calc(64px + var(--safe-bottom)) !important;
}

#view-print-settings .print-settings-action-bar {
  bottom: 0;
  padding-bottom: var(--safe-bottom);
  height: calc(52px + var(--safe-bottom));
}

/* Cashier page layout */
.cashier-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px - 50px - var(--safe-bottom));
}

.camera-container {
  height: 180px;
  background-color: #2c3e50;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.camera-stream {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-reticle {
  position: absolute;
  width: 100%;
  height: 100%;
  border: none;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.scan-reticle::before, .scan-reticle::after {
  content: '';
  position: absolute;
  width: 15px;
  height: 15px;
  border: 3px solid var(--primary-color);
}
.scan-reticle::before { top: 6px; left: 6px; border-right: none; border-bottom: none; }
.scan-reticle::after { bottom: 6px; right: 6px; border-left: none; border-top: none; }

.scanner-line {
  width: 100%;
  height: 2px;
  background-color: var(--primary-color);
  position: absolute;
  top: 0;
  left: 0;
  animation: scan-anim 2s infinite linear;
  z-index: 6;
  box-shadow: 0 0 8px var(--primary-color);
}

@keyframes scan-anim {
  0% { top: 0; }
  50% { top: 100%; }
  100% { top: 0; }
}

.camera-overlay-btn {
  position: absolute;
  z-index: 10;
  background-color: rgba(255,255,255,0.9);
  border: none;
  border-radius: 20px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: bold;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.camera-overlay-btn:active {
  opacity: 1;
}

.btn-no-code {
  bottom: 10px;
  left: 10px;
}

.btn-flashlight {
  bottom: 10px;
  right: 76px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  padding: 0;
  justify-content: center;
  font-size: 11px;
}

.btn-version-toggle {
  bottom: 10px;
  right: 10px;
  background-color: var(--primary-color);
  color: #ffffff;
}

.cashier-bill-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 12px;
  background-color: #ffffff;
}

.bill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

/* Switch styling */
.switch-container {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-small);
  color: var(--text-muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .2s;
  border-radius: 20px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .switch-slider {
  background-color: var(--primary-color);
}

input:checked + .switch-slider:before {
  transform: translateX(16px);
}

/* Counter widget */
.counter {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  width: 72px;
  height: 24px;
}

.counter-btn {
  width: 22px;
  height: 100%;
  border: none;
  background-color: #f7f8fa;
  font-size: var(--font-normal);
  font-weight: bold;
  cursor: pointer;
}

.counter-value {
  flex-grow: 1;
  text-align: center;
  font-size: var(--font-small);
  font-weight: bold;
  border: none;
  outline: none;
  width: 28px;
}

/* Modal / Alert box */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}

.modal-overlay.active {
  display: flex;
}

.alert-box {
  background-color: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 290px;
  padding: 24px 20px;
  text-align: center;
  position: relative;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.alert-close {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
}

.alert-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #ffebe8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  font-size: 24px;
  margin: 0 auto 16px auto;
}

.alert-title {
  font-size: var(--font-medium);
  font-weight: bold;
  margin-bottom: 8px;
  color: var(--text-main);
}

.alert-message {
  font-size: var(--font-normal);
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* agreement check */
.agreement-container {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: var(--font-small);
  color: var(--text-muted);
  margin-top: 12px;
}

.agreement-container input {
  margin-top: 2px;
}

.agreement-link {
  color: var(--primary-color);
  cursor: pointer;
}

.agreement-modal-box {
  background-color: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 340px;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

.agreement-modal-header {
  height: 48px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.agreement-modal-title {
  font-size: var(--font-medium);
  font-weight: bold;
  color: var(--text-main);
}

.agreement-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.agreement-modal-content {
  padding: 14px 16px;
  overflow-y: auto;
  line-height: 1.65;
  color: var(--text-main);
  font-size: var(--font-normal);
  text-align: left;
}

.agreement-modal-content p {
  margin: 0 0 12px 0;
}

.agreement-modal-content h4 {
  margin: 14px 0 6px 0;
  font-size: var(--font-normal);
  color: var(--text-main);
}

.agreement-modal-confirm {
  width: auto;
  margin: 0 16px 16px 16px;
  flex-shrink: 0;
}

/* Tabs inside drawers */
.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.drawer-tab {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  font-size: var(--font-normal);
  font-weight: bold;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.drawer-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* Member Card */
.member-card {
  background: linear-gradient(135deg, #ff9f80, #ff5234);
  border-radius: 12px;
  padding: 16px;
  color: #ffffff;
  margin: 12px;
  box-shadow: 0 4px 10px rgba(255, 82, 52, 0.2);
  position: relative;
}

.member-card-title {
  font-size: var(--font-medium);
  opacity: 0.9;
}

.member-card-points {
  font-size: 28px;
  font-weight: bold;
  margin: 8px 0;
}

.member-card-phone {
  font-size: var(--font-normal);
  margin-bottom: 4px;
}

.member-card-no {
  font-size: var(--font-small);
  opacity: 0.8;
  font-family: monospace;
}

.member-card-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: #ffffff;
  color: var(--primary-color);
  border: none;
  padding: 4px 8px;
  font-size: var(--font-small);
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
}

.member-card-edit {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-size: 16px;
  color: #ffffff;
  cursor: pointer;
  opacity: 0.9;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 12px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* Image uploader styling */
.image-uploader {
  width: 72px;
  height: 72px;
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--bg-color);
  position: relative;
}

.image-uploader span {
  font-size: 24px;
  color: var(--text-muted);
}

.image-uploader img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 7px;
}

.image-uploader input[type="file"] {
  display: none;
}

.uploader-delete-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  background-color: var(--danger-color);
  color: #ffffff;
  border-radius: 50%;
  text-align: center;
  line-height: 14px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  z-index: 12;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Table styling for stats/logs */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-small);
}

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

.data-table th {
  background-color: #fff2ef;
  color: var(--text-main);
  font-weight: bold;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: var(--font-small);
  z-index: 3000;
  display: none;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Form selector grid for units / suppliers drawer */
.selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.selector-item {
  border: 1px solid var(--border-color);
  padding: 8px 4px;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  font-size: var(--font-small);
  background-color: #f8f9fa;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selector-item.active {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background-color: #fff2ef;
  font-weight: bold;
}

/* Order status item tag */
.tag {
  font-size: var(--font-small);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  display: inline-block;
}

.tag-sale {
  background-color: #ffebe8;
  color: var(--primary-color);
}

.tag-return {
  background-color: #ebf9eb;
  color: var(--success-color);
}

/* Custom small font utility */
.small-text {
  font-size: var(--font-small) !important;
}

.muted-text {
  color: var(--text-muted);
}

/* Margin utility */
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* Mascot Header/Decoration for Login/Register */
.mascot-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  background: linear-gradient(180deg, #ffebe8, var(--bg-color));
  position: relative;
}

.mascot-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  overflow: hidden;
}

.mascot-circle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mascot-logo {
  display: block;
  border-radius: 50%;
}

.mascot-title {
  font-size: var(--font-medium);
  font-weight: bold;
  color: var(--primary-color);
  margin-top: 6px;
}

.mascot-banners {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 8px 16px;
}

.mascot-bubble {
  background-color: #ffffff;
  border: 1px solid #ffcec5;
  color: var(--primary-color);
  border-radius: 12px;
  padding: 4px 8px;
  font-size: var(--font-small);
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

/* Custom Picker Selector display and drawer list styling */
.selector-display-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 38px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  border-radius: 6px;
  padding: 0 12px;
  font-size: var(--font-normal);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}
.selector-display-control::after {
  content: '▼';
  font-size: 10px;
  color: var(--text-muted);
}

.picker-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s;
}

.picker-item-row:active {
  background-color: #f2f3f5;
}

.picker-item-text {
  flex-grow: 1;
  font-size: var(--font-normal);
  color: var(--text-main);
}

.picker-item-actions {
  display: flex;
  gap: 8px;
}

.picker-action-btn {
  border: none;
  background: none;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.picker-action-btn.edit {
  color: #3498db;
}

.picker-action-btn.delete {
  color: var(--danger-color);
}

.product-item-card {
  display: flex;
  align-items: center;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: transform 0.1s;
}

.product-item-card:active {
  transform: scale(0.99);
}

.product-list-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 8px;
}

.product-list-action {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background-color: #ffffff;
  color: var(--text-main);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.product-list-action.edit {
  color: var(--primary-color);
  background-color: #fff2ef;
  border-color: #ffd5cc;
}

.product-list-action.delete {
  color: var(--danger-color);
  background-color: #fff5f5;
  border-color: #ffd6d6;
}

.audit-log-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  gap: 6px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.product-detail-header-actions {
  justify-content: flex-end;
  width: 44px;
  position: relative;
}

.product-detail-more-menu {
  position: absolute;
  top: 38px;
  right: 0;
  width: 132px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  display: none;
  overflow: hidden;
  z-index: 50;
}

.product-detail-more-menu.active {
  display: block;
}

.product-detail-more-menu button {
  width: 100%;
  height: 36px;
  border: none;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: var(--font-normal);
  text-align: left;
  padding: 0 12px;
}

.product-detail-more-menu button:last-child {
  border-bottom: none;
}

.product-detail-more-menu button.danger {
  color: var(--danger-color);
}

.product-detail-content {
  background-color: var(--bg-color);
  padding: 10px 0 calc(20px + var(--safe-bottom));
}

.product-detail-hero {
  background-color: #ffffff;
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.product-detail-image-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background-color: #f0f2f5;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-detail-image-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-detail-image-stage.empty {
  color: var(--text-muted);
  font-size: var(--font-normal);
}

.product-image-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 48px;
  border: none;
  background: rgba(0, 0, 0, 0.32);
  color: #ffffff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.product-image-nav.prev {
  left: 0;
}

.product-image-nav.next {
  right: 0;
}

.product-image-counter {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 44px;
  height: 22px;
  border-radius: 11px;
  background-color: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  font-size: var(--font-small);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
}

.product-detail-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
}

.product-detail-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  border: 2px solid transparent;
  object-fit: cover;
  flex-shrink: 0;
  cursor: pointer;
  background-color: #f0f2f5;
}

.product-detail-thumb.active {
  border-color: var(--primary-color);
}

.product-detail-title {
  font-size: var(--font-large);
  font-weight: bold;
  color: var(--text-main);
  margin-top: 10px;
  line-height: 1.35;
}

.product-detail-subtitle {
  font-size: var(--font-small);
  color: var(--text-muted);
  margin-top: 4px;
}

.product-detail-price-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.product-detail-metric {
  background-color: #fff8f6;
  border: 1px solid #ffe0d8;
  border-radius: 8px;
  padding: 8px 6px;
  min-width: 0;
}

.product-detail-metric .label {
  color: var(--text-muted);
  font-size: var(--font-small);
  margin-bottom: 3px;
}

.product-detail-metric .value {
  color: var(--primary-color);
  font-size: var(--font-normal);
  font-weight: bold;
  word-break: break-all;
}

.detail-field-list {
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-top: 8px;
}

.detail-field-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-color);
  gap: 14px;
}

.detail-field-row:last-child {
  border-bottom: none;
}

.detail-field-label {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: var(--font-small);
}

.detail-field-value {
  text-align: right;
  color: var(--text-main);
  font-size: var(--font-normal);
  font-weight: 500;
  word-break: break-word;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 42px 16px;
}

.image-lightbox.active {
  display: flex;
}

.image-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 18px;
  background-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 64px;
  border: none;
  background-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 42px;
  cursor: pointer;
}

.lightbox-prev {
  left: 0;
}

.lightbox-next {
  right: 0;
}

.lightbox-counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 56px;
  height: 24px;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: var(--font-small);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}

.import-alert-box {
  max-width: 320px;
  text-align: left;
}

.import-option {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  margin-top: 8px;
  cursor: pointer;
  background-color: #ffffff;
}

.import-option.active {
  border-color: var(--primary-color);
  background-color: #fff8f6;
}

.import-option input {
  margin-top: 3px;
}

.import-option span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.import-option strong {
  font-size: var(--font-normal);
  color: var(--text-main);
}

.import-option small {
  font-size: var(--font-small);
  color: var(--text-muted);
}

.print-template-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.template-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.template-tab {
  height: 32px;
  border: none;
  border-right: 1px solid var(--border-color);
  background-color: #ffffff;
  color: var(--text-main);
  font-size: var(--font-small);
  font-weight: bold;
  cursor: pointer;
}

.template-tab:last-child {
  border-right: none;
}

.template-tab.active {
  background-color: #fff2ef;
  color: var(--primary-color);
}

.template-editor-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.template-editor-pane,
.template-preview-pane {
  min-width: 0;
}

.template-editor {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: #f8f9fa;
  color: var(--text-main);
  font-size: 12px;
  line-height: 1.45;
  padding: 10px;
  outline: none;
  font-family: Consolas, "Courier New", monospace;
}

.template-editor:focus {
  border-color: var(--primary-color);
}

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

.template-vars {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.template-var-chip {
  border: 1px solid #ffd2c9;
  color: var(--primary-color);
  background-color: #fff8f6;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 10px;
  cursor: pointer;
  font-family: Consolas, "Courier New", monospace;
}

.template-preview-title {
  font-size: var(--font-small);
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: bold;
}

.template-preview {
  min-height: 180px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: #ffffff;
  color: var(--text-main);
  padding: 10px;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
}

@media (min-width: 760px) {
  .template-editor-layout {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
  }
}
