/* ==========================================================================
   ALIGNER LOUNGE — Invoice document
   Screen first, then a print block that strips everything a sheet of paper
   does not need. The brand reads gold on screen and holds up in grayscale.
   ========================================================================== */

:root{
  --inv-ink:#1A1A1F;
  --inv-muted:#6B6B78;
  --inv-line:#E2DED4;
  --inv-gold:#9C7C15;
  --inv-paper:#FFFFFF;
  --inv-ground:#F4F1EA;
}

body.invoice-page{
  margin:0;
  background:var(--inv-ground);
  color:var(--inv-ink);
  font-family:"Jost",-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif;
  font-size:15px;
  line-height:1.6;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}
html[lang^="ar"] body.invoice-page{font-family:"Tajawal","Jost",system-ui,sans-serif}

/* --- Action bar (screen only) --------------------------------------- */
.invoice-bar{
  max-width:860px;margin:1.5rem auto .75rem;padding:0 1.25rem;
  display:flex;flex-wrap:wrap;gap:1rem;align-items:center;justify-content:space-between;
}
.invoice-bar__back{
  color:var(--inv-muted);text-decoration:none;font-size:.875rem;
}
.invoice-bar__back:hover{color:var(--inv-gold)}
.invoice-bar__actions{display:flex;gap:.6rem}
.invoice-bar .btn{padding:.7rem 1.5rem;font-size:.75rem}

.invoice-hint{
  max-width:860px;margin:0 auto 1.5rem;padding:0 1.25rem;
  font-size:.8125rem;color:var(--inv-muted);
}

/* --- The document ----------------------------------------------------- */
.invoice{
  max-width:860px;margin:0 auto 3rem;
  background:var(--inv-paper);
  padding:clamp(1.75rem,5vw,3.5rem);
  box-shadow:0 20px 60px -30px rgb(0 0 0 / .25);
  border-top:3px solid var(--inv-gold);
}

.invoice__head{
  display:flex;flex-wrap:wrap;gap:2rem;
  align-items:flex-start;justify-content:space-between;
  padding-bottom:1.75rem;margin-bottom:1.75rem;
  border-bottom:1px solid var(--inv-line);
}
.invoice__logo{height:72px;width:auto}
.invoice__brandname{
  margin:0;font-size:1.25rem;letter-spacing:.12em;text-transform:uppercase;color:var(--inv-gold);
}
.invoice__title{
  margin:0 0 .75rem;font-size:1.5rem;letter-spacing:.2em;
  text-transform:uppercase;color:var(--inv-gold);text-align:end;
}
html[lang^="ar"] .invoice__title{letter-spacing:0}

.invoice__metatable{border-collapse:collapse;margin-inline-start:auto}
.invoice__metatable th,
.invoice__metatable td{padding:.2rem 0;font-size:.875rem;text-align:start;vertical-align:top}
.invoice__metatable th{color:var(--inv-muted);font-weight:400;padding-inline-end:1.25rem;white-space:nowrap}

