/* ==========================================================================
   Rafay Invoice — Industrial Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Core Palette */
  --c-bg:         #F3F5F7;
  --c-surface:    #FFFFFF;
  --c-surface-2:  #F8FAFC;
  --c-border:     #D7DDE5;
  --c-border-md:  #AEB8C5;
  --c-border-focus: #1F2937;

  --c-text:       #111827;
  --c-text-2:     #4B5563;
  --c-text-3:     #7B8794;
  --c-text-inv:   #FFFFFF;

  --c-accent:     #F2B705;
  --c-accent-dk:  #D99A00;
  --c-accent-soft:#FFF7D6;
  --c-accent-text:#111827;

  --c-primary:    #111827;
  --c-primary-2:  #1F2937;

  --c-danger:     #D32F2F;
  --c-danger-bg:  #FFF0F0;
  --c-success:    #2E7D32;
  --c-success-bg: #F0FFF2;
  --c-warning:    #E65100;
  --c-warning-bg: #FFF8F0;
  --c-info:       #1565C0;
  --c-info-bg:    #F0F4FF;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.06);
  --shadow-md: 0 8px 20px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-lg: 0 18px 36px rgba(15,23,42,0.14), 0 1px 2px rgba(15,23,42,0.06);
  --shadow-xl: 0 28px 70px rgba(15,23,42,0.24);

  /* Type */
  --font:      'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  /* Layout */
  --header-h: 60px;
  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 8px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: var(--font); color: var(--c-text); background: var(--c-bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4 { font-weight: 700; letter-spacing: -0.02em; }
a { color: var(--c-primary); }
input, select, textarea, button { font-family: var(--font); }

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--c-primary);
  border-bottom: 1px solid #2A2A2A;
}

.header-container {
  display: flex; align-items: center; height: 100%;
  padding: 0 20px; gap: 16px;
  max-width: 1920px; margin: 0 auto;
}

.logo-area { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.logo-mark { width: 32px; height: 32px; flex-shrink: 0; }
.logo-text { display: flex; flex-direction: column; }
.logo-name { font-size: 0.85rem; font-weight: 700; color: #FFFFFF; letter-spacing: 0.08em; font-family: var(--font-mono); }
.logo-sub { font-size: 0.6rem; color: #666660; letter-spacing: 0.12em; margin-top: 1px; font-family: var(--font-mono); }

.header-nav { display: flex; align-items: center; gap: 8px; }
.header-divider { width: 1px; height: 22px; background: #333330; margin: 0 4px; }

/* Header Buttons */
.hbtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--r-md);
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s ease; white-space: nowrap;
  letter-spacing: 0.02em;
}
.hbtn svg { width: 16px; height: 16px; flex-shrink: 0; }

.hbtn-ghost {
  background: transparent; color: #A0A09A; border-color: #2E2E2A;
}
.hbtn-ghost:hover { background: #1A1A1A; color: #FFFFFF; border-color: #404040; }

.hbtn-accent {
  background: var(--c-accent); color: var(--c-accent-text); border-color: var(--c-accent);
}
.hbtn-accent:hover { background: var(--c-accent-dk); border-color: var(--c-accent-dk); }

.hbtn-primary {
  background: var(--c-surface); color: var(--c-primary); border-color: var(--c-surface);
}
.hbtn-primary:hover { background: #E8E8E4; }

.hbtn-danger {
  background: transparent; color: #FF5252; border-color: #3A2020;
  padding: 7px 10px;
}
.hbtn-danger:hover { background: #2A1010; border-color: #FF5252; }
.hbtn-danger svg { width: 15px; height: 15px; }

.hbtn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Count chip */
.count-chip {
  display: inline-flex; align-items: center; justify-content: center;
  background: #2A2A2A; color: var(--c-accent); font-size: 0.7rem;
  font-weight: 700; border-radius: 10px; padding: 1px 7px;
  min-width: 22px; font-family: var(--font-mono);
}

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle-lbl { font-size: 0.75rem; color: #666660; letter-spacing: 0.04em; }

.toggle-switch { position: relative; width: 40px; height: 22px; display: inline-block; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0; background: #2A2A2A;
  border-radius: 11px; border: 1px solid #3A3A3A;
  cursor: pointer; transition: all 0.2s;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: #666660;
  border-radius: 50%; transition: all 0.2s;
}
input:checked ~ .toggle-track { background: var(--c-accent); border-color: var(--c-accent); }
input:checked ~ .toggle-track .toggle-thumb { left: 20px; background: var(--c-primary); }

/* ============================================================
   MOBILE TABS
   ============================================================ */
.mobile-tabs {
  display: none; position: fixed; top: var(--header-h); left: 0; right: 0;
  height: 44px; z-index: 90; background: var(--c-primary-2);
  border-bottom: 1px solid #2A2A2A; padding: 5px 8px; gap: 4px;
}
.mtab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; border: none; color: #666660;
  font-weight: 600; font-size: 0.82rem; border-radius: var(--r-sm);
  cursor: pointer; transition: all 0.12s;
}
.mtab svg { width: 15px; height: 15px; }
.mtab.active { background: var(--c-primary); color: #FFFFFF; }

/* ============================================================
   WORKSPACE
   ============================================================ */
.workspace {
  margin-top: var(--header-h);
  display: grid; grid-template-columns: 1fr auto 1fr;
  height: calc(100vh - var(--header-h)); overflow: hidden;
}

.workspace-resizer {
  width: 6px;
  height: 100%;
  background: #1e1e1a;
  border-left: 1px solid #141411;
  border-right: 1px solid #2d2d27;
  cursor: col-resize;
  position: relative;
  z-index: 1000;
  transition: background 0.15s, width 0.15s;
  user-select: none;
}
.workspace-resizer::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 2px; height: 30px;
  background: var(--c-text-3);
  border-radius: 1px;
  opacity: 0.3;
  transition: opacity 0.15s;
}
.workspace-resizer:hover, .workspace-resizer.is-dragging {
  background: var(--c-accent);
  border-left-color: var(--c-accent-dk);
  border-right-color: var(--c-accent);
}
.workspace-resizer:hover::after, .workspace-resizer.is-dragging::after {
  background: var(--c-primary);
  opacity: 0.9;
}

.panel { height: 100%; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--c-border) transparent; }

.panel-editor { background: var(--c-bg); padding: 20px; }
.panel-preview { background: #2A2A26; display: flex; flex-direction: column; align-items: center; padding: 20px; }

/* ============================================================
   EDITOR CARDS
   ============================================================ */
.card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--c-border);
  background: var(--c-bg); border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.card-head h3 { font-size: 0.85rem; color: var(--c-text); flex: 1; }
.card-head-icon {
  width: 30px; height: 30px; background: var(--c-primary);
  border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card-head-icon svg { width: 14px; height: 14px; color: var(--c-accent); }

.card-body { padding: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.grid1 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.span2 { grid-column: span 2; }

/* Collapsible Cards */
.collapse-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); margin-bottom: 12px; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.collapse-card:hover { box-shadow: var(--shadow-md); }

.collapse-trigger {
  width: 100%; background: var(--c-bg); border: none;
  padding: 13px 16px; display: flex; justify-content: space-between;
  align-items: center; cursor: pointer; outline: none;
}
.collapse-trigger:hover { background: #ECEAE4; }

.ct-left { display: flex; align-items: center; gap: 10px; }
.ct-icon {
  width: 30px; height: 30px; background: var(--c-primary);
  border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ct-icon svg { width: 14px; height: 14px; color: var(--c-accent); }
.ct-left span { font-size: 0.85rem; font-weight: 700; color: var(--c-text); }

.ct-right { display: flex; align-items: center; gap: 10px; }
.chevron { width: 14px; height: 14px; color: var(--c-text-3); transition: transform 0.2s; }
.collapse-card.open .chevron { transform: rotate(180deg); }

.collapse-body { display: none; border-top: 1px solid var(--c-border); padding: 16px; }
.collapse-card.open .collapse-body { display: block; }

/* Tags */
.tag { font-size: 0.65rem; font-weight: 700; padding: 2px 8px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-mono); }
.tag-required { background: var(--c-danger-bg); color: var(--c-danger); }
.tag-optional { background: var(--c-info-bg); color: var(--c-info); }
.tag-info { background: #F0FFF4; color: var(--c-success); }

/* ============================================================
   FORM CONTROLS
   ============================================================ */
.fg { display: flex; flex-direction: column; gap: 5px; }
.fg label {
  font-size: 0.72rem; font-weight: 700; color: var(--c-text-2);
  text-transform: uppercase; letter-spacing: 0.07em;
}
.req { color: var(--c-danger); }
.err { font-size: 0.72rem; color: var(--c-danger); font-weight: 600; display: none; margin-top: 2px; }
.fg.has-error .err { display: block; }

input[type="text"], input[type="date"], input[type="number"],
input[type="email"], input[type="tel"], input[type="url"],
select, textarea {
  width: 100%; padding: 9px 11px;
  font-family: var(--font); font-size: 0.85rem; color: var(--c-text);
  background: #FFFFFF; border: 1px solid var(--c-border);
  border-radius: var(--r-md); outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(10,10,10,0.08);
}
textarea { resize: vertical; }
.fg.has-error input, .fg.has-error select, .fg.has-error textarea { border-color: var(--c-danger); }

.input-action { display: flex; gap: 6px; }
.input-action input { flex: 1; }
.btn-inline {
  padding: 0 12px; background: var(--c-primary); color: var(--c-accent);
  border: none; border-radius: var(--r-md); cursor: pointer;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em;
  font-family: var(--font-mono); transition: background 0.12s; white-space: nowrap;
}
.btn-inline:hover { background: var(--c-primary-2); }

.date-range { display: flex; align-items: center; gap: 8px; }
.date-range input { flex: 1; }
.range-sep { font-size: 0.8rem; color: var(--c-text-3); font-family: var(--font-mono); }

.due-badge {
  font-size: 0.72rem; font-weight: 600; padding: 3px 8px;
  border-radius: var(--r-sm); font-family: var(--font-mono);
  background: var(--c-info-bg); color: var(--c-info);
}

.section-sep {
  font-size: 0.7rem; font-weight: 700; color: var(--c-text-3);
  text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--c-border); padding-bottom: 6px;
  margin-top: 4px; font-family: var(--font-mono);
}

/* Checkbox */
.fg-check { grid-column: span 2; padding: 4px 0; }
.check-label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 0.84rem; color: var(--c-text); }
.check-label input[type="checkbox"] { display: none; }
.check-box {
  width: 18px; height: 18px; border: 1.5px solid var(--c-border-md);
  border-radius: 3px; flex-shrink: 0; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s; background: #FFF;
}
.check-label input:checked + .check-box { background: var(--c-primary); border-color: var(--c-primary); }
.check-label input:checked + .check-box::after { content: ''; display: block; width: 10px; height: 5px; border-left: 2px solid var(--c-accent); border-bottom: 2px solid var(--c-accent); transform: rotate(-45deg) translateY(-2px); }

/* ============================================================
   LOGO UPLOAD
   ============================================================ */
.logo-zone {
  border: 1.5px dashed var(--c-border-md); border-radius: var(--r-lg);
  background: var(--c-bg); cursor: pointer; min-height: 100px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; position: relative; overflow: hidden;
}
.logo-zone:hover { border-color: var(--c-primary); background: #ECEAE4; }
.logo-zone.dragover { border-color: var(--c-accent); background: #F8FFF0; }

.zone-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px; }
.zone-empty svg { width: 40px; height: 40px; color: var(--c-text-3); }
.zone-empty p { font-size: 0.85rem; color: var(--c-text-2); }
.zone-empty span { font-size: 0.72rem; color: var(--c-text-3); }

.zone-preview { width: 100%; display: flex; justify-content: center; align-items: center; padding: 16px; position: relative; }
.zone-preview img { max-height: 90px; max-width: 100%; object-fit: contain; border-radius: var(--r-sm); }
.remove-logo-btn {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--c-danger); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #FFF; box-shadow: var(--shadow-md);
}
.remove-logo-btn svg { width: 12px; height: 12px; }

/* ============================================================
   ADD BUTTONS
   ============================================================ */
.btn-add {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-md);
  background: var(--c-primary); color: var(--c-accent);
  border: none; cursor: pointer; font-size: 0.75rem;
  font-weight: 700; letter-spacing: 0.04em; transition: background 0.12s;
  margin-left: auto;
}
.btn-add svg { width: 13px; height: 13px; }
.btn-add:hover { background: var(--c-primary-2); }

.btn-add-sm { padding: 5px 10px; font-size: 0.7rem; margin-left: 0; }
.btn-add-alt { background: #1A4A1A; color: #7CFC7C; }
.btn-add-alt:hover { background: #143614; }

.head-actions { display: flex; gap: 6px; margin-left: auto; }

/* ============================================================
   DATA TABLES (Editor)
   ============================================================ */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
}
.data-table th {
  background: var(--c-bg); color: var(--c-text-2);
  font-size: 0.68rem; font-weight: 700; padding: 9px 10px;
  border-bottom: 1px solid var(--c-border); text-transform: uppercase;
  letter-spacing: 0.06em; white-space: nowrap; font-family: var(--font-mono);
  vertical-align: middle;
  text-align: left;
}
.data-table td {
  padding: 8px 6px; border-bottom: 1px solid var(--c-border); vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--c-bg); }
.data-table input, .data-table select { padding: 6px 8px; font-size: 0.8rem; }
.data-table textarea { padding: 6px 8px; font-size: 0.78rem; min-width: 180px; }

.drag-h { color: var(--c-text-3); font-size: 1rem; cursor: grab; user-select: none; text-align: center; }
.drag-h:active { cursor: grabbing; }

/* Table Spacing & Drag States */
#items-table {
  min-width: 1100px;
}
#allowances-charges-table {
  min-width: 850px;
}
.data-table tr.dragging {
  opacity: 0.4;
  background: var(--c-bg) !important;
  border: 1.5px dashed var(--c-primary);
}
.data-table tr.drag-over {
  border-top: 3px solid var(--c-accent) !important;
}

.item-desc-wrap { display: flex; flex-direction: column; gap: 4px; }

.row-actions { display: flex; gap: 3px; }
.ra-btn {
  width: 28px; height: 28px; border: none; background: transparent;
  border-radius: var(--r-sm); cursor: pointer; color: var(--c-text-3);
  display: flex; align-items: center; justify-content: center; transition: all 0.1s;
}
.ra-btn svg {
  width: 14px; height: 14px;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
  flex-shrink: 0;
}
.ra-btn:hover { background: var(--c-bg); color: var(--c-text); }
.ra-btn.del:hover { background: var(--c-danger-bg); color: var(--c-danger); }

.net-cell { font-family: var(--font-mono); font-weight: 600; text-align: right; padding-top: 14px; font-size: 0.8rem; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 40px 20px; text-align: center; color: var(--c-text-3);
}
.empty-state svg { width: 40px; height: 40px; }
.empty-state p { font-size: 0.85rem; }

.empty-state-sm { padding: 20px; text-align: center; color: var(--c-text-3); font-size: 0.82rem; }

/* Attachments */
.attachment-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--c-bg); border: 1px solid var(--c-border);
  border-radius: var(--r-md); margin-bottom: 6px; font-size: 0.82rem;
}
.att-info { display: flex; align-items: center; gap: 8px; }
.att-info svg { width: 16px; height: 16px; color: var(--c-text-3); }
.att-name { font-weight: 600; }
.att-size { color: var(--c-text-3); font-size: 0.72rem; font-family: var(--font-mono); }

