/* ==========================================================================
   PB UAE VAT Invoicing System — Admin Stylesheet
   PluginsBuy | https://pluginsbuy.com
   ========================================================================== */

:root {
  --pbuaiv-blue:        #244b8e;
  --pbuaiv-blue-dark:   #1a3668;
  --pbuaiv-blue-mid:    #3a6abf;
  --pbuaiv-blue-light:  #e8effc;
  --pbuaiv-gold:        #f59e0b;
  --pbuaiv-gold-dark:   #d97706;
  --pbuaiv-gold-light:  #fef3c7;
  --pbuaiv-red:         #ef4444;
  --pbuaiv-red-light:   #fee2e2;
  --pbuaiv-green:       #22c55e;
  --pbuaiv-green-light: #dcfce7;
  --pbuaiv-gray:        #64748b;
  --pbuaiv-gray-light:  #94a3b8;
  --pbuaiv-border:      #e2e8f0;
  --pbuaiv-bg:          #f8fafc;
  --pbuaiv-text:        #1e293b;
  --pbuaiv-radius:      10px;
  --pbuaiv-radius-sm:   6px;
  --pbuaiv-shadow:      0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --pbuaiv-shadow-md:   0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
}

/* ==========================================================================
   BASE WRAP
   ========================================================================== */

.pbuaiv-wrap {
  max-width: 1100px;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--pbuaiv-text);
}

/* ==========================================================================
   PAGE HEADER
   ========================================================================== */

.pbuaiv-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 20px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--pbuaiv-border);
}

.pbuaiv-page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--pbuaiv-blue);
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.2;
}

.pbuaiv-logo-mark {
  font-size: 20px;
  line-height: 1;
}

.pbuaiv-page-subtitle {
  font-size: 13px;
  color: var(--pbuaiv-gray);
  margin: 0;
  font-weight: 400;
}

.pbuaiv-page-header__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  padding-top: 2px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.pbuaiv-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--pbuaiv-radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all .15s ease;
  white-space: nowrap;
  line-height: 1.4;
  font-family: inherit;
  vertical-align: middle;
}

.pbuaiv-btn--primary {
  background: var(--pbuaiv-blue);
  color: #fff;
  border-color: var(--pbuaiv-blue-dark);
  box-shadow: 0 1px 2px rgba(36,75,142,.2);
}
.pbuaiv-btn--primary:hover,
.pbuaiv-btn--primary:focus {
  background: var(--pbuaiv-blue-dark);
  color: #fff;
  box-shadow: 0 2px 6px rgba(36,75,142,.3);
  text-decoration: none;
}

.pbuaiv-btn--secondary {
  background: #fff;
  color: var(--pbuaiv-blue);
  border-color: var(--pbuaiv-border);
  box-shadow: var(--pbuaiv-shadow);
}
.pbuaiv-btn--secondary:hover,
.pbuaiv-btn--secondary:focus {
  background: var(--pbuaiv-blue-light);
  border-color: var(--pbuaiv-blue);
  color: var(--pbuaiv-blue);
  text-decoration: none;
}

.pbuaiv-btn--ghost {
  background: transparent;
  color: var(--pbuaiv-gray);
  border-color: var(--pbuaiv-border);
}
.pbuaiv-btn--ghost:hover,
.pbuaiv-btn--ghost:focus {
  background: var(--pbuaiv-bg);
  color: var(--pbuaiv-blue);
  border-color: var(--pbuaiv-blue);
  text-decoration: none;
}

.pbuaiv-btn--danger {
  background: var(--pbuaiv-red);
  color: #fff;
  border-color: #dc2626;
}
.pbuaiv-btn--danger:hover,
.pbuaiv-btn--danger:focus {
  background: #dc2626;
  color: #fff;
  text-decoration: none;
}

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

.pbuaiv-btn--sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 5px;
  gap: 4px;
}

.pbuaiv-btn:disabled,
.pbuaiv-btn.loading {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}

.pbuaiv-btn .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  margin-top: 1px;
}

/* ==========================================================================
   TABS
   ========================================================================== */

