@font-face {
  font-family: InvoiceArabic;
  src: url("./fonts/NotoSansArabic.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --navy: #12324a;
  --blue: #1f5a7a;
  --gold: #b8893b;
  --paper: #f4f7f9;
  --white: #fff;
  --ink: #17232c;
  --slate: #62717c;
  --line: #d9e2e8;
  --error: #9e2835;
  --success: #286048;
  --radius: 12px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    14px/1.7 InvoiceArabic,
    Tahoma,
    sans-serif;
}
a {
  color: var(--blue);
  text-decoration: none;
}
button,
input,
select {
  font: inherit;
}
button,
.button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--navy);
  padding: 8px 15px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
button:hover,
.button:hover {
  border-color: var(--blue);
  background: #edf4f8;
}
button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.primary {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.primary:hover {
  background: var(--blue);
  color: white;
}
input,
select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #b6c5d0;
  border-radius: 6px;
  background: white;
  padding: 8px 11px;
  color: var(--ink);
}
input[type="number"],
input[type="date"],
input[inputmode="decimal"],
input[inputmode="numeric"] {
  direction: ltr;
  text-align: right;
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
}
input::placeholder {
  color: #73828e;
  font-family: InvoiceArabic, Tahoma, sans-serif;
  font-size: 12px;
}
input[type="checkbox"] {
  width: 17px;
  min-height: 17px;
  margin: 0;
  accent-color: var(--blue);
}
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 13px;
}
label input,
label select {
  display: block;
  margin-top: 5px;
}
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 400;
  margin: 8px 0;
}
.check input {
  margin: 0;
  flex-shrink: 0;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 29px;
  line-height: 1.5;
  margin-bottom: 5px;
  letter-spacing: -0.6px;
}
h2 {
  font-size: 17px;
  margin-bottom: 15px;
}
h3 {
  font-size: 16px;
}
.numeric {
  font-family: Consolas, "Courier New", monospace;
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}
.topbar {
  min-height: 86px;
  background: var(--navy);
  color: white;
  display: flex;
  align-items: center;
  padding: 16px max(24px, calc((100vw - 1376px) / 2));
  gap: 52px;
}
.brand {
  display: flex;
  color: white;
  align-items: center;
  gap: 12px;
  font-size: 21px;
  font-weight: 700;
  white-space: nowrap;
}
.brand small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: #c0d2df;
}
.brand-mark {
  font-size: 30px;
  border: 1px solid #6d8798;
  width: 42px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #e2c491;
}
.topbar nav {
  display: flex;
  gap: 28px;
}
.topbar nav a {
  color: #e9f0f5;
  font-size: 12px;
}
.owner-label {
  margin-inline-start: auto;
  font-size: 11px;
  color: #c0d2df;
}
.language-control {
  color: #e9f0f5;
  font-size: 11px;
  flex-shrink: 0;
  margin: 0;
}
.language-control select {
  min-width: 105px;
  min-height: 36px;
  margin: 3px 0 0;
  padding: 4px 8px;
}
html[lang="en"] body {
  font-family: Arial, InvoiceArabic, Tahoma, sans-serif;
}
html[lang="en"] .invoice-paper {
  font-family: InvoiceArabic, Tahoma, sans-serif;
}
html[dir="ltr"] .history,
html[dir="ltr"] .search-results,
html[dir="ltr"] input:not(.numeric) {
  text-align: start;
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .language-control { margin-inline-start: auto; }
}
.workspace {
  max-width: 1424px;
  margin: auto;
  padding: 32px 24px 60px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}
