/* ============================================
   GST BILLING SOFTWARE — DESIGN SYSTEM
   Sree Balaji Textile Spares Productions
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  /* Colors */
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #1e2130;
  --bg-card-hover: #242840;
  --bg-input: #252838;
  --border-color: #2d3148;
  --border-light: #383d58;
  --text-primary: #e8eaf0;
  --text-secondary: #9498b0;
  --text-muted: #6b7094;
  --accent: #6c5ce7;
  --accent-hover: #7f72ea;
  --accent-light: rgba(108, 92, 231, 0.15);
  --success: #00c853;
  --success-light: rgba(0, 200, 83, 0.12);
  --warning: #ff9800;
  --warning-light: rgba(255, 152, 0, 0.12);
  --danger: #ff5252;
  --danger-light: rgba(255, 82, 82, 0.12);
  --info: #448aff;
  --info-light: rgba(68, 138, 255, 0.12);
  --gradient-1: linear-gradient(135deg, #6c5ce7, #a29bfe);
  --gradient-2: linear-gradient(135deg, #00c853, #69f0ae);
  --gradient-3: linear-gradient(135deg, #ff9800, #ffcc02);

  /* Typography */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Sizing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(108, 92, 231, 0.2);

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}



/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ---------- Selection ---------- */
::selection {
  background: var(--accent);
  color: #fff;
}

/* ---------- App Shell ---------- */
#app {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  width: 100%;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 260px;
  min-width: 260px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 1.5rem;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2.5rem;
}

.sidebar-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.sidebar-btn,
.sidebar-btn-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  transition: var(--transition);
}

.sidebar-btn:hover,
.sidebar-btn-link:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.sidebar-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--danger);
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  transition: var(--transition);
}

.sidebar-logout-btn:hover {
  background: var(--danger-light);
}

.powered-by {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 16px;
}

.powered-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.powered-company {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 700;
}

.navbar-logo {
  width: 38px;
  height: 38px;
  background: var(--gradient-1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--gradient-1);
  color: #fff;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px rgba(108, 92, 231, 0.5);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 200, 83, 0.3);
}

.btn-success:hover {
  box-shadow: 0 6px 25px rgba(0, 200, 83, 0.45);
  transform: translateY(-1px);
}

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

