/* ============================================
   Payora — Invoice Editor Styles
   ============================================ */

/* ---------- Editor Layout ---------- */
.editor-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ---------- Sidebar ---------- */
.editor-sidebar {
  width: 72px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  z-index: 100;
  flex-shrink: 0;
}

.sidebar-brand {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-bottom: 24px;
  text-decoration: none;
  transition: var(--transition);
}

.sidebar-brand:hover {
  transform: scale(1.05);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-btn {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.sidebar-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

.sidebar-btn.active {
  background: var(--primary-50);
  color: var(--primary);
}

[data-theme="dark"] .sidebar-btn.active {
  background: rgba(99, 102, 241, 0.15);
}

.sidebar-btn .tooltip {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: var(--transition-fast);
  z-index: 200;
}

.sidebar-btn:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

/* ---------- Form Panel ---------- */
.editor-form-panel {
  width: 440px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.form-panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-panel-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.form-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.form-tab {
  flex: 1;
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.form-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.form-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-secondary);
}

.form-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.form-panel-body::-webkit-scrollbar {
  width: 5px;
}

.form-panel-body::-webkit-scrollbar-track {
  background: transparent;
}

.form-panel-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ---------- Form Sections ---------- */
.form-section {
  margin-bottom: 28px;
}

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

.form-section-title i {
  width: 14px;
  height: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text);
  transition: var(--transition-fast);
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: var(--surface);
}

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

.form-group select:not(#fontSelect) {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

#fontSelect {
  appearance: auto !important;
  background-image: none !important;
  padding-right: 14px !important;
}

/* ---------- Logo Upload ---------- */
.logo-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.logo-upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-50);
}

[data-theme="dark"] .logo-upload-area:hover {
  background: rgba(99, 102, 241, 0.05);
}

.logo-upload-area.has-logo {
  border-style: solid;
  padding: 12px;
}

.logo-upload-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

.logo-upload-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.logo-upload-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.logo-preview {
  max-width: 160px;
  max-height: 80px;
  object-fit: contain;
  margin: 0 auto;
  display: block;
}

.logo-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--error);
  color: white;
  border: none;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.logo-remove-btn:hover {
  transform: scale(1.1);
}

/* ---------- QR Code Section ---------- */
.qr-code-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  user-select: none;
}

.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.qr-code-options {
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

.qr-code-preview {
  width: 160px;
  height: 160px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
}

.qr-code-preview svg {
  width: 100% !important;
  height: 100% !important;
}

/* ---------- Line Items ---------- */
.line-items-table {
  width: 100%;
  border-collapse: collapse;
}

.line-items-table th {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 8px 6px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.line-items-table th:last-child {
  width: 32px;
}

.line-items-table td {
  padding: 6px;
  vertical-align: middle;
}

.line-items-table input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text);
  transition: var(--transition-fast);
}

.line-items-table input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.line-items-table input[type="number"] {
  -moz-appearance: textfield;
}

.line-items-table input[type="number"]::-webkit-inner-spin-button,
.line-items-table input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.line-item-total {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  padding: 8px 10px;
  min-width: 70px;
  text-align: right;
}

.line-item-remove {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.line-item-remove:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.add-line-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin-top: 10px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  width: 100%;
  justify-content: center;
}

.add-line-item:hover {
  background: var(--primary-50);
  border-color: var(--primary);
}

[data-theme="dark"] .add-line-item:hover {
  background: rgba(99, 102, 241, 0.08);
}

/* ---------- Totals ---------- */
.totals-section {
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.85rem;
}

.total-row .label {
  color: var(--text-secondary);
}

.total-row .value {
  font-weight: 600;
}

.total-row.grand-total {
  border-top: 2px solid var(--primary);
  margin-top: 8px;
  padding-top: 12px;
  font-size: 1rem;
}

.total-row.grand-total .label {
  font-weight: 700;
  color: var(--text);
}

.total-row.grand-total .value {
  font-weight: 800;
  color: var(--primary);
  font-size: 1.1rem;
}