.pbuaiv-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--pbuaiv-border);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.pbuaiv-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--pbuaiv-gray);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.5;
}

.pbuaiv-tab:hover {
  color: var(--pbuaiv-blue);
}

.pbuaiv-tab--active {
  color: var(--pbuaiv-blue);
  border-bottom-color: var(--pbuaiv-blue);
  font-weight: 600;
}

.pbuaiv-tab-panels { margin-top: 0; }

.pbuaiv-tab-panel { display: none; }
.pbuaiv-tab-panel:first-child { display: block; } /* fallback */
.pbuaiv-tab-panel.is-active { display: block; }

/* ==========================================================================
   CARDS
   ========================================================================== */

.pbuaiv-card {
  background: #fff;
  border: 1px solid var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius);
  box-shadow: var(--pbuaiv-shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.pbuaiv-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--pbuaiv-border);
  background: var(--pbuaiv-bg);
}

.pbuaiv-card__head h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--pbuaiv-blue);
  margin: 0;
  line-height: 1.3;
}

.pbuaiv-card__head h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--pbuaiv-blue);
  margin: 0;
}

.pbuaiv-card__head-sub {
  font-size: 11px;
  color: var(--pbuaiv-gray);
  font-weight: 400;
  background: var(--pbuaiv-blue-light);
  color: var(--pbuaiv-blue);
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.pbuaiv-card__body {
  padding: 20px;
}

/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */

.pbuaiv-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.pbuaiv-form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.pbuaiv-form-grid.cols-1 { grid-template-columns: 1fr; }

.pbuaiv-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pbuaiv-field--full {
  grid-column: 1 / -1;
}

.pbuaiv-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pbuaiv-text);
  letter-spacing: .1px;
  display: block;
}

.pbuaiv-input,
.pbuaiv-select,
.pbuaiv-textarea {
  border: 1px solid var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius-sm);
  padding: 8px 11px;
  font-size: 13px;
  color: var(--pbuaiv-text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  line-height: 1.4;
}

.pbuaiv-input:focus,
.pbuaiv-select:focus,
.pbuaiv-textarea:focus {
  outline: none;
  border-color: var(--pbuaiv-blue);
  box-shadow: 0 0 0 3px rgba(36,75,142,.1);
}

.pbuaiv-input::placeholder { color: var(--pbuaiv-gray-light); }
.pbuaiv-textarea { resize: vertical; min-height: 80px; }
.pbuaiv-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

.pbuaiv-help {
  font-size: 11px;
  color: var(--pbuaiv-gray);
  margin: 2px 0 0;
  line-height: 1.4;
}

/* Radio group */
.pbuaiv-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.pbuaiv-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--pbuaiv-text);
  font-weight: 500;
  transition: all .15s;
  background: #fff;
}
.pbuaiv-radio:hover { border-color: var(--pbuaiv-blue); background: var(--pbuaiv-blue-light); }
.pbuaiv-radio input[type="radio"]:checked + span,
.pbuaiv-radio:has(input:checked) { border-color: var(--pbuaiv-blue); background: var(--pbuaiv-blue-light); color: var(--pbuaiv-blue); }
.pbuaiv-radio input { flex-shrink: 0; accent-color: var(--pbuaiv-blue); }

/* Checkbox grid */
.pbuaiv-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.pbuaiv-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--pbuaiv-text);
  font-weight: 500;
  transition: all .15s;
  background: #fff;
  line-height: 1.3;
}
.pbuaiv-checkbox:hover { border-color: var(--pbuaiv-blue); background: var(--pbuaiv-blue-light); }
.pbuaiv-checkbox input { flex-shrink: 0; accent-color: var(--pbuaiv-blue); }