/* ============================================================
   PREVIEW PANEL
   ============================================================ */
.preview-toolbar {
  width: 100%; max-width: 800px; display: flex; justify-content: space-between;
  align-items: center; background: var(--c-primary); color: #FFFFFF;
  padding: 10px 16px; border-radius: var(--r-lg) var(--r-lg) 0 0; flex-shrink: 0;
}
.prev-title { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 600; }
.prev-title svg { width: 16px; height: 16px; color: var(--c-accent); }
.sync-indicator {
  font-size: 0.7rem; color: var(--c-accent); font-family: var(--font-mono);
  background: rgba(232,255,60,0.1); padding: 2px 8px; border-radius: 3px;
}

/* ============================================================
   A4 INVOICE
   ============================================================ */
.invoice-a4 {
  width: 100%; max-width: 800px; min-height: 1080px;
  background: #FFFFFF; padding: 44px 48px;
  box-shadow: 0 4px 40px rgba(0,0,0,0.3);
  border-bottom: none; position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  font-family: var(--font); font-size: 0.82rem; color: #1A1A1A;
  line-height: 1.45;
}

.inv-watermark {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  font-size: 8rem; font-weight: 900; color: rgba(0,0,0,0.04);
  letter-spacing: 0.2em; pointer-events: none; user-select: none; z-index: 1;
  border: 8px solid rgba(0,0,0,0.04); padding: 8px 32px;
  font-family: var(--font-mono);
}

/* Invoice Header */
.inv-header {
  display: flex; justify-content: space-between; align-items: flex-start; z-index: 2;
}
.inv-logo { max-width: 160px; max-height: 60px; display: flex; align-items: center; }
.inv-logo img { max-width: 100%; max-height: 60px; object-fit: contain; }
.logo-placeholder {
  font-size: 0.72rem; font-weight: 800; color: #AAAAAA; background: #F4F4F0;
  border: 1.5px dashed #CCCCCA; padding: 12px 20px; border-radius: 4px;
  letter-spacing: 0.12em; font-family: var(--font-mono);
}

