/* Extracted from invoice_v20.html */
* {
  box-sizing: border-box;
}

:root {
  --separator-grey: #cccccc;
  --brand-red: #e4251a;
  --brand-red-dark: #c11913;
  --border-light: #e5e5e7;
  --bg-page: #e7eaee;
  --card-bg: #ffffff;
  --text-main: #1d1d1f;
  --text-muted: #6e6e73;
  --panel-grey: #f8f8fa;
  --footer-grey: #faf2f0;
  --bottom-red: #d5100d;
  --bottom-red-dark: #b40a07;
  /* 字体尺寸整体加大 */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 18px;
}

/* Scoped to .invoice-page to avoid conflicts with theme */
.invoice-page {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto 32px;
  background: #fdfdfd;
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.03);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  font-size: var(--fs-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.invoice-inner {
  position: relative;
  padding: 28px 32px 28px 72px;
  background-image:
    linear-gradient(135deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px),
    linear-gradient(-45deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0, 0 0;
}

.invoice-inner.page2 {
  padding-left: 32px;
}

.invoice-tab {
  position: absolute;
  left: 0;
  top: 140px;
  width: 44px;
  height: 350px;
  background: var(--brand-red);
  border-radius: 0 20px 20px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
}

.invoice-tab span {
  color: #ffffff;
  font-weight: 300;
  letter-spacing: 0.22em;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  transform: rotate(-90deg);
  white-space: nowrap;
}

.invoice-header {
  display: grid;
  grid-template-columns: 260px 1fr;
  column-gap: 16px;
  align-items: flex-start;
}

.meta-panel {
  background: var(--panel-grey);
  border-radius: 16px;
  padding: 16px 16px 12px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  font-size: var(--fs-sm);
}

.meta-item {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  column-gap: 8px;
  margin-bottom: 10px;
}

.meta-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  line-height: 1.3;
}

.meta-value {
  font-weight: 600;
  font-size: var(--fs-md);
  text-align: right;
  outline: none;
}

.meta-value.small {
  font-size: var(--fs-sm);
}

.corporate-panel {
  background: #ffffff !important;
  border-radius: 16px;
  padding: 16px 18px 12px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
  font-size: var(--fs-sm);
}

.corp-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 8px;
}

.corp-brand {
  font-size: var(--fs-lg);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand-red-dark);
}

.corp-subline {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.corp-logo-text {
  font-size: var(--fs-sm);
  text-align: right;
  color: var(--text-muted);
}

.corp-logo-text strong {
  color: #d0201b;
}

.corp-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr;
  column-gap: 12px;
  row-gap: 10px;
  font-size: var(--fs-sm);
}

.corp-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.corp-value {
  font-size: var(--fs-sm);
  line-height: 1.5;
  outline: none;
}

.corp-two-line {
  margin-bottom: 4px;
}

