/* =============================================
   GST Invoice — Deinrim Solutionss (P) Ltd
   Sky Blue Professional Theme | Poppins Font
   ============================================= */

:root {
  --sky:        #0ea5e9;
  --sky-dark:   #0284c7;
  --sky-deeper: #0369a1;
  --sky-light:  #e0f2fe;
  --sky-pale:   #f0f9ff;
  --navy:       #0c1f3f;
  --navy-mid:   #1e3a5f;
  --gold:       #f59e0b;
  --gold-light: #fef3c7;
  --white:      #ffffff;
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-300:   #cbd5e1;
  --gray-400:   #94a3b8;
  --gray-500:   #64748b;
  --gray-600:   #475569;
  --gray-700:   #334155;
  --gray-800:   #1e293b;
  --red:        #ef4444;
  --green:      #10b981;
  --font: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: linear-gradient(135deg, #0c1f3f 0%, #0ea5e9 100%);
  min-height: 100vh;
  color: var(--gray-800);
  -webkit-font-smoothing: antialiased;
}

/* ===== ACTION BAR ===== */
.action-bar {
  background: rgba(12, 31, 63, 0.95);
  backdrop-filter: blur(8px);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 300;
  border-bottom: 2px solid var(--sky);
}

.ab-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.ab-actions {
  display: flex;
  gap: 10px;
}

.ab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-family: var(--font);
  transition: all .15s;
}
.ab-btn:active { transform: scale(0.97); }

.ab-ghost {
  background: transparent;
  color: #94a3b8;
  border-color: #334155;
}
.ab-ghost:hover { color: var(--white); border-color: #64748b; }

.ab-outline {
  background: transparent;
  color: var(--sky);
  border-color: var(--sky);
}
.ab-outline:hover { background: rgba(14,165,233,.12); }

.ab-primary {
  background: var(--sky);
  color: var(--white);
  border-color: var(--sky);
}
.ab-primary:hover { background: var(--sky-dark); }

.ab-setup {
  background: rgba(255,255,255,.12);
  color: var(--white);
  border-color: rgba(255,255,255,.25);
}
.ab-setup:hover { background: rgba(255,255,255,.22); }

.ab-save {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}
.ab-save:hover { background: #047857; }

.ab-hist {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
  font-weight: 700;
}
.ab-hist:hover { background: #d97706; }

.hist-badge {
  background: var(--navy);
  color: var(--white);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  min-width: 18px;
  display: inline-block;
  text-align: center;
}

/* ===== INVOICE DOCUMENT ===== */
.invoice-doc {
  max-width: 1050px;
  margin: 24px auto;
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  font-size: 12.5px;
  line-height: 1.5;
}

/* ===== HEADER ===== */
.doc-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  padding: 24px 28px;
  border-bottom: 4px solid var(--sky);
}

.hdr-left {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

/* Logo */
.biz-logo-wrap {
  width: 88px;
  height: 72px;
  background: linear-gradient(135deg, var(--sky) 0%, var(--sky-dark) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.2);
  position: relative;
  overflow: hidden;
  transition: opacity .15s;
}
.biz-logo-wrap:hover { opacity: .85; }

#bizLogoFb {
  font-size: 26px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -1px;
}

/* Business Info in Header */
.biz-info { flex: 1; }

.biz-name {
  font-size: 21px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin-bottom: 2px;
}

.biz-tagline {
  font-size: 11px;
  font-weight: 400;
  color: var(--sky);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.biz-addr {
  font-size: 11.5px;
  color: rgba(255,255,255,.75);
  margin-bottom: 4px;
}

.biz-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: rgba(255,255,255,.7);
  margin-bottom: 6px;
}

.biz-gstin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.gstin-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--sky);
}

.gstin-inp {
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(14,165,233,.5);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  font-family: var(--font);
  width: 185px;
  outline: none;
  letter-spacing: 0.05em;
  transition: border-color .15s;
}
.gstin-inp::placeholder { color: rgba(255,255,255,.35); font-weight: 400; }
.gstin-inp:focus { border-color: var(--sky); background: rgba(255,255,255,.18); }

.state-lbl {
  font-size: 11px;
  color: rgba(255,255,255,.55);
  padding: 4px 10px;
  background: rgba(255,255,255,.08);
  border-radius: 4px;
}

/* Invoice Meta (right of header) */
.hdr-right {
  min-width: 240px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.tax-inv-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--sky);
  letter-spacing: 0.12em;
  margin-bottom: 12px;
  text-align: right;
}

