/* Jai Crackers - Professional Billing & Inventory System CSS */
:root {
  --primary: #d97706;
  /* Festive Warm Amber / Gold */
  --primary-hover: #b45309;
  --secondary: #ef4444;
  /* Cracker Red Accent */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #3b82f6;

  --bg-main: #0f172a;
  /* Sleek dark theme background */
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-input: #0f172a;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;

  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Top Bar */
.app-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 2px solid var(--primary);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-menu-toggle {
  background: #334155;
  color: #fbbf24;
  border: 1px solid #fbbf24;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-menu-toggle:hover {
  background: #fbbf24;
  color: #0f172a;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

.brand-icon {
  font-size: 2rem;
  line-height: 1;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 0.5px;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.badge-offline {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 8px #34d399;
}

/* Side Menu Drawer & Overlay */
.menu-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.menu-drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.menu-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  background-color: #1e293b;
  border-right: 2px solid var(--primary);
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
}

.menu-drawer.active {
  transform: translateX(0);
}

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

.menu-drawer-items {
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.menu-item {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: all 0.15s ease;
}

.menu-item:hover {
  background-color: #334155;
  color: #fbbf24;
}

.menu-item.active {
  background-color: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border-left: 4px solid #fbbf24;
}

.menu-icon {
  font-size: 1.2rem;
}

/* Main Container */
.app-content {
  flex: 1;
  padding: 1.25rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Layout Grids */
.billing-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1.25rem;
}

@media (max-width: 1200px) {
  .billing-layout {
    grid-template-columns: 1fr;
  }
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #f1f5f9;
}

/* Inputs & Form Controls */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

.input-lg {
  font-size: 1.15rem;
  padding: 0.85rem 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Floating Autocomplete Search Dropdown */
.search-container {
  position: relative;
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #1e293b;
  border: 2px solid var(--primary);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 350px;
  overflow-y: auto;
  z-index: 500;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.7);
  display: none;
}

.search-dropdown.active {
  display: block;
}

.search-result-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.15s ease;
}

.search-result-item:hover,
.search-result-item.selected {
  background-color: #334155;
}

.search-result-code {
  font-weight: 800;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-right: 0.75rem;
}

.search-result-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.search-result-price {
  font-weight: 800;
  color: #34d399;
  font-size: 1.05rem;
}

/* Bill Item Table */
.table-responsive {
  overflow-x: auto;
}

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

.data-table th {
  background-color: rgba(15, 23, 42, 0.8);
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.75rem 0.85rem;
  border-bottom: 2px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.qty-input {
  width: 65px;
  text-align: center;
  padding: 0.3rem;
  font-weight: 700;
}

/* Cart Summary & Payments */
.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.summary-row.discount-row {
  color: #34d399;
  font-weight: 600;
}

.summary-total {
  font-size: 1.6rem;
  font-weight: 900;
  color: #fbbf24;
  border-top: 2px dashed var(--border-color);
  padding-top: 0.6rem;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.btn-success {
  background-color: var(--success);
  color: white;
}

.btn-success:hover {
  background-color: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}

.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-secondary {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: #475569;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 0.9rem 1.5rem;
  font-size: 1.1rem;
}

/* KPI Cards for Reports */
.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.kpi-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-main);
}

.kpi-sub {
  font-size: 0.8rem;
  margin-top: 0.4rem;
  color: var(--text-muted);
}

.kpi-profit {
  border-left: 4px solid #10b981;
}

.kpi-profit .kpi-value {
  color: #34d399;
}

.kpi-revenue {
  border-left: 4px solid #fbbf24;
}

.kpi-revenue .kpi-value {
  color: #fbbf24;
}

.kpi-cogs {
  border-left: 4px solid #ef4444;
}

.kpi-cogs .kpi-value {
  color: #f87171;
}

.kpi-discount {
  border-left: 4px solid #3b82f6;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-main);
}

/* UPI QR Code View */
.qr-container {
  background: white;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1rem 0;
}

.qr-image {
  width: 200px;
  height: 200px;
}

.qr-amount {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  margin-top: 0.5rem;
}

/* Thermal & A4 Print Templates (Strictly Hidden on Screen) */
#thermal-print-area,
#a4-print-area,
#estimate-print-area {
  display: none !important;
}

/* Custom Excel-Style Invoice & Estimate Template Styling */
/* Custom Excel-Style Invoice & Estimate Template Styling */
.a4-template-container {
  width: 794px !important; /* Standard A4 width @ 96DPI */
  background: #ffffff !important;
  color: #1e293b !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  display: block !important;
}

.template-header-banner {
  background-color: #0f4c81 !important; /* Deep Teal / Blue from user template */
  color: #ffffff !important;
  padding: 20px 24px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  display: table !important;
  table-layout: fixed !important;
}

.banner-left {
  display: table-cell !important;
  vertical-align: middle !important;
  text-align: left !important;
}

.banner-left .banner-title {
  font-size: 28px !important;
  font-weight: 800 !important;
  letter-spacing: 1.5px !important;
  color: #ffffff !important;
  margin: 0 !important;
  line-height: 1.1 !important;
}

.banner-left .banner-subtitle-badge {
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #fef08a !important;
  margin-top: 4px !important;
}

.banner-right {
  display: table-cell !important;
  vertical-align: middle !important;
  text-align: right !important;
  color: #ffffff !important;
  font-size: 11px !important;
  line-height: 1.35 !important;
}

.shop-name-title {
  font-size: 16px !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  margin-bottom: 2px !important;
}

.shop-tagline {
  font-style: italic;
  margin-bottom: 3px;
  color: #f1f5f9;
}

.template-meta-section {
  padding: 16px 24px 8px 24px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  display: table !important;
  table-layout: fixed !important;
  background: #ffffff !important;
}

.meta-left {
  display: table-cell !important;
  vertical-align: top !important;
  text-align: left !important;
  font-size: 12px !important;
  color: #1e293b !important;
}

.meta-row {
  margin-bottom: 4px !important;
}

.meta-row strong {
  display: inline-block;
  min-width: 100px;
  color: #0f172a !important;
}

.meta-right {
  display: table-cell !important;
  vertical-align: top !important;
  text-align: right !important;
  font-size: 12px !important;
  color: #1e293b !important;
}

.bill-to-label {
  font-weight: 800 !important;
  font-size: 13px !important;
  color: #0f4c81 !important;
  margin-bottom: 4px !important;
}

.bill-to-content {
  color: #334155 !important;
  font-weight: 600 !important;
}

.template-divider {
  border: 0 !important;
  border-top: 1.5px solid #0f4c81 !important;
  margin: 8px 24px !important;
}

.template-table {
  width: calc(100% - 48px) !important;
  margin: 10px 24px 15px 24px !important;
  border-collapse: collapse !important;
  font-size: 11px !important;
}

.template-table th {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  padding: 8px 8px !important;
  border-top: 1px solid #cbd5e1 !important;
  border-bottom: 2px solid #0f4c81 !important;
  text-align: left !important;
}

.template-table td {
  padding: 7px 8px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  color: #1e293b !important;
  vertical-align: middle !important;
}

.template-table tbody tr:nth-child(even) {
  background-color: #f8fafc !important;
}

.template-bottom-section {
  padding: 0 24px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  display: table !important;
  table-layout: fixed !important;
  margin-top: 10px !important;
}

.template-terms-box {
  display: table-cell !important;
  vertical-align: top !important;
  width: 55% !important;
  font-size: 11px !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
  padding: 10px 12px !important;
  border-radius: 4px !important;
  background: #f8fafc !important;
}

.template-terms-box strong {
  color: #0f172a !important;
}

.template-totals-box {
  display: table-cell !important;
  vertical-align: top !important;
  width: 40% !important;
  text-align: right !important;
}

.template-totals-table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 12px !important;
}