.btn-danger:hover {
  opacity: 0.9;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-outline:hover {
  background: var(--accent-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  padding: 1.5rem 2rem 3rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Page Views ---------- */
.page-view {
  display: none;
  animation: fadeIn 0.35s ease;
}

.page-view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Dashboard ---------- */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.5rem;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.stat-card.purple .stat-icon {
  background: var(--accent-light);
  color: var(--accent);
}

.stat-card.green .stat-icon {
  background: var(--success-light);
  color: var(--success);
}

.stat-card.orange .stat-icon {
  background: var(--warning-light);
  color: var(--warning);
}

.stat-card.blue .stat-icon {
  background: var(--info-light);
  color: var(--info);
}

.stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- Invoice Table (Dashboard) ---------- */
.dashboard-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.dashboard-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.dashboard-section-title {
  font-size: 1rem;
  font-weight: 700;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 12px;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-box input {
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  padding: 9px 0;
  outline: none;
  width: 220px;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box .search-icon {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

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

.data-table tr:hover td {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.data-table .inv-number {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  font-size: 0.83rem;
}

.data-table .inv-amount {
  font-weight: 700;
  color: var(--text-primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-info {
  background: var(--info-light);
  color: var(--info);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-secondary {
  background: rgba(148, 152, 176, 0.15);
  color: var(--text-secondary);
}

.table-actions {
  display: flex;
  gap: 4px;
}

.table-actions .btn-icon {
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 0.87rem;
  margin-bottom: 1.5rem;
}

/* ---------- Login Page ---------- */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 1rem 0;
}

.login-card {
  width: 100%;
  max-width: 420px;
  text-align: left;
}

.login-header {
  text-align: center;
}

/* ---------- Invoice Form Page ---------- */
.invoice-form-page {
  max-width: 1100px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

/* Form Sections */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.2rem;
  transition: var(--transition);
}

.form-section:hover {
  border-color: var(--border-light);
}

.form-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 16px;
  background: var(--gradient-1);
  border-radius: 3px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group textarea {
  resize: vertical;
  min-height: 70px;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239498b0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ---------- Products Table ---------- */
.products-section {
  overflow: visible;
}

.products-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

.products-table th {
  background: var(--bg-secondary);
  padding: 10px 12px;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
}

.products-table td {
  padding: 4px;
  border-bottom: 1px solid var(--border-color);
}

.products-table input,
.products-table textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.85rem;
  width: 100%;
  outline: none;
  transition: var(--transition);
  box-sizing: border-box;
}

.products-table textarea {
  resize: vertical;
  min-height: 80px;
  height: 80px;
  line-height: 1.4;
  display: block;
}

.products-table input:focus,
.products-table textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.products-table input:hover,
.products-table textarea:hover {
  border-color: var(--border-light);
}

.products-table .sno {
  text-align: center;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.83rem;
  padding: 9px;
}

.products-table .amount-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  padding: 9px 12px;
  font-size: 0.85rem;
}

.products-table .delete-row-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.products-table .delete-row-btn:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.add-row-btn {
  margin-top: 0.8rem;
}

/* ---------- Tax Summary ---------- */
.tax-summary-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
  align-items: start;
}

.amount-words-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-style: italic;
  min-height: 60px;
}

.amount-words-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.tax-breakdown {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem;
}

.tax-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.88rem;
}

.tax-row:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}

.tax-row .tax-label {
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tax-row .tax-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

.tax-row.total {
  padding-top: 12px;
  margin-top: 4px;
  border-top: 2px solid var(--accent);
}

.tax-row.total .tax-label {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.tax-row.total .tax-value {
  font-size: 1.15rem;
  color: var(--accent);
  font-weight: 800;
}

.tax-row input[type="number"] {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.83rem;
  width: 60px;
  text-align: center;
  outline: none;
  transition: var(--transition);
}

.tax-row input[type="number"]:focus {
  border-color: var(--accent);
}

.roundoff-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.83rem;
  color: var(--text-secondary);
}

.roundoff-toggle input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-light);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.roundoff-toggle input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.roundoff-toggle input[type="checkbox"]:checked::after {
  content: '✓';
  color: #fff;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: bold;
}

/* ---------- Bank & Signature ---------- */
.bank-signature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.signature-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
}

.signature-line {
  border-top: 2px solid var(--border-light);
  padding-top: 8px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: auto;
}

/* ============================================
   INVOICE PREVIEW / PRINT STYLES
   ============================================ */
.preview-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  overflow-y: auto;
  padding: 2rem;
}

.preview-overlay.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 17, 23, 0.9);
  backdrop-filter: blur(10px);
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

/* The actual printable invoice */
.invoice-print-area {
  width: 210mm;
  font-family: Arial, Helvetica, Roboto, sans-serif;
  font-size: 9pt;
  line-height: 1.4;
}

.invoice-copy {
  background: #fff;
  color: #000;
  width: 210mm;
  min-width: 210mm;
  min-height: 297mm;
  padding: 8mm;
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
  position: relative;
  page-break-after: always;
  margin-bottom: 2rem;
  box-sizing: border-box;
}

.invoice-copy:last-child {
  page-break-after: auto;
  margin-bottom: 0;
}

.invoice-copy * {
  color: #000 !important;
}

.invoice-copy .signature-blue {
  color: #1e3799 !important;
}

/* Invoice Header */
.inv-header {
  text-align: center;
  border: 2px solid #000;
  border-bottom: none;
  padding: 4mm 4mm 3mm;
  position: relative;
}

.inv-header h1 {
  font-size: 14pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1mm;
  color: #000;
}

.inv-header .inv-company-details {
  font-size: 8.5pt;
  color: #000;
  line-height: 1.4;
}

.inv-header .inv-gstin {
  font-size: 9pt;
  font-weight: 700;
  margin-top: 1.5mm;
}

.inv-title-bar {
  background: #f0f0f0;
  text-align: center;
  padding: 1.5mm 0;
  font-size: 10pt;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-left: 2px solid #000;
  border-right: 2px solid #000;
}


/* Invoice Meta + Customer Grid */
.inv-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 2px solid #000;
  border-top: 2px solid #000;
}

