/* ==========================================================================
   D4F Invoice & Voucher Studio - Complete Modern Stylesheet
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-bn: 'Hind Siliguri', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Color Palette */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #0f172a;
  
  --success: #16a34a;
  --success-bg: #dcfce7;
  --success-border: #86efac;

  --warning: #d97706;
  --warning-bg: #fef3c7;
  --warning-border: #fcd34d;

  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-border: #fca5a5;

  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-sidebar: #0f172a;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  --border-dark: #cbd5e1;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-paper: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: var(--font-bn);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.lang-en {
  font-family: var(--font-sans);
}

/* Utility Helpers */
.hidden { display: none !important; }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-gray { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.p-3 { padding: 0.75rem; }

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  background: var(--bg-sidebar);
  color: #fff;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: #ffffff;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.app-brand-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.brand-titles .app-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  line-height: 1.2;
}

.brand-titles .app-subtitle {
  font-size: 0.75rem;
  color: var(--text-light);
  line-height: 1;
}

/* Header Center (Templates) */
.header-center {
  display: flex;
  align-items: center;
}

.template-selector-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.template-label {
  font-size: 0.8rem;
  color: #cbd5e1;
  font-weight: 600;
  white-space: nowrap;
}

.app-select {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  max-width: 230px;
}
.app-select:focus {
  border-color: var(--primary);
}

