/* ===================================================
   KASIRIN POS - IPAD & WEB POS DESIGN SYSTEM
   Theme: Espresso Deep Dark & Emerald Teal
   Typography: Inter & JetBrains Mono
   =================================================== */

:root {
  --bg-main: #0c1017;
  --bg-surface: #141b26;
  --bg-card: #1c2636;
  --bg-card-hover: #243144;
  --bg-input: #0f151f;

  --accent-primary: #0d9488;
  --accent-primary-hover: #14b8a6;
  --accent-primary-light: rgba(13, 148, 136, 0.15);
  
  --accent-amber: #f59e0b;
  --accent-amber-light: rgba(245, 158, 11, 0.15);
  
  --accent-danger: #ef4444;
  --accent-danger-light: rgba(239, 68, 68, 0.15);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #0d9488;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(13, 148, 136, 0.35);

  --header-height: 70px;
}

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

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Main App Container */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

/* ================= HEADER ================= */
.app-header {
  height: var(--header-height);
  background: rgba(20, 27, 38, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  object-fit: cover;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-pos {
  background: linear-gradient(135deg, var(--accent-primary), #0284c7);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.store-badge {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Nav Tabs */
.header-nav {
  display: flex;
  gap: 6px;
  background: rgba(12, 16, 23, 0.6);
  padding: 5px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.system-time {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.shift-badge {
  display: block;
  font-family: var(--font-main);
  font-size: 0.72rem;
  color: var(--accent-amber);
  font-weight: 600;
}

/* ================= MAIN CONTENT ================= */
.main-content {
  flex: 1 1 0%;
  min-height: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view-panel {
  display: none;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  flex: 1 1 0%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view-panel.active {
  display: flex;
  flex-direction: column;
}

/* POS Panel itself must NOT scroll; internal catalog and cart scroll instead */
#viewPos.view-panel {
  overflow: hidden !important;
}

/* ================= POS VIEW (FLEXBOX SPLIT LAYOUT) ================= */
.pos-container {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  flex: 1 1 0%;
  overflow: hidden;
}

/* Left: Catalog Section */
.catalog-section {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  padding: 20px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.catalog-controls {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
}

.search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 1rem;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 40px 12px 42px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
  transition: all 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-primary-light);
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-add-product {
  background: var(--accent-primary-light);
  color: var(--accent-primary-hover);
  border: 1px dashed var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 0 18px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-add-product:hover {
  background: var(--accent-primary);
  color: #fff;
}

/* Category Pills */
.categories-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.categories-bar::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.cat-pill:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.cat-pill.active {
  background: var(--text-primary);
  color: var(--bg-main);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  padding-bottom: 30px;
}

.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

@media (hover: hover) {
  .product-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-card);
  }
}

.product-card:active {
  background: var(--bg-card-hover);
}

.product-card .prod-emoji {
  font-size: 2.2rem;
  margin-bottom: 10px;
  display: inline-block;
}

.product-card .prod-name {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.product-card .prod-cat {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.product-card .prod-price-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.product-card .prod-price {
  font-family: var(--font-mono);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--accent-primary-hover);
}

.product-card .btn-add-badge {
  background: var(--accent-primary);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

/* Right: Cart Sidebar */
.cart-section {
  width: 390px;
  flex: 0 0 390px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.cart-title-wrap h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.order-id {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent-primary);
  font-weight: 600;
}

.btn-clear-cart {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.btn-clear-cart:hover {
  background: var(--accent-danger-light);
  color: var(--accent-danger);
}

/* Cart Meta */
.cart-meta {
  padding: 14px 20px;
  background: rgba(12, 16, 23, 0.4);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.meta-field label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.meta-field input,
.meta-field select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.86rem;
}

.meta-field input:focus,
.meta-field select:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Cart Items Container */
.cart-items-scroll {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 8px;
  opacity: 0.6;
}

.cart-item-row {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border-subtle);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.item-main {
  flex: 1;
}

.item-title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
}

.item-unit-price {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
}

.item-qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-qty {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.qty-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.88rem;
  min-width: 18px;
  text-align: center;
}

.item-subtotal {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.88rem;
  min-width: 75px;
  text-align: right;
  color: var(--text-primary);
}

/* Cart Summary */
.cart-summary {
  padding: 18px 20px;
  background: rgba(12, 16, 23, 0.7);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.discount-row input {
  width: 80px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--accent-amber);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: right;
  margin-left: 8px;
}

.summary-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 12px 0;
}

.total-row {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.total-price {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  color: var(--accent-primary-hover);
}

.cart-actions-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.btn-split-bill {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid var(--accent-amber);
  border-radius: var(--radius-md);
  padding: 0 16px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-split-bill:hover:not(:disabled) {
  background: var(--accent-amber);
  color: #000;
}

.btn-split-bill:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.btn-checkout {
  flex: 1;
  background: linear-gradient(135deg, var(--accent-primary), #0f766e);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(13, 148, 136, 0.4);
}

.btn-checkout:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-checkout:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.checkout-total {
  font-family: var(--font-mono);
  font-size: 1.05rem;
}

/* ================= VIEW 2: RIWAYAT TABLE ================= */
.history-container,
.attendance-container,
.settings-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.view-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.view-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

.history-stats {
  display: flex;
  gap: 16px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  min-width: 180px;
}

.stat-label {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-primary-hover);
}

.history-table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.history-table th {
  background: rgba(12, 16, 23, 0.6);
  padding: 14px 18px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}

.history-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.history-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.history-table .badge-method {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-method.cash { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.badge-method.qris { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-method.transfer { background: rgba(14, 165, 233, 0.15); color: #38bdf8; }

.btn-print-sm {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-print-sm:hover {
  background: var(--accent-primary);
}

/* ================= VIEW 3: ABSENSI ================= */
.attendance-tabs {
  display: flex;
  gap: 8px;
}

.pill-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}

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

.att-subpanel {
  display: none;
}

.att-subpanel.active {
  display: block;
}

.camera-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
}

.camera-frame-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.camera-frame-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror selfie */
}

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

.face-oval {
  width: 190px;
  height: 240px;
  border: 2px dashed rgba(20, 184, 166, 0.8);
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.face-prompt {
  font-size: 0.8rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-top: 14px;
}

.att-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group label {
  display: block;
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

.shift-chips {
  display: flex;
  gap: 12px;
}

.chip-btn {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chip-btn.active[data-type="MASUK"] {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #4ade80;
}

.chip-btn.active[data-type="PULANG"] {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #f87171;
}

.btn-capture-att {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(13, 148, 136, 0.4);
}

.btn-capture-att:hover {
  background: var(--accent-primary-hover);
  box-shadow: var(--shadow-glow);
}

.status-box {
  display: none;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.status-box.success {
  display: block;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid #22c55e;
  color: #4ade80;
}

.status-box.error {
  display: block;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #f87171;
}

/* Att Records Grid */
.att-list-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.att-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.btn-secondary-sm {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.att-records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.att-record-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.att-record-img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--accent-primary);
}

.att-rec-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.att-rec-time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ================= VIEW 4: PENGATURAN ================= */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.card-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.qris-preview-box {
  background: #fff;
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 220px;
  height: 220px;
  margin: 10px auto;
}

.qris-preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.qris-upload-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--accent-danger);
  color: var(--accent-danger);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
}

/* ================= MODALS ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 520px;
  max-height: min(90vh, 90dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
  animation: modalPop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card.modal-sm { max-width: 440px; }
.modal-card.modal-receipt { max-width: 440px; }

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

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

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

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px 10px;
  touch-action: manipulation;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  flex-shrink: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  position: sticky;
  bottom: 0;
  z-index: 20;
}

.btn-cancel {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-confirm-pay {
  background: linear-gradient(135deg, var(--accent-primary), #0284c7);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 22px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-confirm-pay:active,
.btn-primary:active {
  transform: scale(0.98);
}

/* Payment Modal Specifics */
.pay-total-banner {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.15), rgba(2, 132, 199, 0.15));
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.pay-banner-label {
  font-size: 0.86rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.pay-banner-amount {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-primary-hover);
}

.pay-method-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.pay-tab {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 10px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.pay-tab.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.pay-content { display: none; }
.pay-content.active { display: block; }

.cash-quick-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 18px;
}

.quick-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.quick-chip:hover {
  background: var(--accent-primary-light);
  border-color: var(--accent-primary);
}

.change-display-box {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.change-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-amber);
}

/* QRIS Modal Details */
.qris-payment-display {
  text-align: center;
  padding: 10px 0;
}

.qris-img-card {
  background: #fff;
  padding: 16px;
  border-radius: var(--radius-md);
  display: inline-block;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.qris-img-card img {
  width: 220px;
  height: 220px;
  object-fit: contain;
}

.qris-instructions {
  margin-top: 16px;
}

.qris-instructions h4 {
  font-size: 1.1rem;
  font-weight: 700;
}

.qris-instructions p {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin: 6px auto 12px;
  max-width: 320px;
}

.qris-amount-badge {
  display: inline-block;
  background: var(--accent-amber-light);
  border: 1px solid var(--accent-amber);
  color: var(--accent-amber);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.15rem;
  padding: 6px 18px;
  border-radius: var(--radius-full);
}

/* ================= REALISTIC THERMAL RECEIPT ================= */
.thermal-receipt {
  background: #ffffff;
  color: #111827;
  font-family: var(--font-mono);
  padding: 24px 20px;
  width: 100%;
  max-width: 330px;
  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  line-height: 1.4;
  position: relative;
  border-radius: 4px;
}

.thermal-receipt .receipt-header {
  text-align: center;
  margin-bottom: 8px;
}

.thermal-receipt h2 {
  font-size: 16px;
  font-weight: 800;
  color: #000;
  margin-bottom: 4px;
}

.thermal-receipt p {
  font-size: 11px;
  color: #4b5563;
}

.dash-line {
  letter-spacing: 1px;
  color: #9ca3af;
  margin: 6px 0;
  overflow: hidden;
  white-space: nowrap;
}

.r-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.r-bold { font-weight: 700; color: #000; }
.r-large { font-size: 14px; }

.receipt-footer {
  text-align: center;
  margin-top: 14px;
}

.rec-powered {
  font-size: 10px;
  color: #6b7280;
  margin-top: 4px;
}

.barcode-sim {
  font-size: 16px;
  letter-spacing: 3px;
  margin-top: 10px;
  font-weight: bold;
}

/* ================= PRINT MEDIA QUERY (FOR THERMAL PRINTERS) ================= */
@media print {
  body * {
    visibility: hidden;
  }
  
  #thermalReceiptPaper, #thermalReceiptPaper * {
    visibility: visible;
  }

  #thermalReceiptPaper {
    position: absolute;
    left: 0;
    top: 0;
    width: 58mm; /* Standar printer struk 58mm */
    max-width: 58mm;
    box-shadow: none;
    padding: 2mm;
    margin: 0;
    color: #000;
    background: #fff;
  }
}

/* ================= IPAD & TABLET RESPONSIVENESS ================= */
@media (max-width: 1024px) and (orientation: landscape) {
  .cart-section {
    width: 330px;
    flex: 0 0 330px;
  }
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  }
}

/* iPad Portrait & Mobile */
@media (max-width: 900px), (orientation: portrait) {
  :root {
    --header-height: 64px;
  }
  .app-header {
    padding: 0 16px;
  }
  .pos-container {
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .catalog-section {
    flex: 1 1 0%;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
  }
  .cart-section {
    width: 100%;
    flex: 0 0 auto;
    max-height: 44vh;
    min-height: 160px;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }
  .camera-card {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .header-nav .nav-label {
    display: none;
  }
  .header-brand .brand-title {
    font-size: 1.1rem;
  }
}