.inv-details-grid .inv-col {
  padding: 2mm 3mm;
}

.inv-details-grid .inv-col:first-child {
  border-right: 1px solid #000;
}

.inv-field {
  display: flex;
  gap: 2mm;
  font-size: 8.5pt;
  padding: 0.5mm 0;
}

.inv-field .inv-label {
  font-weight: 800;
  white-space: nowrap;
  min-width: 25mm;
}

.invoice-print-area .inv-customer-highlight {
  background-color: #000;
  padding: 1.5mm 2mm;
  margin-bottom: 2mm;
  margin-top: 1mm;
  border-radius: 2px;
}

.invoice-print-area .inv-customer-highlight,
.invoice-print-area .inv-customer-highlight * {
  color: #fff !important;
}

.invoice-print-area .inv-customer-highlight .inv-label {
  font-weight: 800;
}

.invoice-print-area .inv-customer-highlight .inv-value {
  font-weight: normal;
}

.inv-customer-section {
  border: 2px solid #000;
  border-top: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.inv-customer-section .inv-col {
  padding: 2mm 3mm;
}

.inv-customer-section .inv-col:first-child {
  border-right: 1px solid #000;
}

.inv-customer-section .inv-col-title {
  font-size: 10pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1.5mm;
  border-bottom: 1px solid #000;
  padding-bottom: 1mm;
}

/* Products Table (Print) */
.inv-products-table {
  width: 100%;
  border-collapse: collapse;
  border-left: 2px solid #000;
  border-right: 2px solid #000;
}

.inv-products-table th {
  background: #f0f0f0;
  padding: 1.5mm 2mm;
  font-size: 8pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid #000;
  text-align: center;
}

.inv-products-table .inv-item-row {
  height: 26px;
}

.inv-products-table td {
  padding: 1.5mm 2mm;
  font-size: 10pt;
  border: 1px solid #000;
}

.inv-products-table td.text-right {
  text-align: right;
}

.inv-products-table td.text-center {
  text-align: center;
}

.inv-products-table tfoot td {
  border: 1px solid #000;
  font-weight: 800;
}

/* Tax Section (Print) */
.inv-tax-section {
  border: 2px solid #000;
  border-top: none;
  display: grid;
  grid-template-columns: 1fr 200px;
}

.inv-tax-section .inv-amount-words {
  padding: 2mm 3mm;
  border-right: 1px solid #000;
  font-size: 10.5pt;
}

.inv-tax-section .inv-amount-words .label {
  font-weight: 800;
  font-size: 8pt;
  text-transform: uppercase;
  margin-bottom: 1px;
}

.inv-tax-section .inv-amount-words .words {
  font-weight: 600;
}

.inv-totals {
  padding: 0;
}

.inv-total-row {
  display: flex;
  justify-content: space-between;
  padding: 1.5mm 3mm;
  font-size: 9pt;
  border-bottom: 1px solid #000;
}

.inv-total-row:last-child {
  border-bottom: none;
}

.inv-total-row.grand {
  background: #f0f0f0;
  font-weight: 800;
  font-size: 11pt;
  padding: 2mm 3mm;
  border-top: 2px solid #000;
}

/* Bank & Signature (Print) */
.inv-footer-grid {
  border: 2px solid #000;
  border-top: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.inv-footer-grid .inv-col {
  padding: 2mm 3mm;
}

.inv-footer-grid .inv-col:first-child {
  border-right: 1px solid #000;
}

.inv-footer-col-title {
  font-size: 10pt;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 1.5mm;
  border-bottom: 1px solid #000;
  padding-bottom: 1mm;
}

.inv-bank-detail {
  font-size: 13pt;
  padding: 0.5mm 0;
}

.inv-bank-detail span {
  font-weight: 800;
}

.inv-signature-area {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 18mm;
  text-align: center;
}

.inv-signature-label {
  font-size: 8.5pt;
  font-weight: 800;
  border-top: 1px solid #000;
  padding-top: 1mm;
  margin-top: auto;
}

.inv-auth-for {
  font-size: 8.5pt;
  font-weight: 800;
  text-align: right;
  margin-bottom: 1.5mm;
}

.inv-terms {
  border: 2px solid #000;
  border-top: none;
  padding: 2mm 3mm;
  font-size: 10pt;
}

.inv-terms p {
  margin-bottom: 1px;
}

.inv-computer-gen {
  text-align: center;
  font-size: 8pt;
  padding: 1mm 0;
  border: 2px solid #000;
  border-top: none;
}

/* ---------- Settings Page ---------- */
.settings-page {
  max-width: 800px;
  margin: 0 auto;
}

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.87rem;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.35s ease;
  min-width: 280px;
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.info {
  border-left: 3px solid var(--info);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ---------- Confirm Modal ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  animation: fadeIn 0.25s ease;
}

.modal h3 {
  font-size: 1.15rem;
  margin-bottom: 0.7rem;
}

.modal p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  body * {
    visibility: hidden;
  }

  #invoicePrintArea,
  #invoicePrintArea * {
    visibility: visible;
  }

  #invoicePrintArea {
    position: absolute;
    top: 0;
    left: 0;
    width: 210mm;
  }

  html, 
  body {
    width: 210mm;
    height: auto;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .invoice-copy {
    width: 210mm;
    min-height: 297mm;
    page-break-after: always;
    box-sizing: border-box;
    padding: 8mm;
    margin: 0;
    transform: scale(1);
    transform-origin: top left;
  }

  @page {
    size: A4;
    margin: 0;
  }

  .inv-header,
  .inv-title-bar,
  .inv-details-grid,
  .inv-customer-section,
  .inv-products-table,
  .inv-tax-section,
  .inv-footer-grid,
  .inv-terms,
  .inv-computer-gen {
    page-break-inside: avoid !important;
  }
}