.total-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.total-input-group input {
  width: 60px;
  padding: 4px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  text-align: center;
  color: var(--text);
}

.total-input-group input:focus {
  border-color: var(--primary);
}

/* ---------- Color Presets ---------- */
.color-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.color-preset {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.color-preset:hover {
  transform: scale(1.15);
}

.color-preset.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text);
}

.color-preset.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.custom-color-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-color-group input[type="color"] {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 2px;
  background: var(--surface);
}

.custom-color-group input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.custom-color-group input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.custom-color-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ---------- Template Grid ---------- */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.template-option {
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.template-option:hover {
  border-color: var(--primary-200);
  background: var(--surface);
}

.template-option.active {
  border-color: var(--primary);
  background: var(--primary-50);
}

[data-theme="dark"] .template-option.active {
  background: rgba(99, 102, 241, 0.1);
}

.template-option .template-mini-preview {
  height: 60px;
  border-radius: 4px;
  margin-bottom: 8px;
  background: var(--preview-gradient, linear-gradient(135deg, #e2e8f0, #cbd5e1));
}

.template-option .template-option-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

/* ---------- Status Badge Selector ---------- */
.status-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-badge-option {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge-option:hover {
  transform: scale(1.05);
}

.status-badge-option.status-paid {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.status-badge-option.status-paid.active {
  border-color: #059669;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-badge-option.status-pending {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.status-badge-option.status-pending.active {
  border-color: #d97706;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.status-badge-option.status-overdue {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.status-badge-option.status-overdue.active {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.status-badge-option.status-draft {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

.status-badge-option.status-draft.active {
  border-color: #64748b;
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.2);
}

/* ---------- Preview Panel ---------- */
.editor-preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-tertiary);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.preview-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-zoom {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 2px;
}

.preview-zoom button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.preview-zoom button:hover {
  background: var(--surface);
  color: var(--text);
}

.preview-zoom .zoom-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  min-width: 45px;
  text-align: center;
}

.preview-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.preview-action-btn:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-sm);
}

.preview-action-btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-color: transparent;
}

.preview-action-btn.primary:hover {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

.preview-container {
  flex: 1;
  overflow: auto;
  padding: 32px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-width: 0;
}

.preview-container::-webkit-scrollbar {
  width: 8px;
}

.preview-container::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

.preview-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* ---------- Invoice Preview ---------- */
.invoice-preview {
  width: 794px; /* A4 width at 96 DPI */
  min-height: 1123px; /* A4 height */
  background: #ffffff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  border-radius: 4px;
  color: #1a1a2e;
  position: relative;
  transform-origin: top center;
  transition: transform 0.3s ease;
  overflow: hidden;
  flex-shrink: 0;
}

/* ---------- Invoice Template Styles ---------- */

/* Template: Classic White */
.invoice-preview.tpl-classic {
  padding: 48px;
  font-family: 'Inter', sans-serif;
}

.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
}

.inv-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.inv-brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: contain;
}

.inv-brand-logo-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.4rem;
  color: white;
  background: var(--accent-color, #6366f1);
}

.inv-brand-text h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1a1a2e;
}

.inv-brand-text p {
  font-size: 0.8rem;
  color: #64748b;
}

.inv-header-right {
  text-align: right;
}

/* QR Code Styling */
.inv-qr-code {
  width: 100px;
  height: 100px;
  border: 2px solid #f1f5f9;
  border-radius: 8px;
  background: white;
  padding: 4px;
}

.inv-qr-code-container {
  display: flex;
  justify-content: flex-end;
}

