/* ─────────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f5f5f7;
  --surface:   #ffffff;
  --border:    #e8e8ed;
  --border-2:  #d1d1d6;
  --text:      #1c1c1e;
  --text-2:    #6e6e73;
  --text-3:    #aeaeb2;
  --accent:    #0071e3;
  --accent-h:  #0077ed;
  --accent-lt: #e8f1fd;
  --danger:    #ff3b30;
  --success:   #34c759;
  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 2px 16px rgba(0,0,0,.06);
  --shadow-md: 0 8px 32px rgba(0,0,0,.10);
  --font:      'Inter', system-ui, -apple-system, sans-serif;
}

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

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

/* ─────────────────────────────────────────────
   TOP BAR
───────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}

.topbar-brand .dot { color: var(--accent); }

.topbar-tag {
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--border);
  padding: 3px 10px;
  border-radius: 20px;
}

/* ─────────────────────────────────────────────
   MAIN LAYOUT
───────────────────────────────────────────── */
.main {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─────────────────────────────────────────────
   SECTIONS
───────────────────────────────────────────── */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.optional {
  font-size: .78rem;
  font-weight: 400;
  color: var(--text-3);
  margin-left: 4px;
}

/* ─────────────────────────────────────────────
   COMPANY CARDS
───────────────────────────────────────────── */
.company-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.company-card {
  position: relative;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color .2s, box-shadow .2s, background .2s;
  user-select: none;
}

.company-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.company-card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow);
}

.company-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-lt);
  box-shadow: 0 0 0 3px rgba(0,113,227,.12);
}

.company-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: -.5px;
  flex-shrink: 0;
}

.logo-text strong {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.logo-text small {
  font-size: .72rem;
  color: var(--text-2);
  font-weight: 400;
}

/* Company colour themes */
.logo-hidangi .logo-icon {
  background: linear-gradient(135deg, #0071e3, #00c7ff);
  color: #fff;
}

.logo-tenfold .logo-icon {
  background: linear-gradient(135deg, #8b5e3c, #c8956c);
  color: #fff;
}

.logo-lhallied .logo-icon {
  background: linear-gradient(135deg, #1c2b4a, #3a5a8c);
  color: #fff;
  font-size: .78rem;
}

.logo-rolling .logo-icon {
  background: linear-gradient(135deg, #6e3de8, #b06ef3);
  color: #fff;
  font-size: .78rem;
}

/* ─────────────────────────────────────────────
   FORM ELEMENTS
───────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group--full { grid-column: 1 / -1; }

.form-label {
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-2);
}

.req { color: var(--accent); }

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  appearance: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,113,227,.12);
}

.form-input::placeholder { color: var(--text-3); }

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

/* ─────────────────────────────────────────────
   ITEMS TABLE
───────────────────────────────────────────── */
.items-table-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  min-width: 640px;
}

.items-table thead tr {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.items-table th {
  padding: 10px 12px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-2);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}

.items-table td {
  padding: 8px 6px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

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

.items-table tbody tr:hover { background: var(--bg); }

/* Column widths */
.col-no    { width: 36px; text-align: center; }
.col-name  { width: 18%; }
.col-desc  { }
.col-qty   { width: 80px; }
.col-price { width: 130px; }
.col-total { width: 120px; }
.col-action{ width: 40px; }

.item-input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid transparent;
  border-radius: 6px;
  font-family: var(--font);
  font-size: .875rem;
  color: var(--text);
  background: transparent;
  outline: none;
  transition: border-color .15s, background .15s;
}

.item-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0,113,227,.1);
}

.item-input[type="number"] { text-align: right; }

.item-total-cell {
  font-weight: 600;
  color: var(--text);
  text-align: right;
  padding-right: 12px;
  white-space: nowrap;
}

.row-num {
  font-size: .75rem;
  color: var(--text-3);
  text-align: center;
  display: block;
}

.btn-remove-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-3);
  transition: color .15s, background .15s;
  margin: 0 auto;
}

.btn-remove-row:hover { color: var(--danger); background: #fff0ef; }

/* Add Row Button */
.btn-add-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 8px 16px;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius-sm);
  background: none;
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}

.btn-add-row:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-lt);
}

/* ─────────────────────────────────────────────
   SUMMARY BLOCK
───────────────────────────────────────────── */
.summary-block {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-left: auto;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .9rem;
  color: var(--text-2);
}

