/* top bar: More menu, sync icon, initials menu */
header.top .menu { position: relative; display: inline-flex; }
nav.tabs .tablike { background: none; border: 0; color: #e9e0ef; font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
nav.tabs .tablike.on, nav.tabs .tablike:hover { background: rgba(255,255,255,.14); color: #fff; }
header.top .menu-pop { position: absolute; top: calc(100% + 6px); left: 0; min-width: 180px; background: #fff; color: #1f1a24; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; z-index: 50; display: flex; flex-direction: column; }
header.top .menu-pop[hidden] { display: none; }
header.top .menu-pop.right { left: auto; right: 0; }
header.top .menu-pop a, header.top .menu-pop button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; color: #1f1a24 !important;
  background: none !important; border: 0; font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; }
header.top .menu-pop a:hover, header.top .menu-pop button:hover, header.top .menu-pop a.on { background: #f1ecf5 !important; }
header.top .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid #eee; margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; }
.syncbox .iconbtn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid rgba(255,255,255,.25); color: #e9e0ef;
  border-radius: 8px; padding: 5px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.syncbox .iconbtn:hover:not(:disabled) { background: rgba(255,255,255,.12); color: #fff; }
.syncbox .iconbtn .syncico { font-size: 15px; line-height: 1; display: inline-block; }
.syncbox .iconbtn.spinning .syncico { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.syncbox .avatar { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--gold); color: #3B1A4B; font-weight: 700; font-size: 13px; cursor: pointer; }
.syncbox .avatar.on, .syncbox .avatar:hover { box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
@media (max-width: 1060px) { .syncbox .synctext { display: none; } }
nav.tabs a.more-inline { display: none; }
.tabs .badge[hidden] { display: none !important; }
@media (max-width: 700px) { nav.tabs .menu { display: none; } nav.tabs a.more-inline { display: inline-block; } }

/* Microsoft sign-in */
.btn.ms { background: #fff; color: #1f1a24; border: 1px solid #8c8c8c; font-weight: 600; }
.btn.ms:hover { background: #f3f3f3; }
.login .or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 12px; }
.login .or::before, .login .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

:root {
  --purple: #4A365B; --purple-2: #5a2d70; --gold: #FDB813;
  --bg: #f6f5f8; --card: #fff; --ink: #1f1a24; --muted: #6b6474; --line: #e6e2ea;
  --red: #c0392b; --red-bg: #fdecea; --orange: #b85c00; --orange-bg: #fff1e0;
  --yellow-bg: #fff8d6; --green: #1e7e45; --green-bg: #e6f5ec; --blue: #1f5fa8; --blue-bg: #e8f0fb;
  --grey-bg: #efedf2; --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--purple-2); }
button, input, select, textarea { font: inherit; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* header */
header.top { background: var(--purple); color: #fff; border-bottom: 3px solid var(--gold); position: sticky; top: 0; z-index: 20; }
.top-inner { display: flex; align-items: center; gap: 14px; padding: 8px 20px; max-width: 1400px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; white-space: nowrap; text-decoration: none; color: #fff; }
.brand img { height: 40px; display: block; margin: -4px 0; }
.brand span { color: var(--gold); border-left: 1px solid rgba(255,255,255,.3); padding-left: 10px; }
nav.tabs { display: flex; gap: 2px; flex-wrap: nowrap; flex: 1; min-width: 0; }
nav.tabs a { color: #e9e0ef; text-decoration: none; padding: 7px 10px; border-radius: 7px; white-space: nowrap; font-size: 14px; }
nav.tabs a.on, nav.tabs a:hover { background: rgba(255,255,255,.14); color: #fff; }
.syncbox { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #e9e0ef; white-space: nowrap; }
.syncbox .dot { width: 8px; height: 8px; border-radius: 50%; background: #8fd19e; display: inline-block; }
.syncbox .dot.bad { background: #ff8a80; }

main { max-width: 1400px; margin: 0 auto; padding: 20px; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.card .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

/* tables */
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #faf9fb; position: sticky; top: 0; white-space: nowrap; cursor: default; }
th.sort { cursor: pointer; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #fbf8fd; }
tr:last-child td { border-bottom: 0; }
.desc { max-width: 380px; color: var(--muted); font-size: 12px; }

/* pills */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; background: var(--grey-bg); color: var(--ink); }
.s1 { background: var(--blue-bg); color: var(--blue); }
.s2 { background: var(--yellow-bg); color: #7a5b00; }
.s3 { background: var(--orange-bg); color: var(--orange); }
.s4 { background: var(--red-bg); color: var(--red); }
.s5 { background: var(--grey-bg); color: var(--muted); }
.st-promised, .fl-promised { background: #e0f4f3; color: #0f6b66; }
.st-says_paid, .fl-says_paid { background: var(--green-bg); color: var(--green); }
.st-disputed, .fl-disputed { background: var(--orange-bg); color: var(--orange); }
.st-chasing { background: var(--blue-bg); color: var(--blue); }
.st-on_hold { background: var(--red-bg); color: var(--red); }
.st-write_off_review, .st-written_off, .fl-write_off { background: var(--grey-bg); color: var(--muted); }
.good { color: var(--green); } .bad { color: var(--red); } .warn { color: var(--orange); }

/* forms */
input[type=text], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  border: 1px solid #cfc8d6; border-radius: 7px; padding: 7px 9px; background: #fff; min-width: 0; }
textarea { width: 100%; min-height: 80px; resize: vertical; }
label.f { display: block; margin-bottom: 10px; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
label.f input, label.f select { width: 100%; }
.btn { border: 1px solid #cfc8d6; background: #fff; border-radius: 7px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--purple-2); }
.btn.primary { background: var(--purple); color: #fff; border-color: var(--purple); }
.btn.primary:hover { background: var(--purple-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #2b1a00; font-weight: 600; }
.btn.danger { color: var(--red); }
.btn.small { padding: 4px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }

/* login */
.login { max-width: 360px; margin: 10vh auto; background: #fff; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.login .head { background: var(--purple); color: #fff; padding: 14px 22px 16px; border-bottom: 3px solid var(--gold); }
.login .head img { width: 100%; max-width: 260px; display: block; margin: 0 auto 6px; }
.login .head b { font-size: 18px; } .login .head div { color: #e9e0ef; font-size: 12px; margin-top: 2px; }
.login form { padding: 22px; }
.err { color: var(--red); font-size: 13px; margin: 6px 0; min-height: 1em; }

/* client page */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.kv div b { display: block; font-size: 16px; }
.kv div span { font-size: 12px; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .meta { font-size: 12px; color: var(--muted); }

/* modal + toast */
.modal-back { position: fixed; inset: 0; background: rgba(20,10,30,.45); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 6vh 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; padding: 20px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal h2 { margin-bottom: 14px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; }
pre.email { white-space: pre-wrap; background: #faf9fb; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-family: inherit; max-height: 50vh; overflow: auto; }
.notice { background: var(--yellow-bg); border: 1px solid #f0dc8a; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.qbo-notes { background: var(--blue-bg); border: 1px solid #c9dbf3; border-radius: 8px; padding: 10px 12px; margin: 12px 0 0; font-size: 13px; }
.qbo-notes b { display: block; font-size: 12px; color: var(--blue); margin-bottom: 4px; }
.qnote { font-size: 12px; color: var(--blue); margin-top: 3px; white-space: pre-wrap; }

/* dashboard */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .grid3 { grid-template-columns: 1fr; } }
.cards { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, 1fr); } }
.chartrow { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.donut-wrap { position: relative; width: 180px; height: 180px; flex: none; }
.donut-wrap svg path { cursor: default; transition: opacity .15s; }
.donut-wrap svg path:hover { opacity: .85; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.donut-center b { font-size: 18px; } .donut-center span { font-size: 11px; color: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; font-size: 12px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 6px; align-items: center; padding: 3px 0; }
.legend i, .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw { margin: 0 4px -1px 0; }
.legend b { font-weight: 600; font-variant-numeric: tabular-nums; } .legend em { font-style: normal; color: var(--muted); width: 32px; text-align: right; }
.hbars { display: flex; flex-direction: column; gap: 6px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: 8px; align-items: center; font-size: 12px; }
.hbar.click { cursor: pointer; } .hbar.click:hover .hl { text-decoration: underline; }
.hbar .hl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .ht { background: #f1eff4; border-radius: 4px; height: 14px; overflow: hidden; }
.hbar .hf { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.hbar .hv { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 64px; text-align: right; }
.agestack { display: flex; height: 12px; border-radius: 4px; overflow: hidden; gap: 2px; background: #fff; }
.agestack span { display: block; height: 100%; }
svg.vbars { width: 100%; height: 150px; display: block; }
svg.vbars text { font-size: 10px; fill: var(--muted); }
#viz-tip { position: fixed; z-index: 80; background: #1f1a24; color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 6px; pointer-events: none; opacity: 0; transition: opacity .1s; max-width: 260px; line-height: 1.4; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; -webkit-text-size-adjust: 100%; }
  .m-hide { display: none; }
  header.top { padding-top: env(safe-area-inset-top); }
  .top-inner { padding: 8px 12px; gap: 8px; }
  .brand img { height: 32px; }
  .syncbox { margin-left: auto; }
  nav.tabs { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }
  nav.tabs::-webkit-scrollbar { display: none; }
  nav.tabs a { white-space: nowrap; padding: 8px 12px; }
  main { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; }
  .panel { padding: 12px; }
  .cards { gap: 8px; }
  .card { padding: 10px 12px; } .card .value { font-size: 19px; }
  .grid2, .grid3 { grid-template-columns: 1fr; gap: 12px; }
  .filters { gap: 6px; }
  .filters > * { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .filters input[type=search] { flex-basis: 100%; }
  .filters .spacer { display: none; }
  input[type=text], input[type=password], input[type=date], input[type=search], select, textarea { font-size: 16px; padding: 9px 10px; } /* 16px stops iPhone zooming */
  .btn { padding: 10px 14px; } .btn.small { padding: 7px 10px; font-size: 13px; }
  .actions .btn { flex: 1 1 calc(50% - 8px); }
  .row > label.small { flex: 1 1 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .kv { grid-template-columns: 1fr 1fr; }
  .chartrow { flex-direction: column; align-items: stretch; } .donut-wrap { margin: 0 auto; }
  .hbar { grid-template-columns: minmax(80px, 40%) 1fr auto; }
  .modal-back { padding: 0; align-items: stretch; }
  .modal { max-width: none; min-height: 100%; border-radius: 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
  .modal .foot { position: sticky; bottom: 0; background: #fff; padding-top: 10px; flex-wrap: wrap; }
  .modal .foot .btn { flex: 1 1 auto; }
  .login { margin: 6vh 12px; }

  /* tables become cards */
  .tablewrap { background: none; border: 0; overflow: visible; }
  table.cardify, table.cardify tbody, table.cardify tr, table.cardify td { display: block; width: 100%; }
  table.cardify thead { display: none; }
  table.cardify tr { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
  .panel table.cardify tr { border-color: var(--line); }
  table.cardify td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; text-align: right; }
  table.cardify td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; padding-top: 2px; }
  table.cardify td[data-label=""]::before, table.cardify td:not([data-label])::before { content: none; }
  table.cardify td:first-child { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  table.cardify td:first-child::before { content: none; }
  table.cardify td.desc { max-width: none; text-align: left; display: block; }
  table.cardify td.desc::before { display: block; margin-bottom: 2px; }
  table.cardify td .agestack { width: 55%; margin-top: 4px; }
  table.cardify td:empty { display: none; }
  tr.click:hover td { background: none; }
  tr.click:active { background: #f3eff7; }
}
@media (max-width: 760px) {
  table.cardify td:first-child:has(> input[type=checkbox]) { display: flex; justify-content: flex-end; border-bottom: 0; margin: 0 0 -28px; padding: 0; position: relative; z-index: 1; }
  table.cardify td:first-child:has(> input[type=checkbox]) input { width: 22px; height: 22px; }
  table.cardify td:first-child:has(> input[type=checkbox]) + td { display: block; text-align: left; font-size: 15px; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 4px; }
  table.cardify td:first-child:has(> input[type=checkbox]) + td::before { content: none; }
}
@media (max-width: 760px) {
  table.cardify td { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; }
  table.cardify td::before { grid-column: 1; grid-row: 1 / span 6; }
  table.cardify td > * { grid-column: 2; justify-self: end; text-align: right; }
  table.cardify td:first-child, table.cardify td.desc { display: block; }
  table.cardify td:first-child > *, table.cardify td.desc > * { text-align: left; }
}
@media (max-width: 760px) {
  table.cardify td { row-gap: 0; gap: 0 12px; }
  .cards { grid-template-columns: 1fr 1fr; }
}
.qnote { text-align: left !important; justify-self: start !important; }
@media (max-width: 760px) { table.cardify td.desc .qnote { display: block; } }

/* WhatsApp + phone card payments */
.btn.wa { background: #25D366; border-color: #1ebe5a; color: #fff; }
.btn.wa:hover { background: #1ebe5a; }
.nowrap { white-space: nowrap; }
.blink-card input, .blink-card select { max-width: 100%; }
.blink-card #cardfields { margin: 6px 0 4px; min-height: 120px; }
@media (max-width: 760px) { .nowrap { white-space: normal; } .nowrap .btn { margin: 2px 0; } }
.pickrow { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pickrow:hover { background: #f6f2fa; }
.pickrow:last-child { border-bottom: 0; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--purple); text-decoration: underline; }
th.sortable .arr { font-size: 11px; }
.tabs .tab.active { background: var(--purple); color: #fff; border-color: var(--purple); }
.gres { position: absolute; right: 0; top: 36px; width: 360px; max-height: 420px; overflow: auto; background: #fff; color: #1f1a24; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.18); z-index: 60; }
.gres .pickrow.on { background: #f6f2fa; }

/* top bar: one tidy row on desktop */
.gsearch { position: relative; display: flex; align-items: center; }
.gsearch svg { position: absolute; left: 9px; width: 15px; height: 15px; color: rgba(255,255,255,.75); pointer-events: none; }
header.top .gsearch input[type=search] { width: 200px; padding: 7px 10px 7px 30px; border-radius: 8px; border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.12); color: #fff; font-size: 14px; transition: width .15s, background .15s; }
header.top .gsearch input[type=search]::placeholder { color: rgba(255,255,255,.7); }
header.top .gsearch input[type=search]:focus { background: #fff; color: #1f1a24; outline: none; width: 260px; border-color: #fff; }
.gsearch:focus-within svg { color: #6b6375; }
.syncbox .btn.small { padding: 4px 10px; }
@media (max-width: 1250px) { .wide-only { display: none; } header.top .gsearch input[type=search] { width: 160px; } }
@media (max-width: 1060px) { .brand span { display: none; } nav.tabs a { padding: 7px 8px; font-size: 13px; } }
@media (max-width: 760px) {
  .top-inner { flex-wrap: wrap; gap: 8px; }
  .brand span { display: inline; }
  .gsearch { order: 2; flex: 1 1 100%; }
  header.top .gsearch input[type=search], header.top .gsearch input[type=search]:focus { width: 100%; font-size: 16px; padding: 9px 10px 9px 32px; }
  .gres { left: 0; right: 0; width: auto; }
  nav.tabs a { font-size: 14px; padding: 8px 12px; }
}

/* task count on the Tasks tab */
.tabs .badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px; border-radius: 9px; background: var(--gold, #FDB813); color: #1f1a24; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
@media (max-width: 700px) { .fc-row { grid-template-columns: 1fr 90px !important; } .fc-row > span:nth-child(2) { display: none !important; } }

/* ---------- aged debtors report ---------- */
.ar-report { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.ar-head { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid var(--gold); padding-bottom: 10px; margin-bottom: 12px; }
.ar-head img { height: 34px; }
.ar-head h2 { margin: 0 0 2px; color: var(--purple); }
.ar-sum { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 12px; }
.ar-sum > div { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.ar-sum span { display: block; font-size: 11px; color: #6b6478; text-transform: uppercase; letter-spacing: .03em; }
.ar-sum b { font-size: 17px; }
.ar-sum i { font-style: normal; font-size: 11px; color: #6b6478; margin-left: 6px; }
.ar-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ar-table th { text-align: left; font-size: 11px; color: #6b6478; border-bottom: 2px solid var(--purple); padding: 5px 6px; white-space: nowrap; }
.ar-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ar-table .num { text-align: right; white-space: nowrap; }
.ar-table tr.ar-old > td:first-child { box-shadow: inset 3px 0 0 #ec4647; }
.ar-table td.ar-notes, .ar-table th.ar-notes { width: 22%; border-left: 1px solid var(--line); }
.ar-table tfoot td { border-top: 2px solid var(--purple); border-bottom: 0; font-weight: 600; }
.ar-table tr.ar-inv > td { padding: 0 6px 6px 22px; border-bottom: 1px solid var(--line); }
.ar-table tr.ar-inv table { border-collapse: collapse; font-size: 11px; min-width: 55%; }
.ar-table tr.ar-inv th { border-bottom: 1px solid var(--line); font-size: 10px; padding: 2px 8px 2px 0; }
.ar-table tr.ar-inv td { border: 0; padding: 1px 8px 1px 0; }
.ar-foot { margin-top: 10px; }
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  /* summary: laid out landscape (277 x 190mm), turned on the portrait page so every page is portrait */
  .ar-rot { width: 190mm; height: 277mm; overflow: hidden; position: relative; break-after: page; page-break-after: always; break-inside: avoid; }
  .ar-rot:last-child { break-after: auto; page-break-after: auto; }
  .ar-rot .ar-page { position: absolute; top: 0; left: 0; width: 277mm; height: 190mm; overflow: hidden; box-sizing: border-box;
    transform-origin: top left; transform: rotate(-90deg) translateX(-100%); break-after: auto; page-break-after: auto; }
  header.top, .noprint, #toast, .toast { display: none !important; }
  body { background: #fff !important; }
  main { max-width: none; padding: 0; }
  .ar-report { border: 0; padding: 0; border-radius: 0; }
  .ar-table { font-size: 10.5px; }
  .ar-table thead { display: table-header-group; }
  .ar-table tfoot { display: table-row-group; }
  .ar-table tr { break-inside: avoid; page-break-inside: avoid; }
  .ar-table td.ar-notes { height: 28px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* one-page summary */
.ar-page { margin-bottom: 16px; }
.ar-sum8 { grid-template-columns: repeat(4, 1fr); }
.ar-sum8 i { display: block; margin: 0; }
.ar-agebar { display: flex; height: 16px; border-radius: 4px; overflow: hidden; gap: 2px; margin: 4px 0 4px; }
.ar-agekey { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 11.5px; margin-bottom: 12px; }
.ar-agekey i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.ar-grid { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 16px; }
.ar-grid h3 { font-size: 13px; color: var(--purple); margin: 0 0 4px; }
.ar-grid h3:not(:first-child) { margin-top: 12px; }
.ar-mini { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ar-mini th { text-align: left; font-size: 10.5px; color: #6b6478; border-bottom: 1.5px solid var(--purple); padding: 3px 4px; }
.ar-mini td { padding: 3px 4px; border-bottom: 1px solid var(--line); }
.ar-mini .num { text-align: right; white-space: nowrap; }
@media print {
  .ar-page { margin: 0; }
  .ar-page .ar-sum b { font-size: 15px; }
  .ar-mini { font-size: 10px; }
  .ar-mini tr { break-inside: avoid; }
}
@media print {
  .ar-table td { padding: 3px 5px; }
  .ar-table td.ar-notes { height: auto; }
  .ar-table .small { font-size: 10px; }
}
@media print {
  /* full list prints portrait: tighter type so all columns fit */
  .ar-report:not(.ar-page) .ar-table { font-size: 9px; }
  .ar-report:not(.ar-page) .ar-table .small { font-size: 8.5px; }
  .ar-report:not(.ar-page) .ar-table th { font-size: 8.5px; padding: 4px 3px; }
  .ar-report:not(.ar-page) .ar-table td { padding: 3px 3px; }
  .ar-report:not(.ar-page) .ar-table td.ar-notes, .ar-report:not(.ar-page) .ar-table th.ar-notes { width: 18%; }
  .ar-report:not(.ar-page) .ar-sum { grid-template-columns: repeat(3, 1fr); }
  .ar-report:not(.ar-page) .ar-sum b { font-size: 13px; }
}

/* ---------- El Al vouchers ---------- */
.ev-table .ev-numtxt { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
.ev-copy { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 2px 7px; font-size: 11.5px; cursor: pointer; margin-left: 4px; color: var(--purple-2); white-space: nowrap; }
.ev-copy:hover { background: #f3eff8; border-color: #cbbfdc; }
.ev-copy.copied { background: #e6f6ea; border-color: #9ad3a8; color: #0b7a2a; }
.ev-copy6 { color: #6b6474; }
.ev-rem { padding: 2px 7px; border-radius: 5px; font-weight: 600; }
.ev-g { background: #4CAF50; color: #fff; } .ev-o { background: #FF9800; color: #fff; } .ev-y { background: #FFEB3B; color: #1f1a24; }
.ev-neg { background: #fde3e3; color: #b42318; }
.ev-key { padding: 1px 6px; border-radius: 4px; margin-right: 4px; }

/* payment day */
.pill.pd-waiting { background: #e8f0fd; color: #1d4f9c; }
.pill.pd-due { background: #fff4d6; color: #8a5a00; }
.pill.pd-missed { background: #fde3e3; color: #b42318; font-weight: 600; }

/* admin "log in as" */
.syncbox .masqexit { background: #d92d20; border: 1px solid #b42318; color: #fff; font-weight: 600; border-radius: 8px; padding: 5px 10px; cursor: pointer; white-space: nowrap; }
.syncbox .masqexit:hover { background: #b42318; }
.syncbox .avatar.masq { box-shadow: 0 0 0 3px #d92d20; }
header.top .masqlist { max-height: 300px; overflow: auto; margin: 2px 0 4px 10px; border-left: 2px solid #e6dcef; padding-left: 4px; }
header.top .masqlist input { width: calc(100% - 8px); margin: 4px; padding: 6px 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
header.top .masqlist button { padding: 6px 10px; font-size: 13.5px; }
header.top .masqlist button[hidden] { display: none; }
@media (max-width: 760px) { .syncbox .masqexit { padding: 4px 8px; font-size: 12px; } }

/* saved cards on the client page */
.savedcards { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 10px; }
.savedcards .savedcard { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 4px 6px 4px 10px; background: #fff; font-size: 13.5px; }
.savedcards .sc-brand { font-weight: 600; color: var(--purple); }
.savedcards .savedcard .btn { padding: 3px 9px; }

/* pay links: keep the whole row on screen */
.pl-table td { padding: 7px 8px; }
.pl-table td:nth-child(2) b { overflow-wrap: anywhere; word-break: break-word; }
.pl-table td:nth-child(2) { max-width: 260px; }
.pl-table td:nth-child(3) { max-width: 220px; overflow-wrap: anywhere; }
.pl-table td.pl-act { white-space: nowrap; text-align: right; width: 1%; }
.pl-table td.pl-act .btn { padding: 3px 7px; margin-left: 3px; font-size: 12px; }
@media (max-width: 1100px) { .pl-table td.pl-act { white-space: normal; min-width: 150px; } .pl-table td.pl-act .btn { margin: 2px 0 2px 3px; } }

/* private jet invoices (TravelDesk Jets) */
.pill.jet { background: #efe4f6; color: #4A365B; font-size: 11px; margin-left: 4px; }