.inv-meta-tbl {
  border-collapse: collapse;
  font-size: 11.5px;
  width: 100%;
}

.inv-meta-tbl .ml {
  color: rgba(255,255,255,.6);
  font-weight: 500;
  padding: 3px 8px 3px 0;
  white-space: nowrap;
  text-align: right;
}

.inv-meta-tbl td { padding: 2px 0; }

.mi {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--white);
  font-family: var(--font);
  width: 160px;
  outline: none;
  transition: border-color .15s;
}
.mi::placeholder { color: rgba(255,255,255,.3); font-weight: 400; }
.mi:focus { border-color: var(--sky); background: rgba(255,255,255,.18); }
.mi option { background: var(--navy); color: var(--white); }

/* ===== PARTIES ROW ===== */
.parties-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--gray-200);
}

.party-box { border-right: 1px solid var(--gray-200); }
.party-box:last-child { border-right: none; }

.party-hdr {
  background: var(--sky);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 6px 16px;
}

.party-body {
  padding: 14px 16px;
  min-height: 120px;
}

/* Seller (fixed content) */
.seller-box .party-hdr {
  background: linear-gradient(90deg, var(--sky-dark), var(--sky));
}

.p-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 2px;
}

.p-sub {
  font-size: 11px;
  color: var(--sky-dark);
  font-weight: 500;
  margin-bottom: 6px;
}

.p-detail {
  font-size: 11.5px;
  color: var(--gray-600);
  line-height: 1.7;
}

.p-gstin-line {
  font-size: 11.5px;
  color: var(--gray-700);
  margin-top: 4px;
  font-weight: 500;
}

/* Customer (editable) */
.cust-box .party-hdr {
  background: linear-gradient(90deg, var(--navy-mid), var(--navy));
}

.cf {
  width: 100%;
  border: none;
  border-bottom: 1.5px solid var(--gray-200);
  background: transparent;
  padding: 5px 2px;
  font-size: 12px;
  font-family: var(--font);
  color: var(--gray-800);
  outline: none;
  margin-bottom: 5px;
  transition: border-color .15s;
  display: block;
}
.cf:focus { border-bottom-color: var(--sky); }
.cf::placeholder { color: var(--gray-400); }

.cf-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}
.cf-name::placeholder { font-weight: 400; color: var(--gray-400); }

.cf-addr {
  resize: none;
  line-height: 1.5;
}

.cf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cf-half { width: 100%; }

.ship-lbl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--gray-500);
  cursor: pointer;
  margin-top: 4px;
}
.ship-lbl input { accent-color: var(--sky); }

/* ===== ITEMS SECTION ===== */
.items-section {
  border-bottom: 1px solid var(--gray-200);
}

.sec-bar {
  background: var(--navy);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.add-row-btn {
  background: var(--sky);
  color: var(--white);
  border: none;
  border-radius: 5px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background .15s;
}
.add-row-btn:hover { background: var(--sky-dark); }

.tbl-scroll { overflow-x: auto; }

.items-tbl {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  font-size: 12px;
}

.items-tbl thead th {
  background: var(--sky-pale);
  color: var(--navy);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 6px;
  border-bottom: 2px solid var(--sky);
  white-space: nowrap;
  text-align: left;
}

.items-tbl thead th.r, .items-tbl td.r { text-align: right; }
.items-tbl thead th.c, .items-tbl td.c { text-align: center; }

.tc-no    { width: 34px; text-align: center !important; }
.tc-desc  { min-width: 170px; }
.tc-hsn   { width: 80px; }
.tc-qty   { width: 60px; }
.tc-unit  { width: 70px; }
.tc-rate  { width: 80px; text-align: right !important; }
.tc-disc  { width: 60px; text-align: center !important; }
.tc-taxable { width: 88px; text-align: right !important; }
.tc-gst   { width: 60px; text-align: center !important; }
.tc-tax   { width: 80px; text-align: right !important; }
.tc-total { width: 88px; text-align: right !important; }
.tc-del   { width: 32px; }

.items-tbl tbody tr { border-bottom: 1px solid var(--gray-100); }
.items-tbl tbody tr:hover td { background: var(--sky-pale); }
.items-tbl tbody td { padding: 5px 6px; vertical-align: middle; }
.items-tbl tbody tr:nth-child(even) td { background: var(--gray-50); }
.items-tbl tbody tr:nth-child(even):hover td { background: var(--sky-pale); }

/* Item inputs */
.it {
  width: 100%;
  border: none;
  border-bottom: 1px dashed transparent;
  background: transparent;
  padding: 3px 4px;
  font-size: 12px;
  font-family: var(--font);
  color: var(--gray-800);
  outline: none;
  transition: border-color .15s;
}
.it:focus { border-bottom-color: var(--sky); background: rgba(14,165,233,.04); border-radius: 3px; }
.it::placeholder { color: var(--gray-300); font-size: 11px; }

.it-num { text-align: right; }
.it-center { text-align: center; }

.row-no { text-align: center; color: var(--gray-400); font-size: 11px; }
.row-amt { text-align: right; font-weight: 600; color: var(--navy); font-size: 12px; }

.del-btn {
  width: 24px; height: 24px;
  background: #fee2e2; color: var(--red);
  border: none; border-radius: 50%;
  font-size: 15px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font);
  transition: all .15s;
}
.del-btn:hover { background: var(--red); color: var(--white); }