.section-bar {
  margin-top: 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Invoice Type Toggle - JetBlue Style Small Blocks */
.invoice-type-toggle {
  display: inline-flex;
  gap: 12px;
  margin-top: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.invoice-type-btn {
  min-width: 130px;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 16px;
  border: none;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
  background: linear-gradient(to bottom, #5BB8FF, #1A6ED8);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 90, 210, 0.25);
  transition: background 0.18s ease, color 0.18s ease,
    box-shadow 0.18s ease, transform 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;
}

.invoice-type-btn:not(.active) {
  background: linear-gradient(to bottom, #E6F2FF, #BBD9FF);
  color: #003A70;
  box-shadow: 0 2px 6px rgba(0, 60, 140, 0.18);
}

.invoice-type-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 90, 210, 0.32);
}

.invoice-type-btn.active {
  background: linear-gradient(to bottom, #6BC6FF, #1A75E8);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 90, 210, 0.38);
}


.section-bar.fill-red,
.section-bar.pill-red {
  background: var(--brand-red);
  color: #fff;
  padding: 8px 20px;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: inline-block;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.18);
}

.section-bar.fill-red {
  border-radius: 20px 20px 0 0;
}

.section-bar.pill-red {
  border-radius: 20px;
}

.section-note {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  flex: 1;
  min-width: 160px;
  outline: none;
}

.exclusive-panel {
  background: var(--card-bg);
  border-radius: 0 16px 16px 16px;
  padding: 14px 18px 16px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
  font-size: var(--fs-sm);
}

.client-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr;
  column-gap: 28px;
  font-size: var(--fs-sm);
  margin-top: 6px;
}

.client-col-title {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.client-row {
  display: grid;
  grid-template-columns: 0.9fr 1.5fr;
  column-gap: 4px;
  margin-bottom: 4px;
}

.client-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.client-value {
  font-size: var(--fs-sm);
  font-weight: 600;
  outline: none;
}

.client-note {
  font-size: var(--fs-sm);
  font-style: italic;
  color: var(--text-muted);
  margin-top: 4px;
  outline: none;
}

.purchase-wrapper {
  margin-top: 24px;
}

.purchase-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.purchase-table thead th {
  background: #f2f2f4;
  padding: 9px 10px;
  text-align: left;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

.purchase-table thead th.qty-col {
  width: 40px;
  text-align: center;
}

.purchase-table thead th.price-col {
  width: 90px;
  text-align: right;
}

.purchase-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f2;
  vertical-align: top;
}

.purchase-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

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

.purchase-table td.qty {
  text-align: center;
}

.purchase-table td.money {
  text-align: right;
  white-space: nowrap;
}

.purchase-item-title {
  font-weight: 600;
  outline: none;
}

.purchase-item-note {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
  outline: none;
}

.purchase-footnote-row td {
  background: #f6f6f8 !important;
  border-top: none;
}

.add-item-btn {
  margin-top: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--brand-red);
  background: #fff;
  color: var(--brand-red);
  font-size: var(--fs-sm);
  cursor: pointer;
}

.add-item-btn:hover {
  background: #ffecec;
}

.summary-row {
  display: grid;
  grid-template-columns: 1.7fr 1.1fr;
  column-gap: 24px;
  align-items: flex-start;
  margin-top: 14px;
}

.summary-left {
  display: flex;
  align-items: flex-start;
}

.qr-section {
  padding-top: 4px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.qr-title {
  margin-bottom: 4px;
}

#invoice-qr canvas,
#invoice-qr img {
  width: 120px;
  height: 120px;
  display: block;
}

@media (max-width: 768px) {
  .qr-section {
    margin-top: 12px;
  }
}


.price-summary-box {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 14px 18px 12px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  font-size: var(--fs-sm);
  width: 600px;
}

.price-summary-title {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.price-row {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  margin-bottom: 3px;
}

.price-label {
  color: var(--text-muted);
}

.price-value {
  text-align: right;
  white-space: nowrap;
  outline: none;
}

.price-row.grand-total {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid #e0e0e4;
}

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


.price-footnote {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 4px;
  outline: none;
}

.exclusive-bottom {
  margin-top: 26px;
  background: var(--card-bg);
  border-radius: 16px 16px 0 0;
  padding: 0 24px 18px 24px;
  border-top: 2px solid var(--brand-red);
  font-size: var(--fs-sm);
}

.exclusive-tagline {
  margin-top: 8px;
  font-size: var(--fs-sm);
  color: var(--text-main);
  outline: none;
}

.exclusive-warranty-grid {
  display: grid;
  grid-template-columns: 1.1fr 2fr;
  column-gap: 24px;
  margin-top: 10px;
  font-size: var(--fs-sm);
}

/* 1:1 图片框替代 X30 文本 */
.warranty-image-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
  /* box-shadow removed as per user request */
  display: flex;
  align-items: center;
  justify-content: center;
}

.warranty-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Extend Summary Width */
.price-summary-box {
  width: 600px !important;
}

.upload-controls {
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.upload-controls input[type="file"] {
  font-size: var(--fs-xs);
}

.warranty-text {
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text-muted);
  outline: none;
}

.warranty-link {
  font-size: var(--fs-sm);
  margin-top: 6px;
  color: var(--brand-red-dark);
  text-decoration: none;
  outline: none;
  display: inline-block;
  word-break: break-all;
}

/* footer banner 广告图 */
.footer-banner {
  margin-top: 20px;
  padding: 0 0 14px 0;
}

.footer-banner-image {
  border-radius: 0 0 18px 18px;
  overflow: hidden;
  background: var(--footer-grey);
}

.footer-banner-image img {
  width: 100%;
  display: block;
}

.footer-banner .upload-controls {
  padding: 6px 18px 0 18px;
}

/* ---------- Page2 ---------- */

.payment-section {
  margin-top: 8px;
  font-size: var(--fs-sm);
}

.payment-panel {
  background: var(--card-bg);
  border-radius: 0 16px 16px 16px;
  padding: 10px 18px 12px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.payment-title {
  font-size: var(--fs-md);
  font-weight: 600;
}

.payment-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.payment-options {
  margin-top: 6px;
}

.payment-option-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-size: var(--fs-sm);
}

.payment-option-row input[type="radio"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
}

.payment-label-main {
  font-weight: 600;
  outline: none;
}

.payment-label-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-style: italic;
  margin-left: 4px;
  outline: none;
}

