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

:root {
  --primary:       #4F46E5;
  --primary-light: #6366F1;
  --primary-dark:  #3730A3;
  --primary-glow:  rgba(79, 70, 229, 0.18);
  --success:       #059669;
  --success-light: #10B981;
  --success-glow:  rgba(5, 150, 105, 0.15);
  --danger:        #DC2626;
  --warning:       #D97706;

  --bg-app:        #0F0F23;
  --bg-panel:      #16162A;
  --bg-card:       #1E1E3A;
  --bg-input:      #252545;
  --bg-hover:      #2A2A50;

  --border:        rgba(99, 102, 241, 0.18);
  --border-input:  rgba(99, 102, 241, 0.3);
  --border-focus:  rgba(99, 102, 241, 0.7);

  --text-primary:  #EEEEF8;
  --text-secondary:#9393C0;
  --text-muted:    #5C5C8A;

  /* Nota (receipt) colours - kept light for print readability */
  --nota-bg:       #FFFFFF;
  --nota-text:     #1E1B4B;
  --nota-accent:   #4F46E5;
  --nota-border:   #C7D2FE;
  --nota-muted:    #6B7280;
  --nota-stripe:   #F5F5FF;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  22px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);

  --font-sans:  'Plus Jakarta Sans', system-ui, sans-serif;
  --font-serif: 'Noto Serif', Georgia, serif;
  --trans:      0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  height: 100dvh;
  overflow: hidden;
}

/* ===== LAYOUT ===== */
.app-shell {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* === FORM PANEL === */
.form-panel {
  width: 380px;
  min-width: 320px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--trans), transform var(--trans);
  overflow: hidden;
  position: relative;
  z-index: 10;
}
.form-panel.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(79,70,229,0.15), rgba(99,102,241,0.05));
}
.panel-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.panel-logo svg { border-radius: 8px; }

.form-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 80px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-input) transparent;
}
.form-scroll::-webkit-scrollbar { width: 4px; }
.form-scroll::-webkit-scrollbar-thumb { background: var(--border-input); border-radius: 4px; }

/* === FORM SECTIONS === */
.form-section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  animation: fadeSlideIn 0.3s ease;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-icon { font-size: 14px; }

/* === COLLAPSIBLE SECTION === */
.section-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  margin: -4px -6px 10px;
  transition: background var(--trans);
  width: calc(100% + 12px);
}
.section-toggle:hover { background: var(--bg-hover); }
.section-toggle:hover .toggle-chevron { color: var(--primary-light); }

.section-toggle-label { flex: 1; }

.section-toggle-badge {
  font-size: 10px;
  font-weight: 600;
  background: rgba(5, 150, 105, 0.15);
  color: var(--success-light);
  border: 1px solid rgba(5, 150, 105, 0.3);
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.section-toggle-badge.empty {
  background: var(--primary-glow);
  color: var(--primary-light);
  border-color: rgba(99,102,241,0.3);
}

.toggle-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.25s ease, color var(--trans);
}
.section-toggle[aria-expanded="true"] .toggle-chevron {
  transform: rotate(180deg);
}

.collapsible-body {
  overflow: hidden;
  animation: expandIn 0.25s ease;
}
@keyframes expandIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === FORM INPUTS === */
.form-group { margin-bottom: 12px; }
.form-group:last-of-type { margin-bottom: 0; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  letter-spacing: 0.2px;
}

input[type="text"],
input[type="tel"],
input[type="date"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  padding: 9px 13px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
  resize: vertical;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  background: var(--bg-hover);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select option { background: var(--bg-card); }

/* === LOGO UPLOAD === */
.logo-upload-area {
  width: 100%;
  height: 90px;
  border: 2px dashed var(--border-input);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 14px;
  transition: border-color var(--trans), background var(--trans);
  overflow: hidden;
  position: relative;
}
.logo-upload-area:hover {
  border-color: var(--primary-light);
  background: var(--primary-glow);
}
.logo-thumb {
  max-width: 100%;
  max-height: 80px;
  object-fit: contain;
}
.logo-placeholder-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

/* === ITEM ROW === */
.item-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  animation: fadeSlideIn 0.25s ease;
  transition: border-color var(--trans);
}
.item-row:hover { border-color: var(--border-focus); }

.item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.item-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-light);
  background: var(--primary-glow);
  padding: 2px 8px;
  border-radius: 20px;
}
.btn-delete-item {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--trans), background var(--trans);
  display: flex;
  align-items: center;
}
.btn-delete-item:hover { color: var(--danger); background: rgba(220, 38, 38, 0.1); }