/* Landscape Print Override */
@media print and (orientation: landscape) {
  @page {
    size: A4 landscape;
    margin: 0;
  }
  .invoice-copy {
    width: 297mm !important;
    height: 210mm !important;
    min-height: 210mm !important;
    padding: 8mm !important;
    box-sizing: border-box !important;
  }
  .invoice-print-area {
    width: 297mm !important;
  }
}



/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* ---------- Tablets & Small Laptops ---------- */
@media (max-width: 1024px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .tax-summary-grid {
    grid-template-columns: 1fr;
  }

  .bank-signature-grid {
    grid-template-columns: 1fr;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .invoice-form-page {
    max-width: 100%;
  }
}

/* ---------- Tablets Portrait & Large Phones ---------- */
@media (max-width: 768px) {



  .navbar {
    padding: 0 1rem;
    height: 56px;
  }

  .navbar-subtitle {
    display: none;
  }

  .navbar-logo {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }

  .navbar-title {
    font-size: 1rem;
  }

  /* Main content */
  .main-content {
    padding: 1rem;
    padding-bottom: 20px;
  }

  /* Dashboard stats */
  .dashboard-stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-card .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    margin-bottom: 0.7rem;
  }

  .stat-value {
    font-size: 1.15rem;
  }

  .stat-label {
    font-size: 0.72rem;
  }

  /* Dashboard table header */
  .dashboard-section-header {
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem;
    align-items: stretch;
  }

  .dashboard-section-header>div {
    flex-direction: column;
    gap: 8px;
  }

  .search-box {
    width: 100%;
  }

  .search-box input {
    width: 100%;
  }

  /* Data table on mobile — horizontal scroll hint */
  .data-table th,
  .data-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  /* Form layout */
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-section {
    padding: 1.1rem;
  }

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

  /* Page header */
  .page-header {
    flex-direction: column;
    gap: 0.8rem;
    align-items: stretch;
  }

  .page-header>div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-header>div .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    font-size: 0.75rem;
    padding: 10px 12px;
  }

  /* Invoice preview */
  .preview-overlay {
    padding: 1rem;
  }

  .preview-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
  }

  .preview-toolbar .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    font-size: 0.82rem;
    padding: 10px 10px;
  }

  .invoice-print-area {
    width: 100%;
    padding: 5mm;
    font-size: 8pt;
    min-height: auto;
  }

  .inv-header h1 {
    font-size: 12pt;
  }

  .inv-details-grid {
    grid-template-columns: 1fr;
  }

  .inv-details-grid .inv-col:first-child {
    border-right: none;
    border-bottom: 1px solid #333;
  }

  .inv-customer-section {
    grid-template-columns: 1fr;
  }

  .inv-customer-section .inv-col:first-child {
    border-right: none;
    border-bottom: 1px solid #333;
  }

  .inv-tax-section {
    grid-template-columns: 1fr;
  }

  .inv-tax-section .inv-amount-words {
    border-right: none;
    border-bottom: 1px solid #333;
  }

  .inv-footer-grid {
    grid-template-columns: 1fr;
  }

  .inv-footer-grid .inv-col:first-child {
    border-right: none;
    border-bottom: 1px solid #333;
  }

  /* Touch-optimized inputs */
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 12px;
    font-size: 16px;
    /* prevents iOS zoom on focus */
    min-height: 44px;
    /* touch target */
  }

  /* Buttons touch target */
  .btn {
    min-height: 44px;
    padding: 10px 18px;
  }

  .btn-sm {
    min-height: 38px;
    padding: 8px 14px;
  }

  /* Toast on mobile */
  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  /* Modal */
  .modal {
    padding: 1.5rem;
    margin: 0 1rem;
  }
}