/* TRN */
.pbuaiv-trn-wrap { position: relative; }
.pbuaiv-trn-status {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--pbuaiv-radius-sm);
}
.pbuaiv-trn-status.valid   { display: flex; background: var(--pbuaiv-green-light); color: #15803d; }
.pbuaiv-trn-status.invalid { display: flex; background: var(--pbuaiv-red-light);   color: #b91c1c; }
.pbuaiv-trn-status.empty   { display: flex; background: var(--pbuaiv-bg);          color: var(--pbuaiv-gray); }

/* Color picker */
.pbuaiv-color-picker { max-width: 140px !important; }

/* Logo upload */
.pbuaiv-logo-upload {
  border: 2px dashed var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius);
  padding: 20px;
  text-align: center;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s;
  background: var(--pbuaiv-bg);
  margin-bottom: 10px;
}
.pbuaiv-logo-upload:hover { border-color: var(--pbuaiv-blue); }

.pbuaiv-logo-preview {
  max-height: 70px;
  max-width: 200px;
  object-fit: contain;
}

.pbuaiv-logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--pbuaiv-gray);
  font-size: 12px;
}
.pbuaiv-logo-placeholder .dashicons { font-size: 28px; width: 28px; height: 28px; color: var(--pbuaiv-gray-light); }

/* ==========================================================================
   NOTICES
   ========================================================================== */

.pbuaiv-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--pbuaiv-radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  line-height: 1.5;
}
.pbuaiv-notice.info,
.pbuaiv-notice--info    { background: var(--pbuaiv-blue-light); border-color: #bfdbfe; color: var(--pbuaiv-blue-dark); }
.pbuaiv-notice.success,
.pbuaiv-notice--success { background: var(--pbuaiv-green-light); border-color: #bbf7d0; color: #15803d; }
.pbuaiv-notice.warning,
.pbuaiv-notice--warning { background: var(--pbuaiv-gold-light);  border-color: #fde68a; color: #92400e; }
.pbuaiv-notice.error,
.pbuaiv-notice--error   { background: var(--pbuaiv-red-light);   border-color: #fca5a5; color: #b91c1c; }

/* ==========================================================================
   BADGES
   ========================================================================== */

.pbuaiv-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
}
.pbuaiv-badge--issued   { background: var(--pbuaiv-green-light); color: #15803d; }
.pbuaiv-badge--sent     { background: #dbeafe; color: #1d4ed8; }
.pbuaiv-badge--void     { background: var(--pbuaiv-red-light);   color: #b91c1c; text-decoration: line-through; }
.pbuaiv-badge--pending  { background: var(--pbuaiv-bg); color: var(--pbuaiv-gray); border: 1px solid var(--pbuaiv-border); }

/* ==========================================================================
   SPINNER
   ========================================================================== */

.pbuaiv-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pbuaiv-spin .65s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}
.pbuaiv-spinner.dark {
  border-color: rgba(36,75,142,.2);
  border-top-color: var(--pbuaiv-blue);
}
@keyframes pbuaiv-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   ORDER METABOX
   ========================================================================== */

.pbuaiv-metabox {
  padding: 0;
  margin: -6px -12px -12px;
}

.pbuaiv-doc-row {
  border-bottom: 1px solid var(--pbuaiv-border);
  padding: 0;
}
.pbuaiv-doc-row:last-of-type { border-bottom: none; }

.pbuaiv-doc-row__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px 5px;
}

.pbuaiv-doc-row__icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.pbuaiv-doc-row__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pbuaiv-text);
  flex: 1;
}

.pbuaiv-doc-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 12px 10px;
  align-items: center;
}

.pbuaiv-doc-row__meta {
  font-size: 10px;
  color: var(--pbuaiv-gray);
  padding: 0 12px 8px;
  font-style: italic;
}

.pbuaiv-xml-note {
  padding: 8px 12px;
  background: var(--pbuaiv-bg);
  border-top: 1px solid var(--pbuaiv-border);
  text-align: center;
}
.pbuaiv-xml-note small { font-size: 10px; color: var(--pbuaiv-gray-light); }

#pbuaiv-metabox-notice { display: none; margin: 8px 12px; }

/* ==========================================================================
   SETUP WIZARD
   ========================================================================== */

.pbuaiv-setup-wrap {
  max-width: 680px;
  margin: 24px auto 40px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header */
.pbuaiv-setup-header {
  text-align: center;
  padding: 0 0 28px;
}

.pbuaiv-setup-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pbuaiv-setup-logo__name {
  font-size: 18px;
  font-weight: 700;
  color: var(--pbuaiv-blue);
  line-height: 1;
}

.pbuaiv-setup-tagline {
  font-size: 13px;
  color: var(--pbuaiv-gray);
  margin: 0;
}

/* Step progress bar */
.pbuaiv-setup-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  position: relative;
}

.pbuaiv-setup-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
  flex: 1;
  max-width: 100px;
}