.eyebrow {
  color: var(--slate);
  font-size: 11px;
  margin-bottom: 6px;
}
.muted {
  color: var(--slate);
  font-size: 13px;
  margin-bottom: 0;
}
.heading-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.heading-actions [role="status"] {
  font-size: 11px;
  color: var(--slate);
}
.badge {
  display: inline-block;
  font-size: 10px;
  line-height: 1.5;
  padding: 5px 10px;
  border-radius: 20px;
  background: #eaf0f4;
  color: var(--blue);
  font-weight: 500;
  vertical-align: middle;
  letter-spacing: 0;
}
h1 .badge {
  margin-inline-start: 10px;
}
.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 28px;
  align-items: start;
}
.editor-column {
  min-width: 0;
}
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 17px;
  gap: 12px;
}
.section-heading h2 {
  margin: 0;
}
.step-label {
  font-size: 10px;
  color: var(--slate);
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field-help {
  color: var(--slate);
  font-size: 11px;
  line-height: 1.9;
  margin-bottom: 10px;
}
.inline-links {
  display: flex;
  gap: 10px;
  margin-top: -4px;
  margin-bottom: 8px;
}
.text-button {
  border: 0;
  background: none;
  padding: 2px 0;
  min-height: 32px;
  color: var(--blue);
  font-size: 12px;
}
.text-button:hover {
  background: none;
  text-decoration: underline;
}
.search-area {
  position: relative;
  margin-bottom: 6px;
}
.search-results {
  position: absolute;
  z-index: 5;
  top: 100%;
  width: 100%;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 10px 26px #12324a1a;
  max-height: 250px;
  overflow-y: auto;
  padding: 6px;
}
.search-results button {
  display: block;
  width: 100%;
  border: 0;
  text-align: right;
  font-size: 12px;
  border-radius: 4px;
}
.search-result-row {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.search-result-row button:first-child {
  flex: 1;
}
.search-result-row button:last-child {
  width: auto;
  flex-shrink: 0;
}
.search-results p {
  margin: 5px;
  font-size: 12px;
}
.compass-card {
  border-top: 3px solid var(--gold);
  background: linear-gradient(135deg, #fff 65%, #f6f9fb);
}
.target-row {
  display: grid;
  grid-template-columns: 1fr 105px;
  gap: 16px;
}
.target-row input {
  font-size: 21px;
  font-weight: bold;
  height: 52px;
}
.target-row .vat-field input {
  font-size: 16px;
}
.currency {
  font-size: 10px;
  font-weight: 400;
  color: var(--slate);
}
.compass-figure {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 13px 0 14px;
}
.compass-figure span {
  display: block;
  font-size: 11px;
  color: var(--slate);
}
.compass-figure strong {
  display: block;
  font-size: 32px;
  line-height: 1.5;
  color: var(--navy);
  letter-spacing: -1px;
}
.compass-difference {
  text-align: left;
}
.compass-difference strong {
  font-size: 23px;
  color: var(--blue);
  padding-top: 6px;
}
progress {
  display: block;
  width: 100%;
  height: 7px;
  border: 0;
  border-radius: 4px;
  appearance: none;
  background: #e4eaef;
  overflow: hidden;
  direction: ltr;
}
progress::-webkit-progress-bar {
  background: #e4eaef;
}
progress::-webkit-progress-value {
  background: var(--gold);
}
progress::-moz-progress-bar {
  background: var(--gold);
}
.compass-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 10px;
  color: var(--slate);
  padding-top: 13px;
}
.compass-details b {
  font-size: 12px;
  color: var(--ink);
}
.readiness {
  font-size: 11px;
  color: var(--blue);
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin: 15px 0 0;
}
.readiness[data-ready="true"] {
  color: var(--success);
}
.generation-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.generation-actions button {
  font-size: 12px;
}
.line {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 13px 0;
  padding: 14px;
  background: #fcfdfe;
}
.line-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.line-top .check {
  font-size: 10px;
}
.line-actions {
  margin-inline-start: auto;
  display: flex;
  gap: 3px;
}
.line-actions button {
  padding: 0;
  width: 29px;
  min-height: 30px;
  font:
    19px/1 Arial,
    sans-serif;
}
.line-values {
  display: grid;
  grid-template-columns: 1fr 0.7fr 1fr 0.9fr;
  gap: 10px;
  align-items: end;
}
.line-values label {
  margin-bottom: 0;
  font-size: 10px;
}
.line-values input,
.line-values select {
  font-size: 12px;
  padding: 7px;
}
.description-field {
  margin-bottom: 10px;
}
.line-sum {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 10px;
  padding-bottom: 8px;
}
.line-sum span {
  font-size: 10px;
  color: var(--slate);
}
.line-sum output {
  font-size: 15px;
  font-weight: bold;
  color: var(--navy);
}
.add-line {
  width: 100%;
  border-style: dashed;
  color: var(--blue);
  font-size: 12px;
}
.advisor {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}
.advisor p {
  margin-bottom: 5px;
}
#advice button {
  font-size: 11px;
  line-height: 1.9;
  width: 100%;
  margin-top: 7px;
  text-align: right;
  justify-content: flex-start;
}
.preview-column {
  position: sticky;
  top: 22px;
  min-width: 0;
}
.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 3px 14px;
  font-size: 11px;
  color: var(--slate);
}
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  margin-inline-end: 5px;
}
.preview-note {
  font-size: 10px;
}
.invoice-paper {
  background: white;
  box-shadow: 0 8px 32px #12324a0c;
  border: 1px solid #d8e1e7;
  padding: 30px 26px 27px;
  border-radius: 3px;
  min-height: 690px;
}
.invoice-brand {
  text-align: center;
  color: var(--blue);
}
.invoice-emblem {
  display: inline-grid;
  place-items: center;
  border: 2px solid var(--blue);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.invoice-brand h2 {
  font-size: 17px;
  margin: 11px 0 3px;
}
.invoice-brand p {
  font-family: Georgia, serif;
  font-size: 10px;
  letter-spacing: 2px;
  margin-bottom: 21px;
}
.invoice-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-block: 2px solid var(--blue);
  padding: 9px 0;
  color: var(--blue);
}
.invoice-title h3 {
  margin: 0;
  font-size: 15px;
}
.invoice-title span {
  font-family: Consolas, monospace;
  font-size: 11px;
}
.invoice-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  gap: 10px;
  margin: 14px 0;
}
.invoice-meta div {
  display: flex;
  gap: 10px;
}
.invoice-meta dd {
  margin: 0;
  font-weight: bold;
  font-size: 12px;
}
.invoice-customer {
  font-size: 11px;
  margin: 22px 0;
  overflow-wrap: anywhere;
}
.invoice-customer small {
  color: var(--slate);
  margin-inline-end: 8px;
}
.invoice-customer strong {
  font-size: 13px;
}
.invoice-customer p {
  margin: 5px 0;
}
.preview-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 10px;
}
.preview-table th {
  font-weight: 600;
  background: #edf3f7;
  color: var(--blue);
  border-block: 1px solid #b9cdd9;
  padding: 9px 4px;
}
.preview-table th:first-child {
  width: 43%;
  text-align: right;
}
.preview-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 4px;
  overflow-wrap: anywhere;
}
.preview-table td:not(:first-child) {
  font:
    11px Consolas,
    monospace;
  text-align: center;
  direction: ltr;
}
.preview-empty {
  text-align: center;
  color: var(--slate);
  font-size: 10px;
  padding: 35px 0;
  border-bottom: 1px solid var(--line);
}
.invoice-totals {
  font-size: 10px;
  margin: 22px 0;
}
.invoice-totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}
.invoice-totals dd {
  margin: 0;
  font-size: 12px;
}
.invoice-totals .invoice-grand-total {
  background: var(--blue);
  color: white;
  margin-top: 6px;
  padding: 12px 10px;
  align-items: center;
}
.invoice-grand-total b {
  font-size: 20px;
}
.amount-words {
  font-size: 10px;
  text-align: center;
  color: var(--slate);
  min-height: 28px;
}
.signatures {
  display: flex;
  justify-content: space-around;
  font-size: 10px;
  color: var(--slate);
  margin-top: 48px;
}
.signatures span {
  border-top: 1px solid #acbdc8;
  padding: 10px 16px;
}
.preview-caption {
  text-align: center;
  color: var(--slate);
  font-size: 10px;
  margin: 14px 0;
}
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--slate);
}
.empty.compact {
  font-size: 12px;
  padding: 25px 5px;
}
.error-summary {
  background: #fff0f1;
  border: 1px solid #e2b9bf;
  border-inline-start: 4px solid var(--error);
  border-radius: 7px;
  color: var(--error);
  padding: 15px;
  margin-bottom: 20px;
  font-size: 13px;
}
.panel-error {
  font-size: 12px;
  color: var(--error);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 36px);
  color: var(--ink);
  box-shadow: 0 24px 100px #12324a44;
}
dialog::backdrop {
  background: #12324a88;
}
.panel-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.app-footer {
  max-width: 1376px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 20px 24px;
  color: var(--slate);
  font-size: 10px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
}
.mobile-only {
  display: none;
}
.skip-link {
  position: fixed;
  top: -100px;
  z-index: 100;
  background: white;
  padding: 10px;
}
.skip-link:focus {
  top: 10px;
}
.table-scroll {
  overflow: auto;
}
.history {
  border-collapse: collapse;
  width: 100%;
  text-align: right;
}
.history th,
.history td {
  border-bottom: 1px solid var(--line);
  padding: 15px;
  font-size: 13px;
  white-space: nowrap;
}
.search-form {
  max-width: 520px;
  margin-bottom: 25px;
}
.inline {
  display: flex;
  gap: 10px;
}
[hidden] {
  display: none !important;
}
body.busy {
  cursor: progress;
}
@media (max-width: 1050px) {
  .topbar {
    gap: 30px;
  }
  .owner-label {
    display: none;
  }
  .builder-grid {
    gap: 18px;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }
  .card {
    padding: 18px;
  }
  .invoice-paper {
    padding: 22px 15px;
  }
  .line-values {
    grid-template-columns: 1fr 1fr;
  }
  .page-heading {
    align-items: flex-start;
  }
  .heading-actions {
    justify-content: flex-end;
    max-width: 230px;
  }
}
@media (max-width: 760px) {
  .topbar {
    min-height: 73px;
    padding: 13px 18px;
    gap: 20px;
    justify-content: space-between;
  }
  .brand {
    font-size: 18px;
    gap: 9px;
  }
  .brand-mark {
    width: 35px;
    height: 39px;
    font-size: 25px;
  }
  .topbar nav {
    gap: 17px;
  }
  .topbar nav a {
    font-size: 10px;
  }
  .workspace {
    padding: 23px 15px 38px;
  }
  .page-heading {
    display: block;
    margin-bottom: 20px;
  }
  h1 {
    font-size: 25px;
  }
  .heading-actions {
    max-width: none;
    justify-content: flex-start;
    margin-top: 18px;
    gap: 10px;
  }
  .heading-actions [role="status"] {
    width: 100%;
    font-size: 10px;
  }
  .heading-actions button {
    flex: 1;
    font-size: 12px;
  }
  .builder-grid {
    display: block;
  }
  .card {
    padding: 18px 15px;
    margin-bottom: 15px;
  }
  .field-grid {
    gap: 11px;
  }
  .target-row {
    grid-template-columns: 1fr 79px;
    gap: 10px;
  }
  .compass-figure strong {
    font-size: 29px;
  }
  .compass-difference strong {
    font-size: 21px;
  }
  .compass-details {
    gap: 6px 12px;
  }
  .line {
    padding: 12px;
  }
  .line-top {
    gap: 8px;
  }
  .line-top .badge {
    font-size: 9px;
    padding: 4px 7px;
  }
  .line-top .check {
    font-size: 9px;
    gap: 5px;
  }
  .line-values {
    grid-template-columns: 1fr 1fr;
  }
  .generation-actions {
    gap: 7px;
  }
  .generation-actions button {
    font-size: 10px;
    padding: 8px;
    flex: 1;
  }
  .preview-column {
    display: none;
  }
  .preview-column.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    background: var(--paper);
    padding: 15px;
    overflow: auto;
    overscroll-behavior: contain;
  }
  .preview-toolbar {
    margin-top: 5px;
  }
  .preview-note {
    display: none;
  }
  .invoice-paper {
    padding: 24px 18px;
    min-height: 640px;
  }
  .invoice-brand h2 {
    font-size: 16px;
  }
  .mobile-only {
    display: inline-flex;
  }
  .app-footer {
    display: block;
    padding: 18px;
  }
  .app-footer span {
    display: block;
    margin-top: 5px;
  }
  .preview-open {
    overflow: hidden;
  }
  label {
    font-size: 11px;
  }
  .invoice-totals dd {
    font-size: 11px;
  }
  .invoice-grand-total b {
    font-size: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
