* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, Segoe UI, Roboto, sans-serif; background: #f3f4f6; color: #1f2937; }

.screen { display: none; } 
.screen.active { display: block; }
.view { display: none; padding: 24px; } 
.view.active { display: block; }

/* Auth */
#auth-screen.active { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#0891b2,#1e40af); }
.auth-card { background: #fff; padding: 32px; border-radius: 16px; width: 420px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.auth-card h1 { text-align: center; margin-bottom: 24px; color: #1e40af; }
.auth-card input { width: 100%; padding: 12px; margin-bottom: 12px; border: 1px solid #d1d5db; border-radius: 8px; }
.role-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.toggle-btn { flex: 1; padding: 12px; background: #f3f4f6; border: 2px solid transparent; border-radius: 8px; cursor: pointer; font-weight: 600; }
.toggle-btn.active { background: #1e40af; color: #fff; }

/* Buttons */
.primary { background: #1e40af; color: #fff; padding: 12px 24px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; width: 100%; }
.primary:hover { background: #1e3a8a; }
.secondary { background: #e5e7eb; color: #1f2937; padding: 10px 16px; border: none; border-radius: 8px; cursor: pointer; }
.link { background: none; border: none; color: #1e40af; cursor: pointer; text-decoration: underline; margin-top: 8px; }
.big { padding: 16px; font-size: 18px; }
.row { display: flex; gap: 12px; margin: 12px 0; align-items: center; }

/* App */
header { background: #1e293b; color: #fff; padding: 12px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-btn { background: transparent; color: #cbd5e1; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; }
.nav-btn.active { background: #1e40af; color: #fff; }
.user-info { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.user-info button { padding: 6px 12px; }

/* POS */
.pos-layout { max-width: 1200px; margin: 0 auto; }
.search-box { position: relative; }
.search-box input { width: 100%; padding: 14px; border: 2px solid #e5e7eb; border-radius: 8px; font-size: 16px; }
.search-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; max-height: 300px; overflow-y: auto; z-index: 100; display: none; box-shadow: 0 8px 20px rgba(0,0,0,.1); }
.search-dropdown.open { display: block; }
.search-result { padding: 12px; border-bottom: 1px solid #f3f4f6; cursor: pointer; }
.search-result:hover { background: #f0f9ff; }
.search-result .brand { font-weight: 600; color: #1e40af; }
.search-result .meta { font-size: 12px; color: #6b7280; }

.customer-row { display: flex; gap: 12px; margin: 16px 0; align-items: center; }
.customer-row select { padding: 10px; border-radius: 8px; border: 1px solid #d1d5db; }

.data-table { width: 100%; border-collapse: collapse; margin: 12px 0; background: #fff; border-radius: 8px; overflow: hidden; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e5e7eb; }
.data-table th { background: #f9fafb; font-weight: 600; }
.data-table input[type=number] { width: 70px; padding: 6px; border: 1px solid #d1d5db; border-radius: 4px; }

.totals { background: #f9fafb; padding: 16px; border-radius: 8px; margin-top: 16px; }
.totals > div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-size: 20px; font-weight: 700; color: #1e40af; border-top: 2px solid #e5e7eb; margin-top: 8px; padding-top: 8px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid #e5e7eb; margin-bottom: 16px; }
.tab { background: none; border: none; padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab.active { border-color: #1e40af; color: #1e40af; font-weight: 600; }
.rcv-panel { padding: 16px; background: #fff; border-radius: 8px; }

/* Modals */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-card { background: #fff; padding: 24px; border-radius: 12px; width: 400px; }
.modal-card h3 { margin-bottom: 16px; }
.modal-card input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #d1d5db; border-radius: 6px; }

/* Product info */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); gap: 12px; margin: 16px 0; }
.info-card { background: #fff; padding: 12px; border-radius: 8px; cursor: pointer; border: 1px solid #e5e7eb; }
.info-card:hover { border-color: #1e40af; }
.info-detail { background: #fff; padding: 20px; border-radius: 8px; margin-top: 16px; }
.info-detail h3 { color: #1e40af; margin-bottom: 8px; }
.info-detail p { margin: 6px 0; }

/* Reports */
#report-content { background: #fff; padding: 16px; border-radius: 8px; margin-top: 12px; }

/* Print */
@media print {
  header, nav, .row button, .nav-btn { display: none !important; }
  .printable { display: block !important; }
  .signature-area { display: flex; justify-content: space-between; margin-top: 40px; }
  .signature-area div { flex: 1; text-align: center; padding-top: 60px; border-top: 1px solid #000; margin: 0 20px; }
}
.printable { display: none; }

/* Alerts */
.alert { padding: 10px; border-radius: 6px; margin: 8px 0; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }

/* ☢️ KNOWLEDGE BASE COMPLIANT OVERRIDE: Force the POS App to render */
#app-screen, #app-screen.active {
  display: block !important;
  min-height: 100vh !important;
  background: #f3f4f6 !important;
  visibility: visible !important;
  opacity: 1 !important;
}
#app-screen header {
  display: flex !important;
  background: #1e293b !important;
  color: #fff !important;
  visibility: visible !important;
  opacity: 1 !important;
}
#app-screen main {
  display: block !important;
  visibility: visible !important;
}
#view-pos, #view-pos.active {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  padding: 24px !important;
}