.terms-section {
  margin-top: 24px;
  font-size: var(--fs-sm);
}

.terms-panel {
  background: var(--card-bg);
  border-radius: 0 16px 16px 16px;
  padding: 14px 20px 14px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.terms-title {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.terms-list {
  margin: 0;
  padding-left: 20px;
  font-size: var(--fs-sm);
}

.terms-list li {
  margin-bottom: 5px;
  line-height: 1.5;
  outline: none;
}

.page2-footer {
  margin-top: 26px;
  padding: 10px 18px 0 18px;
  font-size: var(--fs-xs);
  text-align: center;
  color: var(--text-muted);
}

.page2-footer-line {
  margin-bottom: 6px;
  outline: none;
}

.bottom-red-bar {
  margin-top: 10px;
  background: linear-gradient(135deg, var(--bottom-red-dark), var(--bottom-red));
  color: #ffffff;
  padding: 10px 24px;
  font-size: var(--fs-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bottom-red-left {
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.bottom-red-right {
  text-align: right;
}

/* 手机排版 */
@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .invoice-inner,
  .invoice-inner.page2 {
    padding: 20px 14px;
  }

  .invoice-tab {
    position: static;
    margin: 0 auto 10px;
    width: 140px;
    height: 30px;
    border-radius: 0 0 16px 16px;
  }

  .invoice-tab span {
    transform: none;
    letter-spacing: 0.2em;
  }

  .invoice-header {
    grid-template-columns: 1fr;
    row-gap: 12px;
  }

  .client-grid,
  .corp-grid,
  .summary-row,
  .exclusive-warranty-grid {
    grid-template-columns: 1fr;
  }

  .exclusive-bottom {
    padding: 0 14px 14px 14px;
  }

  .bottom-red-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .bottom-red-right {
    text-align: left;
  }
}

/* Print: Robust reset to hide all theme elements */
@media print {

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

  /* Show only the invoice and its children */
  .invoice-page,
  .invoice-page * {
    visibility: visible;
  }

  /* Position the invoice at the top left */
  .invoice-page {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    background: white;
  }

  .invoice-inner {
    padding: 20px !important;
  }

  /* Hide controls */
  .upload-controls,
  .add-item-btn,
  .submit-controls,
  .invoice-type-toggle,
  .section-note {
    display: none !important;
  }
}

.price-line {
  border: 0;
  border-top: 1px solid var(--separator-grey);
  margin: 4px 0;
}

/* Custom styles for plugin */
.submit-controls {
  margin-top: 20px;
  text-align: center;
  padding: 20px;
}

.submit-btn,
.print-btn {
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin: 0 10px;
}

.submit-btn {
  background-color: var(--brand-red);
  color: white;
}

.print-btn {
  background-color: #333;
  color: white;
}