.invoice__status{
  display:inline-block;padding:.15rem .7rem;border-radius:99px;
  font-size:.75rem;font-weight:600;
  background:#F0F0F1;color:#50575E;
}
.invoice__status.is-paid{background:#E4F5EA;color:#17643A}
.invoice__status.is-sent{background:#E5F0FB;color:#1D5A96}
.invoice__status.is-overdue{background:#FCEBEB;color:#9A2323}
.invoice__status.is-cancelled{background:#F0F0F1;color:#8C8F94;text-decoration:line-through}

/* --- Parties ---------------------------------------------------------- */
.invoice__parties{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,15rem),1fr));
  gap:2rem;margin-bottom:2rem;
}
.invoice__parties h3{
  margin:0 0 .5rem;font-size:.6875rem;letter-spacing:.18em;
  text-transform:uppercase;color:var(--inv-muted);font-weight:600;
}
html[lang^="ar"] .invoice__parties h3{letter-spacing:0;text-transform:none;font-size:.875rem}
.invoice__party{margin:0;font-size:.9375rem;line-height:1.7}

/* --- Items ------------------------------------------------------------ */
.invoice__items{width:100%;border-collapse:collapse;margin-bottom:1.5rem}
.invoice__items th{
  padding:.65rem .75rem;
  font-size:.6875rem;letter-spacing:.14em;text-transform:uppercase;
  color:var(--inv-muted);font-weight:600;text-align:start;
  border-bottom:1.5px solid var(--inv-ink);
}
html[lang^="ar"] .invoice__items th{letter-spacing:0;text-transform:none;font-size:.875rem}
.invoice__items td{
  padding:.8rem .75rem;border-bottom:1px solid var(--inv-line);
  vertical-align:top;font-size:.9375rem;
}
.invoice__items .is-num{text-align:end;white-space:nowrap}
.invoice__items .is-desc{width:52%}

/* --- Summary ---------------------------------------------------------- */
.invoice__summary{display:flex;justify-content:flex-end;margin-bottom:2rem}
.invoice__summary table{border-collapse:collapse;min-width:min(100%,19rem)}
.invoice__summary th,
.invoice__summary td{padding:.45rem .75rem;font-size:.9375rem}
.invoice__summary th{text-align:start;color:var(--inv-muted);font-weight:400}
.invoice__summary td{text-align:end;white-space:nowrap}
.invoice__grand th,
.invoice__grand td{
  border-top:1.5px solid var(--inv-ink);
  padding-top:.7rem;font-size:1.0625rem;font-weight:700;color:var(--inv-ink);
}
.invoice__grand td{color:var(--inv-gold)}

/* --- Notes and foot --------------------------------------------------- */
.invoice__notes{
  padding-top:1.25rem;border-top:1px solid var(--inv-line);margin-bottom:1.5rem;
}
.invoice__notes h3{
  margin:0 0 .4rem;font-size:.6875rem;letter-spacing:.18em;
  text-transform:uppercase;color:var(--inv-muted);font-weight:600;
}
html[lang^="ar"] .invoice__notes h3{letter-spacing:0;text-transform:none;font-size:.875rem}
.invoice__notes p{margin:0;font-size:.9375rem;color:var(--inv-muted)}

.invoice__foot{
  padding-top:1.5rem;border-top:1px solid var(--inv-line);
  display:flex;flex-wrap:wrap;gap:.5rem;justify-content:space-between;
  font-size:.8125rem;color:var(--inv-muted);
}
.invoice__foot p{margin:0}

/* --- Lookup form ------------------------------------------------------ */
.inv-lookup{max-width:40rem}
.inv-lookup__intro{margin:0 0 1.75rem;color:var(--ink-soft,#5C5C68);line-height:1.75}
.inv-lookup__msg{
  padding:.9rem 1.15rem;border-radius:.35rem;font-size:.9375rem;margin-bottom:1.25rem;
}
.inv-lookup__msg.is-err{background:#FDECEC;border:1px solid #F3C2C2;color:#A32020}
.inv-lookup__hint{font-size:.875rem;color:var(--text-muted,#6B6B78);margin:0}

/* ==========================================================================
   PRINT
   ========================================================================== */
@media print{
  @page{margin:14mm}

  body.invoice-page{background:#fff;font-size:11pt}
  .no-print,
  .invoice-bar,
  .invoice-hint,
  #wpadminbar{display:none !important}

  .invoice{
    max-width:none;margin:0;padding:0;
    box-shadow:none;border-top:2px solid var(--inv-gold);
    padding-top:10mm;
  }
  .invoice__logo{height:58px}

  /* Keep a row from splitting across a page break. */
  .invoice__items tr,
  .invoice__summary table{page-break-inside:avoid;break-inside:avoid}
  .invoice__items thead{display:table-header-group}
  .invoice__foot{page-break-inside:avoid;break-inside:avoid}

  a[href]::after{content:""}
}