.template-totals-table td {
  padding: 5px 8px !important;
  color: #1e293b !important;
}

.total-highlight-row {
  font-size: 15px !important;
  font-weight: 800 !important;
  background-color: #e0f2fe !important;
  color: #0f4c81 !important;
}

.total-highlight-row td {
  padding: 8px 10px !important;
  border-top: 2px solid #0f4c81 !important;
  color: #0f4c81 !important;
}

.template-signatures {
  padding: 30px 24px 15px 24px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  display: table !important;
  table-layout: fixed !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #334155 !important;
}

.template-signatures div:first-child {
  display: table-cell !important;
  text-align: left !important;
}

.template-signatures div:last-child {
  display: table-cell !important;
  text-align: right !important;
}

.template-footer-banner {
  background-color: #0f4c81 !important;
  color: #ffffff !important;
  text-align: center !important;
  padding: 10px 20px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  margin-top: 20px !important;
}

/* PRINT MEDIA RULES */
@media print {
  body * {
    visibility: hidden !important;
  }

  .app-header,
  .menu-drawer,
  .menu-drawer-overlay,
  .app-content,
  .modal-overlay,
  #pdf-temp-wrapper {
    display: none !important;
  }

  /* Thermal Receipt Print Styling */
  body.print-thermal #thermal-print-area,
  body.print-thermal #thermal-print-area * {
    visibility: visible !important;
  }

  body.print-thermal #thermal-print-area {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    padding: 2mm;
    color: #000;
    background: #fff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    line-height: 1.3;
  }

  /* A4 Invoice Print Styling */
  body.print-a4 #a4-print-area,
  body.print-a4 #a4-print-area * {
    visibility: visible !important;
  }

  body.print-a4 #a4-print-area {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 794px !important;
    background: #fff;
  }

  /* A4 Estimate / Quotation Print Styling */
  body.print-estimate #estimate-print-area,
  body.print-estimate #estimate-print-area * {
    visibility: visible !important;
  }

  body.print-estimate #estimate-print-area {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 794px !important;
    background: #fff;
  }
}