/* ---------- Phones (Landscape & Portrait) ---------- */
@media (max-width: 600px) {

  /* Enable horizontal scroll for products table */
  .products-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    padding-bottom: 10px;
  }

  /* Company Name in form — smaller */
  #companyNameDisplay {
    font-size: 1.05rem !important;
  }

  #companyAddressDisplay,
  #companyContactDisplay {
    font-size: 0.78rem !important;
  }

  /* Tax summary — stack fully */
  .tax-summary-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .tax-breakdown {
    padding: 1rem;
  }

  .tax-row {
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 4px;
  }

  .tax-row .tax-label {
    flex-wrap: wrap;
    gap: 6px;
  }

  .tax-row.total .tax-value {
    font-size: 1.05rem;
  }

  /* Signature grid */
  .bank-signature-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Small Phones ---------- */
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .navbar {
    height: 52px;
    padding: 0 0.8rem;
  }

  .navbar-logo {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
    border-radius: 7px;
  }

  .navbar-brand {
    gap: 8px;
  }

  .navbar-title {
    font-size: 0.92rem;
  }

  .main-content {
    padding: 0.7rem;
    padding-bottom: 20px;
  }

  /* Stats — single column */
  .dashboard-stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .stat-card {
    padding: 0.8rem;
  }

  .stat-card .stat-icon {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
  }

  .stat-value {
    font-size: 1rem;
  }

  .stat-label {
    font-size: 0.68rem;
  }

  /* Form sections */
  .form-section {
    padding: 0.9rem;
    margin-bottom: 0.8rem;
    border-radius: var(--radius-md);
  }

  .form-section-title {
    font-size: 0.75rem;
    margin-bottom: 0.9rem;
  }

  /* Buttons */
  .btn {
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  /* State code field in customer details */
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 11px;
    font-size: 16px;
  }

  /* State code field in customer details */
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 11px;
    font-size: 16px;
  }

  /* Preview print area */
  .invoice-print-area {
    font-size: 7pt;
    padding: 3mm;
  }

  .inv-header h1 {
    font-size: 10pt;
    letter-spacing: 0;
  }

  .inv-header .inv-company-details {
    font-size: 7pt;
  }

  .inv-field {
    font-size: 7pt;
  }

  .inv-products-table th {
    font-size: 5.5pt;
    padding: 1.5mm 2mm;
  }

  .inv-products-table td {
    font-size: 7pt;
    padding: 1.5mm 2mm;
  }

  /* Search box */
  .dashboard-section-header {
    padding: 0.8rem;
  }
}

