/* ========================================================
   RIGVEDAA Stock & Billing Suite - Modern UI Stylesheet
   Enhanced for Authentication, Thermal & A4 Invoices, and Mobile App POS
   ======================================================== */
:root {
  --ink: #17231f;
  --muted: #62726b;
  --line: #e0e6e1;
  --paper: #f4f7f4;
  --white: #ffffff;
  --green: #195e42;
  --green-dark: #0f3626;
  --green-light: #247c58;
  --lime: #d8f59d;
  --lime-dark: #bde079;
  --orange: #e88636;
  --orange-light: #fef3e9;
  --red: #c93b3b;
  --red-light: #fde8e8;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --shadow-sm: 0 2px 8px rgba(15, 54, 38, 0.05);
  --shadow: 0 10px 30px rgba(15, 54, 38, 0.07);
  --shadow-lg: 0 22px 50px rgba(15, 54, 38, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  cursor: pointer;
  transition: all 0.15s ease;
}

/* App Layout */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

/* Sidebar */
.sidebar {
  background: var(--green-dark);
  color: var(--white);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 40;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 6px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--lime);
  color: var(--green-dark);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 4px 14px rgba(216, 245, 157, 0.35);
  flex-shrink: 0;
}

.brand-info strong {
  display: block;
  font-size: 18px;
  letter-spacing: 0.5px;
  font-weight: 850;
  line-height: 1.2;
}

.brand-info small {
  color: #b5d0c1;
  font-size: 10.5px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.switcher {
  padding: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.switcher button {
  border: 0;
  border-radius: 9px;
  padding: 9px 5px;
  background: transparent;
  color: #b9d0c3;
  font-size: 12px;
  font-weight: 700;
}

.switcher button.active {
  background: var(--lime);
  color: var(--green-dark);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nav-label {
  font-size: 10px;
  letter-spacing: 1.6px;
  color: #8bb59d;
  padding: 0 10px;
  margin-bottom: -10px;
  font-weight: 700;
}

.nav {
  display: grid;
  gap: 5px;
}

.nav button {
  border: 0;
  background: transparent;
  color: #c7dbd0;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13.5px;
  font-weight: 550;
}

.nav button span {
  width: 22px;
  text-align: center;
  font-size: 17px;
  opacity: 0.85;
}

.nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav button.active {
  background: rgba(255, 255, 255, 0.16);
  color: white;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--lime);
}

.side-bottom {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 16px 8px 0;
  color: #b9d0c3;
  font-size: 11.5px;
  line-height: 1.6;
}

.db-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(216, 245, 157, 0.15);
  color: var(--lime);
  font-weight: 700;
  font-size: 11px;
  margin-top: 8px;
}

/* User Profile Badge in Sidebar Bottom */
.user-sidebar-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.user-sidebar-info {
  display: flex;
  flex-direction: column;
}

.user-sidebar-name {
  font-weight: 750;
  font-size: 13px;
  color: #fff;
}

.user-sidebar-role {
  font-size: 10.5px;
  color: var(--lime);
  text-transform: uppercase;
  font-weight: 700;
}

/* Main Content Area */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  height: 80px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 1.6px;
  color: var(--green);
  font-weight: 800;
  text-transform: uppercase;
}

.topbar h1 {
  font-size: 23px;
  margin: 3px 0 0;
  letter-spacing: -0.6px;
  font-weight: 800;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pill {
  background: #edf7ee;
  color: var(--green);
  padding: 7px 13px;
  border-radius: 30px;
  font-size: 11.5px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #d4ecd6;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 4px 12px 4px 5px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #faeedb;
  color: #794a20;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  border: 1px solid #ebdbc4;
}

.user-pill-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-pill-name {
  font-size: 12px;
  font-weight: 750;
  color: var(--ink);
}

.user-pill-role {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
}

/* Content Container */
.content {
  padding: 28px 34px 50px;
  max-width: 1520px;
  width: 100%;
  margin: 0 auto;
}

/* Welcome Banner */
.welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.welcome h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.9px;
  font-weight: 850;
}

.welcome p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

/* Buttons */
.btn {
  border: 1px solid var(--line);
  background: var(--white);
  padding: 10px 16px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  user-select: none;
}

