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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app {
  height: 100%;
  width: 100%;
  position: relative;
}

/* ===== Views ===== */
.view {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.view.active {
  display: flex;
}

/* ===== Overlay ===== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 26, 46, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.overlay p {
  margin-top: 16px;
  font-size: 1rem;
  opacity: 0.7;
}

/* ===== Common ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.camera {
  background: rgba(52, 152, 219, 0.2);
  color: #5dade2;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

.badge.zebra {
  background: rgba(46, 204, 113, 0.2);
  color: #58d68d;
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.hint {
  margin-top: 16px;
  font-size: 0.9rem;
  opacity: 0.5;
}

/* ===== Buttons ===== */
.btn-primary {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: #3498db;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active { background: #2980b9; }
.btn-primary:disabled { opacity: 0.35; cursor: default; }

.btn-secondary {
  width: 100%;
  padding: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
}

.btn-secondary:active { background: rgba(255, 255, 255, 0.1); }

.btn-cancel {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  cursor: pointer;
  margin-top: 10px;
}

.btn-danger {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: #c0392b;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-danger:active { background: #a93226; }

.btn-charge {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: #27ae60;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
}

.btn-charge:active { background: #219a52; }

/* ===== LOGIN ===== */
.login-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.subtitle {
  font-size: 0.85rem;
  opacity: 0.6;
  margin-top: 4px;
}

.login-form {
  width: 100%;
  max-width: 360px;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.6;
  margin-bottom: 6px;
  margin-top: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field-label:first-child {
  margin-top: 0;
}

.login-form input,
.login-form select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.login-form input:focus,
.login-form select:focus {
  border-color: rgba(52, 152, 219, 0.6);
}

.login-form select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.login-form select:disabled {
  opacity: 0.4;
}

.login-form select option {
  background: #1a1a2e;
  color: #fff;
}

.error-msg {
  background: rgba(192, 57, 43, 0.2);
  border: 1px solid rgba(192, 57, 43, 0.4);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.85rem;
  color: #e74c3c;
  margin-top: 12px;
}

/* ===== POS ===== */
.pos-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topbar-operator {
  font-size: 0.95rem;
  font-weight: 700;
}

.topbar-event {
  font-size: 0.75rem;
  opacity: 0.5;
}

.topbar-btn {
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.topbar-btn:active {
  background: rgba(255, 255, 255, 0.1);
}

.pos-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Product Grid */
.product-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
  align-content: start;
}

.product-card {
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.product-card:active {
  background: rgba(52, 152, 219, 0.15);
  border-color: rgba(52, 152, 219, 0.4);
}

.product-card.in-cart {
  border-color: rgba(39, 174, 96, 0.5);
  background: rgba(39, 174, 96, 0.1);
}

.product-name {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-word;
}

.product-price {
  font-size: 1.1rem;
  font-weight: 800;
  color: #5dade2;
}

.product-stock {
  font-size: 0.7rem;
  opacity: 0.4;
}

.product-cart-qty {
  background: #27ae60;
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

/* Cart */
.cart-section {
  background: rgba(255, 255, 255, 0.04);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  max-height: 45%;
  display: flex;
  flex-direction: column;
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
}

.cart-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.cart-clear {
  background: none;
  border: none;
  color: #e74c3c;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 0 14px;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.cart-item-price {
  font-size: 0.75rem;
  opacity: 0.5;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-qty-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

.cart-item-qty {
  font-size: 1rem;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.cart-item-subtotal {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 60px;
  text-align: right;
}

.cart-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 12px;
}

/* ===== QR SCAN ===== */
.scan-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.scan-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.scan-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#qr-reader {
  width: 100%;
  max-width: 400px;
  border-radius: 16px;
  overflow: hidden;
}

#qr-reader video {
  border-radius: 16px;
}

#qr-reader__scan_region {
  min-height: 280px !important;
}

#qr-reader__dashboard,
#qr-reader img[alt="Info icon"],
#qr-reader__header_message {
  display: none !important;
}

/* Zebra */
.zebra-icon {
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 24px;
  animation: pulse-zebra 2s ease-in-out infinite;
}

@keyframes pulse-zebra {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

.zebra-hint {
  font-size: 1.1rem;
  opacity: 0.6;
}

#zebra-input {
  position: absolute;
  left: -9999px;
  opacity: 0;
  width: 1px;
  height: 1px;
}

/* ===== CONFIRM ===== */
.confirm-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.confirm-container h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.confirm-account {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
  width: 100%;
  max-width: 360px;
  margin-bottom: 16px;
  text-align: center;
}

.confirm-account .account-balance {
  font-size: 2rem;
  font-weight: 900;
  color: #5dade2;
}

.confirm-account .account-cedula {
  font-size: 0.85rem;
  opacity: 0.5;
  margin-top: 4px;
}

.confirm-items {
  width: 100%;
  max-width: 360px;
  margin-bottom: 16px;
}

.confirm-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
}

.confirm-total {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 360px;
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 8px;
  padding: 12px 0;
  border-top: 2px solid rgba(255, 255, 255, 0.15);
}

.balance-warn {
  width: 100%;
  max-width: 360px;
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.85rem;
  color: #e74c3c;
  text-align: center;
  margin-bottom: 12px;
}

.confirm-container .btn-primary {
  max-width: 360px;
}

.confirm-container .btn-cancel {
  max-width: 360px;
}

/* ===== RESULT ===== */
#view-result {
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#view-result.approved { background: #27ae60; }
#view-result.rejected { background: #c0392b; }

.result-content {
  text-align: center;
  padding: 24px;
}

.result-icon {
  font-size: 5rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 16px;
}

.result-title {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 4px;
  margin-bottom: 16px;
}

.result-detail {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: 8px;
}

.result-balance {
  font-size: 1rem;
  opacity: 0.7;
}

.tap-hint {
  position: absolute;
  bottom: 28px;
  font-size: 0.8rem;
  opacity: 0.5;
}

.timer-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 6px;
  width: 100%;
  background: rgba(255, 255, 255, 0.4);
  transform-origin: left;
}

.timer-bar.running {
  animation: shrink 3s linear forwards;
}

.timer-bar.paused {
  animation-play-state: paused;
}

@keyframes shrink {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ===== REPORT ===== */
.report-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.report-title {
  font-size: 1rem;
  font-weight: 700;
}

.report-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.report-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
}

.report-loading p {
  margin-top: 16px;
  opacity: 0.6;
}

.report-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.report-card {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.card-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.card-value {
  font-size: 1.5rem;
  font-weight: 900;
}

.card-value.green { color: #27ae60; }
.card-value.red { color: #e74c3c; }

.report-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.report-table {
  margin-bottom: 24px;
}

.report-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.report-row-name {
  flex: 1;
  font-weight: 600;
}

.report-row-qty {
  opacity: 0.5;
  margin: 0 12px;
  font-size: 0.8rem;
}

.report-row-amount {
  font-weight: 700;
  min-width: 70px;
  text-align: right;
}

.report-tx-row {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  margin-bottom: 4px;
}

.report-tx-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.report-tx-type {
  font-weight: 600;
}

.report-tx-type.purchase { color: #27ae60; }
.report-tx-type.refund { color: #e74c3c; }

.report-tx-amount {
  font-weight: 700;
}

.report-tx-time {
  font-size: 0.75rem;
  opacity: 0.4;
  margin-top: 2px;
}

.report-actions {
  margin-top: 24px;
  padding-bottom: 32px;
}

.report-empty {
  text-align: center;
  padding: 24px;
  opacity: 0.4;
  font-size: 0.9rem;
}

/* ===== ADMIN ===== */
.admin-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.admin-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
}

.admin-badge {
  background: rgba(155, 89, 182, 0.2);
  color: #bb8fce;
  border: 1px solid rgba(155, 89, 182, 0.3);
}

.admin-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.admin-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.admin-tab.active {
  color: #fff;
  border-bottom-color: #3498db;
}

.admin-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

.admin-list-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.admin-list-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.admin-product-event-select {
  margin-top: 8px;
}

.admin-product-event-select select {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.admin-product-event-select select option {
  background: #1a1a2e;
  color: #fff;
}

.btn-add {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: #3498db;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-add:active { background: #2980b9; }
.btn-add:disabled { opacity: 0.35; cursor: default; }

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
}

.admin-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.admin-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  flex: 1;
}

.admin-card-actions {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}

.admin-btn-edit,
.admin-btn-delete {
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.admin-btn-edit {
  background: rgba(52, 152, 219, 0.2);
  color: #5dade2;
}

.admin-btn-edit:active { background: rgba(52, 152, 219, 0.35); }

.admin-btn-delete {
  background: rgba(192, 57, 43, 0.2);
  color: #e74c3c;
}

.admin-btn-delete:active { background: rgba(192, 57, 43, 0.35); }

.admin-card-meta {
  font-size: 0.8rem;
  opacity: 0.45;
  line-height: 1.5;
}

.admin-card-meta span {
  display: inline-block;
  margin-right: 12px;
}

.admin-card.inactive {
  opacity: 0.5;
  border-color: rgba(231, 76, 60, 0.2);
}

.admin-card-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.admin-card-status.active {
  background: rgba(39, 174, 96, 0.2);
  color: #27ae60;
}

.admin-card-status.inactive {
  background: rgba(192, 57, 43, 0.2);
  color: #e74c3c;
}

.admin-empty {
  text-align: center;
  padding: 40px 20px;
  opacity: 0.4;
  font-size: 0.9rem;
}

.btn-admin-link {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(155, 89, 182, 0.3);
  border-radius: 12px;
  background: rgba(155, 89, 182, 0.1);
  color: #bb8fce;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  text-align: center;
}

.btn-admin-link:active {
  background: rgba(155, 89, 182, 0.2);
}

.topbar-right {
  display: flex;
  gap: 8px;
}

/* ===== Account Search ===== */
.account-search {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.account-search input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.9rem;
  outline: none;
}

.account-search input:focus {
  border-color: rgba(52, 152, 219, 0.5);
}

.admin-card-balance {
  font-size: 1.2rem;
  font-weight: 800;
  color: #5dade2;
}

.admin-card-balance.blocked {
  color: #e74c3c;
}

.admin-btn-recharge {
  padding: 5px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(39, 174, 96, 0.2);
  color: #27ae60;
}

.admin-btn-recharge:active { background: rgba(39, 174, 96, 0.35); }

/* ===== Product Assignment ===== */
.assign-product-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.assign-product-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.assign-product-item:active {
  background: rgba(255, 255, 255, 0.1);
}

.assign-product-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #3498db;
  flex-shrink: 0;
}

.assign-product-name {
  font-size: 0.9rem;
  font-weight: 600;
  flex: 1;
}

.assign-product-meta {
  font-size: 0.75rem;
  opacity: 0.45;
  text-align: right;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-content {
  background: #1e1e3a;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-body .field-label {
  margin-top: 14px;
}

.modal-body .field-label:first-child {
  margin-top: 0;
}

.modal-body input,
.modal-body select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.modal-body input:focus,
.modal-body select:focus {
  border-color: rgba(52, 152, 219, 0.6);
}

.modal-body select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.modal-body select option {
  background: #1e1e3a;
  color: #fff;
}

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-footer .btn-cancel {
  flex: 1;
  margin-top: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.modal-footer .btn-primary {
  flex: 1;
  padding: 12px;
}

/* ===== Safe area ===== */
@supports (padding-top: env(safe-area-inset-top)) {
  .login-container {
    padding-top: calc(24px + env(safe-area-inset-top));
  }
  .pos-topbar,
  .scan-topbar,
  .report-topbar,
  .admin-topbar {
    padding-top: calc(12px + env(safe-area-inset-top));
  }
}