.pbuaiv-setup-step__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--pbuaiv-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all .2s;
  z-index: 1;
  position: relative;
}

.pbuaiv-setup-step__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--pbuaiv-gray);
  white-space: nowrap;
  transition: color .2s;
}

.pbuaiv-setup-step--active .pbuaiv-setup-step__icon {
  background: var(--pbuaiv-blue);
  border-color: var(--pbuaiv-blue);
  box-shadow: 0 0 0 4px rgba(36,75,142,.15);
  font-size: 18px;
}
.pbuaiv-setup-step--active .pbuaiv-setup-step__label {
  color: var(--pbuaiv-blue);
  font-weight: 700;
}

.pbuaiv-setup-step--done .pbuaiv-setup-step__icon {
  background: var(--pbuaiv-green);
  border-color: var(--pbuaiv-green);
}
.pbuaiv-setup-step--done .pbuaiv-setup-step__label {
  color: var(--pbuaiv-green);
}

.pbuaiv-setup-step-divider {
  flex: 1;
  height: 2px;
  background: var(--pbuaiv-border);
  margin: 0 -4px;
  margin-bottom: 24px;
  max-width: 60px;
  transition: background .2s;
}

/* Wizard body / panels */
.pbuaiv-setup-body {
  background: #fff;
  border: 1px solid var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius);
  box-shadow: var(--pbuaiv-shadow-md);
  overflow: hidden;
}

.pbuaiv-setup-panel {
  padding: 28px 32px;
}

.pbuaiv-setup-panel h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--pbuaiv-blue);
  margin: 0 0 6px;
}

.pbuaiv-setup-panel__sub {
  font-size: 13px;
  color: var(--pbuaiv-gray);
  margin: 0 0 24px;
}

.pbuaiv-setup-panel h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--pbuaiv-text);
  margin: 24px 0 4px;
}

/* Wizard navigation footer */
.pbuaiv-setup-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--pbuaiv-border);
}

/* FTA notice in wizard */
.pbuaiv-fta-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--pbuaiv-blue-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--pbuaiv-radius-sm);
  font-size: 13px;
  color: var(--pbuaiv-blue-dark);
  margin-bottom: 20px;
  line-height: 1.5;
}
.pbuaiv-fta-notice__flag { font-size: 20px; line-height: 1; flex-shrink: 0; }

/* Template picker in wizard */
.pbuaiv-template-picker { margin-top: 16px; }
.pbuaiv-template-picker h3 { margin-top: 0 !important; margin-bottom: 12px; }

.pbuaiv-template-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 2px solid var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius-sm);
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 8px;
  background: #fff;
}
.pbuaiv-template-option:hover { border-color: var(--pbuaiv-blue); background: var(--pbuaiv-blue-light); }
.pbuaiv-template-option--selected { border-color: var(--pbuaiv-blue); background: var(--pbuaiv-blue-light); }
.pbuaiv-template-option input[type="radio"] { flex-shrink: 0; accent-color: var(--pbuaiv-blue); }
.pbuaiv-template-option strong { font-size: 13px; font-weight: 600; color: var(--pbuaiv-text); }
.pbuaiv-template-option small  { font-size: 11px; color: var(--pbuaiv-gray); display: block; margin-top: 2px; }