/* ---------- Very Small Phones (320px) ---------- */
@media (max-width: 360px) {
  html {
    font-size: 13px;
  }

  .navbar {
    height: 48px;
    padding: 0 0.6rem;
  }

  .navbar-title {
    font-size: 0.85rem;
  }

  .navbar-logo {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .main-content {
    padding: 0.5rem;
    padding-bottom: 20px;
  }

  .dashboard-stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }

  .stat-card {
    padding: 0.7rem;
  }

  .stat-value {
    font-size: 0.9rem;
  }

  .form-section {
    padding: 0.7rem;
    border-radius: var(--radius-sm);
  }

  .form-section {
    padding: 0.7rem;
    border-radius: var(--radius-sm);
  }

  .preview-overlay {
    padding: 0.5rem;
  }

  .preview-toolbar {
    padding: 8px;
    gap: 6px;
    border-radius: var(--radius-md);
  }

  .preview-toolbar .btn {
    padding: 8px 8px;
    font-size: 0.75rem;
  }
}

/* ============================================
   TOUCH & INTERACTION ENHANCEMENTS
   ============================================ */
@media (hover: none) and (pointer: coarse) {

  /* Disable hover transforms on touch devices — they stick */
  .stat-card:hover {
    transform: none;
    box-shadow: none;
  }

  .btn-primary:hover,
  .btn-success:hover {
    transform: none;
  }

  /* Larger tap targets */
  .table-actions .btn-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  /* Add active states for buttons */
  .btn:active {
    transform: scale(0.95);
    opacity: 0.9;
  }

  /* Products table delete button */
  .products-table .delete-row-btn {
    padding: 10px;
    font-size: 1.2rem;
  }
}

/* ============================================
   SAFE AREA (Notch devices / iOS)
   ============================================ */