.item-row .form-row { align-items: flex-end; }
.item-subtotal {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-light);
  text-align: right;
  padding-top: 4px;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: transform var(--trans), box-shadow var(--trans), opacity var(--trans), background var(--trans);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(79,70,229,0.4); transform: translateY(-1px); }

.btn-success {
  background: linear-gradient(135deg, var(--success), var(--success-light));
  color: white;
  box-shadow: 0 4px 14px var(--success-glow);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(5,150,105,0.35); transform: translateY(-1px); }

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

.btn-outline {
  background: transparent;
  color: var(--primary-light);
  border: 1.5px dashed var(--primary-light);
}
.btn-outline:hover { background: var(--primary-glow); }

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

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color var(--trans), background var(--trans);
}
.btn-icon:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-block { width: 100%; margin-top: 10px; }

.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

/* === PREVIEW PANEL === */
.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  overflow: hidden;
  position: relative;
}

/* Hidden on desktop; only shown on mobile via media query */
.mobile-tabbar { display: none; }

.preview-topbar {
  display: none; /* shown on mobile */
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  background: var(--bg-panel);
  flex-shrink: 0;
}
.preview-topbar-title {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
}
.preview-topbar-actions { display: flex; gap: 8px; }

.nota-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 36px 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  scrollbar-width: thin;
  scrollbar-color: var(--border-input) transparent;
  background: 
    radial-gradient(ellipse 60% 50% at 30% 40%, rgba(79,70,229,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 75% 70%, rgba(5,150,105,0.05) 0%, transparent 60%),
    var(--bg-app);
}
.nota-wrapper::-webkit-scrollbar { width: 4px; }
.nota-wrapper::-webkit-scrollbar-thumb { background: var(--border-input); border-radius: 4px; }

/* === NOTA CARD === */
.nota-card {
  width: 100%;
  max-width: 640px;
  background: var(--nota-bg);
  border-radius: var(--radius-xl);
  box-shadow: 0 0 0 1px rgba(79,70,229,0.15), var(--shadow-lg);
  overflow: hidden;
  color: var(--nota-text);
  font-family: var(--font-sans);
}

/* NOTA HEADER */
.nota-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 28px 32px 24px;
  background: linear-gradient(135deg, #EEF2FF, #F0FDF4);
  border-bottom: 2px solid var(--nota-border);
}

.nota-logo-area { flex-shrink: 0; }

.nota-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 14px;
  border: 2px solid var(--nota-border);
  padding: 4px;
  background: white;
}
.nota-logo-placeholder {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--nota-accent);
  border-radius: 14px;
}
.nota-store-info { flex: 1; }
.nota-store-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--nota-accent);
  line-height: 1.2;
  letter-spacing: -0.5px;
}
.nota-tagline {
  font-size: 13px;
  color: var(--nota-muted);
  margin-top: 3px;
}

/* NOTA DIVIDERS */
.nota-divider { border: none; border-top: 1px dashed var(--nota-border); margin: 0 28px; }
.nota-divider-thick { border: none; border-top: 3px solid var(--nota-accent); margin: 0; }

/* NOTA META */
.nota-meta {
  padding: 20px 32px;
}
.nota-meta-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--nota-accent);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.nota-meta-table { border-collapse: collapse; width: auto; }
.nota-meta-table td { padding: 2px 0; font-size: 13.5px; vertical-align: top; }
.meta-label { font-weight: 600; color: var(--nota-text); padding-right: 8px; min-width: 80px; white-space: nowrap; }
.meta-colon { color: var(--nota-muted); padding-right: 8px; }
.meta-value { color: var(--nota-text); }

/* NOTA ITEMS TABLE */
.nota-items-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0 0;
}
.nota-items-table thead tr {
  background: var(--nota-accent);
}
.nota-items-table th {
  color: white;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 9px 10px;
}
.th-no { width: 36px; text-align: center; }
.th-name { text-align: left; padding-left: 16px !important; }
.th-qty { width: 56px; text-align: center; }
.th-price { width: 110px; text-align: right; }
.th-subtotal { width: 120px; text-align: right; padding-right: 16px !important; }

.nota-items-table tbody tr:nth-child(even) { background: var(--nota-stripe); }
.nota-items-table tbody td {
  padding: 9px 10px;
  font-size: 13.5px;
  border-bottom: 1px solid #EEF2FF;
}
.td-no { text-align: center; color: var(--nota-muted); font-size: 12px; }
.td-name { font-weight: 500; padding-left: 16px !important; }
.td-qty { text-align: center; font-weight: 600; }
.td-price { text-align: right; color: var(--nota-muted); }
.td-subtotal { text-align: right; font-weight: 700; padding-right: 16px !important; color: var(--nota-accent); }

