
    :root{
      --bg: #0b1220;
      --surface: #0f172a;
      --muted: #94a3b8;
      --text: #e5edf9;
      --accent: #7c3aed;
      --accent-2: #22d3ee;
      --ok: #10b981;
      --warn: #f59e0b;
      --danger: #ef4444;
      --paper: #ffffff;
      --paper-text: #111827;
      --radius: 16px;
      --shadow: 0 10px 30px rgba(0,0,0,.35);
    }
    html,body{height:100%}
    body {
      margin:0;
      background: radial-gradient(1000px 600px at 15% -10%,rgba(124,58,237,.35),transparent),
                 radial-gradient(900px 600px at 90% 10%,rgba(34,211,238,.25),transparent),
                 var(--bg);
      color:var(--text);
      font: 15px/1.5 Arial, "Arial Unicode MS", system-ui, Segoe UI, Roboto, sans-serif;
    }

    .wrap{max-width:1200px;margin:0 auto;padding:20px 16px 160px}

    header.appbar{position:sticky;top:0;z-index:50;background:linear-gradient(180deg, rgba(15,23,42,.9), rgba(15,23,42,.6));
      -webkit-backdrop-filter: blur(10px);backdrop-filter: blur(10px); border-bottom:1px solid rgba(255,255,255,.06);
    }
    .appbar-inner{display:flex;gap:12px;align-items:center;justify-content:space-between; padding:12px 4px}
    .brand{display:flex;align-items:center;gap:10px;font-weight:700;letter-spacing:.4px}
    .brand .dot{width:12px;height:12px;border-radius:50%;background:conic-gradient(var(--accent),var(--accent-2)); box-shadow:0 0 0 3px rgba(124,58,237,.4)}
    .toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
    .chip{display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border-radius:999px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.1)}
    .btn{display:inline-flex;align-items:center;gap:8px;padding:10px 14px;border-radius:12px;border:1px solid rgba(255,255,255,.12); cursor:pointer; background:rgba(255,255,255,.06); color:var(--text); text-decoration:none; font-weight:600}
    .btn:hover{background:rgba(255,255,255,.1)}
    .btn.affirm{border-color:rgba(16,185,129,.4); background:linear-gradient(180deg, rgba(16,185,129,.2), rgba(16,185,129,.15))}
    .btn.warn{border-color:rgba(245,158,11,.4); background:linear-gradient(180deg, rgba(245,158,11,.2), rgba(245,158,11,.14))}
    .btn.danger{border-color:rgba(239,68,68,.4); background:linear-gradient(180deg, rgba(239,68,68,.2), rgba(239,68,68,.14))}

    .stage{display:grid;grid-template-columns:1fr;gap:16px;margin-top:16px}
    .paper-wrap{display:flex;justify-content:center}
    #paper{width:min(900px,100%);background:var(--paper);color:var(--paper-text);border-radius:20px;box-shadow:var(--shadow);padding:28px}

    
    /* ===== THEMES / TEMPLATES ===== */
    :root{
      --accent: #7c3aed;
      --accent-2: #22d3ee;
      --brand: #0ea5e9;
      --paper: #ffffff;
      --paper-text: #111827;
    }
    body.light {
      --bg: #f6f7fb;
      --surface: #ffffff;
      --text: #111827;
    }
    .template-classic #paper { border: 1px solid #e5e7eb; }
    .template-minimal #paper { box-shadow: none; border: 1px dashed #e5e7eb; }
    .template-lined #paper { background-image: linear-gradient(#f3f4f6 1px, transparent 1px); background-size: 100% 28px; }
    .color-accent { outline-color: var(--accent); }

    /* ====== HEADER (two cards) ====== */
    #invHead{display:grid; grid-template-columns: 1.4fr .6fr; gap:16px}
    .seller-buyer{display:grid; grid-template-columns: 1fr 1fr; gap:12px}
    .card{border:1px solid #e5e7eb;border-radius:14px;padding:14px; background:#fff}
    .muted{color:#6b7280}
    h1.title{margin:0;font-size: clamp(22px, 3vw, 32px); letter-spacing:.3px}
    .grid-meta{display:grid; grid-template-columns:1fr 1fr; gap:10px}
    .meta{display:grid; gap:6px}
    .meta .kv{display:flex; align-items:center; gap:8px}

    [contenteditable="true"]{outline:none; border-radius:8px}
    [contenteditable="true"]:focus{box-shadow:0 0 0 3px rgba(124,58,237,.25)}
    [data-ph]:empty:before{content: attr(data-ph); color:#9ca3af}

    .items{width:100%;border-collapse: collapse; border-spacing:0}
    .items thead th{position:sticky; top:0; background:#f8fafc; color:#374151; font-weight:700; text-align:center; border-bottom:2px solid #e5e7eb; padding:10px}
    .items td{border-bottom:1px solid #e5e7eb; padding:10px; vertical-align:middle; word-break:break-word; white-space:normal}
    .items tbody td{text-align:center}
    .items tbody td:first-child{ text-align:left }
    .items tbody td.desc-col{ text-align:left }
    .items tbody td.rate, .items tbody td.amount{ text-align:right }
    .items tbody td.hsn, .items tbody td.qty, .items tbody td.taxp{ text-align:center }
    .items tbody tr:hover{background:#fafafa}
    .hsn{width:110px}
    .desc{min-width:0}

    .items-wrap{position:relative}
    .row-rail{position:absolute; right:-6px; transform:translateX(100%); display:flex; gap:6px; align-items:center}
    .row-rail button{border:none; padding:6px 8px; border-radius:999px; cursor:pointer; box-shadow:var(--shadow); font-weight:700}
    .row-rail .move{background:#eef2ff; color:#3730a3}
    .row-rail .del{background:#fee2e2; color:#b91c1c}
    .row-rail .add{background:#dcfce7; color:#065f46}
    .items-tools{display:flex; justify-content:flex-end; gap:8px; padding:10px 0}
    .items-tools .btn{font-size:14px}
    .items thead th[contenteditable="true"]:focus{box-shadow:inset 0 -3px 0 0 rgba(124,58,237,.35)}

    .sum{display:grid; grid-template-columns: 1fr minmax(260px, 340px); gap:16px; align-items:start; margin-top:10px}
    .sum .box{border:1px solid #e5e7eb;border-radius:14px;padding:14px;background:#fff}
    .sum .totals{display:grid;gap:8px}
    .line{display:flex;align-items:center;justify-content:space-between;gap:12px}
    .grand{font-weight:800;font-size:18px;border-top:2px dashed #e5e7eb; padding-top:10px; margin-top:4px}

    .amount, .rate, #tSubtotal, #tGrand, #singleTaxTotal, #cgstTotal, #sgstTotal {
      font-family: Arial, "Arial Unicode MS", "Nirmala UI", system-ui, "Segoe UI Symbol", sans-serif;
      -webkit-font-smoothing: antialiased;
      text-rendering: optimizeLegibility;
    }

    .fab{position:fixed; right:18px; bottom:18px; z-index:60}
    .fab .main{width:56px;height:56px;border-radius:50%;display:grid;place-items:center;border:none;background:linear-gradient(135deg,var(--accent),var(--accent-2)); color:#fff; box-shadow:var(--shadow); cursor:pointer;font-size:22px}
    .fab-menu{position:absolute; bottom:70px; right:0; display:none; flex-direction:column; gap:10px}
    .fab.open .fab-menu{display:flex}
    .fab-menu .btn{background:#111827; border-color:#374151}

    .drawer{position:fixed; inset:0; z-index:70; display:none}
    .drawer.open{display:block}
    .drawer .backdrop{position:absolute; inset:0; background:rgba(0,0,0,.5)}
    .drawer .panel{position:absolute; top:0; right:0; width:min(560px,96%); height:100%; background:#0b1220; color:var(--text); border-left:1px solid rgba(255,255,255,.12); overflow:auto}
    .drawer h3{margin:0; padding:16px 18px; border-bottom:1px solid rgba(255,255,255,.08)}
    .drawer .content{padding:14px 18px; display:grid; gap:14px}
    .list{display:grid; gap:10px}
    .inv-card{border:1px solid rgba(255,255,255,.12); border-radius:12px; padding:12px; display:grid; gap:8px; background:rgba(255,255,255,.04)}
    .inv-card .row{display:flex;align-items:center;justify-content:space-between}

    .switch{position:relative;width:48px;height:28px;background:#475569;border-radius:999px;cursor:pointer}
    .switch i{position:absolute; top:3px; left:3px; width:22px;height:22px;border-radius:50%; background:#fff; transition:.2s}
    .switch.on{background:#10b981}
    .switch.on i{left:23px}

    .select, select, input[type="text"], input[type="date"], input[type="number"], input[type="file"], textarea{background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.15); color:var(--text); padding:10px 12px; border-radius:10px}
    .select{display:inline-flex; align-items:center; gap:8px}

    .modal{position:fixed; inset:0; display:grid; place-items:center; background:radial-gradient(800px 500px at 50% -10%,rgba(124,58,237,.3),transparent), rgba(2,6,23,.9); z-index:80}
    .card-lg{width:min(640px,96%); background:#0f172a; border:1px solid rgba(255,255,255,.1); border-radius:18px; padding:20px; box-shadow: var(--shadow)}
    .stack{display:grid; gap:12px}
    .field{display:grid; gap:6px}
    label{font-size:12px;color:#cbd5e1}

    .hide{display:none !important}
    .muted-badge{font-size:12px;color:#64748b;border:1px dashed #475569;padding:3px 8px;border-radius:999px}

    /* Force pure black text during PDF export */
    body.pdf-exporting { font-family: "Nirmala UI", "Arial Unicode MS", Inter, system-ui, "Segoe UI Symbol", Arial, sans-serif !important; }
    body.pdf-exporting .muted { color:#000 !important; }

    body.hide-tax .taxp, 
    body.hide-tax .items thead th[data-head="taxp"] { display:none !important; }

    /* PRINT & PDF-EXPORT VISIBILITY */
    @media print{
      header.appbar, .fab, .drawer, .toolbar, .save-strip, .row-rail, .items-tools, .chip, .select, select, input, button, .btn, .row-btn, .print-hide {display:none !important}
      #paper{box-shadow:none; border-radius:0; width:210mm; padding:12mm}
      @page{size: A4; margin: 12mm}
    }

    @media (max-width: 820px){
      #invHead{grid-template-columns: 1fr}
      .seller-buyer{grid-template-columns: 1fr}
      .sum{grid-template-columns:1fr}
      .items .desc{min-width:200px}
    }
  
/* === Hide UI-only controls in print and PDF export === */
@media print{
  #payInput, #btnMakeQR, #clientPicker, label[for="clientPicker"], #termsSelect {display:none !important;}
  .print-hide {display:none !important;}
}
body.pdf-exporting .print-hide,
body.pdf-exporting #payInput,
body.pdf-exporting #btnMakeQR,
body.pdf-exporting #clientPicker,
body.pdf-exporting label[for="clientPicker"],
body.pdf-exporting #termsSelect {
  display: none !important;
  visibility: hidden !important;
}


/* === Force pure black text in PDF export === */
body.pdf-exporting,
body.pdf-exporting * {
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
}

/* Hide placeholders in inputs/textareas during PDF export */
body.pdf-exporting input::placeholder,
body.pdf-exporting textarea::placeholder {
  color: transparent !important;
}


/* === Force pure black text during PDF export, hide placeholders in print/PDF === */
body.pdf-exporting, 
body.pdf-exporting * {
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
}

/* Hide placeholder text when printing or exporting PDF */
@media print{
  input::placeholder,
  textarea::placeholder { color: transparent !important; }
  input::-webkit-input-placeholder,
  textarea::-webkit-input-placeholder { color: transparent !important; }
  input::-moz-placeholder,
  textarea::-moz-placeholder { color: transparent !important; }
  input:-ms-input-placeholder,
  textarea:-ms-input-placeholder { color: transparent !important; }
}

body.pdf-exporting input::placeholder,
body.pdf-exporting textarea::placeholder,
body.pdf-exporting input::-webkit-input-placeholder,
body.pdf-exporting textarea::-webkit-input-placeholder,
body.pdf-exporting input::-moz-placeholder,
body.pdf-exporting textarea::-moz-placeholder,
body.pdf-exporting input:-ms-input-placeholder,
body.pdf-exporting textarea:-ms-input-placeholder {
  color: transparent !important;
}


/* S.No column sizing */
#itemsTable th:first-child, #itemsTable td.sno { 
  width: 36px; min-width: 36px; max-width: 48px; 
  text-align: center;
  white-space: nowrap;
}