@supports (padding: env(safe-area-inset-bottom)) {
@supports (padding: env(safe-area-inset-bottom)) {

  .navbar {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* ============================================
   LANDSCAPE PHONE
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .navbar {
    height: 44px;
  }

  .navbar-logo {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .main-content {
    padding: 0.5rem 1rem 20px;
  }

  .stat-card {
    padding: 0.6rem;
  }

  .stat-card .stat-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 0.4rem;
  }

  .stat-value {
    font-size: 0.95rem;
  }

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

  .form-section {
    padding: 0.8rem;
  }
}

/* ---------- Utilities ---------- */
.text-right {
  text-align: right;
}

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

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.gap-1 {
  gap: 0.5rem;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.w-full {
  width: 100%;
}

.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }
}

/* ==========================================================================
   HTML2CANVAS RENDERING OVERRIDES (Ensures PDF and Print layout matches Preview)
   ========================================================================== */
.html2canvas-render .invoice-print-area {
  width: 210mm !important;
  font-size: 9pt !important;
  padding: 0 !important;
}

.html2canvas-render .invoice-copy {
  width: 210mm !important;
  min-width: 210mm !important;
  min-height: 297mm !important;
  padding: 8mm !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  
}

.html2canvas-render .inv-header h1 {
  font-size: 14pt !important;
  letter-spacing: 1px !important;
}

.html2canvas-render .inv-header .inv-company-details {
  font-size: 8.5pt !important;
}

.html2canvas-render .inv-field {
  font-size: 8.5pt !important;
}

.html2canvas-render .inv-products-table th {
  font-size: 8pt !important;
  padding: 1.5mm 2mm !important;
}

.html2canvas-render .inv-products-table td {
  font-size: 10pt !important;
  padding: 1.5mm 2mm !important;
}

/* Align items to top-left on small screens in preview overlay so scroll works nicely */
@media (max-width: 1024px) {
  .preview-overlay.active {
    align-items: flex-start !important;
    overflow-x: auto !important;
  }
}

/* Responsive Sidebar Overrides */
@media (max-width: 768px) {
  #app {
    flex-direction: column !important;
  }

  .sidebar {
    width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    position: relative !important;
    padding: 1rem !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 1rem !important;
  }

  .sidebar-header {
    margin-bottom: 0.5rem !important;
  }

  .sidebar-menu {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .sidebar-btn,
  .sidebar-btn-link {
    padding: 8px 12px !important;
    font-size: 0.82rem !important;
    width: auto !important;
    flex: 1 1 auto !important;
    justify-content: center !important;
    white-space: nowrap !important;
  }

  .sidebar-footer {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-top: 1rem !important;
    margin-top: 0.5rem !important;
    width: 100% !important;
  }

  .sidebar-logout-btn {
    width: auto !important;
    padding: 8px 12px !important;
    font-size: 0.82rem !important;
  }

  .powered-by {
    align-items: flex-end !important;
    padding-left: 0 !important;
  }
}

/* ========== TEST REPORT PRINT / PREVIEW STYLES ========== */
.test-report-copy {
  background: #fff;
  color: #000;
  width: 210mm;
  min-width: 210mm;
  min-height: 297mm;
  padding: 6mm 15mm 15mm 15mm;
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
  position: relative;
  page-break-after: always;
  margin-bottom: 2rem;
  box-sizing: border-box;
  font-family: Calibri, Candara, 'Segoe UI', Segoe, Arial, sans-serif;
  font-size: 10.5pt;
  line-height: 1.4;
}

.test-report-copy * {
  color: #000 !important;
}

/* Header styling for corporate test report */
.tr-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: 2mm;
  margin-bottom: 5mm;
}