.summary-sst-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
}

.summary-total {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  padding-top: 10px;
  border-top: 2px solid var(--border);
  margin-top: 4px;
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-2);
  border-radius: 20px;
  transition: background .2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ─────────────────────────────────────────────
   GENERATE BUTTON
───────────────────────────────────────────── */
.generate-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0 16px;
}

.btn-generate {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 36px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,113,227,.35);
  transition: background .2s, transform .15s, box-shadow .2s;
}

.btn-generate:hover {
  background: var(--accent-h);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,113,227,.45);
}

.btn-generate:active { transform: translateY(0); }

.generate-hint {
  font-size: .78rem;
  color: var(--text-3);
}

/* ─────────────────────────────────────────────
   MODAL
───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

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

.modal-title {
  font-size: .95rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.modal-close:hover { background: var(--bg); }

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.btn-secondary {
  padding: 10px 20px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  background: none;
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.btn-secondary:hover { border-color: var(--text-2); color: var(--text); }

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}

.btn-download:hover { background: var(--accent-h); }

/* ─────────────────────────────────────────────
   INVOICE PREVIEW (inside modal)
───────────────────────────────────────────── */
#invoice-preview {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  font-family: var(--font);
  box-shadow: 0 4px 24px rgba(0,0,0,.07);
}

/* Gradient accent bar at top */
.inv-accent-bar {
  height: 5px;
  width: 100%;
}

/* Header */
.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 32px 36px 24px;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}

.inv-logo-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.inv-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 11px;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 10px;
  letter-spacing: -.5px;
}

.inv-logo-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
}

.inv-logo-contact {
  font-size: .78rem;
  color: var(--text-2);
  line-height: 1.7;
}

/* Right meta block */
.inv-meta {
  text-align: right;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.inv-meta-badge {
  display: inline-block;
  padding: 5px 16px;
  border-radius: 6px;
  color: #fff;
  font-size: .85rem;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.inv-meta-no {
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .3px;
}

.inv-meta-dates {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.inv-meta-date-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.inv-meta-date-label {
  font-size: .72rem;
  color: var(--text-3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.inv-meta-date-val {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}

.inv-meta-date-val.due {
  color: #ff6b35;
}

/* Client row — project tag + KEPADA card */
.inv-client-row {
  margin: 16px 36px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Project tag */
.inv-project-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: var(--bg);
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
  border: 1px solid var(--border);
  width: fit-content;
}

/* KEPADA single card */
.inv-client-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  background: var(--bg);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.inv-client-body {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0 32px;
}

.inv-client-body .inv-party-name {
  width: 100%;
  margin-bottom: 4px;
}

.inv-client-body .inv-party-detail {
  margin-bottom: 4px;
}

.inv-client-body .inv-party-contact {
  flex-direction: row;
  gap: 16px;
}

/* Legacy .inv-parties not used anymore but keep for safety */
.inv-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 16px 36px 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.inv-party {
  padding: 18px 20px;
}

.inv-party--right {
  border-left: 1px solid var(--border);
  background: var(--bg);
}

.inv-party-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-3);
  margin-bottom: 8px;
}

.inv-party-name {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.inv-party-detail {
  font-size: .8rem;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 8px;
}

.inv-party-contact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inv-party-contact span {
  font-size: .78rem;
  color: var(--text-2);
}

/* Items table */
.inv-items-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 4px;
  font-size: .84rem;
}

.inv-items-table thead tr {
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.inv-items-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-3);
}

.inv-items-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.inv-items-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

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

.inv-items-table .align-right { text-align: right; }
.inv-items-table .align-center { text-align: center; }

/* Total block */
.inv-total-block {
  display: flex;
  justify-content: flex-end;
  padding: 0 36px 28px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.inv-total-inner {
  min-width: 280px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.inv-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 16px;
  font-size: .84rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}

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

.inv-total-row.grand {
  color: #fff;
  font-size: .92rem;
  font-weight: 700;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.inv-total-row.grand span:first-child {
  flex: 1;
  white-space: nowrap;
}

.inv-total-row.grand span:last-child {
  color: #a3f0b5;
  white-space: nowrap;
  text-align: right;
  flex-shrink: 0;
}

/* Items wrapper (padding) */
#invoice-preview > div[style*="padding:0 36px"] {
  margin-bottom: 0;
}

/* Notes */
.inv-notes-block {
  margin: 0 36px 20px;
  padding: 14px 16px;
  background: #fffbf0;
  border: 1px solid #f0e6c8;
  border-radius: 8px;
}

.inv-notes-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #b89040;
  margin-bottom: 6px;
}

.inv-notes-body {
  font-size: .82rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* Payment */
.inv-payment {
  margin: 0 36px 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}

.inv-payment-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-3);
  margin-bottom: 14px;
}

.inv-bank-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.inv-bank-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px 16px;
}

