      /* --- GENERAL PAGE STYLING --- */
      body {
        font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
        background-color: #e2e8f0;
        margin: 0;
        display: flex;
        height: 100vh;
        overflow: hidden;
      }

      .app-container {
        display: flex;
        width: 100%;
        height: 100%;
      }

      /* Left Side: Input Form */
      .form-section {
        width: 35%;
        background: #fff;
        padding: 20px;
        overflow-y: auto;
        border-right: 1px solid #ccc;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
        position: relative;
        z-index: 5;
      }

      .form-group { margin-bottom: 10px; }
      .form-group label {
        display: block; font-weight: bold; margin-bottom: 5px;
        font-size: 0.85rem; color: #333;
      }
      .form-group input, .form-group textarea, .form-group select {
        width: 100%; padding: 8px; border: 1px solid #ccc;
        border-radius: 4px; box-sizing: border-box;
      }

      .row-inputs { display: flex; gap: 10px; }
      .row-inputs .form-group { flex: 1; }

      .section-title {
        font-size: 1.1rem; font-weight: bold; color: #2c5282;
        margin-top: 20px; margin-bottom: 10px;
        border-bottom: 2px solid #2c5282; padding-bottom: 5px;
      }

      /* Buttons */
      .action-buttons {
        position: sticky; bottom: 0; background: white;
        padding: 10px 0; border-top: 1px solid #eee;
        display: flex; flex-direction: column; gap: 10px; z-index: 10;
      }

      .btn-row { display: flex; gap: 10px; }

      .btn {
        padding: 10px 20px; border: none; border-radius: 5px;
        cursor: pointer; font-weight: bold; flex: 1; color: white;
      }

      .btn-add { background-color: #ed8936; width: 100%; margin-bottom: 15px;}
      .btn-update { background-color: #3182ce; width: 100%; margin-bottom: 15px;}
      .btn-print { background-color: #48bb78; }
      .btn-save { background-color: #6b46c1; }
      .btn-history { background-color: #2d3748; }

      .btn:hover { opacity: 0.9; }

      .item-list-container {
        background: #f7fafc; border: 1px solid #e2e8f0;
        padding: 10px; border-radius: 5px; margin-bottom: 15px;
      }
      .list-row {
        display: flex; justify-content: space-between; align-items: center;
        border-bottom: 1px solid #ddd; padding: 8px 0; font-size: 0.9rem;
      }
      .btn-icon { padding: 4px 10px; border-radius: 4px; cursor: pointer; color: white; border: none; margin-left: 5px;}
      .btn-del { background-color: #e53e3e; }
      .btn-edit { background-color: #3182ce; }
      .field-status { display: block; margin-top: 5px; font-size: 0.85rem; }
      #gstMessage { color: #9c4221; }

      /* Right Side: Invoice Preview */
      .preview-section {
        width: 65%; background: #525659; padding: 40px;
        overflow-y: auto; display: flex; justify-content: center;
      }

      /* HISTORY SIDEBAR STYLING */
      #historySidebar {
        position: fixed; top: 0; left: -400px; width: 350px; height: 100%;
        background: white; box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        z-index: 100; transition: left 0.3s ease;
        padding: 20px; overflow-y: auto; display: flex; flex-direction: column;
      }
      #historySidebar.open { left: 0; }
      .history-card {
        background: #f7fafc; border: 1px solid #cbd5e0;
        padding: 10px; margin-bottom: 10px; border-radius: 5px;
        cursor: pointer; transition: background 0.2s;
      }
      .history-card:hover { background: #ebf8ff; border-color: #3182ce; }
      .history-company { margin: 12px 0 6px; overflow-wrap: anywhere; }
      .history-date { font-size: 0.8rem; color: #718096; }
      .history-title { font-weight: bold; color: #2d3748; }
      .close-sidebar {
        align-self: flex-end; cursor: pointer; font-size: 1.5rem; margin-bottom: 10px;
      }

      /* --- INVOICE PAPER CSS --- */
      .invoice-container {
        background-color: white; width: 210mm; min-height: 297mm;
        padding: 15px; box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
        box-sizing: border-box; border: 1px solid #ccc;
        font-family: "Arial", sans-serif; font-size: 10pt; color: black;
      }
      .text-center { text-align: center; }
      .text-right { text-align: right; }
      .bold { font-weight: bold; }
      .small-text { font-size: 8pt; }
      .header-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #000; }
      .header-left { border-right: 1px solid #000; padding: 5px; }
      .logo-box { width: 80px; height: 80px; float: left; margin-right: 10px; }

      table { width: 100%; border-collapse: collapse; }
      .info-table-right td { border-bottom: 1px solid #ccc; padding: 2px 5px; vertical-align: top; font-size: 9pt; }
      .item-table { width: 100%; border: 1px solid #000; border-top: none; }
      .item-table th { border-right: 1px solid #000; border-bottom: 1px solid #000; background-color: #eee; padding: 5px; font-size: 9pt; }
      .item-table td { border-right: 1px solid #000; padding: 5px; vertical-align: top; }
      .goods-description { overflow-wrap: anywhere; }
      .batch-description { white-space: pre-wrap; }
      .item-table tr.totals-row td { border-top: 1px solid #000; border-bottom: 1px solid #000; font-weight: bold; }
      .no-border-bottom td { border-bottom: none !important; }
      .footer-section { border: 1px solid #000; border-top: none; display: flex; }
      .bank-details { flex: 1; padding: 5px; border-right: 1px solid #000; }
      .signature-box { width: 30%; padding: 5px; text-align: center; display: flex; flex-direction: column; justify-content: space-between; }
      .page-footer { display: flex; place-content: center; margin-top: 1.2em; }

      @media print {
        @page { margin: 0; size: auto; }
        body { margin: 0; height: auto; overflow: visible; background-color: white; }
        .app-container { height: auto; }
        .form-section, #historySidebar { display: none; }
        .preview-section { width: 100%; padding: 0; display: block; overflow: visible; }
        #invoiceItemsBody tr { break-inside: avoid; }
        .invoice-container { box-shadow: none; margin: 0; width: 100%; border: none; }
        .btn { display: none; }
      }

      #invoiceWorkspace { display: contents; }
      #invoiceWorkspace[hidden], [hidden] { display: none !important; }
      #authPanel { width: min(24rem, 90vw); margin: auto; padding: 24px; background: white; box-sizing: border-box; }
      #signInForm { display: grid; gap: 8px; }
      #signInForm input { padding: 8px; }
      .staff-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
      #legacyImport { max-width: 13rem; font-size: 0.8rem; }
      @media print { #authPanel { display: none !important; } }