.btn:hover {
  background: #f8faf8;
  border-color: #ccd7ce;
  transform: translateY(-1px);
}

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

.btn.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
  box-shadow: 0 3px 10px rgba(25, 94, 66, 0.25);
}

.btn.primary:hover {
  background: var(--green-light);
  border-color: var(--green-light);
}

.btn.lime {
  background: var(--lime);
  border-color: var(--lime-dark);
  color: var(--green-dark);
}

.btn.lime:hover {
  background: #cff08b;
}

.btn.danger {
  color: var(--red);
  border-color: #f7d2d2;
  background: #fff8f8;
}

.btn.danger:hover {
  background: var(--red-light);
  border-color: var(--red);
}

.btn.sm {
  padding: 6px 12px;
  font-size: 11.5px;
  border-radius: 8px;
}

/* Stat Cards */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #ebf6ee;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--green);
}

.stat strong {
  font-size: 28px;
  display: block;
  margin-top: 14px;
  letter-spacing: -1px;
  font-weight: 850;
  color: var(--ink);
}

.stat small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

/* Panels */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: #fafbfa;
}

.panel-head h3 {
  font-size: 16px;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.field, select, input, textarea {
  border: 1px solid #d4ded7;
  background: var(--white);
  border-radius: 10px;
  padding: 10px 13px;
  outline: none;
  color: var(--ink);
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field:focus, input:focus, select:focus, textarea:focus {
  border-color: #40956b;
  box-shadow: 0 0 0 3px rgba(64, 149, 107, 0.18);
}

.search {
  min-width: 230px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
}

th {
  text-align: left;
  background: #f7f9f7;
  color: #64736b;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  padding: 13px 20px;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 14px 20px;
  border-top: 1px solid #edf1ee;
  font-size: 13px;
  color: var(--ink);
}

tr:hover td {
  background: #fbfdfb;
}

td strong {
  font-weight: 750;
}

.sub {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

/* Tags and Badges */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 30px;
  background: #ebf6ee;
  color: #1f6b4c;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
}

.tag.low {
  background: var(--orange-light);
  color: #ba5d0d;
}

.tag.out {
  background: var(--red-light);
  color: #c93b3b;
}

.tag.blue {
  background: var(--blue-light);
  color: var(--blue);
}

.tag.superadmin {
  background: #fdf2f8;
  color: #9d174d;
  border: 1px solid #fbcfe8;
}

.tag.admin {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.tag.billing {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.tag.inactive {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

/* Grids */
.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 22px;
}

.form-grid label, .stack label {
  font-size: 11.5px;
  font-weight: 800;
  color: #55665d;
  display: grid;
  gap: 6px;
}

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

.stack {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.section {
  display: none;
}

.section.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

/* Billing Desk */
.bill-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  gap: 20px;
}

.bill-items {
  padding: 8px 20px;
}

.bill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #edf1ee;
  font-size: 13px;
}

.bill-row:last-child {
  border-bottom: 0;
}

.row-product-picker {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.row-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.row-qty-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-qty-label {
  display: none;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.row-qty-box input {
  width: 72px;
  padding: 8px 6px;
  text-align: center;
  font-weight: 750;
  border-radius: 8px;
}

.row-total-box {
  min-width: 85px;
  text-align: right;
  font-weight: 850;
  font-size: 14px;
  color: var(--ink);
}

.row-action-box button {
  padding: 6px 10px;
  font-weight: bold;
}

.bill-summary {
  padding: 22px;
}

.sumline {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  color: #5b6961;
  font-size: 13.5px;
}

.sumline.total {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 16px;
  font-size: 19px;
  color: var(--ink);
  font-weight: 900;
}

/* POS Quick Product Search & Auto-Suggest */
.pos-search-wrap {
  padding: 12px 18px;
  position: relative;
  background: #f7faf7;
  border-bottom: 1px solid var(--line);
}

.pos-search-inner {
  position: relative;
  display: flex;
  align-items: center;
}

.pos-search-icon {
  position: absolute;
  left: 12px;
  color: #558b2f;
  font-size: 15px;
  pointer-events: none;
}

.pos-search-input {
  width: 100%;
  padding: 11px 36px 11px 36px;
  font-size: 13.5px;
  border: 1px solid #c4d7ca;
  border-radius: 9px;
  background: var(--white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pos-search-input:focus {
  border-color: #388e3c;
  box-shadow: 0 0 0 3px rgba(56, 142, 60, 0.18);
}

.pos-search-clear {
  position: absolute;
  right: 10px;
  background: transparent;
  border: 0;
  color: #888;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.pos-search-clear:hover {
  color: #222;
}

/* Floating Suggestion Dropdown */
.pos-suggestions-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 18px;
  right: 18px;
  background: #ffffff;
  border: 1px solid #cfe0d5;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(18, 48, 30, 0.18);
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #edf1ee;
  cursor: pointer;
  transition: background 0.1s ease;
}

.suggestion-item:last-child {
  border-bottom: 0;
}

.suggestion-item:hover, .suggestion-item.highlighted {
  background: #eef7f0;
}

.suggestion-item .sugg-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.suggestion-item .sugg-title {
  font-size: 13.5px;
  font-weight: 750;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.suggestion-item .sugg-meta {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.suggestion-item .sugg-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-product-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.row-search-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.row-search-input {
  width: 100%;
  padding: 5px 8px;
  font-size: 11px;
  border: 1px solid #d4ded7;
  border-radius: 6px;
  background: #fcfdfc;
}

.row-search-input:focus {
  border-color: #388e3c;
  background: #ffffff;
}

/* Modals */
.modal-back {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14, 34, 25, 0.75);
  z-index: 60;
  align-items: center;
  justify-content: center;
  padding: 18px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-back.show {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: 20px;
  width: min(680px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
  animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.modal.modal-large {
  width: min(850px, 100%);
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 850;
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
}

.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fafbfa;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  flex-wrap: wrap;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--green-dark);
  color: white;
  border-radius: 12px;
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  font-size: 13px;
  font-weight: 600;
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideToast 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ========================================================
   AUTHENTICATION & LOGIN SCREEN
   ======================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0e3022 0%, #174f38 100%);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.login-card {
  background: #ffffff;
  border-radius: 24px;
  width: min(440px, 100%);
  padding: 38px 34px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
  animation: modalScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

.login-logo {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--lime);
  color: var(--green-dark);
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 900;
  margin: 0 auto 16px;
  box-shadow: 0 6px 20px rgba(216, 245, 157, 0.4);
}

.login-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 900;
  color: var(--green-dark);
  letter-spacing: -0.5px;
}

.login-card p {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 16px;
  text-align: left;
}

.login-form label {
  font-size: 12px;
  font-weight: 750;
  color: #3b4943;
  display: grid;
  gap: 6px;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  width: 100%;
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  background: transparent;
  border: 0;
  color: #888;
  padding: 4px;
  font-size: 16px;
}

.login-app-download {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.login-app-download .app-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ebf6ee;
  color: var(--green);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 12px;
}

/* ========================================================
   INVOICE PREVIEW MODAL (THERMAL & A4 FORMATS)
   ======================================================== */
.invoice-type-tabs {
  display: flex;
  gap: 8px;
  background: #eef3ef;
  padding: 5px;
  border-radius: 12px;
  margin-bottom: 18px;
}

.invoice-type-tabs button {
  flex: 1;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  border-radius: 9px;
  font-weight: 750;
  font-size: 12.5px;
  color: var(--muted);
}

.invoice-type-tabs button.active {
  background: #ffffff;
  color: var(--green);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* 1. Thermal POS Format */
.receipt-wrap {
  background: #ffffff;
  padding: 22px 18px;
  border: 1px dashed #ced4cf;
  border-radius: 12px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #111;
  max-width: 380px;
  margin: 0 auto;
}

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

.receipt-header h2 {
  font-size: 18px;
  margin: 0 0 4px;
  text-transform: uppercase;
  font-weight: 900;
}

.receipt-divider {
  border-top: 1px dashed #333;
  margin: 8px 0;
}

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

.receipt-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

.receipt-table th {
  background: transparent;
  padding: 5px 0;
  border-bottom: 1px dashed #333;
  color: #111;
  font-size: 11px;
}

.receipt-table td {
  padding: 5px 0;
  border-top: 0;
  font-size: 11.5px;
}

.receipt-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 11px;
}

.qr-code-box {
  margin: 14px auto;
  text-align: center;
}

.qr-code-box img {
  width: 130px;
  height: 130px;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 4px;
  background: white;
}

/* 2. Standard GST Tax Invoice (A4 Format) */
.a4-invoice-wrap {
  background: #ffffff;
  padding: 32px 36px;
  border: 1px solid #d8dfd9;
  border-radius: 12px;
  font-size: 12.5px;
  color: #111;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.a4-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--green);
  padding-bottom: 18px;
  margin-bottom: 20px;
}

.a4-brand h2 {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 22px;
  font-weight: 900;
}

.a4-title {
  text-align: right;
}

.a4-title h3 {
  margin: 0;
  font-size: 20px;
  color: #222;
  font-weight: 900;
  letter-spacing: 1px;
}

.a4-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  background: #fbfdfb;
  border: 1px solid #e3e8e4;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 22px;
}

.a4-meta-col h4 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--green);
  letter-spacing: 0.6px;
}

.a4-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 22px;
}

.a4-table th {
  background: #eef4f0;
  color: #1a4231;
  font-size: 11px;
  padding: 10px 14px;
  border: 1px solid #d4ded6;
  text-transform: uppercase;
}

.a4-table td {
  padding: 10px 14px;
  border: 1px solid #e4eae5;
  font-size: 12px;
}

.a4-totals-wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.a4-qr-pane {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid #e2e8e3;
  padding: 12px 16px;
  border-radius: 10px;
  background: #fbfdfb;
}

.a4-qr-pane img {
  width: 90px;
  height: 90px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.a4-summary-table {
  width: 280px;
  border-collapse: collapse;
}

.a4-summary-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #eee;
  font-size: 12.5px;
}

.a4-summary-table .grand-row td {
  font-size: 15px;
  font-weight: 850;
  color: var(--green);
  border-top: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  padding: 10px;
}

.a4-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid #e2e8e3;
  padding-top: 20px;
  margin-top: 10px;
  font-size: 11px;
  color: #555;
}

.a4-sign {
  text-align: center;
  width: 180px;
}

.a4-sign-line {
  border-top: 1px solid #333;
  margin-top: 40px;
  padding-top: 5px;
  font-weight: 700;
}

/* ========================================================
   MOBILE APP PWA INSTALL BANNER & BOTTOM NAVIGATION
   ======================================================== */
.install-banner {
  background: linear-gradient(90deg, #103828 0%, #1f6b4c 100%);
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.install-banner.hide {
  display: none !important;
}

.install-banner-text {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
}

.install-banner-text span.icon {
  font-size: 20px;
}

.mobile-bottom-nav {
  display: none;
}

/* ========================================================
   PRINT MEDIA STYLES
   ======================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  body * {
    visibility: hidden;
  }

  #printableInvoiceContainer, #printableInvoiceContainer * {
    visibility: visible;
  }

  #printableInvoiceContainer {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none !important;
  }

  .receipt-wrap {
    width: 78mm !important;
    max-width: 78mm !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .a4-invoice-wrap {
    border: none !important;
    box-shadow: none !important;
    padding: 10mm !important;
    width: 100% !important;
  }

  .modal-back, .modal-head, .modal-foot, .invoice-type-tabs, .btn, .topbar, .sidebar, .mobile-bottom-nav, .install-banner {
    display: none !important;
  }
}

/* ========================================================
   RESPONSIVE LAYOUT & MOBILE SCREEN ADJUSTMENTS
   ======================================================== */
@media (max-width: 980px) {
  .app {
    grid-template-columns: 220px 1fr;
  }
  .sidebar {
    padding: 20px 12px;
  }
  .content {
    padding: 20px 16px;
  }
  .topbar {
    padding: 0 20px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid2, .bill-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app {
    display: block;
    padding-bottom: 74px; /* Space for bottom nav */
  }

  .sidebar {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    width: 275px;
    z-index: 70;
    box-shadow: 10px 0 50px rgba(0, 0, 0, 0.45);
  }

  .sidebar.open {
    display: flex;
  }

  .topbar {
    height: 58px;
    padding: 0 12px;
    gap: 8px;
    justify-content: space-between;
  }

  .topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  .topbar-title-wrap {
    min-width: 0;
    overflow: hidden;
  }

  .mobile-menu {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 16px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .topbar h1 {
    font-size: 15px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }

  .eyebrow {
    font-size: 8.5px;
    letter-spacing: 0.8px;
    line-height: 1;
    margin-bottom: 2px;
  }

  .top-actions {
    flex-shrink: 0;
    gap: 6px;
  }

  .top-actions .pill, .user-pill-text {
    display: none;
  }

  .user-pill {
    padding: 2px 6px;
    gap: 4px;
    border-radius: 20px;
  }

  .avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .content {
    padding: 14px 10px 84px;
  }

  .welcome {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 16px;
  }

  .welcome h2 {
    font-size: 20px;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat {
    padding: 14px 15px;
  }

  .stat strong {
    font-size: 22px;
  }

  .panel-head {
    padding: 14px 12px;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .toolbar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .toolbar select {
    flex: 1 1 calc(50% - 4px);
    min-width: 130px;
  }

  .search {
    min-width: 0;
    flex: 1 1 100%;
    width: 100%;
  }

  .form-grid {
    padding: 14px 12px;
    grid-template-columns: 1fr;
  }

  .form-grid .full {
    grid-column: auto;
  }

  /* POS Quick Search on Mobile */
  .pos-search-wrap {
    padding: 10px 12px;
  }

  .pos-search-input {
    font-size: 12px;
    padding: 8px 28px 8px 30px;
    border-radius: 8px;
  }

  .pos-search-icon {
    left: 9px;
    font-size: 13px;
  }

  .pos-suggestions-menu {
    left: 10px;
    right: 10px;
    max-height: 250px;
  }

  .suggestion-item {
    padding: 9px 10px;
  }

  /* Card Layout for Bill Rows on Mobile */
  .bill-items {
    padding: 10px 12px;
  }

  .bill-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: #ffffff;
    border: 1px solid #dce8df;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(22, 60, 35, 0.05);
    gap: 8px;
  }

  .bill-row:last-child {
    border-bottom: 1px solid #dce8df;
  }

  .row-product-picker {
    width: 100%;
    min-width: 0;
  }

  .row-search-filter {
    width: 100%;
    margin-bottom: 4px;
  }

  .row-search-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 8px;
    box-sizing: border-box;
  }

  .row-product-select {
    width: 100%;
    padding: 8px 10px;
    font-size: 12.5px;
    border-radius: 8px;
    box-sizing: border-box;
  }

  .row-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px dashed #e1eae3;
    gap: 8px;
  }

  .row-qty-label {
    display: inline;
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
  }

  .row-qty-box {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .row-qty-box input {
    width: 64px;
    padding: 7px 4px;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    border-radius: 8px;
  }

  .row-total-box {
    font-size: 15px;
    font-weight: 900;
    color: var(--green);
  }

  .row-action-box .btn {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 8px;
  }

  .a4-invoice-wrap {
    padding: 16px 14px;
  }

  .a4-header {
    flex-direction: column;
    gap: 10px;
  }

  .a4-title {
    text-align: left;
  }

  .a4-meta-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .a4-totals-wrap {
    flex-direction: column;
  }

  .a4-summary-table {
    width: 100%;
  }

  /* Mobile App Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #ffffff;
    border-top: 1px solid var(--line);
    z-index: 50;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
  }

  .mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    gap: 3px;
    flex: 1;
    padding: 6px 0;
  }

  .mobile-nav-btn span.icon {
    font-size: 19px;
  }

  .mobile-nav-btn.active {
    color: var(--green);
  }

  .mobile-nav-btn.fab {
    position: relative;
    top: -12px;
  }

  .mobile-nav-btn.fab span.icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--green);
    color: var(--lime);
    display: grid;
    place-items: center;
    font-size: 24px;
    box-shadow: 0 4px 14px rgba(25, 94, 66, 0.4);
  }
}