/* Table footer */
.tfoot-row td {
  background: var(--navy) !important;
  padding: 8px 6px;
  border-top: 2px solid var(--sky);
}
.tfoot-lbl {
  color: rgba(255,255,255,.7);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: right;
}
.tfoot-val {
  color: var(--sky);
  font-size: 12.5px;
  font-weight: 700;
  text-align: right;
}

/* ===== BOTTOM ROW: Bank + Summary ===== */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--gray-200);
}

.bank-box {
  border-right: 1px solid var(--gray-200);
}

.bank-tbl {
  border-collapse: collapse;
  width: 100%;
  padding: 0 16px;
  font-size: 12px;
}

.bank-tbl tr td {
  padding: 5px 16px;
  border-bottom: 1px solid var(--gray-100);
}

.bank-tbl tr:last-child td { border-bottom: none; }

.bk-lbl {
  color: var(--gray-500);
  font-weight: 500;
  white-space: nowrap;
  width: 110px;
  font-size: 11.5px;
}

.bk-inp {
  width: 100%;
  border: none;
  border-bottom: 1px dashed transparent;
  background: transparent;
  padding: 2px 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--gray-800);
  outline: none;
  transition: border-color .15s;
}
.bk-inp:focus { border-bottom-color: var(--sky); }
.bk-inp::placeholder { font-weight: 400; color: var(--gray-300); }
.bk-inp option { font-weight: 400; }

/* Bill Amount Summary */
.summary-box {}

.summary-tbl {
  border-collapse: collapse;
  width: 100%;
}

.s-row td, .s-gst-total td {
  padding: 6px 16px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--gray-100);
}

.s-row td:first-child { color: var(--gray-500); }
.s-row td:last-child { text-align: right; font-weight: 600; }

.s-taxable-row td {
  font-weight: 700 !important;
  color: var(--gray-800) !important;
  border-bottom: 2px solid var(--sky-light) !important;
  padding-bottom: 8px;
}

.s-gst-total td { background: var(--sky-pale); font-weight: 600; border-top: 2px solid var(--sky-light); }
.s-gst-total td:first-child { color: var(--sky-dark); }
.s-gst-total td:last-child { text-align: right; color: var(--sky-dark); }

.gst-sub-row td {
  padding: 6px 16px 6px 24px;
  font-size: 12px;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
  background: #f8fbff;
}
.gst-sub-row td:first-child::before {
  content: '▸ ';
  color: var(--sky);
  font-size: 10px;
}
.gst-sub-row td:last-child { text-align: right; font-weight: 600; color: var(--gray-700); }

.gst-sub-row.placeholder td { color: var(--gray-400); font-style: italic; }
.gst-sub-row.placeholder td:last-child { color: var(--gray-400); }

.s-grand td {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: var(--white) !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  padding: 12px 16px;
  letter-spacing: 0.02em;
}
.s-grand td:last-child { text-align: right; color: var(--gold) !important; }

.s-words td {
  background: var(--gold-light);
  padding: 8px 16px;
  font-size: 11.5px;
  font-style: italic;
  font-weight: 600;
  color: var(--gray-700);
  text-align: center;
  border-top: 1px solid #fde68a;
}

.s-red { color: var(--red) !important; }

/* ===== FOOTER ROW: Terms + Signature ===== */
.footer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0;
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
}

.terms-box { padding-right: 24px; }

.terms-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sky-dark);
  margin-bottom: 6px;
}

.terms-ta {
  width: 100%;
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 11px;
  font-family: var(--font);
  color: var(--gray-600);
  resize: none;
  outline: none;
  background: var(--gray-50);
  line-height: 1.7;
  transition: border-color .15s;
}
.terms-ta:focus { border-color: var(--sky); }