/* Header Right (Toggles & Action Buttons) */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toggle-group {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.toggle-btn {
  background: transparent;
  color: #94a3b8;
  border: none;
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.toggle-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.action-btn-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Generic Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-icon {
  width: 15px;
  height: 15px;
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover {
  background: #15803d;
}

.btn-dark {
  background: #334155;
  color: #fff;
}
.btn-dark:hover {
  background: #475569;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-ghost {
  background: transparent;
  color: #cbd5e1;
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-block {
  width: 100%;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.btn-text-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   APP MAIN LAYOUT (SPLIT SCREEN)
   ========================================================================== */
.app-main {
  display: flex;
  flex: 1;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* LEFT PANEL (Editor) */
.editor-panel {
  width: 480px;
  min-width: 420px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.editor-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.auto-save-pill {
  font-size: 0.72rem;
  color: var(--success);
  background: var(--success-bg);
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
}

/* Cards & Accordions */
.card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

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

.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Quick Service Inserter */
.quick-service-controls .form-group-flex {
  display: flex;
  gap: 0.5rem;
}

.special-customizer {
  margin-top: 0.65rem;
  background: #eff6ff;
  border: 1px dashed var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
}

.customizer-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: #1e40af;
  margin-bottom: 0.35rem;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

.price-input {
  width: 100px;
  flex-shrink: 0;
}

.helper-text {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Editor Accordion Sections */
.editor-section {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.section-summary {
  padding: 0.75rem 1rem;
  background: #f8fafc;
  font-size: 0.86rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: background 0.15s ease;
}

.editor-section[open] .section-summary {
  border-bottom-color: var(--border-color);
  background: #f1f5f9;
}

.section-summary .chevron {
  transition: transform 0.2s ease;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.editor-section[open] .section-summary .chevron {
  transform: rotate(180deg);
}

.section-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.form-control.highlight-input {
  background: #f0fdf4;
  border-color: var(--success);
  font-weight: 600;
  color: #166534;
}

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

/* Items List in Editor */
.items-editor-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-editor-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.item-editor-card.service-highlight {
  border-left: 3px solid var(--primary);
}

.item-editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.item-title-input {
  font-weight: 600;
  color: var(--text-main);
}

.item-editor-grid {
  display: grid;
  grid-template-columns: 75px 110px 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.item-delete-btn {
  background: transparent;
  color: var(--danger);
  border: none;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.85rem;
}
.item-delete-btn:hover {
  background: var(--danger-bg);
}

.item-total-display {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: right;
  color: var(--accent);
}

/* Calculations Box */
.calculations-box {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border-color);
  margin-bottom: 0.5rem;
}

.calc-summary-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.summary-pill {
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.total-pill {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.due-pill {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.summary-pill .pill-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.summary-pill .pill-amount {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ==========================================================================
   RIGHT PANEL: LIVE A4 PREVIEW
   ========================================================================== */
.preview-panel {
  flex: 1;
  background: #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.preview-toolbar {
  background: #ffffff;
  padding: 0.5rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-dark);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  z-index: 10;
}

.preview-tag {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.preview-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.invoice-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* A4 Sheet Dimensions & Paper Styling */
.invoice-sheet {
  width: 210mm;
  min-height: 297mm;
  background: #ffffff;
  padding: 38px 45px;
  box-shadow: var(--shadow-paper);
  border-radius: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  transform-origin: top center;
  transition: transform 0.15s ease-out;
}

.invoice-accent-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #1e40af, #3b82f6, #06b6d4);
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

/* Invoice Header */
.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-top: 10px;
}

.inv-brand-row {
  display: flex;
  align-items: center;
  gap: 1.15rem;
}

.inv-logo {
  width: 65px;
  height: 65px;
  object-fit: contain;
  border-radius: 8px;
}

.inv-company-name {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.inv-company-tagline {
  font-size: 0.82rem;
  color: #475569;
  font-weight: 500;
  margin-top: 2px;
}

.inv-company-contacts {
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 6px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.dot-sep {
  color: #cbd5e1;
}

/* QR Scanner Box (Top Right) */
.inv-header-scanner {
  display: flex;
  justify-content: flex-end;
}

.qr-box {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 8px;
  padding: 6px 8px;
  text-align: center;
  width: 105px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.qr-canvas-holder {
  width: 85px;
  height: 85px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-canvas-holder img, 
.qr-canvas-holder canvas {
  width: 85px !important;
  height: 85px !important;
  border-radius: 4px;
}

.qr-caption {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  color: #334155;
  margin-top: 4px;
  line-height: 1.1;
}

.inv-divider {
  border: none;
  height: 1px;
  background: #e2e8f0;
  margin: 1.15rem 0;
}

/* Invoice Title & Status Bar */
.inv-title-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.15rem;
}

.inv-main-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
  line-height: 1;
}

.inv-meta-sub {
  font-size: 0.84rem;
  color: #64748b;
  margin-top: 4px;
}

.inv-status-badge {
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  border-radius: 9999px;
  text-transform: uppercase;
}

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

.status-due {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.status-partial {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.status-advance {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* Client & Dates Grid */
.inv-info-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  margin-bottom: 1.35rem;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  padding: 1rem 1.15rem;
}

.section-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.25rem;
}

.client-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.client-detail {
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.35;
  margin-top: 2px;
}

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

.dates-table td {
  padding: 3px 0;
  font-size: 0.8rem;
}

.date-lbl {
  color: #64748b;
  width: 50%;
}

.date-val {
  color: #0f172a;
  text-align: right;
  font-weight: 600;
}

/* Items Table */
.inv-table-wrapper {
  margin-bottom: 1.5rem;
}

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

.inv-table th {
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 12px;
}

.inv-table th:first-child {
  border-top-left-radius: 6px;
}

.inv-table th:last-child {
  border-top-right-radius: 6px;
}

.inv-table td {
  padding: 10px 12px;
  font-size: 0.82rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.inv-table tr:nth-child(even) td {
  background: #fbfcfe;
}

.col-num {
  width: 40px;
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.col-desc {
  width: auto;
}

.item-service-title {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.88rem;
}

.item-service-desc {
  font-size: 0.76rem;
  color: #475569;
  white-space: pre-line;
  margin-top: 3px;
  line-height: 1.35;
}

.col-qty {
  width: 80px;
  font-family: var(--font-mono);
}

.col-rate {
  width: 110px;
  font-family: var(--font-mono);
}

.col-amount {
  width: 120px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #0f172a;
}

/* Bottom Grid (Calculations + Payment Info) */
.inv-bottom-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 2rem;
  margin-top: auto;
  position: relative;
}

.payment-instructions-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.75rem;
}

.sub-heading {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.35rem;
}

.payment-methods-text {
  font-family: var(--font-sans);
  font-size: 0.73rem;
  color: #334155;
  white-space: pre-line;
  line-height: 1.4;
}

.terms-box {
  padding: 0.4rem 0.2rem;
}

.terms-text {
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.4;
}

/* Calculations Table */
.calc-table {
  width: 100%;
  border-collapse: collapse;
}

.calc-table td {
  padding: 5px 8px;
  font-size: 0.82rem;
}

.calc-lbl {
  color: #475569;
}

.calc-amt {
  text-align: right;
  color: #0f172a;
}

.total-row td {
  border-top: 2px solid #0f172a;
  border-bottom: 2px solid #0f172a;
  font-size: 0.95rem;
  padding: 8px 8px;
  color: #0f172a;
}

.paid-row td {
  padding: 6px 8px;
}

.due-row td {
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 4px;
  font-size: 0.95rem;
  padding: 8px 8px;
}

/* Realistic Watermark Stamp */
.stamp-wrapper {
  margin-top: 15px;
  display: flex;
  justify-content: flex-end;
}

.stamp-seal {
  display: inline-block;
  padding: 0.35rem 1.25rem;
  text-transform: uppercase;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  border-width: 4px;
  border-style: double;
  border-radius: 8px;
  transform: rotate(-10deg);
  opacity: 0.88;
  user-select: none;
}

.stamp-paid {
  color: #16a34a;
  border-color: #16a34a;
  background: rgba(220, 252, 231, 0.4);
}

.stamp-due {
  color: #dc2626;
  border-color: #dc2626;
  background: rgba(254, 226, 226, 0.4);
}

.stamp-partial {
  color: #d97706;
  border-color: #d97706;
  background: rgba(254, 243, 199, 0.4);
}

.stamp-advance {
  color: #2563eb;
  border-color: #2563eb;
  background: rgba(239, 246, 255, 0.4);
}

/* Invoice Footer */
.inv-footer {
  margin-top: 2rem;
  padding-top: 1.15rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.thank-you-msg {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
}

.footer-note {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 2px;
}

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

.signature-line {
  width: 170px;
  height: 1px;
  background: #334155;
  margin-bottom: 6px;
}

.signature-title {
  font-size: 0.72rem;
  color: #475569;
  font-weight: 600;
}

/* ==========================================================================
   MODALS & OVERLAYS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

.modal-box.modal-lg {
  max-width: 760px;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}
.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 1.25rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Services Management Table inside Modal */
.services-list-table-wrap {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-height: 250px;
  overflow-y: auto;
}

.services-mgmt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.services-mgmt-table th {
  background: #f1f5f9;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.services-mgmt-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

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

/* Notification Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-left: 4px solid var(--success);
  animation: toastSlideUp 0.25s ease-out;
}

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

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

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .no-print,
  .app-header,
  .editor-panel,
  .preview-toolbar,
  .modal-overlay,
  .toast {
    display: none !important;
  }

  .app-main {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .preview-panel {
    background: transparent !important;
    overflow: visible !important;
  }

  .invoice-scroll-area {
    padding: 0 !important;
    overflow: visible !important;
    display: block !important;
  }

  .invoice-sheet {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 10px 15px !important;
    width: 100% !important;
    min-height: auto !important;
    transform: none !important;
  }

  .inv-table tr {
    page-break-inside: avoid;
  }

  .inv-bottom-grid {
    page-break-inside: avoid;
  }
}

/* ==========================================================================
   RESPONSIVE DESIGN (Tablets & Mobile)
   ========================================================================== */
@media (max-width: 1024px) {
  .app-main {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .editor-panel {
    width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .preview-panel {
    height: auto;
    overflow: visible;
  }

  .invoice-scroll-area {
    padding: 1rem 0.5rem;
    overflow-x: auto;
  }

  .invoice-sheet {
    width: 100%;
    max-width: 210mm;
  }
}