.empty-items-msg {
  text-align: center;
  color: var(--nota-muted);
  font-style: italic;
  padding: 24px 0 !important;
  font-size: 13px;
}

/* NOTA SUMMARY */
.nota-summary { padding: 16px 32px; }
.summary-table { border-collapse: collapse; margin-left: auto; min-width: 280px; }
.summary-table td { padding: 5px 0; font-size: 14px; }
.sum-label { font-weight: 500; color: var(--nota-text); padding-right: 12px; }
.sum-colon { color: var(--nota-muted); padding-right: 12px; }
.sum-value { text-align: right; font-weight: 600; }
.discount-row td { color: var(--danger); }
.grand-total-row {
  border-top: 2px solid var(--nota-accent);
  margin-top: 6px;
}
.grand-total-row td {
  padding-top: 10px !important;
  font-size: 17px;
}
.grand-total-row .sum-label { font-weight: 800; color: var(--nota-accent); }
.grand-total-value { font-weight: 800; color: var(--nota-accent); font-size: 20px; }

/* NOTA FOOTER */
.nota-footer {
  background: linear-gradient(135deg, #EEF2FF, #F0FDF4);
  border-top: 2px solid var(--nota-border);
  padding: 20px 32px 24px;
}
.nota-footer-address {
  text-align: center;
  margin-bottom: 14px;
}
.nota-footer-storename {
  font-weight: 800;
  font-size: 15px;
  color: var(--nota-accent);
}
.nota-footer-address p {
  font-size: 12.5px;
  color: var(--nota-muted);
  line-height: 1.6;
}
.nota-footer-note {
  text-align: center;
  font-style: italic;
  color: var(--nota-muted);
  font-size: 13px;
  margin-bottom: 20px;
  padding: 8px 0;
  border-top: 1px dashed var(--nota-border);
  border-bottom: 1px dashed var(--nota-border);
}
.nota-footer-sig {
  display: flex;
  justify-content: space-around;
  margin-top: 8px;
}
.sig-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  min-width: 100px;
}
.sig-line {
  width: 100%;
  border-bottom: 1.5px solid #9CA3AF;
  height: 1px;
  align-self: flex-end;
}
.sig-box p {
  font-size: 12px;
  color: var(--nota-muted);
  font-weight: 600;
}

/* === HELPER ===*/
.hidden { display: none !important; }

/* === PDF LOADING OVERLAY === */
.pdf-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.pdf-loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.pdf-loading-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text-primary);
  font-weight: 600;
}
.pdf-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 40px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), opacity 0.3s ease;
  z-index: 999;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== RESPONSIVE — TABLET ===== */
@media (max-width: 900px) {
  .form-panel { width: 320px; min-width: 280px; }
}