.note-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--gray-600);
}

.note-inp {
  flex: 1;
  border: none;
  border-bottom: 1px dashed var(--gray-300);
  background: transparent;
  font-size: 11.5px;
  font-family: var(--font);
  color: var(--gray-700);
  padding: 2px 4px;
  outline: none;
  font-style: italic;
}
.note-inp:focus { border-bottom-color: var(--sky); }
.note-inp::placeholder { color: var(--gray-300); }

/* Signature */
.sig-box {
  min-width: 200px;
  text-align: center;
  border-left: 1px solid var(--gray-200);
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.sig-space {
  height: 60px;
  border-bottom: 1.5px solid var(--gray-400);
  margin-bottom: 6px;
}

.sig-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
}

.sig-co {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  margin-top: 3px;
}

/* ===== Doc Footer ===== */
.doc-powered {
  background: var(--navy);
  color: rgba(255,255,255,.4);
  text-align: center;
  padding: 8px;
  font-size: 10px;
  letter-spacing: 0.03em;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  box-shadow: 0 10px 32px rgba(0,0,0,.28);
  animation: toastIn .2s ease;
  min-width: 240px;
  max-width: 380px;
}
.toast.success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.toast.error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.toast.info    { background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }

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

/* ===== PRINT STYLES ===== */
@media print {
  @page { size: A4; margin: 8mm 10mm; }

  body { background: white; }

  .no-print { display: none !important; }

  .invoice-doc {
    box-shadow: none;
    border-radius: 0;
    margin: 0;
    max-width: none;
    font-size: 11pt;
  }

  /* Transparent input/select/textarea on print */
  input, select, textarea {
    border: none !important;
    border-bottom: none !important;
    background: transparent !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
    color: inherit !important;
    padding: 0 2px !important;
    font-family: var(--font) !important;
  }

  .gstin-inp {
    color: var(--white) !important;
    font-weight: 700 !important;
  }

  /* Show GSTIN as text */
  .gstin-inp { display: none !important; }
  .gstin-display { display: inline !important; color: white; font-weight: 700; }

  select { pointer-events: none; }

  .items-tbl { min-width: 0; }
  .tbl-scroll { overflow: visible; }

  .items-tbl tbody tr { page-break-inside: avoid; }
  .footer-row { page-break-inside: avoid; }
  .bottom-row { page-break-inside: avoid; }

  .ship-lbl { display: none !important; }

  .doc-powered { display: block !important; }

  .biz-logo-wrap { cursor: default; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .action-bar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .ab-brand span { display: none; }
  .invoice-doc { margin: 8px; border-radius: 8px; }
  .doc-header { grid-template-columns: 1fr; padding: 16px; }
  .hdr-right { align-items: flex-start; margin-top: 16px; }
  .tax-inv-title { font-size: 18px; }
  .parties-row { grid-template-columns: 1fr; }
  .party-box { border-right: none; border-bottom: 1px solid var(--gray-200); }
  .bottom-row { grid-template-columns: 1fr; }
  .bank-box { border-right: none; border-bottom: 1px solid var(--gray-200); }
  .footer-row { grid-template-columns: 1fr; }
  .sig-box { border-left: none; padding-left: 0; border-top: 1px solid var(--gray-200); padding-top: 14px; margin-top: 14px; }
  .biz-contacts { flex-direction: column; gap: 2px; }
}

/* =============================================
   Invoice History Modal
   ============================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12,31,63,.78);
  backdrop-filter: blur(4px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .18s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--white);
  border-radius: 14px;
  width: 100%;
  max-width: 900px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 28px 72px rgba(0,0,0,.45);
  border-top: 4px solid var(--sky);
  animation: slideUp .2s ease;
  overflow: hidden;
}

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

.modal-hdr {
  background: var(--navy);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-hdr-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-hdr-left h3 {
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
}

.modal-count {
  background: rgba(14,165,233,.25);
  color: var(--sky);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  border: 1px solid rgba(14,165,233,.3);
}

.modal-hdr-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  width: 30px;
  height: 30px;
  background: rgba(255,255,255,.1);
  color: var(--white);
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  transition: background .15s;
}
.modal-close:hover { background: rgba(255,255,255,.25); }

.modal-search-bar {
  padding: 12px 20px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-search-bar .search-wrap { flex: 1; }
.search-go-btn { white-space: nowrap; font-size: 12.5px; padding: 7px 14px; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 14px;
  transition: border-color .15s;
}
.search-wrap:focus-within { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(14,165,233,.10); }

.modal-search-inp {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: var(--font);
  color: var(--gray-800);
  background: transparent;
}
.modal-search-inp::placeholder { color: var(--gray-400); }

.search-clear {
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-family: var(--font);
}
.search-clear:hover { color: var(--gray-700); }

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

/* History Table */
.hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.hist-table thead th {
  background: var(--sky-pale);
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 9px 12px;
  border-bottom: 2px solid var(--sky-light);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.hist-table th.r, .hist-table td.r { text-align: right; }

.hist-table tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background .1s;
}
.hist-table tbody tr:hover { background: var(--sky-pale); }

.hist-table td {
  padding: 9px 12px;
  vertical-align: middle;
}

.hist-inv-no {
  font-weight: 700;
  color: var(--sky-dark);
  font-family: var(--font);
}

.hist-customer { font-weight: 600; color: var(--navy); }

.hist-amt {
  font-weight: 800;
  color: var(--navy);
  text-align: right;
  font-size: 13px;
}

.hist-date { color: var(--gray-600); font-size: 12px; }

.hist-saved { color: var(--gray-400); font-size: 11px; }

.hist-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-400);
  font-style: italic;
  font-size: 13px;
}