.tr-logo-container {
  width: 400px;
  height: auto;
  margin: 0 auto 5px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tr-logo-img {
  width: 100%;
  height: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
  mix-blend-mode: multiply;
}

.tr-company-address {
  font-family: 'Times New Roman', Times, serif;
  font-size: 14px !important;
  color: #1E3A8A !important;
  font-weight: bold;
  text-align: center;
  line-height: 1.3;
  margin: 4px 0 !important;
}

.tr-company-contact {
  font-family: 'Times New Roman', Times, serif;
  font-size: 13px !important;
  color: #1E3A8A !important;
  font-weight: bold;
  text-align: center;
  line-height: 1.2;
  margin: 4px 0 !important;
}

.tr-header-bottom-line {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
  font-size: 13px !important;
  color: #1E3A8A !important;
  font-family: 'Times New Roman', Times, serif;
  font-weight: bold;
}

.tr-header-web {
  text-align: left;
}

.tr-header-web a {
  color: #1E3A8A !important;
  text-decoration: underline;
  font-weight: bold;
}

.tr-header-email {
  text-align: right;
}

.tr-header-email a {
  color: #1E3A8A !important;
  text-decoration: underline;
  font-weight: bold;
}

/* Document title */
.tr-doc-title {
  text-align: center;
  font-size: 16pt;
  font-weight: bold;
  color: #000 !important;
  margin: 6mm 0 6mm 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Generic Table formatting for A4 Reports */
.tr-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 6mm;
  font-size: 10.5pt;
}

.tr-table th, 
.tr-table td {
  border: 0.8px solid #000;
  padding: 2mm 3mm;
  text-align: left;
}

/* Customer info table styles */
.tr-info-table td {
  padding: 1.2mm 3mm !important;
}

.tr-info-table td.label-cell {
  background-color: transparent !important;
  font-weight: bold !important;
  width: 35%;
}

.tr-info-table td.value-cell {
  background-color: transparent !important;
  font-weight: normal !important;
  width: 65%;
}

/* Test results table styles */
.tr-results-table th {
  background-color: #f2f2f2 !important;
  font-weight: bold !important;
  text-align: center;
  text-transform: none;
  font-size: 10.5pt;
  letter-spacing: 0.2px;
}

.tr-results-table td {
  padding: 1.2mm 3mm !important;
  text-align: center;
}

/* Tester and Signatures layout at bottom */
.tr-tester-details {
  margin-top: 8mm;
  margin-bottom: 8mm;
  font-size: 10.5pt;
  line-height: 1.8;
}

.tr-detail-row {
  display: flex;
}

.tr-detail-label {
  width: 260px;
  font-weight: bold;
}

.tr-detail-colon {
  width: 20px;
  text-align: center;
}

.tr-detail-value {
  font-weight: normal;
}

.tr-bottom-branding {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 15mm;
  padding-bottom: 2mm;
}

.tr-bottom-left {
  font-size: 10.5pt;
  line-height: 1.4;
  text-align: left;
  font-weight: normal;
}

.tr-bottom-left-company {
  font-weight: bold;
  text-transform: uppercase;
  margin-top: 0.5mm;
  margin-bottom: 0.5mm;
}
.tr-bottom-center {
  text-align: center;
  width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.tr-bottom-center-label {
  font-weight: bold;
  font-size: 10.5pt;
  text-transform: uppercase;
  color: #000;
  letter-spacing: 0.5px;
  text-align: center;
  border-top: 1px solid #000;
  padding-top: 2mm;
  width: 100%;
}

.tr-bottom-right {
  text-align: center;
  width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.tr-handwritten-sig-space {
  height: 55px;
  width: 100%;
}

.tr-bottom-right-company {
  font-weight: bold;
  font-size: 10.5pt;
  text-transform: uppercase;
  color: #000;
  letter-spacing: 0.5px;
  text-align: center;
  border-top: 1px solid #000;
  padding-top: 2mm;
  width: 100%;
}

/* Inline Edit visual indicators on screen */
[contenteditable="true"] {
  outline: none;
  transition: background-color 0.2s ease;
}

[contenteditable="true"]:hover {
  background-color: rgba(27, 67, 156, 0.05);
}

[contenteditable="true"]:focus {
  background-color: rgba(27, 67, 156, 0.08);
  box-shadow: 0 0 0 1px #1b439c;
  border-radius: 2px;
}

/* HTML2CANVAS Rendering overrides for Test Report */
.html2canvas-render.test-report-print-area {
  width: 210mm !important;
  padding: 0 !important;
}

.html2canvas-render .test-report-copy {
  width: 210mm !important;
  min-width: 210mm !important;
  min-height: 297mm !important;
  padding: 6mm 15mm 15mm 15mm !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
}

.html2canvas-render .tr-logo-container {
  width: 105.8mm !important;
  height: auto !important;
}

.html2canvas-render .tr-logo-img {
  width: 100% !important;
  height: auto !important;
}

.html2canvas-render [contenteditable="true"] {
  background-color: transparent !important;
  box-shadow: none !important;
}

/* Media print override for Test Report */
@media print {
  #testReportPrintArea,
  #testReportPrintArea * {
    visibility: visible;
  }

  #testReportPrintArea {
    position: absolute;
    top: 0;
    left: 0;
    width: 210mm;
  }

  .test-report-copy {
    width: 210mm;
    min-height: 297mm;
    page-break-after: always;
    box-sizing: border-box;
    padding: 6mm 15mm 15mm 15mm;
    margin: 0;
    transform: scale(1);
    transform-origin: top left;
  }
  
  .tr-logo-container {
    width: 105.8mm !important;
    height: auto !important;
  }
  
  .tr-logo-img {
    width: 100% !important;
    height: auto !important;
  }

  [contenteditable="true"] {
    background-color: transparent !important;
    box-shadow: none !important;
  }
}