/* High Contrast Active Selection Highlights for Payment Mode & Report Period Buttons */
.pay-mode-btn.active {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  border: 2px solid #34d399 !important;
  font-weight: 800 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
  transform: scale(1.03);
}

.report-period-btn.active {
  background: linear-gradient(135deg, #fbbf24, #d97706) !important;
  color: #0f172a !important;
  border: 2px solid #fef08a !important;
  font-weight: 900 !important;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
  transform: scale(1.03);
}

.report-paymode-btn.active {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  border: 2px solid #34d399 !important;
  font-weight: 800 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
  transform: scale(1.03);
}

.pay-mode-btn:not(.active),
.report-period-btn:not(.active),
.report-paymode-btn:not(.active) {
  background-color: #1e293b !important;
  color: #94a3b8 !important;
  border: 1px solid #334155 !important;
  opacity: 0.85;
}

/* ========================================== */
/* EXACT ESTIMATE PDF TEMPLATE STYLING        */
/* (Matching Last Year's Design)              */
/* ========================================== */
.a4-estimate-wrapper {
  width: 794px !important; /* Standard A4 width @ 96 DPI */
  min-height: 1123px !important;
  background: #ffffff !important;
  color: #000000 !important;
  font-family: Arial, Helvetica, sans-serif !important;
  box-sizing: border-box !important;
  padding: 0 0 60px 0 !important;
  margin: 0 !important;
  position: relative !important;
  display: block !important;
}

/* Header Bar */
.est-header-bar {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  width: 100% !important;
  height: 75px !important;
  position: relative !important;
  margin-bottom: 10px !important;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.est-header-navy {
  background: #1c2430 !important; /* Slate navy */
  color: #ffffff !important;
  height: 65px !important;
  padding: 0 35px 0 20px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  border-radius: 0 0 50px 0 !important;
  box-sizing: border-box !important;
  min-width: 360px !important;
}

.est-logo-circle {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.est-shop-title {
  font-size: 22px !important;
  font-weight: 900 !important;
  letter-spacing: 1.5px !important;
  color: #ffffff !important;
  text-transform: uppercase !important;
}

.est-header-red {
  background: #e11d2e !important; /* Vibrant Red */
  color: #ffffff !important;
  height: 45px !important;
  padding: 0 25px 0 40px !important;
  display: flex !important;
  align-items: center !important;
  gap: 20px !important;
  border-radius: 0 0 0 35px !important;
  box-sizing: border-box !important;
  margin-top: 0 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

.est-contact-item {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  color: #ffffff !important;
}

/* Meta & Customer Details */
.est-meta-container {
  padding: 0 35px !important;
  margin-bottom: 15px !important;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.est-title-row {
  display: flex !important;
  justify-content: flex-end !important;
  margin-bottom: 10px !important;
}

.est-doc-title {
  font-size: 32px !important;
  font-weight: 800 !important;
  color: #000000 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-family: system-ui, Arial, sans-serif !important;
}

.est-info-grid {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
}

.est-red-label {
  color: #e11d2e !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  margin-bottom: 4px !important;
}

.est-customer-name {
  font-size: 20px !important;
  font-weight: 700 !important;
  color: #000000 !important;
  text-transform: capitalize !important;
}

.est-meta-fields {
  text-align: right !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
  color: #000000 !important;
}

.est-meta-fields span {
  color: #333333 !important;
  font-weight: 500 !important;
}

.est-meta-fields strong {
  font-weight: 700 !important;
  color: #000000 !important;
  margin-left: 5px !important;
}

/* Items Table */
.est-items-table {
  width: calc(100% - 70px) !important;
  margin: 0 35px 20px 35px !important;
  border-collapse: collapse !important;
  font-size: 12px !important;
}

.est-items-table th {
  background: #e11d2e !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  padding: 8px 10px !important;
  border: 1px solid #e11d2e !important;
  text-align: left !important;
}

.est-items-table th.col-num { width: 5% !important; text-align: center !important; }
.est-items-table th.col-name { width: 32% !important; }
.est-items-table th.col-qty { width: 7% !important; text-align: center !important; }
.est-items-table th.col-unit { width: 7% !important; text-align: center !important; }
.est-items-table th.col-mrp { width: 13% !important; text-align: right !important; }
.est-items-table th.col-disc { width: 8% !important; text-align: right !important; }
.est-items-table th.col-rate { width: 13% !important; text-align: right !important; }
.est-items-table th.col-amt { width: 15% !important; text-align: right !important; }

.est-items-table tr {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.est-items-table td {
  padding: 7px 8px !important;
  border: 1px solid #444444 !important;
  color: #000000 !important;
  vertical-align: middle !important;
}

.est-items-table td.col-num { text-align: center !important; }
.est-items-table td.col-qty { text-align: center !important; }
.est-items-table td.col-unit { text-align: center !important; }
.est-items-table td.col-mrp { text-align: right !important; }
.est-items-table td.col-disc { text-align: right !important; }
.est-items-table td.col-rate { text-align: right !important; }
.est-items-table td.col-amt { text-align: right !important; }

.est-table-total-row td {
  border-top: 2px solid #000000 !important;
  border-bottom: 2px solid #000000 !important;
  font-weight: 700 !important;
  background-color: #ffffff !important;
}

/* Summary & Terms Section */
.est-summary-section {
  padding: 0 35px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  margin-top: 10px !important;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.est-left-terms {
  width: 52% !important;
}

.est-section-heading {
  color: #e11d2e !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  margin-bottom: 5px !important;
  display: inline-block !important;
}

.est-words-value {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #000000 !important;
  line-height: 1.4 !important;
}

.est-terms-body {
  font-size: 12px !important;
  color: #1e293b !important;
  line-height: 1.4 !important;
}

.est-right-totals {
  width: 40% !important;
}

.est-totals-box-table {
  width: 100% !important;
  border-collapse: collapse !important;
  border: 1px solid #444444 !important;
  font-size: 13px !important;
}

.est-totals-box-table td {
  padding: 7px 12px !important;
  border-bottom: 1px solid #444444 !important;
  color: #000000 !important;
}

.est-totals-box-table td.num {
  text-align: right !important;
  font-weight: 600 !important;
}

.est-grand-total-row {
  background: #e11d2e !important;
}

.est-grand-total-row td {
  color: #ffffff !important;
  font-weight: 800 !important;
  border-bottom: 1px solid #e11d2e !important;
}

/* Footer Bottom Accents */
.est-footer-bar {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 35px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-end !important;
  pointer-events: none !important;
}

.est-footer-red {
  background: #e11d2e !important;
  width: 320px !important;
  height: 25px !important;
  border-radius: 0 25px 0 0 !important;
}

.est-footer-navy {
  background: #1c2430 !important;
  width: 420px !important;
  height: 35px !important;
  border-radius: 35px 0 0 0 !important;
}

/* Toast Notification Styles */
#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 380px;
  width: calc(100% - 2.5rem);
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  background: var(--bg-card);
  color: var(--text-main);
  border-radius: var(--radius-md);
  border-left: 5px solid var(--primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: 0.92rem;
  font-weight: 500;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
}

.toast-message.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-message.toast-success {
  border-left-color: #10b981;
}

.toast-message.toast-warning {
  border-left-color: #f59e0b;
}

.toast-message.toast-error {
  border-left-color: #ef4444;
}

.toast-message.toast-info {
  border-left-color: #3b82f6;
}

.toast-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.toast-text {
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.2rem;
}

.toast-close:hover {
  color: var(--text-main);
}

/* Autocomplete Keyboard Selection & Badges */
.search-dropdown-item {
  padding: 0.7rem 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
}

.search-dropdown-item:hover,
.search-dropdown-item.selected {
  background-color: var(--bg-card-hover) !important;
}

.badge-stock {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  display: inline-block;
}

.badge-in-stock {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-low-stock {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.badge-out-of-stock {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* Split Payment Mode UI */
.split-pay-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.split-pay-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fbbf24;
  display: flex;
  justify-content: space-between;
}

/* Mobile & Laptop Responsive Touch Optimizations */
@media (max-width: 768px) {
  .app-header {
    padding: 0.6rem 0.8rem;
  }

  .brand-title {
    font-size: 1.1rem;
  }

  .brand-subtitle {
    display: none;
  }

  .header-status .badge-offline {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr !important;
  }

  .card {
    padding: 0.85rem;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table th, .data-table td {
    padding: 0.5rem 0.4rem;
    font-size: 0.8rem;
  }

  .form-control {
    font-size: 0.95rem;
    padding: 0.6rem 0.8rem;
  }

  .btn {
    min-height: 44px;
    font-size: 0.9rem;
  }
}

/* Protected Store Access Login Screen Overlay */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-overlay.hidden {
  display: none !important;
}

.login-card {
  background: #1e293b;
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 40px rgba(251, 191, 36, 0.15);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 2.2rem 2rem;
  animation: loginPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.login-header {
  text-align: center;
  margin-bottom: 1.8rem;
}

.login-badge-icon {
  font-size: 3.2rem;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.login-header h2 {
  color: #fbbf24;
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.login-header p {
  color: #94a3b8;
  font-size: 0.85rem;
  margin-top: 0.3rem;
}