.inv-bank-name {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-3);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.inv-bank-acc {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .8px;
  margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}

.inv-bank-holder {
  font-size: .78rem;
  color: var(--text-2);
}

/* Footer — signature + thank you */
.inv-footer-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 36px 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.inv-signature-block {
  min-width: 140px;
}

.inv-signature-text {
  font-family: 'Dancing Script', cursive;
  font-size: 2.2rem;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 6px;
}

.inv-sig-line {
  height: 1.5px;
  background: var(--border-2);
  margin-bottom: 6px;
  width: 90%;
}

.inv-signature-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
}

.inv-signature-sub {
  font-size: .7rem;
  color: var(--text-3);
  margin-top: 2px;
}

.inv-thankyou {
  flex: 1;
  text-align: right;
}

.inv-thankyou-icon {
  font-size: 1rem;
  color: var(--text-3);
  margin-bottom: 6px;
}

.inv-thankyou p {
  font-size: .82rem;
  color: var(--text-2);
  font-style: italic;
  line-height: 1.7;
}

/* ─────────────────────────────────────────────
   FOOTER
───────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 24px;
  font-size: .78rem;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ─────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────── */
@media (max-width: 640px) {
  .main { padding: 20px 16px 40px; gap: 16px; }
  .section { padding: 20px 16px; }
  .company-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group--full { grid-column: 1; }
  .summary-block { max-width: 100%; }

  /* Invoice preview responsive */
  .inv-header { flex-direction: column; padding: 20px 20px 16px; }
  .inv-meta { align-items: flex-start; text-align: left; }
  .inv-meta-date-row { justify-content: flex-start; }
  .inv-client-row { margin: 12px 20px 16px; }
  .inv-client-card { flex-direction: column; gap: 8px; }
  .inv-client-body .inv-party-contact { flex-direction: column; gap: 2px; }
  #invoice-preview > div[style*="padding:0 36px"] { padding: 0 20px !important; }
  .inv-total-block { padding: 16px 20px 20px; }
  .inv-total-inner { min-width: 100%; width: 100%; }
  .inv-notes-block { margin: 0 20px 16px; }
  .inv-payment { margin: 0 20px 20px; }
  .inv-bank-grid { grid-template-columns: 1fr; }
  .inv-footer-row { flex-direction: column; align-items: flex-start; margin: 0 20px 24px; }
  .inv-thankyou { text-align: left; }
}

@media (max-width: 480px) {
  .topbar-inner { padding: 12px 16px; }
  .btn-generate { padding: 12px 24px; font-size: .95rem; }
}

/* ─────────────────────────────────────────────
   HISTORY PANEL
───────────────────────────────────────────── */
.history-section { margin-top: 4px; }

.history-section .section-title {
  justify-content: space-between;
  margin-bottom: 16px;
}

.step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-2);
  flex-shrink: 0;
}

.btn-clear-history {
  margin-left: auto;
  padding: 5px 12px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  background: none;
  font-family: var(--font);
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.btn-clear-history:hover { color: var(--danger); border-color: var(--danger); }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

.history-item:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow);
}

.history-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.history-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -.3px;
}

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

.history-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: .78rem;
  color: var(--text-2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-date {
  font-size: .72rem;
  color: var(--text-3);
  margin-top: 2px;
}

.history-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.history-amount {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
}

.history-actions {
  display: flex;
  gap: 6px;
}

.btn-hist-edit,
.btn-hist-del {
  padding: 4px 10px;
  border-radius: 5px;
  font-family: var(--font);
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid;
  transition: background .15s, color .15s;
}

.btn-hist-edit {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-lt);
}

.btn-hist-edit:hover {
  background: var(--accent);
  color: #fff;
}

.btn-hist-del {
  border-color: var(--border-2);
  color: var(--text-3);
  background: none;
}

.btn-hist-del:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff0ef;
}
