/* Vision 2100 Group — Owner's Desk. Phone first. Big text, big buttons, plain words.
   Desktop gets a two-column editor with a live A4 document preview. */
:root {
  --navy: #1f2241;
  --navy-2: #2b305c;
  --navy-deep: #151830;
  --gold: #c8a84b;
  --gold-dark: #8c6a18;
  --gold-soft: #f8f2e2;
  --bg: #f1f2f6;
  --card: #ffffff;
  --ink: #121528;
  --muted: #586074;
  --line: #d7dbe6;
  --ok: #1f8a4c;
  --ok-soft: #e4f4ea;
  --warn: #a65808;
  --warn-soft: #fdf0e1;
  --bad: #c62828;
  --bad-soft: #fdecec;
  --radius: 16px;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px));
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: rgba(200, 168, 75, .18);
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { fill: currentColor; }

/* ---------- screens + top bar ---------- */
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  background: var(--navy); color: #fff;
  border-bottom: 3px solid var(--gold);
  padding: calc(12px + var(--safe-top)) 16px 12px;
  min-height: 66px;
  box-shadow: 0 2px 12px rgba(15, 18, 40, .22);
}
.bar-text { min-width: 0; }
.bar-text h1 { margin: 0; font-size: 20px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-text p { margin: 2px 0 0; font-size: 14px; color: #d5d9ea; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-mark { width: 46px; height: 46px; border-radius: 12px; border: 1.5px solid rgba(200, 168, 75, .55); background: var(--navy); object-fit: contain; flex: none; }
.back-btn {
  flex: none; display: inline-flex; align-items: center; gap: 2px;
  min-height: 48px; padding: 0 12px 0 6px; margin-left: -6px;
  border: 1px solid rgba(200, 168, 75, .45); border-radius: 12px;
  background: rgba(255, 255, 255, .08); color: #fff; font-size: 15px; font-weight: 600;
}
.back-btn svg { width: 24px; height: 24px; }

.page { width: 100%; max-width: 680px; margin: 0 auto; padding: 16px 16px 24px; flex: 1; }

/* ---------- sign in ---------- */
.signin {
  background: linear-gradient(170deg, var(--navy-deep) 0%, var(--navy) 55%, var(--navy-2) 100%);
  align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}
.signin-card {
  width: 100%; max-width: 430px; background: #fff; border-radius: 22px;
  border-top: 5px solid var(--gold);
  padding: 26px 22px 22px; text-align: center; box-shadow: 0 22px 54px rgba(0, 0, 0, .38);
}
.signin-logo {
  width: 132px; height: 132px; object-fit: contain; margin: 0 auto 10px; display: block;
  border-radius: 18px; border: 2px solid var(--gold); background: var(--navy);
}
.signin h1 { margin: 6px 0 4px; font-size: 25px; color: var(--navy); }
.signin-lead { margin: 0 0 16px; color: var(--muted); font-size: 16px; }
.signin-steps { text-align: left; margin: 0 0 18px; padding: 14px 14px 14px 36px; background: var(--gold-soft); border: 1px solid rgba(200, 168, 75, .4); border-radius: 14px; font-size: 16px; }
.signin-steps li { margin: 4px 0; }
#signinEmail { display: block; font-size: 15px; overflow-wrap: anywhere; word-break: normal; color: var(--navy); }
.signin-error { color: var(--bad); font-weight: 600; min-height: 1em; margin: 12px 0 0; }
.signin-small { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.made-by { color: #c7cde0; font-size: 13px; margin-top: 18px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 20px; border-radius: 14px;
  border: 2px solid transparent; font-weight: 700; font-size: 17px;
}
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:active { background: var(--navy-2); }
.btn.secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn.outline { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.google { width: 100%; background: #fff; color: #1f1f1f; border: 2px solid #c9d2dc; font-size: 18px; }
.btn.google svg { width: 24px; height: 24px; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .55; }
.link-btn { background: none; border: 0; color: var(--navy); font-weight: 700; text-decoration: underline; min-height: 48px; padding: 0 8px; font-size: 16px; }
.danger-link { background: none; border: 0; color: var(--bad); font-weight: 700; text-decoration: underline; min-height: 48px; padding: 0 4px; font-size: 16px; }

/* ---------- home ---------- */
.drive-card {
  display: flex; gap: 12px; align-items: flex-start;
  background: #fff; border-radius: var(--radius); padding: 14px;
  border-left: 5px solid var(--line); margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(18, 21, 40, .08);
}
.drive-card.is-ok { border-left-color: var(--ok); }
.drive-card.is-wait { border-left-color: var(--warn); }
.drive-card.is-off { border-left-color: var(--gold); }
.drive-ico { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-dark); }
.drive-card.is-ok .drive-ico { background: var(--ok-soft); color: var(--ok); }
.drive-card.is-wait .drive-ico { background: var(--warn-soft); color: var(--warn); }
.drive-ico svg { width: 22px; height: 22px; }
.drive-body { flex: 1; min-width: 0; }
.drive-body b { display: block; font-size: 16px; }
.drive-body p { margin: 2px 0 0; font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.drive-body .btn { margin-top: 10px; min-height: 48px; font-size: 16px; }

.new-grid { display: grid; gap: 12px; }
.new-btn {
  display: flex; align-items: center; gap: 14px; text-align: left;
  width: 100%; min-height: 84px; padding: 14px 16px;
  background: #fff; border: 2px solid transparent; border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(18, 21, 40, .08);
}
.new-btn:active { border-color: var(--gold); }
.new-ico { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; }
.new-ico svg { width: 28px; height: 28px; }
.is-quote .new-ico { background: var(--gold); color: var(--navy); }
.is-invoice .new-ico { background: var(--navy); color: #fff; }
.new-txt { flex: 1; }
.new-txt b { display: block; font-size: 19px; color: var(--navy); }
.new-txt small { display: block; font-size: 15px; color: var(--muted); }
.chev { font-size: 32px; color: #9aa2b6; line-height: 1; }

.owed-card {
  margin-top: 14px; background: var(--warn-soft); color: #6a3a07;
  border-radius: var(--radius); padding: 12px 14px; font-size: 16px;
}
.owed-card b { font-size: 18px; }
.owed-card .link-btn { display: block; min-height: 44px; padding: 0; margin-top: 2px; color: #6a3a07; }

.list-title { font-size: 20px; margin: 26px 0 10px; color: var(--navy); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 2px solid var(--line); background: #fff; font-weight: 600; font-size: 15px; color: var(--muted);
}
.chip.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }
.search {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 0 12px;
}
.search:focus-within { border-color: var(--gold-dark); }
.search svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.search input { flex: 1; border: 0; outline: 0; min-height: 50px; font-size: 17px; background: transparent; min-width: 0; }

.doc-list { display: grid; gap: 10px; margin-top: 12px; }
.doc {
  display: block; width: 100%; text-align: left; background: #fff;
  border: 2px solid transparent; border-radius: var(--radius); padding: 14px;
  box-shadow: 0 1px 3px rgba(18, 21, 40, .08);
}
.doc:active { border-color: var(--gold); }
.doc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; letter-spacing: .02em; }
.tag.quotation { background: var(--gold); color: var(--navy); }
.tag.invoice { background: var(--navy); color: #fff; }
.doc-num { font-weight: 700; }
.doc-amt { margin-left: auto; font-weight: 800; font-size: 18px; color: var(--navy); }
.doc-client { font-size: 18px; font-weight: 600; margin: 6px 0 2px; overflow-wrap: anywhere; }
.doc-meta { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.st { font-weight: 700; }
.st.ok { color: var(--ok); }
.st.wait { color: var(--warn); }
.st.bad { color: var(--bad); }
.pill { font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.pill.paid { background: var(--ok-soft); color: var(--ok); }
.pill.unpaid { background: var(--warn-soft); color: var(--warn); }
.pill.draft { background: #eef0f3; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 26px 12px; font-size: 16px; }
.home-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 8px 16px calc(20px + var(--safe-bottom)); }

/* ---------- form ---------- */
.block {
  background: #fff; border-radius: var(--radius); padding: 16px;
  margin-bottom: 14px; box-shadow: 0 1px 3px rgba(18, 21, 40, .08);
}
.block h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 20px; color: var(--navy); }
.step { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: var(--gold); display: grid; place-items: center; font-size: 17px; font-weight: 800; }
.help { margin: -4px 0 12px; color: var(--muted); font-size: 16px; }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.field { display: block; margin-bottom: 14px; }
.field > span, .field-label { display: block; font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
  display: block; width: 100%; min-height: 52px; padding: 12px 14px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff;
  font-size: 18px; outline: none;
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.4; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(200, 168, 75, .24); }
.field .is-bad { border-color: var(--bad) !important; background: var(--bad-soft); }
.err { display: block; color: var(--bad); font-style: normal; font-weight: 600; font-size: 15px; margin-top: 6px; }
.err:empty { display: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.item { border: 2px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 12px; background: #fbfbfd; }
.item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.item-head b { font-size: 16px; color: var(--navy); }
.item-remove { background: none; border: 0; color: var(--bad); font-weight: 700; text-decoration: underline; min-height: 44px; padding: 0 4px; font-size: 15px; }
.item .field { margin-bottom: 10px; }
.item-nums { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.item-total { text-align: right; font-size: 15px; color: var(--muted); }
.item-total b { color: var(--ink); font-size: 17px; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 10px; }
.suggest:empty { display: none; }
.suggest button {
  text-align: left; border: 1px dashed var(--gold-dark); background: var(--gold-soft); color: var(--navy);
  border-radius: 10px; padding: 8px 10px; font-size: 14px; min-height: 40px; max-width: 100%;
}
.add-btn {
  width: 100%; min-height: 54px; border: 2px dashed var(--gold-dark); border-radius: 14px;
  background: var(--gold-soft); color: var(--navy); font-weight: 700; font-size: 17px;
}

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid #edf0f3; }
.switch-row:first-child { border-top: 0; padding-top: 0; }
.switch-row small { display: block; color: var(--muted); font-size: 14px; font-weight: 400; }
.switch { position: relative; flex: none; width: 60px; height: 34px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #c3ccd6; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(26px); }
.switch input:focus-visible + i { outline: 3px solid rgba(200, 168, 75, .55); outline-offset: 2px; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.seg button {
  flex: 1 1 auto; min-height: 48px; padding: 0 10px; white-space: nowrap; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 15px; color: var(--muted);
}
.seg button.is-on { border-color: var(--navy); background: var(--navy); color: #fff; }
#depositOther { margin-top: 4px; }
.sum { margin-top: 12px; border-radius: 14px; overflow: hidden; border: 2px solid var(--line); }
.sum div { display: flex; justify-content: space-between; padding: 10px 14px; font-size: 16px; }
.sum div + div { border-top: 1px solid #edf0f3; }
.sum .sum-total { background: var(--navy); color: #fff; font-size: 20px; }
.sum .sum-total b { color: var(--gold); }
.paid-row { margin-top: 16px; }

.extra { padding: 0; }
.extra summary { list-style: none; padding: 16px; display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 60px; }
.extra summary::-webkit-details-marker { display: none; }
.extra summary::after { content: "+"; margin-left: auto; width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--gold-soft); color: var(--navy); display: grid; place-items: center; font-size: 24px; font-weight: 700; }
.extra[open] summary::after { content: "–"; }
.extra summary b { display: block; font-size: 18px; color: var(--navy); }
.extra summary small { display: block; color: var(--muted); font-size: 14px; }
.extra > :not(summary) { margin-left: 16px; margin-right: 16px; }
.extra[open] { padding-bottom: 16px; }

.doc-actions { text-align: center; padding: 4px 0 8px; }
.from-note { color: var(--muted); font-size: 15px; margin: 10px 0 0; }
.doc-actions .danger-link { margin-top: 10px; }

.action-bar {
  position: sticky; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 14px rgba(18, 21, 40, .08);
}
.action-bar .btn { width: 100%; padding: 0 12px; }

/* ---------- preview ---------- */
.preview-page { flex: 1; padding: 14px 12px 20px; width: 100%; max-width: 900px; margin: 0 auto; }
.preview-tip { margin: 0 4px 12px; font-size: 16px; color: var(--muted); }
.preview-scaler, .live-scaler { position: relative; overflow: hidden; border-radius: 6px; box-shadow: 0 4px 18px rgba(18, 21, 40, .18); background: #fff; }
#previewDoc, #liveDoc { width: 794px; transform-origin: 0 0; position: absolute; top: 0; left: 0; }
.preview-saved { text-align: center; color: var(--ok); font-weight: 700; font-size: 15px; margin: 14px 0 0; }
.live-preview { display: none; }

/* ---------- settings ---------- */
.fixed { background: #f5f6fa; border-radius: 12px; padding: 12px 14px; font-size: 15px; white-space: pre-line; }
.about { text-align: center; color: var(--muted); font-size: 13px; padding-bottom: calc(10px + var(--safe-bottom)); }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 18, 36, .58);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px 12px calc(16px + var(--safe-bottom));
}
.modal-card { width: 100%; max-width: 460px; background: #fff; border-radius: 20px; padding: 22px 18px 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.modal-card h3 { margin: 0 0 8px; font-size: 21px; color: var(--navy); }
.modal-card p { margin: 0 0 18px; font-size: 17px; color: #333c4f; white-space: pre-line; }
.modal-btns { display: grid; gap: 10px; }
.modal-btns .btn { width: 100%; }
.modal-btns .btn.danger { background: var(--bad); color: #fff; }
#busy { align-items: center; }
.busy-card { background: #fff; border-radius: 20px; padding: 26px 24px; text-align: center; min-width: 240px; max-width: 320px; }
.busy-card p { margin: 14px 0 0; font-size: 18px; font-weight: 600; }
.spinner { width: 46px; height: 46px; margin: 0 auto; border-radius: 50%; border: 5px solid var(--gold-soft); border-top-color: var(--gold-dark); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); z-index: 120;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  width: max-content; max-width: calc(100% - 32px);
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 14px;
  border: 1px solid rgba(200, 168, 75, .5);
  font-size: 16px; font-weight: 600; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28); transition: opacity .25s, transform .25s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* off-screen drawing area for the PDF */
#docRender { position: fixed; left: -10000px; top: 0; width: 794px; pointer-events: none; }

/* ---------- bigger screens ---------- */
@media (min-width: 700px) {
  .new-grid { grid-template-columns: 1fr 1fr; }
  .overlay { align-items: center; }
  .action-bar { grid-template-columns: 220px 300px; justify-content: end; }
}
@media (min-width: 1100px) {
  .edit-layout { display: grid; grid-template-columns: minmax(480px, 620px) minmax(420px, 1fr); gap: 24px; width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 24px; flex: 1; }
  .edit-layout .page { max-width: none; padding-left: 0; padding-right: 0; }
  .live-preview { display: block; position: sticky; top: 84px; align-self: start; padding-top: 16px; }
  .live-label { margin: 0 0 8px; font-weight: 700; color: var(--muted); }
  .page { max-width: 760px; }
}

/* ======================================================================
   The printed document (A4, 794px wide). Vision 2100 Group navy & gold.
   ====================================================================== */
.vdoc { width: 794px; background: #fff; color: #0f1724; font: 13px/1.4 Arial, "Helvetica Neue", Roboto, sans-serif; padding-bottom: 18px; }
.vdoc .d-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; background: #1f2241; color: #fff; border-bottom: 4px solid #c8a84b; }
.vdoc .d-brand { display: flex; align-items: center; gap: 16px; }
.vdoc .d-brand img { width: 112px; height: 112px; object-fit: contain; background: #1f2241; border: 1.5px solid rgba(200, 168, 75, .55); border-radius: 8px; }
.vdoc .d-cname { font-weight: 700; font-size: 17px; max-width: 310px; line-height: 1.25; }
.vdoc .d-tagline { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #c8a84b; margin-top: 5px; font-weight: 700; }
.vdoc .d-type { text-align: right; }
.vdoc .d-label { font-weight: 700; font-size: 22px; letter-spacing: .03em; color: #fff; }
.vdoc .d-badge { margin-top: 8px; background: #fff; color: #1f2241; padding: 7px 11px; border-radius: 6px; font-weight: 700; }
.vdoc .d-badge2 { margin-top: 6px; font-weight: 600; }
.vdoc .d-body { padding: 20px 22px; }
.vdoc .d-parties { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.vdoc .d-from, .vdoc .d-to { flex: 1; white-space: pre-wrap; }
.vdoc .d-from { text-align: left; }
.vdoc .d-to { text-align: right; }
.vdoc .d-date { flex: 0 0 170px; text-align: center; }
.vdoc .d-small { font-size: 12px; color: #6b7280; }
.vdoc .d-dateval { font-weight: 600; margin-top: 6px; }
.vdoc table.d-items { width: 100%; border-collapse: collapse; margin-top: 12px; }
.vdoc .d-items th, .vdoc .d-items td { border: 1px solid #e3e5ec; padding: 10px 8px; font-size: 13px; vertical-align: top; line-height: 1.4; }
.vdoc .d-items th { background: #1f2241; color: #fff; text-align: left; }
.vdoc .d-items .c { text-align: center; }
.vdoc .d-items .r { text-align: right; white-space: nowrap; }
.vdoc .d-items .desc { white-space: pre-wrap; }
.vdoc .d-totals-wrap { display: flex; justify-content: flex-end; margin-top: 12px; }
.vdoc .d-totals { width: 320px; }
.vdoc .d-trow { display: flex; justify-content: space-between; padding: 7px 10px; background: #fafafa; border: 1px solid #e6e6e6; border-top: 0; }
.vdoc .d-trow:first-child { border-top: 1px solid #e6e6e6; border-radius: 6px 6px 0 0; }
.vdoc .d-total { background: #c8a84b; color: #1f2241; font-weight: 800; font-size: 14px; border-color: #c8a84b; border-radius: 0 0 6px 6px; }
.vdoc .d-deposit { margin-top: 8px; font-weight: 700; font-size: 16px; font-style: italic; text-align: right; color: #1f2241; }
.vdoc .d-notes { font-size: 12px; color: #4b5563; margin-top: 18px; white-space: pre-wrap; line-height: 1.5; }
.vdoc .d-pay { display: flex; justify-content: space-between; gap: 14px; margin-top: 22px; padding-top: 14px; border-top: 1px solid #e5e7ef; }
.vdoc .d-pay > div { flex: 1; }
.vdoc .d-pay h4 { margin: 0; font-size: 12px; color: #1f2241; letter-spacing: .04em; }
.vdoc .d-pre { white-space: pre-wrap; font-size: 12px; margin: 6px 0; font-family: "Courier New", Courier, monospace; }
.vdoc .d-terms { font-size: 12px; font-weight: 700; margin-top: 12px; color: #1f2241; }
.vdoc .d-sign { display: flex; align-items: flex-end; gap: 12px; margin-top: 34px; }
.vdoc .d-sign span { font-size: 12px; font-weight: 600; white-space: nowrap; }
.vdoc .d-sign i { flex: 1; border-bottom: 1.5px solid #1f2241; height: 18px; }
.vdoc .d-thanks { font-size: 12px; color: #6b7280; margin-top: 14px; text-align: center; }
.vdoc .d-thanks b { color: #8c6a18; letter-spacing: .06em; }

/* preview: Download PDF first, the rest second */
.action-bar.three { grid-template-columns: 1fr 1fr; }
.action-bar.three .btn:first-child { grid-column: 1 / -1; }
@media (min-width: 700px) {
  .action-bar.three { grid-template-columns: 180px 180px 300px; }
  .action-bar.three .btn:first-child { grid-column: 3; grid-row: 1; }
}

/* "Put it on your home screen" (browser version only) */
.install-box { display: block; background: var(--gold-soft); border: 2px solid var(--gold); border-radius: var(--radius); padding: 14px; margin: 14px 0; text-align: left; }
.install-box b { display: block; font-size: 17px; color: var(--navy); }
.install-how { display: block; font-size: 15px; color: var(--muted); margin-top: 2px; }
.install-box .btn { margin-top: 10px; }


/* ======================================================================
   3-Tab Desk Navigation (Billing · Letterheads · Company Vault)
   ====================================================================== */
.desk-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-bottom: 16px; background: #fff; padding: 6px;
  border-radius: var(--radius); box-shadow: 0 2px 8px rgba(18, 21, 40, .08);
}
.desk-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 60px; padding: 8px 6px; border: 0; border-radius: 12px;
  background: transparent; color: var(--muted); font-weight: 700; font-size: 14px;
  transition: background .15s, color .15s;
}
.desk-tab svg { width: 22px; height: 22px; flex: none; }
.desk-tab.is-on { background: var(--navy); color: #fff; }
.desk-tab.is-on svg { color: var(--gold); }
@media (min-width: 700px) {
  .desk-tab { flex-direction: row; gap: 8px; min-height: 52px; font-size: 16px; }
}

/* ---------- Letterheads tab ---------- */
.tpl-grid { display: grid; gap: 10px; margin-bottom: 18px; }
.tpl-btn {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
  min-height: 76px; padding: 13px 15px; background: #fff;
  border: 2px solid transparent; border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(18, 21, 40, .07);
}
.tpl-btn:active { border-color: var(--gold); }
.tpl-btn.is-primary { border-color: rgba(200, 168, 75, .55); background: linear-gradient(180deg, #fff 0%, #fcfaf3 100%); }
.tpl-ico {
  flex: none; width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; background: var(--gold-soft); color: var(--navy);
}
.tpl-btn.is-primary .tpl-ico { background: var(--navy); color: var(--gold); }
.tpl-ico svg { width: 24px; height: 24px; }
.tpl-txt { flex: 1; min-width: 0; }
.tpl-txt b { display: block; font-size: 17px; color: var(--navy); }
.tpl-txt small { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
@media (min-width: 700px) {
  .tpl-grid { grid-template-columns: 1fr 1fr; }
  .tpl-btn.is-primary { grid-column: 1 / -1; }
}
.tag.letter { background: var(--gold-soft); color: var(--navy); border: 1px solid var(--gold); }

/* ---------- Company Vault tab ---------- */
.vault-summary {
  background: #fff; border-radius: var(--radius); padding: 16px;
  margin-bottom: 14px; border-left: 5px solid var(--gold);
  box-shadow: 0 2px 8px rgba(18, 21, 40, .07);
}
.vault-summary-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.vault-summary b { font-size: 17px; color: var(--navy); }
.vault-summary p { margin: 4px 0 10px; font-size: 14px; color: var(--muted); }
.vault-bar { height: 8px; border-radius: 999px; background: #e8eaf2; overflow: hidden; }
.vault-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy), var(--gold)); border-radius: 999px; transition: width .3s; }

.vault-list { display: grid; gap: 12px; margin-top: 12px; }
.vdoc-card {
  background: #fff; border-radius: var(--radius); padding: 15px;
  border: 2px solid var(--line); box-shadow: 0 1px 4px rgba(18, 21, 40, .06);
}
.vdoc-card.has-file { border-color: rgba(31, 34, 65, .18); }
.vdoc-card.is-empty { border-style: dashed; background: #fbfbfd; }
.vdoc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.vdoc-cat { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--gold-soft); color: var(--navy); }
.vdoc-title { margin: 8px 0 4px; font-size: 18px; font-weight: 700; color: var(--navy); }
.vdoc-ref { font-size: 14px; font-weight: 700; color: var(--gold-dark); margin: 0 0 4px; }
.vdoc-meta { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.45; }
.vdoc-file { font-size: 13px; color: var(--navy); font-weight: 600; margin: 8px 0 0; word-break: break-word; }
.vdoc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.vbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 14px; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; color: var(--navy);
  font-weight: 700; font-size: 14px;
}
.vbtn svg { width: 18px; height: 18px; }
.vbtn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.vbtn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.vbtn.danger { color: var(--bad); border-color: #f3c6c6; }
.pill.expired { background: var(--bad-soft); color: var(--bad); }

/* Upload / Edit Vault Modal */
.vault-modal-card { max-height: 90vh; overflow-y: auto; }
.vault-file-pick {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 2px dashed var(--gold-dark); background: var(--gold-soft); border-radius: 14px;
  padding: 16px; text-align: center; cursor: pointer; margin-bottom: 14px;
}
.vault-file-pick b { color: var(--navy); font-size: 16px; }
.vault-file-pick small { color: var(--muted); font-size: 13px; }

/* ======================================================================
   Official A4 Letterhead (794px wide, executive Vision 2100 Group layout)
   ====================================================================== */
.vletter {
  width: 794px; min-height: 1123px; background: #fff; color: #161b2e;
  font: 14px/1.65 Arial, "Helvetica Neue", Roboto, sans-serif;
  display: flex; flex-direction: column;
}
.vletter .l-head {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  padding: 24px 36px; background: #1f2241; color: #fff;
}
.vletter .l-brand { display: flex; align-items: center; gap: 16px; }
.vletter .l-brand img {
  width: 96px; height: 96px; object-fit: contain; background: #1f2241;
  border: 1.5px solid rgba(200, 168, 75, .55); border-radius: 8px;
}
.vletter .l-cname { font-size: 19px; font-weight: 800; letter-spacing: .02em; line-height: 1.2; }
.vletter .l-tag { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #c8a84b; margin-top: 4px; }
.vletter .l-services { font-size: 11px; color: #cfd5e6; margin-top: 6px; letter-spacing: .02em; }
.vletter .l-contact { text-align: right; font-size: 12px; line-height: 1.55; color: #e8ebf5; max-width: 245px; }
.vletter .l-addr { color: #c5cce0; margin-top: 2px; }
.vletter .l-gold-bar { height: 5px; background: linear-gradient(90deg, #c8a84b 0%, #e1c571 50%, #c8a84b 100%); }

.vletter .l-body { padding: 34px 44px 28px; flex: 1; display: flex; flex-direction: column; }
.vletter .l-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.vletter .l-recip { flex: 1; font-size: 13.5px; line-height: 1.55; color: #1f2438; }
.vletter .l-to-lbl { font-size: 10.5px; font-weight: 800; letter-spacing: .12em; color: #8c6a18; margin-bottom: 4px; }
.vletter .l-datebox { text-align: right; font-size: 13px; line-height: 1.7; flex: none; }
.vletter .l-lbl { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; color: #8c6a18; margin-right: 8px; }
.vletter .l-subject {
  font-size: 15px; font-weight: 800; color: #1f2241; letter-spacing: .02em;
  padding-bottom: 8px; border-bottom: 2px solid #c8a84b; margin-bottom: 18px;
}
.vletter .l-salute { font-size: 14px; font-weight: 600; margin-bottom: 14px; color: #161b2e; }
.vletter .l-content { flex: 1; }
.vletter .l-p { margin: 0 0 14px; font-size: 14px; line-height: 1.68; color: #1d2236; text-align: left; }
.vletter .l-empty-hint { color: #9aa2b6; font-style: italic; }

.vletter .l-signoff { margin-top: 28px; }
.vletter .l-closing { font-size: 14px; color: #1d2236; }
.vletter .l-sigline { width: 220px; border-bottom: 1.5px solid #1f2241; height: 42px; margin-bottom: 8px; }
.vletter .l-siggap { height: 26px; }
.vletter .l-signer { font-size: 14.5px; font-weight: 800; color: #1f2241; }
.vletter .l-role { font-size: 13px; color: #586074; }
.vletter .l-org { font-size: 13px; font-weight: 700; color: #8c6a18; margin-top: 2px; }

.vletter .l-bankbox {
  margin-top: 24px; padding: 10px 14px; border-radius: 6px;
  background: #f8f6ef; border-left: 3px solid #c8a84b;
  font-size: 12px; color: #2b3048;
}
.vletter .l-foot {
  margin-top: auto; padding: 14px 36px 16px;
  border-top: 2px solid #1f2241; background: #fafafe; text-align: center;
}
.vletter .l-foot-line { font-size: 11.5px; font-weight: 700; color: #1f2241; letter-spacing: .02em; }
.vletter .l-foot-addr { font-size: 11px; color: #666e82; margin-top: 3px; }
#letterPreviewDoc, #letterLiveDoc { width: 794px; transform-origin: 0 0; position: absolute; top: 0; left: 0; }


/* ======================================================================
   4-Tab Bar (with Inbox Badge) + WhatsApp Follow-Up Scripts
   ====================================================================== */
.desk-tabs.desk-tabs-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 5px; }
.desk-tabs-4 .desk-tab { font-size: 12.5px; padding: 8px 3px; }
.desk-tabs-4 .desk-tab span { display: inline-flex; align-items: center; gap: 4px; }
.tab-badge {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: var(--gold); color: var(--navy);
  font-style: normal; font-size: 11px; font-weight: 800; line-height: 1;
}
@media (min-width: 700px) {
  .desk-tabs-4 .desk-tab { font-size: 15px; padding: 8px 10px; }
}

.btn.wa-btn {
  background: #e8f8ee;
  color: #0e5a2b;
  border: 2px solid #25D366;
}
.btn.wa-btn:active { background: #d4f3df; }
.btn.wa-btn svg { fill: #1ea952; }

.enq-issues {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 6px;
}
.enq-issues span {
  font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--gold-soft); color: var(--navy); border: 1px solid rgba(200, 168, 75, .45);
}

.wa-scripts-list { display: grid; gap: 10px; text-align: left; }
.wa-script-card {
  border: 1.5px solid var(--line); border-radius: 14px; padding: 13px; background: #fbfbfd;
}
.wa-script-card b { display: block; font-size: 15.5px; color: var(--navy); margin-bottom: 5px; }
.wa-script-card p {
  margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: #364054;
  white-space: pre-wrap; background: #fff; border: 1px solid #ebedf4; border-radius: 10px; padding: 9px 11px;
}
.wa-script-btns { display: flex; flex-wrap: wrap; gap: 8px; }