/* Mini template thumbnail */
.pbuaiv-template-thumb {
  width: 56px;
  height: 70px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--pbuaiv-border);
  flex-shrink: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.pbuaiv-template-thumb__header {
  height: 16px;
  background: var(--pbuaiv-blue);
  flex-shrink: 0;
}
.pbuaiv-template-thumb--classic .pbuaiv-template-thumb__header { background: #1e293b; }
.pbuaiv-template-thumb--minimal .pbuaiv-template-thumb__header { background: var(--pbuaiv-bg); border-bottom: 2px solid var(--pbuaiv-border); }
.pbuaiv-template-thumb--corporate .pbuaiv-template-thumb__header { background: #0f172a; }

.pbuaiv-template-thumb__lines {
  flex: 1;
  padding: 6px 5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pbuaiv-template-thumb__lines span {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--pbuaiv-border);
}
.pbuaiv-template-thumb__lines span:first-child { width: 85%; }
.pbuaiv-template-thumb__lines span:nth-child(2) { width: 65%; }
.pbuaiv-template-thumb__lines span:last-child   { width: 50%; }

.pbuaiv-template-thumb__footer {
  height: 10px;
  background: var(--pbuaiv-bg);
  border-top: 1px solid var(--pbuaiv-border);
  flex-shrink: 0;
}

/* Wizard done step */
.pbuaiv-setup-panel--done {
  text-align: center;
  padding: 40px 32px;
}
.pbuaiv-done-icon {
  font-size: 56px;
  margin-bottom: 16px;
  line-height: 1;
}
.pbuaiv-setup-panel--done h2 { font-size: 22px; }
.pbuaiv-setup-panel--done p  { color: var(--pbuaiv-gray); max-width: 420px; margin: 0 auto 24px; }

.pbuaiv-done-links {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

/* FTA checklist in done step */
.pbuaiv-fta-checklist {
  text-align: left;
  border: 1px solid var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius-sm);
  overflow: hidden;
  margin-top: 8px;
}
.pbuaiv-fta-checklist h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--pbuaiv-gray);
  margin: 0;
  padding: 10px 14px;
  background: var(--pbuaiv-bg);
  border-bottom: 1px solid var(--pbuaiv-border);
}
.pbuaiv-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--pbuaiv-border);
  color: var(--pbuaiv-text);
}
.pbuaiv-check-item:last-child { border-bottom: none; }
.pbuaiv-check--pass { background: #f0fdf4; }
.pbuaiv-check--warn { background: #fffbeb; }

/* Wizard card in step 4 */
.pbuaiv-setup-panel .pbuaiv-card {
  box-shadow: none;
  border-color: var(--pbuaiv-border);
}

/* ==========================================================================
   DOCUMENTS TABLE
   ========================================================================== */

.pbuaiv-docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pbuaiv-docs-table th {
  background: var(--pbuaiv-blue);
  color: #fff;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  letter-spacing: .3px;
}
.pbuaiv-docs-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--pbuaiv-border);
  vertical-align: middle;
}
.pbuaiv-docs-table tr:hover td { background: var(--pbuaiv-bg); }
.pbuaiv-docs-table tr:last-child td { border-bottom: none; }

/* ==========================================================================
   REPORTS — STAT CARDS
   ========================================================================== */