.inv-title {
  font-size: 2rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  color: var(--accent-color, #6366f1);
}

.inv-status-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inv-status-badge.paid { background: #dcfce7; color: #16a34a; }
.inv-status-badge.pending { background: #fef3c7; color: #d97706; }
.inv-status-badge.overdue { background: #fee2e2; color: #dc2626; }
.inv-status-badge.draft { background: #f1f5f9; color: #64748b; }

.inv-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 36px;
  gap: 24px;
}

.inv-info-block {
  flex: 1;
}

.inv-info-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 8px;
}

.inv-info-block h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.inv-info-block p {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.55;
}

.inv-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f8fafc;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 36px;
}

.inv-detail-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.inv-detail-item .label {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 500;
}

.inv-detail-item .value {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1a1a2e;
}

/* Invoice Table */
.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.inv-table thead th {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid #e2e8f0;
  color: #64748b;
}

.inv-table thead th:last-child {
  text-align: right;
}

.inv-table tbody td {
  padding: 14px 16px;
  font-size: 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.inv-table tbody td:last-child {
  text-align: right;
  font-weight: 600;
}

.inv-table tbody td .item-name {
  font-weight: 600;
  color: #1a1a2e;
}

.inv-table tbody td .item-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* Invoice Totals */
.inv-totals {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 36px;
}

.inv-totals-box {
  width: 280px;
}

.inv-total-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.85rem;
  color: #64748b;
}

.inv-total-row .amount {
  font-weight: 600;
  color: #334155;
}

.inv-total-row.grand {
  border-top: 2px solid;
  margin-top: 8px;
  padding-top: 12px;
  font-size: 1.05rem;
  font-weight: 800;
  border-color: var(--accent-color, #6366f1);
}

.inv-total-row.grand .label,
.inv-total-row.grand .amount {
  font-weight: 800;
  color: var(--accent-color, #6366f1);
}

.inv-notes {
  margin-top: 24px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 4px solid;
  border-color: var(--accent-color, #6366f1);
}

.inv-header-accent {
  background: var(--accent-color, #6366f1);
}

.inv-sidebar-panel-accent {
  background: var(--accent-color, #6366f1);
}

.inv-title-light {
  color: #fff;
}

.inv-text-muted {
  color: rgba(255, 255, 255, 0.5);
}

.empty-table-message {
  text-align: center;
  color: #94a3b8;
  padding: 24px;
}

.inv-notes h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 8px;
}

.inv-notes p {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.6;
}

.inv-footer {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
}

/* ---- Template: Modern Dark ---- */
.invoice-preview.tpl-modern-dark {
  background: #0f172a;
  color: #e2e8f0;
  padding: 48px;
}

.tpl-modern-dark .inv-brand-text h2 { color: #f1f5f9; }
.tpl-modern-dark .inv-brand-text p { color: #64748b; }
.tpl-modern-dark .inv-title { color: #f1f5f9; }
.tpl-modern-dark .inv-info-block h3 { color: #f1f5f9; }
.tpl-modern-dark .inv-info-block p { color: #94a3b8; }
.tpl-modern-dark .inv-details-grid { background: #1e293b; }
.tpl-modern-dark .inv-detail-item .value { color: #f1f5f9; }
.tpl-modern-dark .inv-table thead th { border-color: #334155; color: #64748b; }
.tpl-modern-dark .inv-table tbody td { border-color: #1e293b; color: #cbd5e1; }
.tpl-modern-dark .inv-table tbody td .item-name { color: #f1f5f9; }
.tpl-modern-dark .inv-table tbody td .item-desc { color: #64748b; }
.tpl-modern-dark .inv-total-row { color: #94a3b8; }
.tpl-modern-dark .inv-total-row .amount { color: #e2e8f0; }
.tpl-modern-dark .inv-notes { background: #1e293b; }
.tpl-modern-dark .inv-notes h4 { color: #94a3b8; }
.tpl-modern-dark .inv-notes p { color: #94a3b8; }
.tpl-modern-dark .inv-footer { border-color: #334155; color: #475569; }

/* ---- Template: Minimal ---- */
.invoice-preview.tpl-minimal {
  padding: 56px;
  font-family: 'Inter', sans-serif;
}

.tpl-minimal .inv-header { border-bottom: 1px solid #e2e8f0; padding-bottom: 24px; }
.tpl-minimal .inv-title { font-size: 1.5rem; letter-spacing: 0.1em; font-weight: 400; }
.tpl-minimal .inv-table thead th { font-size: 0.65rem; letter-spacing: 0.1em; }
.tpl-minimal .inv-notes { background: transparent; border-left: 2px solid #e2e8f0; padding: 12px 16px; }

/* ---- Template: Bold Header ---- */
.invoice-preview.tpl-bold-header {
  padding: 0;
}

.tpl-bold-header .inv-header {
  padding: 40px 48px;
  margin-bottom: 0;
  color: white;
}

.tpl-bold-header .inv-header .inv-brand-text h2 { color: white; }
.tpl-bold-header .inv-header .inv-brand-text p { color: rgba(255,255,255,0.7); }
.tpl-bold-header .inv-header .inv-title { color: white; }
.tpl-bold-header .inv-content { padding: 36px 48px 48px; }

/* ---- Template: Corporate ---- */
.invoice-preview.tpl-corporate {
  padding: 0;
  border-top: 6px solid;
  padding: 40px;
}

.tpl-corporate .inv-content {
  padding: 40px 48px;
}

/* ---- Template: Elegant Serif ---- */
.invoice-preview.tpl-elegant {
  padding: 56px;
  font-family: 'Georgia', 'Times New Roman', serif;
}

.tpl-elegant .inv-title {
  font-family: 'Georgia', serif;
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.02em;
}

.tpl-elegant .inv-table thead th {
  font-family: 'Inter', sans-serif;
}

/* ---- Template: Tech Startup ---- */
.invoice-preview.tpl-tech {
  padding: 48px;
  background: #fafbfc;
}

.tpl-tech .inv-header {
  padding-bottom: 24px;
  border-bottom: 3px solid;
}

.tpl-tech .inv-details-grid {
  background: transparent;
  border: 1px solid #e2e8f0;
}

/* ---- Template: Creative ---- */
.invoice-preview.tpl-creative {
  padding: 48px;
}

.tpl-creative .inv-header {
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 32px;
  color: white;
}

.tpl-creative .inv-header .inv-brand-text h2 { color: white; }
.tpl-creative .inv-header .inv-brand-text p { color: rgba(255,255,255,0.7); }
.tpl-creative .inv-header .inv-title { color: white; }

/* ---- Additional Templates ---- */
.invoice-preview.tpl-gradient-header { padding: 0; }
.tpl-gradient-header .inv-header {
  padding: 36px 48px;
  margin: 0;
  color: white;
}
.tpl-gradient-header .inv-header .inv-brand-text h2,
.tpl-gradient-header .inv-header .inv-title { color: white; }
.tpl-gradient-header .inv-header .inv-brand-text p { color: rgba(255,255,255,0.7); }
.tpl-gradient-header .inv-content { padding: 36px 48px 48px; }

.invoice-preview.tpl-sidebar { 
  padding: 0; 
  display: flex; 
  min-height: 1123px;
}
.tpl-sidebar .inv-sidebar-panel {
  width: 240px;
  padding: 40px 24px;
  color: white;
  flex-shrink: 0;
}
.tpl-sidebar .inv-main-panel {
  flex: 1;
  padding: 40px 36px;
}
.tpl-sidebar .inv-sidebar-panel h3 { color: white; margin-bottom: 4px; }
.tpl-sidebar .inv-sidebar-panel p { color: rgba(255,255,255,0.7); font-size: 0.8rem; line-height: 1.5; }
.tpl-sidebar .inv-sidebar-panel .inv-info-label { color: rgba(255,255,255,0.5); }

.invoice-preview.tpl-carbon {
  background: #1a1a2e;
  color: #e2e8f0;
  padding: 48px;
  background-image: radial-gradient(circle at 50% 0%, rgba(99,102,241,0.08) 0%, transparent 50%);
}
.tpl-carbon .inv-brand-text h2, .tpl-carbon .inv-title { color: #f1f5f9; }
.tpl-carbon .inv-info-block h3 { color: #f1f5f9; }
.tpl-carbon .inv-details-grid { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); }
.tpl-carbon .inv-detail-item .value { color: #f1f5f9; }
.tpl-carbon .inv-table thead th { border-color: rgba(255,255,255,0.08); }
.tpl-carbon .inv-table tbody td { border-color: rgba(255,255,255,0.04); color: #cbd5e1; }
.tpl-carbon .inv-table tbody td .item-name { color: #f1f5f9; }
.tpl-carbon .inv-notes { background: rgba(255,255,255,0.03); border-color: var(--accent-color, #6366f1); }
.tpl-carbon .inv-footer { border-color: rgba(255,255,255,0.06); color: #475569; }

/* ---------- Document List Panel ---------- */
.doc-list-panel {
  position: fixed;
  top: 0;
  left: 72px;
  width: 320px;
  height: 100%;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  z-index: 90;
  transform: translateX(-392px);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.doc-list-panel.open {
  transform: translateX(0);
}

.doc-list-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-list-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.doc-list-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.doc-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition-fast);
  margin-bottom: 4px;
}

.doc-list-item:hover {
  background: var(--bg-tertiary);
}

.doc-list-item.active {
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
}

[data-theme="dark"] .doc-list-item.active {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
}

.doc-list-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doc-list-info {
  flex: 1;
  min-width: 0;
}

.doc-list-info .doc-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-list-info .doc-date {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* ========== MOBILE RESPONSIVE DESIGN ========== */

/* Tablets and Below (1024px) */
@media (max-width: 1024px) {
  .editor-form-panel {
    width: 360px;
  }
  
  .preview-toolbar {
    padding: 10px 16px;
  }
  
  .form-panel-body {
    padding: 16px;
  }
}

/* Medium Tablets (768px and below) */
@media (max-width: 768px) {
  .editor-layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }
  
  /* Hide sidebar on mobile, show hamburger menu instead */
  .editor-sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    z-index: 200;
  }
  
  .sidebar-brand {
    width: 36px;
    height: 36px;
    margin-bottom: 0;
    order: 1;
  }
  
  .sidebar-nav {
    flex-direction: row;
    gap: 4px;
    flex: 1;
    margin-left: 12px;
  }
  
  .sidebar-btn {
    width: 40px;
    height: 40px;
  }
  
  .sidebar-bottom {
    flex-direction: row;
    margin-left: auto;
  }
  
  /* Form panel full width on mobile */
  .editor-form-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 50vh;
    order: 2;
  }
  
  /* Preview panel responsive */
  .editor-preview-panel {
    flex: 1;
    order: 3;
  }
  
  .form-panel-body {
    padding: 14px;
    max-height: calc(50vh - 110px);
  }
  
  .form-panel-header {
    padding: 14px;
  }
  
  .form-panel-tabs {
    gap: 0;
  }
  
  .form-tab {
    padding: 10px 12px;
    font-size: 0.75rem;
  }
  
  /* Form inputs touch-friendly */
  .form-group input,
  .form-group select,
  .form-group textarea {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .form-section {
    margin-bottom: 16px;
  }
  
  .form-section-title {
    font-size: 0.75rem;
    margin-bottom: 10px;
  }
  
  .form-group {
    margin-bottom: 10px;
  }
  
  .form-group label {
    font-size: 0.75rem;
    margin-bottom: 4px;
  }
  
  /* Logo upload responsive */
  .logo-upload-area {
    padding: 16px;
  }
  
  .logo-preview {
    max-width: 120px;
    max-height: 60px;
  }
  
  /* Line items table responsive */
  .line-items-table {
    font-size: 0.75rem;
  }
  
  .line-items-table th {
    font-size: 0.65rem;
    padding: 6px 4px;
  }
  
  .line-items-table td {
    padding: 4px;
  }
  
  .line-items-table input {
    font-size: 0.75rem;
    padding: 6px 8px;
    min-height: 36px;
  }
  
  .line-item-total {
    font-size: 0.75rem;
    padding: 6px 8px;
  }
  
  .line-item-remove {
    width: 24px;
    height: 24px;
  }
  
  .add-line-item {
    font-size: 0.75rem;
    padding: 8px 12px;
    margin-top: 8px;
  }
  
  /* Totals responsive */
  .totals-section {
    padding: 12px;
    margin-top: 12px;
  }
  
  .total-row {
    padding: 4px 0;
    font-size: 0.8rem;
  }
  
  .total-row.grand-total {
    font-size: 0.95rem;
  }
  
  .total-input-group {
    gap: 4px;
  }
  
  .total-input-group input {
    width: 50px;
    font-size: 0.75rem;
    padding: 3px 6px;
  }
  
  /* Color presets responsive */
  .color-presets {
    gap: 6px;
  }
  
  .color-preset {
    width: 28px;
    height: 28px;
  }
  
  .custom-color-group input[type="color"] {
    width: 32px;
    height: 32px;
  }
  
  /* Template grid responsive */
  .template-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .template-option {
    padding: 8px;
  }
  
  /* Status badges responsive */
  .status-badge-option {
    padding: 5px 12px;
    font-size: 0.7rem;
  }
  
  /* Preview toolbar responsive */
  .preview-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  
  .preview-toolbar-left {
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
  }
  
  .preview-zoom {
    padding: 2px;
  }
  
  .preview-zoom button {
    width: 28px;
    height: 28px;
  }
  
  /* Document list panel on mobile */
  .doc-list-panel {
    left: 0;
    width: 100%;
    max-height: 400px;
    transform: translateY(-450px);
  }
  
  .doc-list-panel.open {
    transform: translateY(0);
  }
  
  .doc-list-item {
    padding: 10px;
  }
  
  .doc-list-icon {
    width: 36px;
    height: 36px;
  }
}

/* Small Phones (480px and below) */
@media (max-width: 480px) {
  .editor-sidebar {
    padding: 10px 12px;
  }
  
  .sidebar-brand {
    width: 32px;
    height: 32px;
  }
  
  .sidebar-btn {
    width: 36px;
    height: 36px;
  }
  
  .editor-form-panel {
    max-height: 45vh;
  }
  
  .form-panel-body {
    padding: 10px;
    max-height: calc(45vh - 100px);
  }
  
  .form-panel-header {
    padding: 10px;
  }
  
  .form-panel-header h2 {
    font-size: 1rem;
  }
  
  .form-tab {
    padding: 8px 10px;
    font-size: 0.7rem;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 16px;
  }
  
  .form-section {
    margin-bottom: 12px;
  }
  
  .form-section-title {
    font-size: 0.7rem;
    margin-bottom: 8px;
  }
  
  .form-group label {
    font-size: 0.7rem;
    margin-bottom: 3px;
  }
  
  .logo-upload-area {
    padding: 12px;
  }
  
  .logo-upload-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
  }
  
  .logo-upload-text {
    font-size: 0.8rem;
  }
  
  .logo-preview {
    max-width: 100px;
    max-height: 50px;
  }
  
  .logo-remove-btn {
    width: 20px;
    height: 20px;
    font-size: 0.6rem;
  }
  
  /* QR Code responsive */
  .qr-code-preview {
    width: 120px;
    height: 120px;
    margin: 0 auto;
  }
  
  .qr-code-options {
    padding: 12px;
    gap: 10px;
  }
  
  /* Template grid full width */
  .template-grid {
    grid-template-columns: 1fr;
  }
  
  .template-option .template-mini-preview {
    height: 50px;
  }
  
  /* Preview toolbar */
  .preview-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 10px;
  }
  
  .preview-toolbar-left {
    width: 100%;
  }
  
  .preview-zoom {
    width: 100%;
    justify-content: center;
  }
  
  /* Invoice preview mobile adjustments */
  .invoice-preview {
    transform-origin: top center !important;
  }
  
  .invoice-preview {
    padding: 24px 16px !important;
  }
  
  /* Invoice template responsive */
  .inv-header {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
  }
  
  .inv-brand {
    width: 100%;
  }
  
  .inv-brand-text h2 {
    font-size: 1.1rem;
  }
  
  .inv-brand-text p {
    font-size: 0.75rem;
  }
  
  .inv-header-right {
    width: 100%;
    text-align: left;
  }
  
  .inv-title {
    font-size: 1.1rem !important;
  }
  
  .inv-status-badge {
    font-size: 0.7rem;
  }
  
  /* Details grid single column on very small screens */
  .inv-details-grid {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px;
    margin-bottom: 16px;
  }
  
  .inv-detail-item {
    padding: 2px 0;
  }
  
  .inv-detail-item .label {
    font-size: 0.7rem;
  }
  
  .inv-detail-item .value {
    font-size: 0.75rem;
  }
  
  /* Invoice table responsive */
  .inv-table {
    font-size: 0.7rem;
    margin-bottom: 12px;
  }
  
  .inv-table thead th {
    font-size: 0.6rem;
    padding: 8px 6px;
  }
  
  .inv-table tbody td {
    padding: 10px 6px;
    font-size: 0.75rem;
  }
  
  .inv-table tbody td .item-name {
    font-size: 0.8rem;
  }
  
  .inv-table tbody td .item-desc {
    font-size: 0.7rem;
    margin-top: 1px;
  }
  
  /* Info blocks responsive */
  .inv-info-block h3 {
    font-size: 0.9rem;
  }
  
  .inv-info-block p {
    font-size: 0.75rem;
  }
  
  .inv-info-label {
    font-size: 0.65rem;
  }
  
  /* Totals responsive */
  .inv-totals-box {
    width: 100%;
    max-width: none;
  }
  
  .inv-total-row {
    font-size: 0.8rem;
  }
  
  .inv-total-row.grand {
    font-size: 1rem;
  }
  
  /* Notes responsive */
  .inv-notes {
    margin-top: 12px;
    padding: 12px;
  }
  
  .inv-notes h4 {
    font-size: 0.7rem;
    margin-bottom: 6px;
  }
  
  .inv-notes p {
    font-size: 0.75rem;
    line-height: 1.5;
  }
  
  .inv-footer {
    margin-top: 12px;
    padding-top: 10px;
    font-size: 0.7rem;
  }
  
  /* Sidebar template mobile adjustments */
  .invoice-preview.tpl-sidebar {
    flex-direction: column;
    min-height: auto;
  }
  
  .tpl-sidebar .inv-sidebar-panel {
    width: 100%;
    padding: 20px 16px;
    margin-bottom: 16px;
  }
  
  .tpl-sidebar .inv-main-panel {
    padding: 16px;
  }
  
  /* QR Code in templates */
  .inv-qr-code {
    width: 80px;
    height: 80px;
  }
  
  .inv-qr-code-container {
    justify-content: center;
    margin-bottom: 12px;
  }
  
  /* Select2 dropdown mobile */
  .select2-container--open .select2-dropdown {
    width: 100% !important;
    max-height: 200px !important;
  }
  
  .select2-selection--single {
    min-height: 40px;
    height: 40px;
  }
  
  .select2-selection__rendered {
    padding: 8px 12px;
    line-height: 24px;
  }
  
  /* Buttons minimum touch size */
  button {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Preview container adjustments */
  .preview-container {
    min-height: 300px;
    max-height: 60vh;
  }
}

/* Extra small screens (under 320px - safety net) */
@media (max-width: 320px) {
  .editor-sidebar {
    gap: 4px;
  }
  
  .sidebar-brand {
    width: 28px;
    height: 28px;
  }
  
  .sidebar-btn {
    width: 32px;
    height: 32px;
  }
  
  .form-panel-header h2 {
    font-size: 0.9rem;
  }
  
  .form-tab {
    font-size: 0.65rem;
    padding: 6px 8px;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px;
    min-height: 38px;
  }
  
  .preview-toolbar {
    padding: 6px 8px;
  }
  
  .invoice-preview {
    padding: 16px 12px !important;
  }
}

.doc-list-delete {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition-fast);
}

.doc-list-item:hover .doc-list-delete {
  opacity: 1;
}

.doc-list-delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.doc-list-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.doc-list-empty i {
  display: block;
  margin: 0 auto 12px;
  opacity: 0.4;
}

/* ---------- Select2 Custom Styling ---------- */
.select2-container {
  width: 100% !important;
}

.select2-container--default .select2-selection--single {
  background-color: var(--bg-tertiary) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  height: auto !important;
  padding: 10px 14px !important;
  color: var(--text) !important;
  font-family: var(--font-primary) !important;
  font-size: 0.85rem !important;
  transition: var(--transition-fast) !important;
  box-sizing: border-box !important;
}

.select2-container--default .select2-selection--single:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text) !important;
  padding: 0 !important;
  line-height: 1.5 !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: auto !important;
  right: 8px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--text-secondary) transparent transparent transparent !important;
  margin-top: -4px !important;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent var(--text-secondary) transparent !important;
  margin-top: -8px !important;
}

.select2-dropdown {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  background-color: var(--surface) !important;
  box-shadow: var(--shadow-lg) !important;
  z-index: 9999 !important;
}

.select2-container--default.select2-container--open .select2-selection--single {
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.select2-container--default .select2-results__option {
  color: var(--text) !important;
  padding: 10px 14px !important;
  font-family: var(--font-primary) !important;
  font-size: 0.85rem !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--primary-50) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: rgba(99, 102, 241, 0.15) !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
  background-color: var(--primary-100) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .select2-container--default .select2-results__option[aria-selected=true] {
  background-color: rgba(99, 102, 241, 0.2) !important;
}

.select2-container--default .select2-results__group {
  color: var(--text-secondary) !important;
  font-weight: 600 !important;
  padding: 8px 12px !important;
  font-size: 0.8rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  background: var(--bg-tertiary) !important;
}

.select2-search--dropdown .select2-search__field {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  color: var(--text) !important;
  font-family: var(--font-primary) !important;
  padding: 8px 12px !important;
  margin: 8px !important;
  font-size: 0.9rem !important;
}

.select2-search--dropdown .select2-search__field:focus {
  border-color: var(--primary) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* Dark mode adjustments */
[data-theme="dark"] .select2-container--default .select2-selection--single {
  background-color: var(--bg-tertiary) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .select2-dropdown {
  background-color: var(--surface) !important;
}

[data-theme="dark"] .select2-container--default .select2-results__option {
  color: var(--text) !important;
}

/* ---------- Responsive Editor ---------- */
@media (max-width: 1200px) {
  .editor-form-panel {
    width: 380px;
  }
}

@media (max-width: 1024px) {
  .editor-sidebar {
    width: 56px;
  }

  .editor-form-panel {
    width: 340px;
  }

  .preview-container {
    padding: 16px;
  }
}

@media (max-width: 768px) {
  .editor-layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .editor-sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    padding: 8px 12px;
    overflow-x: auto;
  }

  .sidebar-nav {
    flex-direction: row;
  }

  .sidebar-bottom {
    flex-direction: row;
    margin-left: auto;
  }

  .sidebar-brand {
    margin-bottom: 0;
    margin-right: 16px;
  }

  .editor-form-panel {
    width: 100%;
    max-height: 50vh;
  }

  .editor-preview-panel {
    min-height: 50vh;
  }

  .invoice-preview {
    width: 100%;
    min-height: auto;
  }

  .doc-list-panel {
    left: 0;
    width: 100%;
    transform: translateX(-100%);
  }
}
