
:root {
  --bg-dark: #090d16;
  --surface-card: #0f172a;
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-subtle: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top Action Navigation Bar */
.portal-navbar {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 20px;
}

.portal-nav-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  text-decoration: none;
}

.brand-badge span {
  color: var(--accent-cyan);
}

.nav-btn-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-portal-action {
  background: var(--accent-emerald);
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-portal-action:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-portal-outline {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-portal-outline:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Main Container */
.portal-main {
  flex: 1;
  padding: 30px 16px 50px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.portal-sheet-wrapper {
  width: 100%;
  max-width: 850px;
  background: #ffffff;
  color: #0f172a;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  padding: 40px;
  position: relative;
  overflow: hidden;
}

/* Invoice Header */
.invoice-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 24px;
  margin-bottom: 24px;
  gap: 20px;
}

.biz-details h1 {
  font-size: 24px;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 4px;
}

.biz-details p {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

.invoice-meta-box {
  text-align: right;
}

.invoice-title-tag {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #0284c7;
  background: #e0f2fe;
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 8px;
}

.invoice-number {
  font-size: 20px;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 4px;
}

.invoice-date {
  font-size: 12.5px;
  color: #64748b;
}

.status-stamp {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 4px;
  margin-top: 8px;
}

.status-stamp.paid {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.status-stamp.pending {
  background: #fef9c3;
  color: #a16207;
  border: 1px solid #fde047;
}

/* Bill To & Info Grid */
.bill-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.bill-to-col h4, .payment-terms-col h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  font-weight: 800;
  margin-bottom: 6px;
}

.bill-to-col strong {
  font-size: 15px;
  color: #0f172a;
  display: block;
}

.bill-to-col p, .payment-terms-col p {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}

/* Items Table */
.items-table-wrap {
  margin-bottom: 24px;
  overflow-x: auto;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.items-table th {
  background: #f1f5f9;
  color: #475569;
  text-align: left;
  padding: 10px 12px;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  border-bottom: 2px solid #cbd5e1;
}

.items-table td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}

.items-table tr:last-child td {
  border-bottom: none;
}

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

/* Totals & QR Section */
.totals-and-qr-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 30px;
  border-top: 2px solid #e2e8f0;
  padding-top: 20px;
  margin-bottom: 24px;
}

.qr-payment-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.qr-canvas-holder {
  background: #fff;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
}

.qr-details h5 {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.qr-details p {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.4;
}

.totals-table-wrap {
  width: 100%;
}

.totals-table {
  width: 100%;
  font-size: 13.5px;
}

.totals-table td {
  padding: 6px 0;
  color: #475569;
}

.totals-table tr.grand-total-row td {
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
  border-top: 2px solid #0f172a;
  padding-top: 10px;
}

.totals-table tr.balance-due-row td {
  font-size: 15px;
  font-weight: 800;
  color: #b91c1c;
}

/* Words and Notes */
.amount-in-words-box {
  background: #f1f5f9;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 20px;
}

.footer-notes {
  font-size: 12px;
  color: #64748b;
  border-top: 1px dashed #cbd5e1;
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

.signatory-box {
  text-align: center;
  min-width: 150px;
}

.signatory-line {
  border-top: 1px solid #94a3b8;
  margin-top: 35px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  padding-top: 4px;
}

/* Viral Branding Footer */
.portal-growth-footer {
  margin-top: 30px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.portal-growth-footer a {
  color: var(--accent-cyan);
  font-weight: 700;
  text-decoration: none;
}

/* Responsive */
@media (max-width: 700px) {
  .portal-sheet-wrapper { padding: 20px 16px; }
  .invoice-top-row { flex-direction: column; align-items: flex-start; }
  .invoice-meta-box { text-align: left; }
  .bill-info-grid { grid-template-columns: 1fr; }
  .totals-and-qr-grid { grid-template-columns: 1fr; }
  .footer-notes { flex-direction: column; align-items: flex-start; }
  .signatory-box { width: 100%; text-align: left; }
}

/* Print Styles */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .portal-navbar, .portal-growth-footer, .no-print {
    display: none !important;
  }
  .portal-main {
    padding: 0 !important;
  }
  .portal-sheet-wrapper {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}


/* Universal Full-Width Desktop Document Viewer */
@media (min-width: 1024px) {
  .portal-sheet-wrapper {
    max-width: 1050px !important;
    padding: 50px 60px !important;
  }
  .portal-nav-inner {
    max-width: 1050px !important;
  }
  .items-table {
    font-size: 15px !important;
  }
  .items-table th, .items-table td {
    padding: 14px 16px !important;
  }
  .biz-details h1 {
    font-size: 28px !important;
  }
}

@media (min-width: 1600px) {
  .portal-sheet-wrapper {
    max-width: 1150px !important;
    padding: 60px 70px !important;
  }
  .portal-nav-inner {
    max-width: 1150px !important;
  }
}
