/* Nidam Systems — digital quote. One column that reads well on a phone
   (where a client opens the link) and sits as a paper sheet on a desktop. */

@font-face { font-family: "FrankRuhl"; font-weight: 700; src: url("/q-assets/fonts/frank-ruhl-libre-hebrew-700-normal.woff2") format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; font-display: swap; }
@font-face { font-family: "FrankRuhl"; font-weight: 700; src: url("/q-assets/fonts/frank-ruhl-libre-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; font-display: swap; }
@font-face { font-family: "RubikN"; font-weight: 400; src: url("/q-assets/fonts/rubik-hebrew-400-normal.woff2") format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; font-display: swap; }
@font-face { font-family: "RubikN"; font-weight: 400; src: url("/q-assets/fonts/rubik-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; font-display: swap; }
@font-face { font-family: "RubikN"; font-weight: 500; src: url("/q-assets/fonts/rubik-hebrew-500-normal.woff2") format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; font-display: swap; }
@font-face { font-family: "RubikN"; font-weight: 500; src: url("/q-assets/fonts/rubik-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; font-display: swap; }
@font-face { font-family: "RubikN"; font-weight: 600; src: url("/q-assets/fonts/rubik-hebrew-600-normal.woff2") format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; font-display: swap; }
@font-face { font-family: "RubikN"; font-weight: 600; src: url("/q-assets/fonts/rubik-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; font-display: swap; }

:root {
  --ink: #0A1626;
  --ink-2: #1E2C42;
  --muted: #56657E;
  --faint: #7F8DA6;
  --rule: #E3E9F1;
  --tint: #F5F8FC;
  --paper: #FFFFFF;
  --ground: #E8EDF4;
  --blue: #0B5FD0;
  --cyan: #34B5F2;
  --violet: #7B45E0;
  --ok: #0C6B45;
  --ok-bg: #E7F5EE;
  --warn: #7A4E00;
  --warn-bg: #FFF3D6;
  --danger: #B4232A;
  --serif: "FrankRuhl", "Frank Ruhl Libre", "David Libre", "Times New Roman", serif;
  --sans: "RubikN", "Rubik", "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.6; }
h1, h2, h3, p, ol, ul, dl, dd, figure, fieldset { margin: 0; padding: 0; }
ol, ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
img { max-width: 100%; }
bdi { unicode-bidi: isolate; }

.thread { height: 6px; background: linear-gradient(90deg, var(--violet), var(--blue) 48%, var(--cyan)); }

.sheet { max-width: 820px; margin: 0 auto; background: var(--paper); padding: 26px 20px 36px; display: flex; flex-direction: column; gap: 28px; }
.sheet.narrow { max-width: 560px; }
@media (min-width: 720px) {
  .sheet { margin: 28px auto 56px; padding: 44px 54px 44px; border-radius: 6px; box-shadow: 0 12px 44px rgba(10, 22, 38, .13); gap: 34px; }
}

/* ---- header ---- */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.brand { display: flex; align-items: center; gap: 12px; direction: ltr; }
.brand img { width: 52px; height: 52px; border-radius: 12px; }
.brand-name { font-weight: 600; font-size: 1.18rem; line-height: 1.2; }
.brand-sub { font-size: .58rem; letter-spacing: .16em; color: var(--faint); margin-top: 3px; }
.doc { text-align: end; }
.doc h1 { font-family: var(--serif); font-weight: 700; font-size: 2.1rem; line-height: 1.05; }
.doc-num { font-size: .78rem; letter-spacing: .12em; color: var(--blue); font-weight: 600; margin-top: 6px; }

.k { display: block; font-size: .7rem; letter-spacing: .14em; color: var(--faint); font-weight: 500; }
.k.accent { color: var(--blue); }
.label { font-size: .74rem; letter-spacing: .14em; color: var(--faint); font-weight: 500; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.section-sub { color: var(--muted); font-size: .95rem; margin-top: 4px; }

.banner { padding: 12px 16px; border-radius: 8px; font-weight: 500; }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }

/* ---- meta + parties ---- */
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 20px; padding: 16px 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.meta .v { display: block; font-family: var(--serif); font-weight: 700; font-size: 1.12rem; margin-top: 2px; }

.parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px 40px; }
.party-name { font-family: var(--serif); font-weight: 700; font-size: 1.35rem; margin-top: 4px; line-height: 1.25; }
.party-role { color: var(--muted); font-size: .9rem; }
.pairs { margin-top: 10px; font-size: .95rem; }
.pairs > div { display: flex; gap: 12px; padding: 7px 0; border-top: 1px solid var(--rule); }
.pairs dt { color: var(--faint); flex: none; width: 96px; }
.pairs dd { min-width: 0; overflow-wrap: anywhere; }

.lead h2 { font-family: var(--serif); font-weight: 700; font-size: 1.5rem; line-height: 1.25; text-wrap: balance; }
.lead p { margin-top: 8px; color: var(--ink-2); max-width: 62ch; }

/* ---- cost lines ---- */
.items { counter-reset: line; }
.items li { counter-increment: line; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.items li::before { content: counter(line); font-family: var(--serif); font-weight: 700; color: var(--blue); font-size: 1.1rem; line-height: 1.5; }
.item-main { min-width: 0; }
.item-main b { display: block; font-weight: 600; }
.item-main span { display: block; color: var(--muted); font-size: .9rem; }
.chip { grid-column: 2; justify-self: start; font-size: .78rem; color: var(--ink-2); background: var(--tint); border: 1px solid var(--rule); border-radius: 999px; padding: 1px 10px; }
.amount { grid-column: 3; grid-row: 1 / span 2; align-self: center; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount small { font-family: var(--sans); font-weight: 400; font-size: .8rem; color: var(--muted); }

/* ---- total ---- */
.total { background: var(--ink); color: #fff; border-radius: 10px; overflow: hidden; background-image: radial-gradient(circle at 12% 20%, rgba(52, 181, 242, .22), transparent 48%); }
.total-main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 20px 22px 18px; }
.total .k { color: #9FB3CE; }
.total-main p { color: #C9D6E8; font-size: .9rem; margin-top: 3px; }
.total-amt { font-family: var(--serif); font-weight: 700; font-size: 2.5rem; line-height: 1; white-space: nowrap; }
.total-amt em { font-style: normal; font-size: 1.3rem; color: var(--cyan); margin-inline-start: 6px; }
.total-next { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 12px 22px 14px; border-top: 1px solid rgba(255, 255, 255, .14); color: #C9D6E8; font-size: .92rem; }
.total-next b { color: #fff; font-weight: 600; font-size: 1.02rem; }

/* ---- lists ---- */
.ticks { display: grid; gap: 9px; margin-top: 14px; }
.ticks li { position: relative; padding-inline-start: 28px; }
/* a check mark: the bottom-left corner of a small box, turned 45 degrees (physical sides, so it is not mirrored in RTL) */
.ticks li::before { content: ""; position: absolute; inset-inline-start: 4px; top: .42em; width: 12px; height: 7px; border: 2px solid var(--blue); border-top: 0; border-right: 0; transform: rotate(-45deg); }

/* ---- company terms (dialog) ---- */
.terms-dialog { width: min(720px, calc(100% - 24px)); max-height: min(86vh, 86dvh); padding: 0; border: 0; border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 70px rgba(10, 22, 38, .35); overflow: auto; overscroll-behavior: contain; }
.terms-dialog::backdrop { background: rgba(10, 22, 38, .55); }
.terms-dialog:focus { outline: none; }
.terms-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; background: var(--paper); border-bottom: 1px solid var(--rule); }
.terms-head h2 { font-family: var(--serif); font-weight: 700; font-size: 1.5rem; line-height: 1.2; }
.terms { counter-reset: term; display: grid; gap: 16px; padding: 18px 22px 6px; font-size: .97rem; color: var(--ink-2); }
.terms li { counter-increment: term; position: relative; padding-inline-start: 36px; }
.terms li::before { content: counter(term, decimal-leading-zero); position: absolute; inset-inline-start: 0; top: 0; font-family: var(--serif); font-weight: 700; color: var(--blue); }
.terms b { display: block; color: var(--ink); font-weight: 600; }
.terms p { margin-top: 3px; }
.terms-foot { padding: 14px 22px 20px; }
.terms-foot .btn { width: 100%; }

/* ---- approval form ---- */
.approve, .signed { border: 1px solid var(--rule); border-radius: 12px; padding: 22px 18px 24px; background: var(--tint); }
@media (min-width: 720px) { .approve, .signed { padding: 28px 30px 30px; } }
.approve h2, .signed h2 { font-family: var(--serif); font-weight: 700; font-size: 1.5rem; line-height: 1.2; }
.approve form { display: grid; gap: 22px; margin-top: 18px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 16px; }
.field span { display: block; font-size: .9rem; font-weight: 500; margin-bottom: 5px; }
.field em { font-style: normal; font-weight: 400; color: var(--faint); font-size: .8rem; }
.field input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid #C9D3E0; border-radius: 9px; background: #fff; color: var(--ink); font: inherit; }
.field input:focus-visible, .method input:focus-visible + .method-body, .accept input:focus-visible, .btn:focus-visible, .link:focus-visible, #sig-pad:focus-visible { outline: 3px solid rgba(11, 95, 208, .35); outline-offset: 2px; }
.field input:focus { border-color: var(--blue); }

.methods legend { font-weight: 600; margin-bottom: 10px; }
.methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.methods legend { grid-column: 1 / -1; }
.method { position: relative; display: block; cursor: pointer; }
.method input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.method-body { display: block; height: 100%; padding: 12px 14px; border: 1px solid #C9D3E0; border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.method-body b { display: block; font-weight: 600; }
.method input:checked + .method-body { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue) inset; background: #F2F7FF; }

.sig-head { display: flex; align-items: baseline; justify-content: space-between; font-weight: 600; margin-bottom: 8px; }
.link { background: none; border: 0; padding: 4px 6px; color: var(--blue); font: inherit; font-weight: 500; font-size: .9rem; cursor: pointer; border-radius: 6px; }
#sig-pad { display: block; width: 100%; height: 190px; background: #fff; border: 1.5px dashed #AEBBD0; border-radius: 10px; touch-action: none; cursor: crosshair; }
.hint { color: var(--faint); font-size: .84rem; margin-top: 6px; }

.accept { display: flex; gap: 12px; align-items: flex-start; }
.accept input { flex: none; width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--blue); cursor: pointer; }
.accept label { font-weight: 500; font-size: 1.02rem; cursor: pointer; }
.link.inline { padding: 0 2px; font-size: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.method-note { grid-column: 1 / -1; }

.error { color: var(--danger); font-weight: 500; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 26px; border: 0; border-radius: 10px; background: var(--blue); color: #fff; font: inherit; font-weight: 600; font-size: 1.05rem; text-decoration: none; cursor: pointer; }
.btn:hover { background: #0A53B8; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid #C9D3E0; }
.approve .btn { width: 100%; }

/* ---- signed copy ---- */
.signed { background: var(--ok-bg); border-color: #BFE3D1; display: grid; gap: 16px; }
.signed h2 { color: var(--ok); }
.signed .pairs { margin-top: 0; }
.signed .pairs > div { border-top-color: #CDE7DA; }
.sig-figure { background: #fff; border: 1px solid #CDE7DA; border-radius: 10px; padding: 10px 14px 8px; max-width: 420px; }
.sig-figure img { display: block; width: 100%; height: auto; }
.sig-figure figcaption { font-size: .78rem; color: var(--faint); border-top: 1px solid var(--rule); padding-top: 6px; margin-top: 4px; }
.next { background: #fff; border-radius: 10px; padding: 12px 16px; }
.next p { color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .btn { flex: 1 1 220px; }

.notice h1 { font-family: var(--serif); font-size: 1.7rem; }
.notice p { color: var(--muted); margin-top: 8px; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; border-top: 1px solid var(--rule); padding-top: 14px; font-size: .82rem; color: var(--faint); }

/* ---- owner's list ---- */
.table-wrap { overflow-x: auto; }
.admin { width: 100%; border-collapse: collapse; font-size: .95rem; }
.admin th { text-align: start; font-size: .72rem; letter-spacing: .12em; color: var(--faint); font-weight: 500; padding: 0 10px 10px 0; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.admin td { padding: 12px 0 12px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.admin a { color: var(--blue); font-weight: 500; }
.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .82rem; font-weight: 500; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.wait { background: var(--warn-bg); color: var(--warn); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 11pt; }
  .thread, .no-print, .banner { display: none !important; }
  .sheet { box-shadow: none; margin: 0; padding: 0; max-width: none; gap: 18px; }
  .total, .signed, .chip, .sig-figure { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .items li, .terms li, .signed, .total { break-inside: avoid; }
  /* the approved terms are printed after the signed quote */
  .terms-dialog { display: block !important; position: static !important; width: auto; max-height: none; margin: 18px 0 0; box-shadow: none; border-top: 2px solid var(--ink); border-radius: 0; overflow: visible; }
  .terms-head { position: static; padding: 12px 0 8px; border: 0; }
  .terms { padding: 0; }
}