/* Action buttons inside table */
.hist-btn {
  padding: 4px 11px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-family: var(--font);
  transition: all .15s;
  margin-right: 3px;
}

.hist-btn-load { background: var(--sky);   color: var(--white); border-color: var(--sky); }
.hist-btn-load:hover { background: var(--sky-dark); }

.hist-btn-csv  { background: var(--green); color: var(--white); border-color: var(--green); }
.hist-btn-csv:hover { background: #047857; }

.hist-btn-del  { background: #fee2e2; color: var(--red); border-color: #fca5a5; }
.hist-btn-del:hover { background: var(--red); color: var(--white); }

/* Modal Footer */
.modal-footer {
  padding: 11px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-footer-note {
  font-size: 11.5px;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-footer-note::before {
  content: '🔒';
  font-size: 12px;
}

@media (max-width: 640px) {
  .modal-box { max-height: 95vh; border-radius: 10px; }
  .modal-hdr-right .ab-btn { display: none; }
  .hist-table thead th:nth-child(4),
  .hist-table tbody td:nth-child(4),
  .hist-table thead th:nth-child(6),
  .hist-table tbody td:nth-child(6) { display: none; }
}

/* =============================================
   Business Setup Modal
   ============================================= */

.setup-modal-box { max-width: 720px; }

.setup-notice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 12.5px;
  color: #1d4ed8;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 20px;
}

.setup-body { padding: 20px 24px; }

.setup-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-100);
}
.setup-section:last-child { border-bottom: none; margin-bottom: 0; }

.setup-sec-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sky);
  margin-bottom: 14px;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.setup-full { grid-column: 1 / -1; }

.setup-field { display: flex; flex-direction: column; gap: 5px; }
.setup-field label { font-size: 12px; font-weight: 600; color: var(--gray-600); }
.req { color: #ef4444; }

.setup-inp {
  border: 1.5px solid var(--gray-200);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--white);
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
}
.setup-inp:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(14,165,233,.1); }
.setup-inp.error { border-color: #ef4444; }
.setup-ta { resize: vertical; min-height: 60px; }

/* Logo uploader */
.setup-logo-row { display: flex; gap: 20px; align-items: flex-start; }
.setup-logo-preview {
  width: 110px; height: 90px;
  border: 2px dashed var(--gray-200);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--gray-50);
  font-size: 11px; color: var(--gray-400); font-weight: 500;
  overflow: hidden;
}
.setup-logo-actions { display: flex; flex-direction: column; gap: 9px; }
.setup-logo-hint { font-size: 11px; color: var(--gray-400); margin: 0; }

/* Theme Picker */
.theme-picker {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.theme-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  transition: all .15s;
  flex: 1; min-width: 140px;
}
.theme-btn:hover { border-color: var(--sky); }
.theme-btn.active { border-color: var(--sky); background: #f0f9ff; }
.theme-swatch {
  width: 32px; height: 32px;
  border-radius: 6px;
  flex-shrink: 0;
}
.theme-label { flex: 1; }
.theme-check { color: var(--sky); font-size: 14px; font-weight: 700; min-width: 14px; }

@media (max-width: 640px) {
  .setup-grid { grid-template-columns: 1fr; }
  .theme-picker { flex-direction: column; }
  .theme-btn { min-width: unset; }
  .setup-logo-row { flex-direction: column; }
}