.pbuaiv-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.pbuaiv-stat-card {
  background: #fff;
  border: 1px solid var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--pbuaiv-shadow);
}
.pbuaiv-stat-card .stat-label,
.pbuaiv-stat-card__label { font-size: 11px; color: var(--pbuaiv-gray); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.pbuaiv-stat-card .stat-val,
.pbuaiv-stat-card__value  { font-size: 26px; font-weight: 800; color: var(--pbuaiv-blue); margin: 6px 0 4px; line-height: 1; }
.pbuaiv-stat-card .stat-sub   { font-size: 11px; color: var(--pbuaiv-gray-light); }

/* ==========================================================================
   ORDER COLUMNS (list table)
   ========================================================================== */

.pbuaiv-doc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .1s;
}
.pbuaiv-doc-badge:hover { opacity: .85; text-decoration: none; }
.pbuaiv-doc-badge--issued,
.pbuaiv-doc-badge--paid    { background: var(--pbuaiv-green-light); color: #15803d; border: 1px solid #bbf7d0; }
.pbuaiv-doc-badge--sent    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.pbuaiv-doc-badge--void    { background: var(--pbuaiv-red-light); color: #b91c1c; border: 1px solid #fca5a5; }
.pbuaiv-doc-badge--none    { background: var(--pbuaiv-bg); color: var(--pbuaiv-gray-light); border: 1px solid var(--pbuaiv-border); }

/* ==========================================================================
   PDF STATUS BLOCK
   ========================================================================== */

.pbuaiv-mpdf-status {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--pbuaiv-green-light);
  border: 1px solid #bbf7d0;
  border-radius: var(--pbuaiv-radius-sm);
}
.pbuaiv-mpdf-status .pbuaiv-help { color: #15803d; font-size: 12px; margin: 0; }

/* ==========================================================================
   DOCUMENTS PAGE
   ========================================================================== */

/* Filter bar */
.pbuaiv-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius);
  box-shadow: var(--pbuaiv-shadow);
}

/* Small input / select modifiers */
.pbuaiv-input--sm,
.pbuaiv-select--sm {
  padding: 6px 10px;
  font-size: 12px;
  height: 32px;
  border-radius: var(--pbuaiv-radius-sm);
  border: 1px solid var(--pbuaiv-border);
  background: #fff;
  color: var(--pbuaiv-text);
  font-family: inherit;
  transition: border-color .15s;
  box-sizing: border-box;
}
.pbuaiv-select--sm {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}
.pbuaiv-input--sm:focus,
.pbuaiv-select--sm:focus {
  outline: none;
  border-color: var(--pbuaiv-blue);
  box-shadow: 0 0 0 2px rgba(36,75,142,.1);
}
input[type="date"].pbuaiv-input--sm { min-width: 140px; }

/* Documents table — .pbuaiv-table alias */
.pbuaiv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pbuaiv-table th {
  background: var(--pbuaiv-blue);
  color: #fff;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  letter-spacing: .3px;
}
.pbuaiv-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--pbuaiv-border);
  vertical-align: middle;
}
.pbuaiv-table tr:hover td { background: var(--pbuaiv-bg); }
.pbuaiv-table tr:last-child td { border-bottom: none; }