.inv-meta { text-align: right; }
.inv-meta h2 { font-size: 2rem; color: #0A0A0A; letter-spacing: -0.04em; margin-bottom: 10px; font-family: var(--font-mono); font-weight: 700; }

.meta-tbl { margin-left: auto; border-collapse: collapse; font-size: 0.78rem; }
.meta-tbl td { padding: 2px 0 2px 12px; }
.meta-tbl .ml { color: #888880; text-align: right; }

.inv-rule { height: 2px; background: #0A0A0A; margin: 18px 0; z-index: 2; }

/* Parties */
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 20px; z-index: 2; }
.party { display: flex; flex-direction: column; }
.party-lbl { font-size: 0.62rem; font-weight: 700; color: #888880; letter-spacing: 0.1em; text-transform: uppercase; font-family: var(--font-mono); border-bottom: 1px solid #EAEAE6; padding-bottom: 4px; margin-bottom: 6px; }
.party-name { font-size: 0.92rem; font-weight: 700; color: #0A0A0A; margin-bottom: 2px; }
.party-sub { font-size: 0.75rem; color: #888880; font-style: italic; margin-bottom: 4px; }
.party-addr, .party-ids, .party-contact { font-size: 0.76rem; color: #444440; line-height: 1.4; margin-bottom: 4px; }

/* Delivery */
.inv-delivery { background: #F8F8F4; border: 1px solid #E4E4E0; border-radius: 4px; padding: 10px 14px; margin-bottom: 16px; z-index: 2; }
.delivery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 0.76rem; }
.delivery-grid .span2 { grid-column: span 2; }

/* Specs */
.inv-specs { display: grid; grid-template-columns: repeat(4,1fr); border: 1px solid #E4E4E0; border-radius: 4px; margin-bottom: 18px; background: #F8F8F4; overflow: hidden; z-index: 2; }
.spec { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid #E4E4E0; }
.spec:last-child { border-right: none; }
.spec-l { font-size: 0.62rem; font-weight: 700; color: #888880; text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-mono); }
.spec-v { font-size: 0.76rem; font-weight: 700; color: #0A0A0A; }

/* Intro */
.inv-intro { font-size: 0.8rem; color: #444440; font-style: italic; margin-bottom: 16px; z-index: 2; }

/* Invoice Tables */
.inv-table { width: 100%; border-collapse: collapse; font-size: 0.76rem; margin-bottom: 4px; z-index: 2; }
.inv-table th { background: #0A0A0A; color: #FFFFFF; padding: 8px 10px; font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; font-family: var(--font-mono); }
.inv-table td { padding: 8px 10px; border-bottom: 1px solid #F0F0EC; color: #2A2A2A; vertical-align: top; }
.inv-table tbody tr:nth-child(even) td { background: #FAFAF8; }
.inv-table-sm th { background: #F4F4F0; color: #444440; font-size: 0.62rem; }
.inv-table-sm th:first-child { border-radius: 0; }

.block-label { font-size: 0.62rem; font-weight: 700; color: #888880; text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--font-mono); margin-bottom: 6px; margin-top: 12px; }

.ar { text-align: right; }
.mono { font-family: var(--font-mono); }

/* Bottom layout */
.inv-bottom { display: grid; grid-template-columns: 54% 46%; gap: 24px; margin-top: 16px; z-index: 2; }
.inv-bottom-left { display: flex; flex-direction: column; gap: 12px; }

/* QR Block */
.qr-block {
  display: flex; align-items: center; gap: 14px;
  background: #F8F8F4; border: 1px solid #DDE3EA;
  border-left: 3px solid #0A0A0A; border-radius: 4px;
  padding: 11px 12px;
}
.qr-graphic {
  width: 78px; height: 78px; padding: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #FFFFFF; border: 1px solid #111827;
  box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 4px #DDE3EA;
}
.qr-matrix { width: 100%; height: 100%; display: block; shape-rendering: crispEdges; }
.qr-matrix rect { fill: #111827; }
.qr-matrix .qr-bg, .qr-matrix .qr-cut { fill: #FFFFFF; }
.qr-info {
  min-width: 0; font-size: 0.72rem; line-height: 1.4;
  display: flex; flex-direction: column; gap: 2px;
}
.qr-info strong { color: #0A0A0A; font-size: 0.78rem; }
.qr-kicker {
  color: #64748B; font-family: var(--font-mono); font-size: 0.58rem;
  font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
}
.qr-ref {
  max-width: 180px; overflow-wrap: anywhere;
  color: #111827; font-size: 0.68rem;
}

/* Payment */
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; font-size: 0.74rem; margin-bottom: 6px; }
.pay-grid .span2 { grid-column: span 2; }
.pl { color: #888880; font-weight: 600; margin-right: 4px; }
.pay-terms { font-size: 0.7rem; color: #888880; font-style: italic; line-height: 1.4; }

/* Notes */
.notes-body { font-size: 0.74rem; color: #444440; line-height: 1.45; white-space: pre-line; }
.inv-closing { font-size: 0.76rem; font-style: italic; font-weight: 600; color: #0A0A0A; }

/* Totals */
.inv-bottom-right { display: flex; flex-direction: column; gap: 12px; }
.totals-tbl { width: 100%; border-collapse: collapse; font-size: 0.78rem; border: 1px solid #E4E4E0; border-radius: 4px; overflow: hidden; }
.totals-tbl td { padding: 7px 10px; border-bottom: 1px solid #F0F0EC; }
.totals-tbl td:last-child { text-align: right; font-family: var(--font-mono); font-size: 0.76rem; }
.totals-tbl tr:last-child td { border-bottom: none; }

.row-sub { background: #F4F4F0; }
.row-sub td { font-weight: 700; }
.row-gross { background: #0A0A0A; }
.row-gross td { color: #FFFFFF; font-weight: 800; font-size: 0.82rem !important; border-bottom: none; }
.row-due { background: var(--c-accent); }
.row-due td { color: #0A0A0A; font-weight: 900; font-size: 0.88rem !important; border-bottom: none; }

/* Tax Breakdown */
.tax-breakdown { border: 1px solid #E4E4E0; border-radius: 4px; padding: 8px 10px; background: #F8F8F4; }
.tax-tbl { width: 100%; border-collapse: collapse; font-size: 0.7rem; }
.tax-tbl th { color: #888880; font-weight: 700; padding: 3px 0; border-bottom: 1px solid #E4E4E0; font-family: var(--font-mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em; }
.tax-tbl td { padding: 5px 0; border-bottom: 1px solid #F0F0EC; }
.tax-tbl tr:last-child td { border-bottom: none; }

/* Footer */
.inv-footer { margin-top: 16px; padding-top: 10px; z-index: 2; }
.footer-legal { font-size: 0.64rem; color: #888880; line-height: 1.4; text-align: center; margin-bottom: 6px; white-space: pre-line; }
.footer-brand { font-size: 0.6rem; color: #AAAAAA; text-align: center; font-family: var(--font-mono); letter-spacing: 0.08em; }

/* Inline item sub desc */
.sub-desc { font-size: 0.68rem; color: #888880; margin-top: 3px; }

/* Preview Attachments List */
.prev-attachments {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.prev-att-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 0.7rem;
  color: var(--inv-ink);
}
.prev-att-row svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 1.5;
  flex-shrink: 0;
}

.att-download-link {
  color: var(--c-primary);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.12s;
}
.att-download-link:hover {
  text-decoration: underline;
  opacity: 0.8;
}

/* ============================================================
   DRAWER
   ============================================================ */
.drawer { position: fixed; inset: 0; z-index: 1000; visibility: hidden; transition: visibility 0.25s; }
.drawer[aria-hidden="false"] { visibility: visible; }

.drawer-overlay { position: absolute; inset: 0; background: rgba(10,10,10,0.5); backdrop-filter: blur(2px); opacity: 0; transition: opacity 0.25s; }
.drawer[aria-hidden="false"] .drawer-overlay { opacity: 1; }

.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 100%; max-width: 500px;
  background: var(--c-surface); box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.28s cubic-bezier(0.16,1,0.3,1);
}
.drawer[aria-hidden="false"] .drawer-panel { transform: translateX(0); }

.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--c-border); background: var(--c-bg); }
.drawer-head h2 { font-size: 1rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }

.icon-btn { background: transparent; border: 1px solid var(--c-border); border-radius: var(--r-sm); width: 32px; height: 32px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--c-text-2); transition: all 0.12s; }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn:hover { background: var(--c-danger-bg); color: var(--c-danger); border-color: var(--c-danger); }

.filter-bar { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; margin-bottom: 16px; }

.hist-list { display: flex; flex-direction: column; gap: 10px; }
.hist-item { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 14px; transition: all 0.12s; position: relative; }
.hist-item:hover { border-color: var(--c-primary); box-shadow: var(--shadow-md); }
.hist-item-no { font-family: var(--font-mono); font-size: 0.72rem; color: var(--c-text-3); margin-bottom: 4px; }
.hist-item-buyer { font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; }
.hist-item-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 0.75rem; color: var(--c-text-2); margin-bottom: 10px; }
.hist-item-amt { font-size: 1rem; font-weight: 800; color: var(--c-primary); font-family: var(--font-mono); }
.hist-actions { display: flex; gap: 6px; border-top: 1px solid var(--c-border); padding-top: 10px; }
.hist-actions .hbtn { padding: 5px 10px; font-size: 0.72rem; border: 1px solid var(--c-border); background: var(--c-bg); color: var(--c-text); }
.hist-actions .hbtn:hover { background: var(--c-primary); color: var(--c-text-inv); border-color: var(--c-primary); }
.hist-actions .hbtn-load { background: var(--c-primary); color: var(--c-accent); border-color: var(--c-primary); }
.hist-actions .hbtn-del { color: var(--c-danger); border-color: var(--c-danger-bg); }
.hist-actions .hbtn-del:hover { background: var(--c-danger); color: #FFF; border-color: var(--c-danger); }
.hist-status-row { margin-top: 8px; }
.hist-status-row label { font-size: 0.68rem; font-weight: 700; color: var(--c-text-3); text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-mono); display: block; margin-bottom: 3px; }
.hist-status-row select { width: auto; min-width: 120px; padding: 4px 8px; font-size: 0.76rem; }

.status-badge {
  position: absolute; top: 14px; right: 14px; font-size: 0.62rem; font-weight: 800;
  padding: 2px 8px; border-radius: 3px; text-transform: uppercase;
  letter-spacing: 0.07em; font-family: var(--font-mono);
}
.status-paid { background: var(--c-success-bg); color: var(--c-success); }
.status-unpaid { background: var(--c-danger-bg); color: var(--c-danger); }
.status-pending { background: var(--c-warning-bg); color: var(--c-warning); }

.hist-empty { display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 20px; color: var(--c-text-3); gap: 12px; }
.hist-empty svg { width: 48px; height: 48px; }
.hist-empty h3 { font-size: 1rem; color: var(--c-text-2); }
.hist-empty p { font-size: 0.82rem; }

/* ============================================================
   MODAL
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 2000; visibility: hidden; display: flex; align-items: center; justify-content: center; transition: visibility 0.25s; }
.modal[aria-hidden="false"] { visibility: visible; }

.modal-overlay { position: absolute; inset: 0; background: rgba(10,10,10,0.55); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.25s; }
.modal[aria-hidden="false"] .modal-overlay { opacity: 1; }

.modal-panel {
  position: relative; background: var(--c-surface); border-radius: 12px;
  box-shadow: var(--shadow-xl); max-width: 600px; width: 92%;
  max-height: 88vh; display: flex; flex-direction: column; z-index: 2;
  transform: translateY(16px); opacity: 0; transition: all 0.25s cubic-bezier(0.16,1,0.3,1);
  overflow: hidden;
}
.modal[aria-hidden="false"] .modal-panel { transform: translateY(0); opacity: 1; }

.modal-panel form {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--c-border); background: var(--c-bg); border-radius: 12px 12px 0 0; }
.modal-head h2 { font-size: 0.95rem; }
.modal-hint { font-size: 0.8rem; color: var(--c-text-2); margin-bottom: 16px; line-height: 1.5; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--c-border); display: flex; justify-content: flex-end; gap: 10px; align-items: center; background: var(--c-bg); border-radius: 0 0 12px 12px; }

.sub-tabs { display: flex; border-bottom: 2px solid var(--c-border); gap: 0; margin-bottom: 18px; }
.stab { background: transparent; border: none; padding: 10px 16px; font-size: 0.82rem; font-weight: 700; color: var(--c-text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.12s; letter-spacing: 0.02em; }
.stab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.stab:hover { color: var(--c-text); }

.subtab { display: none; }
.subtab.active { display: grid; }

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
.notification-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; max-width: 360px; width: 100%; pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-info); border-radius: var(--r-md);
  padding: 14px 16px; box-shadow: var(--shadow-lg);
  transform: translateX(120%); animation: toastIn 0.25s ease forwards;
  transition: opacity 0.2s, transform 0.2s; pointer-events: all;
}
.toast-success { border-left-color: var(--c-success); }
.toast-danger { border-left-color: var(--c-danger); }
.toast-warning { border-left-color: var(--c-warning); }

.toast-icon-wrap { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast-icon-wrap svg { width: 14px; height: 14px; }
.toast.toast-success .toast-icon-wrap { background: var(--c-success-bg); color: var(--c-success); }
.toast.toast-danger .toast-icon-wrap { background: var(--c-danger-bg); color: var(--c-danger); }
.toast.toast-warning .toast-icon-wrap { background: var(--c-warning-bg); color: var(--c-warning); }
.toast-info .toast-icon-wrap { background: var(--c-info-bg); color: var(--c-info); }

.toast-body { flex: 1; }
.toast-title { font-size: 0.82rem; font-weight: 700; color: var(--c-text); margin-bottom: 2px; }
.toast-msg { font-size: 0.76rem; color: var(--c-text-2); line-height: 1.4; }
.toast-close { background: transparent; border: none; font-size: 1.1rem; color: var(--c-text-3); cursor: pointer; padding: 0; line-height: 1; }
.toast-close:hover { color: var(--c-text); }

@keyframes toastIn { to { transform: translateX(0); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .workspace { grid-template-columns: 1fr !important; height: auto; overflow: visible; }
  .workspace-resizer { display: none !important; }
  
  /* Scrollable faithful preview */
  .panel { display: none; height: auto; overflow-y: visible; padding: 14px; }
  .panel.active { display: flex; flex-direction: column; }
  
  .panel-preview {
    background: #172033;
    overflow-x: auto !important;
    width: 100%;
    padding: 14px;
    -webkit-overflow-scrolling: touch;
  }
  .panel-preview.active {
    display: block !important;
  }
  
  .preview-toolbar {
    min-width: 760px;
    margin: 0 auto 12px auto;
  }
  .invoice-a4 {
    min-width: 760px;
    margin: 0 auto;
  }
  
  .mobile-tabs { display: flex; }
  .workspace { margin-top: calc(var(--header-h) + 44px); }
}

@media (max-width: 768px) {
  .app-header { padding: 0 10px; }
  .logo-sub { display: none !important; }
  .logo-name { font-size: 0.76rem; letter-spacing: 0.04em; }
  .header-nav { gap: 6px; }
  
  /* Compact action-only buttons on mobile */
  .hbtn-txt { display: none !important; }
  .header-divider { display: none !important; }
  .header-nav .hbtn {
    position: relative !important;
    padding: 8px !important;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
  }
  .header-nav .hbtn svg { margin: 0 !important; width: 18px; height: 18px; }
  
  /* Absolute history badge positioning */
  .count-chip {
    position: absolute;
    top: -4px;
    right: -4px;
    margin: 0 !important;
    font-size: 0.6rem;
    padding: 1px 5px;
    min-width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  }
  
  .toggle-wrap { gap: 4px; }
  .toggle-lbl { display: none !important; }
  
  .grid2 { grid-template-columns: 1fr; }
  .span2 { grid-column: span 1; }
  .section-sep { grid-column: span 1; }
  
  .inv-parties { grid-template-columns: 1fr; gap: 16px; }
  .inv-bottom { grid-template-columns: 1fr; }
  .inv-specs { grid-template-columns: repeat(2,1fr); }
  .filter-bar { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hist-actions {
    flex-wrap: wrap;
    gap: 4px;
  }
  .hist-actions .hbtn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    padding: 6px !important;
    font-size: 0.68rem !important;
    height: auto !important;
    width: auto !important;
  }
}

/* ============================================================
   INDUSTRIAL RESPONSIVE POLISH
   ============================================================ */
.app-header {
  background: linear-gradient(90deg, #0F172A 0%, #111827 54%, #1F2937 100%);
  border-bottom-color: rgba(242,183,5,0.28);
  box-shadow: 0 10px 24px rgba(15,23,42,0.18);
}

.header-container { min-width: 0; }
.logo-area { min-width: 210px; }
.logo-mark { filter: drop-shadow(0 6px 10px rgba(242,183,5,0.24)); }
.logo-sub { color: #94A3B8; }
.header-nav { min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
.hbtn { min-height: 36px; border-radius: 6px; }
.hbtn-ghost { color: #CBD5E1; border-color: rgba(148,163,184,0.28); }
.hbtn-ghost:hover { background: rgba(255,255,255,0.08); border-color: rgba(242,183,5,0.45); }
.hbtn-primary { background: #FFFFFF; border-color: #FFFFFF; box-shadow: 0 8px 18px rgba(255,255,255,0.08); }
.hbtn-accent { box-shadow: 0 8px 18px rgba(242,183,5,0.18); }
.count-chip { background: rgba(242,183,5,0.13); color: var(--c-accent); }
.toggle-lbl { color: #94A3B8; }

.workspace {
  background:
    linear-gradient(90deg, rgba(15,23,42,0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15,23,42,0.04) 1px, transparent 1px),
    var(--c-bg);
  background-size: 32px 32px;
}

.panel-editor { padding: 24px; }
.panel-preview {
  background:
    radial-gradient(circle at top left, rgba(242,183,5,0.16), transparent 34%),
    linear-gradient(145deg, #172033 0%, #111827 48%, #0B1120 100%);
  border-left: 1px solid rgba(255,255,255,0.06);
}

.card, .collapse-card {
  border-color: rgba(148,163,184,0.34);
  box-shadow: 0 1px 0 rgba(255,255,255,0.75), var(--shadow-sm);
}
.card:hover, .collapse-card:hover { transform: translateY(-1px); }
.card-head, .collapse-trigger, .drawer-head, .modal-head, .modal-foot {
  background: linear-gradient(180deg, #FFFFFF 0%, var(--c-surface-2) 100%);
}
.card-head-icon, .ct-icon {
  background: #111827;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.card-head-icon svg, .ct-icon svg { color: var(--c-accent); }
.collapse-trigger:hover { background: #F1F5F9; }

input[type="text"], input[type="date"], input[type="number"],
input[type="email"], input[type="tel"], input[type="url"],
select, textarea {
  min-height: 38px;
  background: #FFFFFF;
  border-color: #CBD5E1;
}
input:hover, select:hover, textarea:hover { border-color: #94A3B8; }
input:focus, select:focus, textarea:focus {
  border-color: var(--c-accent-dk);
  box-shadow: 0 0 0 3px rgba(242,183,5,0.22);
}

.btn-inline, .btn-add { background: #111827; color: #FFFFFF; }
.btn-inline:hover, .btn-add:hover { background: #263244; }
.btn-add-alt { background: #0F766E; color: #FFFFFF; }
.btn-add-alt:hover { background: #115E59; }

.table-wrap {
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: #FFFFFF;
}
.data-table { min-width: 820px; }
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #EEF2F6;
}
.data-table td { background: #FFFFFF; }
.data-table tbody tr:hover td { background: #F8FAFC; }
.empty-state, .empty-state-sm {
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  border-radius: var(--r-lg);
}

.preview-toolbar {
  max-width: min(800px, 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-bottom: 0;
  background: rgba(15,23,42,0.92);
  backdrop-filter: blur(10px);
}
.invoice-a4 {
  max-width: min(800px, 100%);
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 24px 70px rgba(0,0,0,0.36);
}
.inv-meta h2 { letter-spacing: 0; }
.inv-rule { background: linear-gradient(90deg, #111827 0%, #111827 74%, var(--c-accent) 74%, var(--c-accent) 100%); }
.party-lbl, .block-label, .spec-l { color: #64748B; }
.inv-table th { background: #111827; }
.row-gross { background: #111827; }
.row-due { background: var(--c-accent); }
.logo-placeholder, .inv-delivery, .inv-specs, .qr-block, .tax-breakdown { background: #F8FAFC; border-color: #E2E8F0; }

/* Invoice theme patterns */
.invoice-a4 {
  --inv-ink: #111827;
  --inv-muted: #64748B;
  --inv-accent: #F2B705;
  --inv-soft: #F8FAFC;
  --inv-border: #E2E8F0;
  --inv-table: #111827;
}
.invoice-a4::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 1;
}
.invoice-a4 > * { position: relative; z-index: 2; }
.invoice-a4 .inv-watermark { position: absolute; z-index: 1; }
.invoice-a4 .inv-meta h2,
.invoice-a4 .party-name,
.invoice-a4 .spec-v,
.invoice-a4 .inv-closing { color: var(--inv-ink); }
.invoice-a4 .party-lbl,
.invoice-a4 .block-label,
.invoice-a4 .spec-l,
.invoice-a4 .meta-tbl .ml,
.invoice-a4 .pl { color: var(--inv-muted); }
.invoice-a4 .inv-rule {
  background: linear-gradient(90deg, var(--inv-ink) 0%, var(--inv-ink) 74%, var(--inv-accent) 74%, var(--inv-accent) 100%);
}
.invoice-a4 .inv-table th,
.invoice-a4 .row-gross { background: var(--inv-table); }
.invoice-a4 .row-due { background: var(--inv-accent); }
.invoice-a4 .logo-placeholder,
.invoice-a4 .inv-delivery,
.invoice-a4 .inv-specs,
.invoice-a4 .qr-block,
.invoice-a4 .tax-breakdown {
  background: var(--inv-soft);
  border-color: var(--inv-border);
}
.invoice-a4 .qr-block { border-left-color: var(--inv-ink); }
.invoice-a4 .qr-graphic { border-color: var(--inv-ink); }
.invoice-a4 .qr-matrix rect { fill: var(--inv-ink); }
.invoice-a4 .qr-matrix .qr-bg,
.invoice-a4 .qr-matrix .qr-cut { fill: #FFFFFF; }

.theme-industrial {
  --inv-ink: #0F172A;
  --inv-muted: #57657A;
  --inv-accent: #F2B705;
  --inv-soft: #F8FAFC;
  --inv-border: #94A3B8;
  --inv-table: #0F172A;
  font-family: 'Plus Jakarta Sans', var(--font), sans-serif;
  letter-spacing: -0.01em;
}
.theme-industrial::before {
  background:
    linear-gradient(90deg, rgba(15,23,42,0.03) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15,23,42,0.02) 1px, transparent 1px);
  background-size: 20px 20px;
}
.theme-industrial .inv-meta h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}
.theme-industrial .inv-rule {
  height: 5px;
  background: linear-gradient(90deg, var(--inv-ink) 0 74%, var(--inv-accent) 74% 100%);
}
.theme-industrial .inv-table th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
}
.theme-industrial .inv-specs, 
.theme-industrial .qr-block, 
.theme-industrial .tax-breakdown, 
.theme-industrial .inv-delivery {
  border: 1.5px solid var(--inv-ink);
  border-radius: 0px;
}
.theme-industrial .inv-watermark {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 800;
  border: 4px dashed rgba(15, 23, 42, 0.05);
  border-radius: 0;
}

.theme-executive {
  --inv-ink: #0E2A47;
  --inv-muted: #647D98;
  --inv-accent: #1D4ED8;
  --inv-soft: #F4F8FC;
  --inv-border: #D1DFEC;
  --inv-table: #0E2A47;
  font-family: 'Inter', var(--font), sans-serif;
}
.theme-executive::before {
  background: linear-gradient(90deg, #1D4ED8 0 8px, transparent 8px);
}
.theme-executive .inv-meta h2 {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  color: #0E2A47;
  letter-spacing: -0.03em;
}
.theme-executive .inv-rule {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--inv-ink) 0 70%, #1D4ED8 70% 100%);
}
.theme-executive .party-lbl,
.theme-executive .block-label {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: #1D4ED8;
  border-bottom: 2px solid #D1DFEC;
  padding-bottom: 3px;
}
.theme-executive .inv-table th {
  background: #0E2A47;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  text-transform: capitalize;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}
.theme-executive .inv-table td {
  border-bottom: 1px solid #E2ECF5;
}
.theme-executive .inv-specs,
.theme-executive .qr-block,
.theme-executive .tax-breakdown,
.theme-executive .inv-delivery {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(14, 42, 71, 0.04);
  border-color: #D1DFEC;
  background: #F4F8FC;
}
.theme-executive .inv-watermark {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  border: 6px double rgba(14, 42, 71, 0.04);
  border-radius: 12px;
}

.theme-minimal {
  --inv-ink: #111111;
  --inv-muted: #71717A;
  --inv-accent: #E4E4E7;
  --inv-soft: #FAFAFA;
  --inv-border: #E4E4E7;
  --inv-table: #111111;
  font-family: 'Inter', var(--font), sans-serif;
}
.theme-minimal::before {
  background: none;
}
.theme-minimal .inv-meta h2 {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  color: #111111;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}
.theme-minimal .inv-rule {
  height: 1px;
  background: #111111;
  margin: 20px 0;
}
.theme-minimal .party-lbl,
.theme-minimal .block-label {
  border-bottom: 1px solid #111111;
  color: #111111;
  font-weight: 700;
  letter-spacing: 0.15em;
}
.theme-minimal .inv-table th {
  background: transparent;
  color: #111111;
  border-top: 1.5px solid #111111;
  border-bottom: 1.5px solid #111111;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  padding-left: 4px;
  padding-right: 4px;
}
.theme-minimal .inv-table td {
  border-bottom: 1px solid #E4E4E7;
  padding-left: 4px;
  padding-right: 4px;
}
.theme-minimal .inv-table tbody tr:nth-child(even) td {
  background: transparent;
}
.theme-minimal .row-gross {
  background: transparent !important;
  border-top: 1.5px solid #111111;
  border-bottom: 1.5px solid #111111;
}
.theme-minimal .row-gross td {
  color: #111111 !important;
  font-weight: 800;
}
.theme-minimal .row-due {
  background: #F4F4F5 !important;
  border-bottom: 1.5px solid #111111;
}
.theme-minimal .row-due td {
  color: #DC2626 !important;
  font-weight: 900;
}
.theme-minimal .inv-specs,
.theme-minimal .qr-block,
.theme-minimal .tax-breakdown,
.theme-minimal .inv-delivery {
  background: transparent;
  border-radius: 0;
  border: none;
  border-top: 1px solid #E4E4E7;
  border-bottom: 1px solid #E4E4E7;
  padding-left: 0;
  padding-right: 0;
}
.theme-minimal .qr-block {
  border-top: 1px solid #E4E4E7;
  border-bottom: 1px solid #E4E4E7;
  border-left: none;
}
.theme-minimal .qr-graphic {
  border: 1px solid #111111;
  box-shadow: none;
}
.theme-minimal .inv-watermark {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  border: 1.5px solid rgba(17, 17, 17, 0.04);
  letter-spacing: 0.3em;
  padding: 4px 16px;
}

.theme-ledger {
  --inv-ink: #2E2218;
  --inv-muted: #7D6B58;
  --inv-accent: #B08A3E;
  --inv-soft: #FAF6ED;
  --inv-border: #E6DDC4;
  --inv-table: #3E2F20;
  font-family: 'Lora', Georgia, serif;
  background: #FAF6ED;
}
.theme-ledger::before {
  content: "";
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 0;
  width: 3px;
  border-left: 1px solid rgba(220,38,38,0.22);
  border-right: 1px solid rgba(220,38,38,0.22);
  background: transparent;
  pointer-events: none;
  z-index: 10;
}
.theme-ledger .inv-meta h2 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: #2E2218;
  letter-spacing: -0.01em;
}
.theme-ledger .party-name {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: #2E2218;
}
.theme-ledger .inv-rule {
  height: 3px;
  background: transparent;
  border-top: 1px solid #B08A3E;
  border-bottom: 1px solid #B08A3E;
}
.theme-ledger .party-lbl,
.theme-ledger .block-label {
  font-family: 'Lora', serif;
  font-style: italic;
  font-weight: 500;
  border-bottom: 1px solid #E6DDC4;
  text-transform: capitalize;
  letter-spacing: 0.04em;
}
.theme-ledger .inv-table th {
  background: #3E2F20;
  font-family: 'Lora', serif;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
}
.theme-ledger .inv-table td {
  border-bottom: 1px dashed #E6DDC4;
}
.theme-ledger .inv-table tbody tr:nth-child(even) td {
  background: #F4EDE0;
}
.theme-ledger .row-sub {
  background: #F4EDE0;
}
.theme-ledger .row-gross {
  border-top: 1px solid #3E2F20;
  border-bottom: 4px double #3E2F20;
  background: transparent !important;
}
.theme-ledger .row-gross td {
  color: #2E2218 !important;
  font-weight: 800;
}
.theme-ledger .row-due {
  background: #FAF6ED !important;
  border-bottom: 3px double #B08A3E;
}
.theme-ledger .row-due td {
  color: #B08A3E !important;
  font-weight: 900;
}
.theme-ledger .inv-specs,
.theme-ledger .qr-block,
.theme-ledger .tax-breakdown,
.theme-ledger .inv-delivery {
  background: #F4EDE0;
  border: 1px solid #E6DDC4;
  border-radius: 4px;
}
.theme-ledger .inv-watermark {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: 700;
  border: 1px solid rgba(46, 34, 24, 0.04);
}

.theme-carbon {
  --inv-ink: #0B0F19;
  --inv-muted: #5F7188;
  --inv-accent: #06B6D4;
  --inv-soft: #F1F5F9;
  --inv-border: #CBD5E1;
  --inv-table: #0B0F19;
  font-family: 'Outfit', sans-serif;
}
.theme-carbon::before {
  background:
    linear-gradient(135deg, rgba(6,182,212,0.03) 0 8px, transparent 8px 16px),
    linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  background-size: 16px 16px, 100% 100%;
}
.theme-carbon .inv-header {
  margin: -44px -48px 24px;
  padding: 40px 48px 28px;
  background: #0B0F19;
  border-bottom: 4px solid #06B6D4;
  box-shadow: 0 10px 30px rgba(11, 15, 25, 0.08);
}
.theme-carbon .inv-meta h2 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.04em;
}
.theme-carbon .meta-tbl td {
  font-family: 'JetBrains Mono', monospace;
  color: #E2E8F0;
}
.theme-carbon .meta-tbl .ml {
  color: #8A9CAE;
}
.theme-carbon .logo-placeholder {
  background: rgba(255,255,255,0.07);
  color: #06B6D4;
  border-color: rgba(6,182,212,0.4);
}
.theme-carbon .inv-rule {
  height: 2px;
  background: #CBD5E1;
}
.theme-carbon .party-lbl,
.theme-carbon .block-label {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #0B0F19;
  letter-spacing: 0.08em;
  border-bottom: 1.5px solid #CBD5E1;
}
.theme-carbon .inv-table th {
  background: #0B0F19;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  letter-spacing: 0.05em;
  font-size: 0.65rem;
  border-bottom: 2px solid #06B6D4;
}
.theme-carbon .inv-table td {
  border-bottom: 1px solid #E2E8F0;
}
.theme-carbon .inv-table tbody tr:nth-child(even) td {
  background: rgba(6,182,212,0.02);
}
.theme-carbon .spec-v,
.theme-carbon .pay-grid,
.theme-carbon .totals-tbl,
.theme-carbon .tax-tbl {
  font-family: 'JetBrains Mono', monospace;
}
.theme-carbon .row-gross {
  background: #0B0F19;
}
.theme-carbon .row-due {
  background: #06B6D4;
}
.theme-carbon .row-due td {
  color: #0B0F19 !important;
}
.theme-carbon .inv-specs,
.theme-carbon .qr-block,
.theme-carbon .tax-breakdown,
.theme-carbon .inv-delivery {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}
.theme-carbon .qr-block {
  border-left: 4px solid #0B0F19;
}
.theme-carbon .inv-watermark {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  border: 2px solid rgba(6, 182, 212, 0.05);
}

.theme-amber-stripe {
  --inv-ink: #1E293B;
  --inv-muted: #64748B;
  --inv-accent: #D97706;
  --inv-soft: #FFFDF5;
  --inv-border: #FDE68A;
  --inv-table: #1E293B;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.theme-amber-stripe::before {
  background: linear-gradient(90deg, #D97706 0 12px, #F59E0B 12px 16px, transparent 16px);
}
.theme-amber-stripe .inv-meta h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  color: #1E293B;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}
.theme-amber-stripe .inv-rule {
  height: 4px;
  background: linear-gradient(90deg, #1E293B 0 70%, #D97706 70% 100%);
}
.theme-amber-stripe .party-lbl,
.theme-amber-stripe .block-label {
  font-weight: 700;
  color: #D97706;
  border-bottom: 2px solid #FDE68A;
}
.theme-amber-stripe .inv-table th {
  background: #1E293B;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-bottom: 2px solid #D97706;
}
.theme-amber-stripe .inv-table td {
  border-bottom: 1px solid #FEF3C7;
}
.theme-amber-stripe .inv-table tbody tr:nth-child(even) td {
  background: #FFFBEB;
}
.theme-amber-stripe .row-due {
  background: #D97706;
}
.theme-amber-stripe .row-due td {
  color: #FFFFFF !important;
  font-weight: 800;
}
.theme-amber-stripe .inv-specs,
.theme-amber-stripe .qr-block,
.theme-amber-stripe .tax-breakdown,
.theme-amber-stripe .inv-delivery {
  border-color: #FDE68A;
  background: #FFFDF5;
  border-radius: 6px;
}
.theme-amber-stripe .inv-watermark {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 900;
  border: 4px solid rgba(217, 119, 6, 0.04);
}

@media (max-width: 768px) {
  .theme-carbon .inv-header {
    margin: -24px -18px 18px;
    padding: 24px 18px 18px;
  }
}

@media (max-width: 1280px) {
  .workspace { grid-template-columns: minmax(0, 52%) minmax(0, 48%); }
  .header-container { padding: 0 14px; }
  .hbtn { padding-inline: 10px; }
  .toggle-wrap { display: none; }
}

@media (max-width: 1120px) {
  :root { --header-h: 72px; }
  .app-header { height: var(--header-h); }
  .header-container { align-items: flex-start; padding-top: 10px; padding-bottom: 10px; }
  .header-nav { row-gap: 6px; }
  .hbtn { min-height: 32px; padding: 5px 9px; font-size: 0.74rem; }
}

@media (max-width: 1024px) {
  :root { --header-h: 60px; }
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - var(--header-h) - 44px);
    overflow: visible;
  }
  .panel {
    display: none;
    height: auto;
    min-height: calc(100vh - var(--header-h) - 44px);
    overflow-y: visible;
    padding: 16px;
  }
  .panel.active { display: flex; flex-direction: column; }
  .mobile-tabs { display: flex; }
  .workspace { margin-top: calc(var(--header-h) + 44px); }
  .preview-toolbar { border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .invoice-a4 { min-height: auto; }
}

@media (max-width: 860px) {
  .logo-text { display: none; }
  .logo-area { min-width: auto; }
  .header-divider { display: none; }
  .hbtn span.count-chip { margin-left: 0; }
}

@media (max-width: 768px) {
  body { overflow-x: hidden; }
  .header-container { padding: 8px 10px; gap: 8px; }
  .header-nav {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
  }
  .app-header .hbtn {
    flex: 1 1 0%;
    max-width: 44px;
    justify-content: center;
    min-width: 0;
    padding: 6px 0;
    font-size: 0;
  }
  .app-header .hbtn svg { width: 17px; height: 17px; }
  .app-header .hbtn .count-chip { font-size: 0.64rem; padding: 0 5px; }
  .grid2 { grid-template-columns: 1fr; }
  .span2, .section-sep, .fg-check { grid-column: span 1; }
  .panel-editor, .panel-preview { padding: 12px; }
  .card-body, .collapse-body { padding: 14px; }
  .card-head, .collapse-trigger { padding: 12px 14px; }
  .ct-right .tag { display: none; }
  .date-range { flex-direction: column; align-items: stretch; }
  .range-sep { display: none; }
  .invoice-a4 { padding: 24px 18px; font-size: 0.72rem; }
  .inv-header { gap: 18px; }
  .inv-logo { max-width: 120px; }
  .inv-meta h2 { font-size: 1.45rem; }
  .inv-parties { grid-template-columns: 1fr; gap: 16px; }
  .inv-bottom { grid-template-columns: 1fr; }
  .inv-specs { grid-template-columns: repeat(2,1fr); }
  .delivery-grid, .pay-grid { grid-template-columns: 1fr; }
  .delivery-grid .span2, .pay-grid .span2 { grid-column: span 1; }
  .inv-table { display: block; overflow-x: auto; white-space: nowrap; }
  .inv-table th, .inv-table td { padding: 7px 8px; }
  .filter-bar { grid-template-columns: 1fr; }
  .modal { align-items: center; padding: 10px; }
  .modal-panel { width: 100%; max-height: calc(100vh - 20px); }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .hbtn { font-size: 0.75rem; flex: 1; }
  #btn-settings-clear { flex-basis: 100%; margin-right: 0 !important; }

  /* ============================================================
     RESPONSIVE TABLES & DYNAMIC CARD LAYOUT FOR EDITOR
     ============================================================ */

  /* Prevent card headers overflow */
  .card-head {
    flex-wrap: wrap !important;
    gap: 8px 10px !important;
  }
  
  .card-head .head-actions,
  .card-head div[style*="display:flex"] {
    flex: 1 1 100% !important;
    justify-content: flex-start !important;
    margin-top: 4px !important;
  }

  .panel-editor .table-wrap {
    border: none !important;
    background: transparent !important;
    overflow-x: visible !important;
  }

  .panel-editor .data-table,
  .panel-editor #items-table,
  .panel-editor #allowances-charges-table {
    display: block !important;
    min-width: 0 !important;
    width: 100% !important;
    background: transparent !important;
    border-collapse: separate !important;
  }

  .panel-editor .data-table thead {
    display: none !important;
  }

  .panel-editor .data-table tbody {
    display: block !important;
    width: 100% !important;
  }

  /* Glassmorphic card shells for each row */
  .panel-editor .data-table tbody tr {
    display: block !important;
    margin-bottom: 20px !important;
    border: 1px solid var(--c-border) !important;
    border-radius: var(--r-lg) !important;
    padding: 16px !important;
    background: var(--c-surface-2) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s ease !important;
    position: relative !important;
  }

  html[data-editor-theme="dark"] .panel-editor .data-table tbody tr {
    background: rgba(30, 41, 59, 0.35) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15) !important;
  }

  /* Hover interactivity */
  .panel-editor .data-table tbody tr:hover {
    background: var(--c-surface-2) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05) !important;
  }

  html[data-editor-theme="dark"] .panel-editor .data-table tbody tr:hover {
    background: rgba(30, 41, 59, 0.5) !important;
    border-color: var(--c-accent) !important;
  }

  /* Reset layout for each cell to stack inside card */
  .panel-editor .data-table td {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    border-bottom: none !important;
    padding: 6px 0 !important;
    width: 100% !important;
    background: transparent !important;
  }

  .panel-editor .data-table tbody tr:hover td {
    background: transparent !important;
  }

  /* Inject uppercase mobile labels */
  .panel-editor .data-table td[data-label]::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--c-accent);
    font-size: 0.68rem;
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 0.06em;
    font-family: var(--font-mono);
  }

  /* Highlight net cell at bottom of card */
  .panel-editor .data-table td.net-cell {
    padding-top: 12px !important;
    border-top: 1px dashed var(--c-border) !important;
    margin-top: 10px !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    text-align: right !important;
  }

  .panel-editor .data-table td.net-cell[data-label]::before {
    margin-bottom: 0 !important;
    font-size: 0.74rem !important;
  }

  .panel-editor .data-table td.net-cell {
    font-size: 0.9rem !important;
    color: var(--c-text) !important;
    font-family: var(--font-mono);
  }

  /* Tactile absolutely positioned drag handle */
  .panel-editor .data-table td.cell-drag {
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    background: var(--c-bg) !important;
    border-radius: var(--r-md) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid var(--c-border) !important;
    z-index: 10;
  }

  .panel-editor .drag-h {
    font-size: 1.1rem !important;
    line-height: 1 !important;
    color: var(--c-text-2) !important;
  }

  /* Space out content so it doesn't overlap with absolute drag handle */
  .panel-editor .data-table tr td:nth-child(2) {
    padding-right: 48px !important;
  }

  /* Actions column/cell styling on mobile */
  .panel-editor .data-table td.cell-actions {
    padding-top: 12px !important;
    border-top: 1px solid var(--c-border) !important;
    margin-top: 12px !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-end !important;
  }

  .panel-editor .row-actions {
    width: 100% !important;
    justify-content: flex-end !important;
    gap: 8px !important;
  }

  .panel-editor .ra-btn {
    width: 36px !important;
    height: 36px !important;
    border: 1px solid var(--c-border) !important;
    background: var(--c-surface) !important;
    border-radius: var(--r-md) !important;
    color: var(--c-text-2) !important;
  }

  .panel-editor .ra-btn svg {
    width: 16px !important;
    height: 16px !important;
  }

  .panel-editor .ra-btn:hover {
    background: var(--c-primary) !important;
    color: #FFFFFF !important;
    border-color: var(--c-primary) !important;
  }

  .panel-editor .ra-btn.del:hover {
    background: var(--c-danger) !important;
    color: #FFFFFF !important;
    border-color: var(--c-danger) !important;
  }

  /* Inputs width adjustment */
  .panel-editor .data-table input,
  .panel-editor .data-table select,
  .panel-editor .data-table textarea {
    width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
  }

  /* Hide empty states border to look clean */
  .panel-editor .empty-state,
  .panel-editor .empty-state-sm {
    border: 1.5px dashed var(--c-border) !important;
    border-radius: var(--r-lg) !important;
    padding: 24px !important;
  }
}

@media (max-width: 520px) {
  .header-nav { display: flex; }
  .mobile-tabs { height: 48px; }
  .workspace { margin-top: calc(var(--header-h) + 48px); }
  .panel { padding: 10px; }
  .head-actions { width: 100%; justify-content: stretch; }
  .head-actions .btn-add { flex: 1; justify-content: center; }
  .preview-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .preview-toolbar .hbtn { font-size: 0.75rem; }
  .inv-header { flex-direction: column; }
  .inv-meta { text-align: left; width: 100%; }
  .meta-tbl { margin-left: 0; }
  .inv-specs { grid-template-columns: 1fr; }
  .spec { border-right: 0; border-bottom: 1px solid #E2E8F0; }
  .spec:last-child { border-bottom: 0; }
  .qr-block { align-items: flex-start; }
  .drawer-panel { max-width: none; }
  .notification-container { left: 10px; right: 10px; top: 10px; max-width: none; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   DARK MODE VARIABLES & OVERRIDES
   ============================================================ */
html[data-editor-theme="dark"] {
  --c-bg:         #0B0F19;
  --c-surface:    #1E293B;
  --c-surface-2:  #0F172A;
  --c-border:     #334155;
  --c-border-md:  #475569;
  --c-border-focus: #F8FAFC;

  --c-text:       #F8FAFC;
  --c-text-2:     #CBD5E1;
  --c-text-3:     #64748B;
  --c-text-inv:   #0B0F19;

  --c-primary:    #F2B705;
  --c-primary-2:  #D99A00;
  
  --c-danger-bg:  #451A1A;
  --c-success-bg: #14351F;
  --c-warning-bg: #4C2B10;
  --c-info-bg:    #1A2A4A;
}

html[data-editor-theme="dark"] body {
  background: var(--c-bg);
  color: var(--c-text);
}
html[data-editor-theme="dark"] .card, 
html[data-editor-theme="dark"] .collapse-card {
  background: var(--c-surface);
  border-color: var(--c-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), var(--shadow-sm);
}
html[data-editor-theme="dark"] .card-head, 
html[data-editor-theme="dark"] .collapse-trigger, 
html[data-editor-theme="dark"] .drawer-head, 
html[data-editor-theme="dark"] .modal-head, 
html[data-editor-theme="dark"] .modal-foot {
  background: linear-gradient(180deg, var(--c-surface) 0%, var(--c-surface-2) 100%);
  border-bottom-color: var(--c-border);
}
html[data-editor-theme="dark"] .card-head h3, 
html[data-editor-theme="dark"] .ct-left span,
html[data-editor-theme="dark"] .modal-head h2,
html[data-editor-theme="dark"] .drawer-head h2 {
  color: var(--c-text);
}
html[data-editor-theme="dark"] input[type="text"], 
html[data-editor-theme="dark"] input[type="date"], 
html[data-editor-theme="dark"] input[type="number"],
html[data-editor-theme="dark"] input[type="email"], 
html[data-editor-theme="dark"] input[type="tel"], 
html[data-editor-theme="dark"] input[type="url"],
html[data-editor-theme="dark"] select, 
html[data-editor-theme="dark"] textarea {
  background: var(--c-surface-2);
  color: var(--c-text);
  border-color: var(--c-border);
}
html[data-editor-theme="dark"] input:hover, 
html[data-editor-theme="dark"] select:hover, 
html[data-editor-theme="dark"] textarea:hover {
  border-color: var(--c-border-focus);
}
html[data-editor-theme="dark"] input:focus, 
html[data-editor-theme="dark"] select:focus, 
html[data-editor-theme="dark"] textarea:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(242,183,5,0.15);
}
html[data-editor-theme="dark"] .btn-inline, 
html[data-editor-theme="dark"] .btn-add {
  background: var(--c-surface-2);
  color: var(--c-text);
  border: 1px solid var(--c-border);
}
html[data-editor-theme="dark"] .btn-inline:hover, 
html[data-editor-theme="dark"] .btn-add:hover {
  background: var(--c-border);
  color: var(--c-text);
}
html[data-editor-theme="dark"] .table-wrap {
  border-color: var(--c-border);
  background: var(--c-surface-2);
}
html[data-editor-theme="dark"] .data-table th {
  background: var(--c-surface);
  color: var(--c-text-2);
  border-bottom-color: var(--c-border);
}
html[data-editor-theme="dark"] .data-table td {
  background: var(--c-surface-2);
  color: var(--c-text);
  border-bottom-color: var(--c-border);
}
html[data-editor-theme="dark"] .data-table tbody tr:hover td {
  background: var(--c-surface);
}
html[data-editor-theme="dark"] .empty-state, 
html[data-editor-theme="dark"] .empty-state-sm {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text-3);
}
html[data-editor-theme="dark"] .drawer-panel,
html[data-editor-theme="dark"] .modal-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
}
html[data-editor-theme="dark"] .stab {
  color: var(--c-text-3);
}
html[data-editor-theme="dark"] .stab.active {
  color: var(--c-accent);
  border-bottom-color: var(--c-accent);
}
html[data-editor-theme="dark"] .stab:hover {
  color: var(--c-text);
}
html[data-editor-theme="dark"] .toast {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}
html[data-editor-theme="dark"] .toast-title {
  color: var(--c-text);
}
html[data-editor-theme="dark"] .toast-msg {
  color: var(--c-text-2);
}

/* ============================================================
   MULTI-VIEW PERSPECTIVES
   ============================================================ */
body.mode-dashboard #panel-dashboard { display: block !important; }
body.mode-dashboard #panel-builder { display: none !important; }
body.mode-dashboard #panel-preview { display: none !important; }
body.mode-dashboard .workspace-resizer { display: none !important; }
body.mode-dashboard .workspace { grid-template-columns: 1fr !important; }
body.mode-dashboard .editor-only { display: none !important; }

body.mode-editor #panel-dashboard { display: none !important; }
body.mode-editor #panel-builder { display: block !important; }
body.mode-editor #panel-preview { display: flex !important; }
body.mode-editor .workspace-resizer { display: block !important; }

/* ============================================================
   DASHBOARD STYLING
   ============================================================ */
.panel-dashboard {
  padding: 30px;
  background: var(--c-bg);
  overflow-y: auto;
}
.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.db-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.db-welcome h1 {
  font-size: 1.6rem;
  color: var(--c-text);
  margin-bottom: 4px;
}
.db-welcome p {
  font-size: 0.88rem;
  color: var(--c-text-2);
}
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.metric-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.m-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.card-revenue .m-icon { background: rgba(242, 183, 5, 0.1); color: var(--c-accent-dk); }
.card-paid .m-icon { background: var(--c-success-bg); color: var(--c-success); }
.card-unpaid .m-icon { background: var(--c-warning-bg); color: var(--c-warning); }
.card-overdue .m-icon { background: var(--c-danger-bg); color: var(--c-danger); }
.m-icon svg {
  width: 22px;
  height: 22px;
}

.m-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.m-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--c-text-3);
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.m-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--c-text);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-sub {
  font-size: 0.72rem;
  color: var(--c-text-2);
  margin-top: 1px;
}
.text-success { color: var(--c-success) !important; font-weight: 600; }
.text-warning { color: var(--c-warning) !important; font-weight: 600; }
.text-danger { color: var(--c-danger) !important; font-weight: 600; }

.db-body-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.db-chart-card, .db-quick-sidebar, .db-table-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.db-card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.db-card-head h3 {
  font-size: 0.9rem;
  color: var(--c-text);
  font-weight: 700;
}
.chart-timeframe {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--c-text-3);
  font-family: var(--font-mono);
}
.db-card-body {
  padding: 20px;
  flex: 1;
}
.svg-chart-container {
  width: 100%;
  height: 240px;
  position: relative;
}

/* SVG Chart Elements Styling */
.chart-grid { stroke: var(--c-border); stroke-dasharray: 4 4; opacity: 0.6; }
.chart-axis-line { stroke: var(--c-border-md); stroke-width: 1.5; }
.chart-label { font-size: 10px; font-family: var(--font-mono); fill: var(--c-text-2); font-weight: 500; }
.chart-bar { fill: url(#barGrad); transition: height 0.3s ease, y 0.3s ease; cursor: pointer; }
.chart-bar:hover { opacity: 0.85; filter: brightness(1.1); }
.chart-line { stroke: var(--c-accent-dk); stroke-width: 2.5; fill: none; stroke-linecap: round; }
.chart-point { fill: var(--c-accent); stroke: var(--c-surface); stroke-width: 2; cursor: pointer; transition: r 0.15s ease; }
.chart-point:hover { r: 6; }
.chart-bar-value { font-size: 9px; font-family: var(--font-mono); font-weight: 600; fill: var(--c-text); text-anchor: middle; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.chart-bar-group:hover .chart-bar-value { opacity: 1; }

/* Quick shortcuts in sidebar */
.db-catalog-links {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.catalog-card-btn {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}
.catalog-card-btn:hover {
  background: var(--c-surface);
  border-color: var(--c-accent);
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}
.cc-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #111827;
  color: var(--c-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.cc-icon svg {
  width: 18px;
  height: 18px;
}
.cc-text {
  display: flex;
  flex-direction: column;
}
.cc-text strong {
  font-size: 0.85rem;
  color: var(--c-text);
  font-weight: 700;
}
.cc-text span {
  font-size: 0.72rem;
  color: var(--c-text-3);
}

/* Recent Activity Table Card */
.db-table-card {
  width: 100%;
}
.db-table-card .table-wrap {
  border: none;
  border-radius: 0;
}
.db-table-card .data-table th {
  background: var(--c-surface-2);
}

/* ============================================================
   DIGITAL SIGNATURE STYLING
   ============================================================ */
.sig-cursive-preview {
  margin-top: 8px;
  padding: 16px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-family: 'Playfair Display', 'Lora', cursive;
  font-size: 1.8rem;
  font-style: italic;
  color: var(--c-text);
  text-align: center;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}
.sig-canvas-wrap {
  position: relative;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: #FFFFFF; /* Canvas drawing stays white for black ink */
  width: 100%;
  max-width: 450px;
  margin-top: 8px;
  overflow: hidden;
}
#sig-canvas {
  display: block;
  cursor: crosshair;
  background:
    linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 20px 20px;
}
.sig-clear-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15,23,42,0.85);
  color: #FFFFFF;
  border: none;
  border-radius: var(--r-sm);
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.sig-clear-btn:hover {
  background: var(--c-danger);
}

/* Printable A4 Preview Signature Block */
.prev-sig-block {
  margin-top: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: flex-end;
  min-width: 180px;
}
.sig-line {
  width: 100%;
  height: 1px;
  background: var(--inv-ink);
  margin-bottom: 6px;
  opacity: 0.6;
}
.prev-sig-visual {
  min-height: 48px;
  max-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  width: 100%;
}
.prev-sig-visual img {
  max-height: 60px;
  max-width: 160px;
  object-fit: contain;
  filter: contrast(1.5) multiply;
}
.prev-sig-visual.sig-typed-visual {
  font-family: 'Playfair Display', 'Lora', cursive !important;
  font-size: 1.5rem;
  font-style: italic;
  color: var(--inv-ink);
}
.prev-sig-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--inv-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}
.prev-sig-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--inv-ink);
  margin-top: 1px;
}

/* ============================================================
   AUTOCOMPLETE & SUGGESTIONS STYLING
   ============================================================ */
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 1500;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 2px;
  display: none;
}
.autocomplete-item {
  padding: 10px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  border-bottom: 1px solid var(--c-surface-2);
  color: var(--c-text);
  display: flex;
  flex-direction: column;
}
.autocomplete-item:last-child {
  border-bottom: none;
}
.autocomplete-item:hover, .autocomplete-item.active {
  background: var(--c-bg);
}
.autocomplete-item strong {
  font-size: 0.84rem;
  color: var(--c-text);
}
.autocomplete-item span {
  font-size: 0.72rem;
  color: var(--c-text-3);
  margin-top: 2px;
}

/* ============================================================
   LIVE STYLE CUSTOMIZER & BORDERS PRESETS
   ============================================================ */
.input-action select {
  flex: 1;
}
.input-action input[type="color"] {
  flex-shrink: 0;
}

.invoice-a4.font-Jakarta { font-family: 'Plus Jakarta Sans', system-ui, sans-serif !important; }
.invoice-a4.font-Outfit { font-family: 'Outfit', system-ui, sans-serif !important; }
.invoice-a4.font-Inter { font-family: 'Inter', system-ui, sans-serif !important; }
.invoice-a4.font-Plex { font-family: 'IBM Plex Sans', system-ui, sans-serif !important; }
.invoice-a4.font-Lora { font-family: 'Lora', Georgia, serif !important; }
.invoice-a4.font-Playfair { font-family: 'Playfair Display', Georgia, serif !important; }
.invoice-a4.font-JetBrains { font-family: 'JetBrains Mono', monospace !important; }

.invoice-a4.border-sharp .inv-specs,
.invoice-a4.border-sharp .qr-block,
.invoice-a4.border-sharp .tax-breakdown,
.invoice-a4.border-sharp .inv-delivery { border-radius: 0px !important; }

.invoice-a4.border-standard .inv-specs,
.invoice-a4.border-standard .qr-block,
.invoice-a4.border-standard .tax-breakdown,
.invoice-a4.border-standard .inv-delivery { border-radius: 4px !important; }

.invoice-a4.border-rounded .inv-specs,
.invoice-a4.border-rounded .qr-block,
.invoice-a4.border-rounded .tax-breakdown,
.invoice-a4.border-rounded .inv-delivery { border-radius: 8px !important; }

.invoice-a4.border-capsule .inv-specs,
.invoice-a4.border-capsule .qr-block,
.invoice-a4.border-capsule .tax-breakdown,
.invoice-a4.border-capsule .inv-delivery { border-radius: 16px !important; }

/* Responsive Dashboard adjusts */
@media (max-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .db-body-row {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .db-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .db-header button {
    width: 100%;
    margin-top: 10px;
  }
}

/* ============================================================
   ADSENSE PLACEHOLDERS & BANNER STYLES
   ============================================================ */
.adsense-slot-placeholder {
  position: relative;
  background: var(--c-surface);
  border: 1px dashed var(--c-border);
  border-radius: var(--border-radius, 8px);
  padding: 12px;
  margin-bottom: 20px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.adsense-slot-placeholder::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(242, 183, 5, 0.03) 0%, rgba(67, 56, 202, 0.03) 100%);
  pointer-events: none;
}

.adsense-slot-placeholder .ad-label {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.55rem;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--c-text-2);
  background: var(--c-bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--c-border);
  letter-spacing: 0.05em;
  z-index: 2;
}

.adsense-slot-placeholder .ad-visual-mock {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  color: var(--c-text-2);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font-mono);
  text-align: center;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.01) 0%, rgba(0, 0, 0, 0.15) 100%);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.adsense-sidebar {
  margin-top: 15px;
  margin-bottom: 0;
}
.adsense-sidebar .ad-visual-mock {
  min-height: 140px;
  font-size: 0.7rem;
}

.adsense-banner {
  margin-bottom: 24px;
  max-width: 100%;
}
.adsense-banner .ad-visual-mock {
  min-height: 90px;
}

/* Hide placeholder graphics when ad actually contains elements */
.adsense-slot-placeholder ins:not(:empty) ~ .ad-visual-mock {
  display: none !important;
}

/* ============================================================
   SEO GLOBAL FOOTER & LINKS
   ============================================================ */
.app-footer {
  margin-top: 32px;
  padding: 24px 0 12px 0;
  border-top: 1px solid var(--c-border);
  text-align: center;
}

.app-footer .footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.app-footer .footer-links a {
  color: var(--c-text-2);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.app-footer .footer-links a:hover {
  color: var(--c-accent);
}

.app-footer .f-dot {
  color: var(--c-border);
  font-size: 1rem;
}

.app-footer .footer-copyright {
  color: var(--c-text-2);
  font-size: 0.7rem;
  font-family: var(--font-mono);
}

.app-footer .footer-copyright a {
  color: var(--c-text);
  text-decoration: none;
  font-weight: 600;
}

.app-footer .footer-copyright a:hover {
  text-decoration: underline;
}

/* ============================================================
   STATIC SEO PAGES LAYOUTS
   ============================================================ */
.static-body {
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  font-family: 'Plus Jakarta Sans', var(--font-sans), sans-serif;
  line-height: 1.6;
  padding-bottom: 40px;
}

.static-container {
  max-width: 840px;
  margin: 0 auto;
  padding: 40px 24px;
}

.static-header {
  margin-bottom: 40px;
  text-align: center;
  position: relative;
}

.static-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--c-text);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.static-header p {
  color: var(--c-text-2);
  font-size: 1rem;
}

.static-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--c-accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 24px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.static-back-btn:hover {
  background: var(--c-border);
  transform: translateX(-2px);
}

.static-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  margin-bottom: 30px;
  backdrop-filter: blur(12px);
}

.static-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--c-text);
  margin-top: 24px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--c-border);
  padding-bottom: 6px;
}

.static-card h2:first-of-type {
  margin-top: 0;
}

.static-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--c-accent);
  margin-top: 18px;
  margin-bottom: 8px;
}

.static-card p {
  color: var(--c-text);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.static-card ul, .static-card ol {
  margin-bottom: 16px;
  padding-left: 20px;
}

.static-card li {
  margin-bottom: 8px;
  font-size: 0.95rem;
  color: var(--c-text);
}

/* FAQ Accordions for About page */
.faq-item {
  border: 1px solid var(--c-border);
  border-radius: 8px;
  margin-bottom: 12px;
  background: var(--c-surface-2);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.faq-question {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 16px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--c-text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-answer {
  padding: 0 16px 16px 16px;
  font-size: 0.9rem;
  color: var(--c-text-2);
  border-top: 1px solid var(--c-border);
  background: var(--c-bg);
}

/* Contact Grid Form */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

@media (max-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

.contact-info-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-info-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  padding: 16px;
  border-radius: 8px;
}

.contact-info-item svg {
  width: 20px;
  height: 20px;
  color: var(--c-accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.contact-info-text strong {
  display: block;
  font-size: 0.9rem;
  color: var(--c-text);
  margin-bottom: 2px;
}

.contact-info-text span {
  font-size: 0.85rem;
  color: var(--c-text-2);
}

/* ============================================================
   CREATOR & SOCIAL PROFILE STYLING
   ============================================================ */
.social-links-title {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--c-text);
}
.social-links-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.social-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--c-text);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}
.social-link-btn svg {
  width: 16px;
  height: 16px;
  color: var(--c-accent);
}
.social-link-btn:hover {
  background: var(--c-border);
  transform: translateY(-2px);
  border-color: var(--c-accent);
}

/* Meet the Creator premium glassmorphic section */
.creator-section {
  margin-top: 40px;
  margin-bottom: 40px;
}
.creator-card {
  display: flex;
  gap: 28px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  padding: 32px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}
.creator-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(242, 183, 5, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 1;
}
.creator-avatar-wrap {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--c-accent);
  box-shadow: 0 0 20px rgba(242, 183, 5, 0.2);
  z-index: 2;
}
.creator-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.creator-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 2;
}
.creator-tag {
  display: inline-block;
  background: rgba(242, 183, 5, 0.15);
  color: var(--c-accent);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 20px;
  width: fit-content;
  margin-bottom: 8px;
}
.creator-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--c-text);
  margin: 0 0 4px 0;
}
.creator-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: 12px;
}
.creator-bio {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--c-text);
  margin-bottom: 16px;
}
@media (max-width: 600px) {
  .creator-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px;
  }
  .creator-avatar-wrap {
    width: 100px;
    height: 100px;
  }
  .creator-content {
    align-items: center;
  }
}

/* ============================================================
   DASHBOARD MOBILE TABS VISIBILITY
   ============================================================ */
@media (max-width: 1024px) {
  body.mode-dashboard .mobile-tabs {
    display: none !important;
  }
  body.mode-dashboard .workspace {
    margin-top: var(--header-h) !important;
    min-height: calc(100vh - var(--header-h)) !important;
  }
  body.mode-dashboard .panel {
    min-height: calc(100vh - var(--header-h)) !important;
  }
  
  /* Ensure active panel works correctly under mode-editor on mobile */
  body.mode-editor #panel-builder,
  body.mode-editor #panel-preview {
    display: none !important;
  }
  body.mode-editor #panel-builder.active {
    display: block !important;
  }
  body.mode-editor #panel-preview.active {
    display: flex !important;
  }
}

/* ============================================================
   PREMIUM EDITORIAL BLOG STYLES
   ============================================================ */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.blog-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  height: 100%;
}

.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c-accent);
}

.blog-card-img-wrap {
  width: 100%;
  height: 180px;
  overflow: hidden;
  border-bottom: 1px solid var(--c-border);
  position: relative;
  background: #111827;
}

.blog-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.blog-card:hover .blog-card-img {
  transform: scale(1.05);
}

.blog-card-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.blog-card-tag {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--c-accent);
  text-transform: uppercase;
  margin-bottom: 10px;
  letter-spacing: 0.08em;
}

.blog-card-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--c-text);
  margin-bottom: 12px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.blog-card:hover .blog-card-title {
  color: var(--c-accent-dk);
}

.blog-card-excerpt {
  font-size: 0.88rem;
  color: var(--c-text-2);
  line-height: 1.6;
  margin-bottom: 20px;
  flex-grow: 1;
}

.blog-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--c-text-3);
  border-top: 1px solid var(--c-border);
  padding-top: 16px;
  margin-top: auto;
}

.blog-card-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.blog-card-author img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--c-border);
}

/* Post Detailed Elements */
.blog-post-img-wrap {
  width: 100%;
  height: 380px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 30px;
  border: 1px solid var(--c-border);
  background: #111827;
}

@media (max-width: 768px) {
  .blog-post-img-wrap {
    height: 220px;
    margin-bottom: 20px;
  }
}

.blog-post-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 0.85rem;
  color: var(--c-text-3);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--c-border);
}

.blog-post-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.blog-post-content {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--c-text);
}

.blog-post-content p {
  margin-bottom: 20px;
}

.blog-post-content h3 {
  font-size: 1.4rem;
  margin-top: 36px;
  margin-bottom: 16px;
  font-weight: 800;
  color: var(--c-text);
  letter-spacing: -0.01em;
}

.blog-post-quote {
  border-left: 4px solid var(--c-accent);
  padding: 16px 24px;
  background: var(--c-surface-2);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  margin: 30px 0;
  font-size: 1.1rem;
  color: var(--c-text-2);
}

.blog-post-callout {
  background: var(--c-accent-soft);
  border: 1px solid var(--c-accent);
  padding: 24px;
  border-radius: 8px;
  margin: 32px 0;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  color: var(--c-text);
}

.blog-post-callout svg {
  width: 24px;
  height: 24px;
  color: var(--c-accent-dk);
  flex-shrink: 0;
  margin-top: 2px;
}

.blog-post-callout-text h4 {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 1rem;
}

.blog-post-callout-text p {
  margin-bottom: 0;
  font-size: 0.92rem;
  color: var(--c-text-2);
}

/* Call To Action Box */
.blog-cta {
  background: linear-gradient(135deg, var(--c-primary) 0%, #1a2332 100%);
  color: #FFFFFF;
  border: 1px solid #2e3b4e;
  padding: 40px;
  border-radius: 12px;
  text-align: center;
  margin-top: 50px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.blog-cta::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(242, 183, 5, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.blog-cta h3 {
  font-size: 1.6rem;
  margin-bottom: 12px;
  color: #FFFFFF !important;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.blog-cta p {
  font-size: 0.95rem;
  color: #9ab0d2;
  margin-bottom: 24px;
  line-height: 1.6;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.blog-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--c-accent);
  color: var(--c-accent-text);
  border: none;
  padding: 14px 28px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.98rem;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(242, 183, 5, 0.2);
}

.blog-cta-btn:hover {
  background: var(--c-accent-dk);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(242, 183, 5, 0.4);
}

.blog-cta-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.blog-cta-btn:hover svg {
  transform: translateX(3px);
}

/* ============================================================
   BREADCRUMBS SEO STYLES
   ============================================================ */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 24px;
  color: var(--c-text-3);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  padding: 8px 16px;
  border-radius: 6px;
  width: fit-content;
}

.breadcrumbs a {
  color: var(--c-text-2);
  text-decoration: none;
  transition: color 0.15s ease;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

.breadcrumbs a:hover {
  color: var(--c-accent);
}

.breadcrumbs .breadcrumb-separator {
  color: var(--c-text-3);
  opacity: 0.6;
  font-size: 0.75rem;
  user-select: none;
}

.breadcrumbs .breadcrumb-current {
  color: var(--c-accent-dk);
  font-weight: 700;
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  /* Hide all non-print panels, header, and navigations with maximum specificity */
  body.mode-dashboard #panel-dashboard,
  body.mode-editor #panel-builder,
  body #panel-dashboard,
  body #panel-builder,
  #panel-dashboard,
  #panel-builder,
  .no-print, 
  header, 
  nav, 
  .preview-toolbar, 
  .drawer, 
  .modal, 
  .notification-container,
  .app-header,
  .mobile-tabs,
  .workspace-resizer,
  .app-footer { 
    display: none !important; 
  }

  html, body { 
    background: #FFFFFF !important; 
    margin: 0 !important; 
    padding: 0 !important; 
    width: 210mm !important; 
  }

  /* Override desktop layout restrictions on the workspace wrapper */
  body.mode-dashboard .workspace,
  body.mode-editor .workspace,
  body .workspace,
  .workspace { 
    margin-top: 0 !important; 
    display: block !important; 
    height: auto !important; 
    overflow: visible !important; 
    grid-template-columns: none !important;
    background: none !important;
    padding: 0 !important;
  }

  /* Exclusively display the preview A4 panel */
  body.mode-dashboard #panel-preview,
  body.mode-editor #panel-preview,
  body #panel-preview,
  #panel-preview { 
    display: block !important; 
    width: 100% !important; 
    padding: 0 !important; 
    background: transparent !important; 
  }

  .invoice-a4 {
    width: 210mm !important; 
    min-height: 297mm !important;
    margin: 0 auto !important; 
    padding: 14mm 16mm !important;
    border: none !important; 
    box-shadow: none !important;
    background: #FFFFFF !important;
  }
  .inv-watermark { display: none !important; }

  table, tr, td, th { page-break-inside: avoid !important; }
  .inv-parties, .inv-bottom, .inv-footer { page-break-inside: avoid !important; }

  .inv-table th { background: #0A0A0A !important; color: #FFFFFF !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .row-gross { background: #0A0A0A !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .row-gross td { color: #FFFFFF !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .row-due { background: #E8FF3C !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .row-due td { color: #0A0A0A !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