/* ===== RESPONSIVE — MOBILE ===== */
@media (max-width: 768px) {

  /* ─ Reset body / shell ─ */
  body { overflow: hidden; height: 100dvh; }

  .app-shell {
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    position: relative;
  }

  /* ─ Hide desktop sidebar / preview-topbar ─ */
  .form-panel {
    /* now rendered as a scrollable tab pane, not an overlay */
    position: static;
    width: 100%;
    min-width: unset;
    height: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    transform: none !important;
    box-shadow: none;
    display: none;         /* hidden by default; JS controls visibility */
    overflow-y: auto;
  }
  .form-panel.mobile-active { display: flex; flex-direction: column; }

  /* hide the desktop collapse arrow inside panel header */
  #btnTogglePanel { display: none; }

  /* ─ Preview panel — default visible tab ─ */
  .preview-panel {
    flex: 1;
    overflow: hidden;
    display: none;
    flex-direction: column;
  }
  .preview-panel.mobile-active { display: flex; }

  /* ─ Hide old preview topbar (replaced by bottom tabs) ─ */
  .preview-topbar { display: none !important; }

  /* ─ Nota wrapper mobile ─ */
  .nota-wrapper {
    padding: 14px 10px calc(90px + env(safe-area-inset-bottom, 0px)); /* extra bottom for tab bar */
    align-items: flex-start;
  }

  /* ─ Scale down nota card on small screens ─ */
  .nota-card {
    border-radius: var(--radius-lg);
    font-size: 13px;
  }
  .nota-header {
    padding: 18px 18px 16px;
    gap: 12px;
  }
  .nota-logo, .nota-logo-placeholder { width: 60px; height: 60px; }
  .nota-store-name { font-size: 17px; }
  .nota-tagline { font-size: 12px; }

  .nota-meta { padding: 14px 18px; }
  .nota-meta-title { font-size: 10px; letter-spacing: 1.5px; }
  .nota-meta-table td { font-size: 12.5px; }
  .meta-label { min-width: 60px; }

  .nota-items-table th { font-size: 10.5px; padding: 8px 6px; }
  .nota-items-table tbody td { font-size: 12.5px; padding: 7px 6px; }
  .th-name { padding-left: 10px !important; }
  .td-name { padding-left: 10px !important; }
  .th-subtotal, .td-subtotal { padding-right: 10px !important; }
  .th-price { width: 80px; }
  .th-subtotal { width: 90px; }

  .nota-summary { padding: 12px 18px; }
  .summary-table { min-width: 220px; }
  .sum-label { font-size: 13px; }
  .grand-total-value { font-size: 17px; }

  .nota-footer { padding: 14px 18px 18px; }
  .nota-footer-storename { font-size: 13px; }
  .nota-footer-address p { font-size: 11.5px; }

  /* ─ Form panel mobile tweaks ─ */
  .panel-header { padding: 14px 16px; }
  .form-section { padding: 16px; }
  .form-scroll { padding-bottom: 100px; }

  /* larger touch targets for inputs */
  input[type="text"],
  input[type="tel"],
  input[type="date"],
  input[type="number"],
  select,
  textarea {
    padding: 11px 13px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }
  label { font-size: 12px; }

  .item-row { padding: 10px; }

  /* ─ BOTTOM TAB BAR ─ */
  .mobile-tabbar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding: 0 8px env(safe-area-inset-bottom, 0px);
    align-items: stretch;
    gap: 4px;
  }
  .tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: color var(--trans), background var(--trans);
    padding: 6px 0;
    position: relative;
  }
  .tab-btn svg { transition: transform 0.2s ease; }
  .tab-btn.active {
    color: var(--primary-light);
    background: var(--primary-glow);
  }
  .tab-btn.active svg { transform: translateY(-1px); }
  .tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--primary-light);
    border-radius: 2px 2px 0 0;
  }

  /* print+pdf quick buttons in tab bar */
  .tab-btn-action {
    background: none;
    border: none;
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: color var(--trans), background var(--trans);
    letter-spacing: 0.2px;
    min-width: 52px;
  }
  .tab-btn-action:hover { background: var(--bg-hover); color: var(--text-primary); }
  .tab-btn-action.print-btn { color: var(--primary-light); }
  .tab-btn-action.pdf-btn   { color: var(--success-light); }

  .tab-divider {
    width: 1px;
    background: var(--border);
    margin: 10px 2px;
    flex-shrink: 0;
  }

  /* ─ Actions section on mobile ─ */
  .actions-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .actions-section .btn-primary,
  .actions-section .btn-success { padding: 10px 12px; font-size: 13px; }
}

/* Extra small phones */
@media (max-width: 380px) {
  .nota-header { padding: 14px 12px; gap: 10px; }
  .nota-meta { padding: 12px 14px; }
  .nota-summary { padding: 10px 14px; }
  .nota-footer { padding: 12px 14px 16px; }
  .nota-items-table th,
  .nota-items-table tbody td { font-size: 11px; padding: 6px 4px; }
  .th-price { width: 68px; }
  .th-subtotal { width: 76px; }
  .nota-store-name { font-size: 15px; }
  .grand-total-value { font-size: 15px; }
}

/* ===== PRINT STYLES ===== */
@media print {
  @page {
    size: A4;
    margin: 15mm 15mm 15mm 15mm;
  }

  /* Hide everything by default */
  body * { visibility: hidden; }

  /* Show only nota card */
  #notaCard, #notaCard * { visibility: visible; }
  #notaCard {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #1E1B4B !important;
    font-size: 13px !important;
  }

  /* Preserve colours in print */
  .nota-header {
    background: #EEF2FF !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .nota-items-table thead tr {
    background: #4F46E5 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .nota-footer {
    background: #EEF2FF !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .nota-items-table tbody tr:nth-child(even) {
    background: #F5F5FF !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* hide mobile bottom bar on print */
  .mobile-tabbar { display: none !important; }
  a { text-decoration: none !important; }
  .nota-logo-placeholder svg { fill: #4F46E5; }
}