/* Type badge */
.pbuaiv-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  background: var(--pbuaiv-blue-light);
  color: var(--pbuaiv-blue);
}
.pbuaiv-type-badge--invoice      { background: var(--pbuaiv-blue-light);  color: var(--pbuaiv-blue); }
.pbuaiv-type-badge--receipt      { background: var(--pbuaiv-green-light); color: #15803d; }
.pbuaiv-type-badge--credit_note  { background: var(--pbuaiv-red-light);   color: #b91c1c; }
.pbuaiv-type-badge--proforma     { background: var(--pbuaiv-gold-light);  color: #92400e; }
.pbuaiv-type-badge--packing_slip { background: #f3e8ff; color: #6b21a8; }
.pbuaiv-type-badge--delivery_note{ background: #ecfeff; color: #0e7490; }

/* Pagination */
.pbuaiv-pagination {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.pbuaiv-pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--pbuaiv-text);
  background: #fff;
  text-decoration: none;
  transition: all .15s;
}
.pbuaiv-pagination__item:hover {
  border-color: var(--pbuaiv-blue);
  color: var(--pbuaiv-blue);
  background: var(--pbuaiv-blue-light);
  text-decoration: none;
}
.pbuaiv-pagination__item--active {
  background: var(--pbuaiv-blue);
  border-color: var(--pbuaiv-blue);
  color: #fff;
  font-weight: 700;
}

/* ==========================================================================
   TEMPLATES PAGE
   ========================================================================== */

/* Two-column layout */
.pbuaiv-templates-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

.pbuaiv-templates-sidebar {
  position: sticky;
  top: 32px;
}

.pbuaiv-templates-preview {
  background: #fff;
  border: 1px solid var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius);
  box-shadow: var(--pbuaiv-shadow);
  overflow: hidden;
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

/* Compact 2×2 template picker grid */
.pbuaiv-template-picker-compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pbuaiv-template-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px 8px;
  border: 2px solid var(--pbuaiv-border);
  border-radius: var(--pbuaiv-radius-sm);
  cursor: pointer;
  transition: all .15s;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--pbuaiv-text);
  background: #fff;
}
.pbuaiv-template-opt:hover {
  border-color: var(--pbuaiv-blue);
  background: var(--pbuaiv-blue-light);
}
.pbuaiv-template-opt--active {
  border-color: var(--pbuaiv-blue);
  background: var(--pbuaiv-blue-light);
  color: var(--pbuaiv-blue);
  font-weight: 700;
}
.pbuaiv-template-opt input[type="radio"] {
  display: none; /* visually hidden — use label styling instead */
}

/* Mini document thumbnail */
.pbuaiv-template-mini {
  width: 48px;
  height: 60px;
  border: 1px solid var(--pbuaiv-border);
  border-radius: 3px;
  overflow: hidden;
  background: #fff;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  flex-shrink: 0;
}
.pbuaiv-template-mini::before {
  content: '';
  display: block;
  height: 14px;
  background: var(--pbuaiv-blue);
  width: 100%;
}
.pbuaiv-template-mini::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 5px;
  right: 5px;
  height: 3px;
  background: var(--pbuaiv-border);
  border-radius: 2px;
  box-shadow:
    0 7px 0 var(--pbuaiv-border),
    0 14px 0 var(--pbuaiv-border),
    0 21px 0 rgba(100,116,139,.12);
}
.pbuaiv-template-mini--classic::before   { background: #1e293b; }
.pbuaiv-template-mini--minimal::before   { background: #f8fafc; border-bottom: 2px solid var(--pbuaiv-border); }
.pbuaiv-template-mini--corporate::before { background: #0f172a; }

/* Wide / full-width button modifier */
.pbuaiv-btn--wide { width: 100%; justify-content: center; }

/* Preview bar (above iframe) */
.pbuaiv-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  background: var(--pbuaiv-bg);
  border-bottom: 1px solid var(--pbuaiv-border);
  flex-shrink: 0;
}
.pbuaiv-preview-bar__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--pbuaiv-blue);
}
.pbuaiv-preview-bar__hint {
  font-size: 11px;
  color: var(--pbuaiv-gray);
}

/* Preview frame */
.pbuaiv-preview-frame-wrap {
  position: relative;
  flex: 1;
  min-height: 460px;
  background: var(--pbuaiv-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pbuaiv-preview-iframe {
  width: 100%;
  min-height: 560px;
  border: none;
  display: block;
  background: #fff;
}

/* Spin utility (for loading dashicons) */
.pbuaiv-spin { animation: pbuaiv-spin .65s linear infinite !important; }

@media (max-width: 900px) {
  .pbuaiv-templates-layout {
    grid-template-columns: 1fr;
  }
  .pbuaiv-templates-sidebar { position: static; }
}

/* ==========================================================================
   MISC / UTILITIES
   ========================================================================== */

.pbuaiv-separator { height: 1px; background: var(--pbuaiv-border); margin: 20px 0; }

.pbuaiv-powered-by {
  font-size: 11px;
  color: var(--pbuaiv-gray-light);
  padding: 16px 0 4px;
  text-align: right;
}
.pbuaiv-powered-by a { color: var(--pbuaiv-blue); text-decoration: none; }
.pbuaiv-powered-by a:hover { text-decoration: underline; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 900px) {
  .pbuaiv-form-grid { grid-template-columns: 1fr; }
  .pbuaiv-field--full { grid-column: auto; }
  .pbuaiv-page-header { flex-direction: column; }
  .pbuaiv-page-header__actions { width: 100%; justify-content: flex-start; }
}

@media (max-width: 600px) {
  .pbuaiv-setup-panel { padding: 20px 16px; }
  .pbuaiv-setup-step__label { display: none; }
  .pbuaiv-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pbuaiv-stats-grid { grid-template-columns: 1fr 1fr; }
}
