/* Offene Posten (offene-posten.html) — this page only. Colours and spacing come from the shared custom
   properties in coolhanx.css; the work bar, the "?" bubble, the tab bar and the empty panel are in ui.css.

   The idea of the page: someone with open items asks three things — what am I owed, what do I owe, and
   how old is it. So the work bar carries the three views and the balance, the age bands are a strip you
   can click (one click = only those items), and a partner is one line that opens into its documents.
   The panel beside the list is where the next step is: record the payment, dun, open the document. */

.op .page-head{margin-bottom:3px}
.op-bar{flex-wrap:wrap;gap:8px 12px;align-items:center}
.op-tabs{border-bottom:0;margin:0;overflow:visible;flex:0 1 auto}
.op-tabs [role=tab]{padding:8px 12px;font-size:.88rem}
.op-tabs [role=tab] .badge{margin-left:5px;padding:1px 7px}
.op-tabs [role=tab][aria-selected=true] .badge{background:var(--accent-soft);color:var(--accent-strong)}
.op-saldo{display:inline-flex;align-items:baseline;gap:8px;white-space:nowrap}
.op-saldo .lab{font-size:.78rem;font-weight:650;color:var(--muted)}
.op-saldo b{font-family:var(--mono);font-variant-numeric:tabular-nums;font-size:1.1rem;font-weight:800;letter-spacing:-.01em}
.op-saldo b.neg,.op-amt.neg{color:var(--crit)}
.op-search{width:170px;min-width:0;background:var(--surface-2);border:1px solid var(--line-2);border-radius:8px;padding:7px 11px;color:var(--ink);font:inherit;font-size:.86rem;box-sizing:border-box}
.op-search:focus{border-color:var(--accent);background:var(--surface)}
.op-btn{width:auto;padding:6px 12px;font-size:.82rem}
@media(max-width:1400px){.op-search{width:140px}.op-tabs [role=tab]{padding:8px 8px}}

/* ---- the figures: one line ---- */
.op-strip{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 28px;margin:0 2px 10px}
.op-fig{display:inline-flex;align-items:baseline;gap:7px;min-width:0}
.op-fig .lab{font-size:.78rem;font-weight:650;color:var(--muted)}
.op-fig b{font-family:var(--mono);font-variant-numeric:tabular-nums;font-size:1.05rem;font-weight:800;letter-spacing:-.01em;white-space:nowrap}
.op-fig .sub{font-size:.76rem;color:var(--muted)}
.op-fig .sub.late{color:var(--crit);font-weight:650}

/* ---- the age bands: a bar, and five buttons that filter the list ---- */
.op-b-not_due{--bk:var(--accent)}
.op-b-d1_30{--bk:color-mix(in srgb,var(--warn) 55%,var(--surface))}
.op-b-d31_60{--bk:var(--warn)}
.op-b-d61_90{--bk:color-mix(in srgb,var(--crit) 65%,var(--surface))}
.op-b-d90_plus{--bk:var(--crit)}
.op-ages{margin:0 0 12px}
.op-ages[hidden]{display:none}
.op-track{display:flex;gap:2px;height:9px;margin:0 0 8px;border-radius:5px;overflow:hidden;background:var(--line)}
.op-t{flex-basis:0;min-width:4px;background:var(--bk)}
.op-t.dim{opacity:.3}
.op-segs{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}
.op-seg{display:flex;flex-direction:column;align-items:flex-start;gap:1px;min-width:0;padding:7px 10px 8px;border:1px solid var(--line-2);border-top:3px solid var(--bk);border-radius:8px;background:var(--surface);color:var(--ink);font:inherit;text-align:left;cursor:pointer}
.op-seg:hover:not(:disabled){background:var(--surface-2)}
.op-seg[aria-pressed=true]{background:var(--accent-soft);border-color:var(--accent);border-top-color:var(--bk)}
.op-seg:disabled{opacity:.5;cursor:default}
.op-seg-l{font-size:.74rem;font-weight:700;color:var(--muted)}
.op-seg-v{font-family:var(--mono);font-size:.95rem;font-weight:800;white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}
.op-seg-n{font-size:.72rem;color:var(--muted);max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:1100px){.op-segs{grid-template-columns:repeat(3,minmax(0,1fr))}}

/* ---- the list ---- */
.op-grid{grid-template-columns:minmax(0,1fr) 380px}
@media(max-width:1100px){.op-grid{grid-template-columns:minmax(0,1fr)}}
.op-left{min-width:0}
.op-card{overflow:visible}
.op-tbl{table-layout:fixed;width:100%}
.op-tbl th,.op-tbl td{padding-left:10px;padding-right:10px}
.op-tbl th:nth-child(2){width:104px}
.op-tbl th:nth-child(3){width:128px}
.op-tbl th:nth-child(4){width:108px}
.op-tbl th:nth-child(5){width:118px}
#op-h-doc th:nth-child(n+4),#op-h-sal th:nth-child(n+2){text-align:right}
#op-h-sal th:nth-child(2),#op-h-sal th:nth-child(3){width:136px}
#op-h-sal th:nth-child(4){width:70px}
.op-tbl td{vertical-align:middle;padding-top:7px;padding-bottom:7px;overflow:hidden}
.op-tbl td.empty{overflow:visible;white-space:normal}
.op-tbl tbody tr:first-child td{border-top:0}
.op-tbl tr.op-b-not_due{--bk:var(--line-2)}
.op-tbl td:first-child{box-shadow:inset 3px 0 0 var(--bk,transparent)}
.op-g{background:var(--surface-2)}
.op-g td{font-weight:650}
.op-d td:first-child{padding-left:34px}
.op-d.sel{background:var(--accent-soft)}
.op-g .op-what{min-width:0}
.op-gh{display:flex;align-items:center;gap:4px;min-width:0}
.op-chev{flex:none;width:24px;height:24px;padding:0;border:0;border-radius:5px;background:none;color:var(--muted);font:inherit;font-size:.8rem;cursor:pointer}
.op-chev:hover,.op-chev:focus-visible{background:var(--line);color:var(--ink)}
.op-pname{min-width:0;padding:2px 0;margin:-2px 0;background:none;border:0;color:var(--ink);font:inherit;font-size:.9rem;font-weight:750;text-align:left;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.op-pname:hover{color:var(--accent-strong);text-decoration:underline}
.op-gsub{padding-left:26px}
.op-num{display:inline-block;vertical-align:top;max-width:100%;padding:4px 0;margin:-4px 0;background:none;border:0;color:var(--ink);font-family:var(--mono);font-size:.84rem;font-weight:700;text-align:left;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.op-num:hover{color:var(--accent-strong);text-decoration:underline}
.op-sub{display:block;margin-top:1px;font-size:.74rem;font-weight:500;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.op-due,.op-age{white-space:nowrap}
.op-age.late{color:var(--crit);font-weight:700}
.op-age.muted{color:var(--muted)}
.op-c-gross{text-align:right;white-space:nowrap;color:var(--muted)}
.op-amt{text-align:right;white-space:nowrap;font-family:var(--mono);font-weight:700}
.op-dir{display:inline-block;margin-right:6px;padding:0 6px;border-radius:5px;font-size:.66rem;font-weight:800;letter-spacing:.02em;vertical-align:baseline}
.op-dir.ar{background:var(--accent-soft);color:var(--accent-strong)}
.op-dir.ap{background:var(--surface-2);color:var(--ink);border:1px solid var(--line-2)}
.op-foot{padding:9px 14px;border-top:1px solid var(--line);font-size:.78rem;color:var(--muted)}
.op-foot:empty{display:none}
@media(max-width:1400px){
  /* beside the panel the gross amount goes: the panel shows it, the row keeps the number, the age and what is open */
  .op-grid .op-tbl th.op-c-gross,.op-grid .op-tbl td.op-c-gross{display:none}
  .op-tbl th:nth-child(2){width:96px}
  .op-tbl th:nth-child(3){width:118px}
}

/* ---- nothing open / nothing found ---- */
.op-ok{display:flex;align-items:center;gap:14px;padding:22px 18px}
.op-ok-i{flex:none;display:inline-grid;place-items:center;width:38px;height:38px;border-radius:50%;background:var(--good-soft);color:var(--good);font-size:1.2rem;font-weight:800}
.op-ok-i.muted{background:var(--surface-2);color:var(--muted)}
.op-ok-t{display:flex;flex-direction:column;align-items:flex-start;gap:3px;font-size:.86rem;color:var(--muted);line-height:1.4}
.op-ok-t b{color:var(--ink);font-size:.95rem}
.op-ok-t .btn{margin-top:6px}
.op-act{width:auto;padding:5px 12px;font-size:.82rem;text-decoration:none}

/* ---- documents in another currency ---- */
.op-foreign{margin-top:14px;overflow:visible}
.op-foreign[hidden]{display:none}
.op-fhead{display:flex;align-items:center;padding:9px 14px;border-bottom:1px solid var(--line);font-size:.86rem}
.op-ftbl{table-layout:fixed}
.op-ftbl td{padding-top:7px;padding-bottom:7px;overflow:hidden}
.op-ftbl td:nth-child(1){width:auto}
.op-ftbl td:nth-child(2){width:104px}
.op-ftbl td:nth-child(3){width:118px}
.op-ftbl td:nth-child(4){width:130px}

/* ---- the panel beside the list ---- (it keeps its place, so the list does not jump when a row is picked) */
.op-side{position:sticky;top:74px;min-width:0;max-height:calc(100vh - 160px);display:flex;flex-direction:column}
@media(max-width:1100px){.op-side{position:static;max-height:none}}
.op-panel{display:flex;flex-direction:column;min-height:0;max-height:calc(100vh - 160px);overflow-y:auto;padding:14px 16px 16px}
.op-panel .bl-empty{min-height:220px}
.op-panel .op-dir{align-self:flex-start;margin:0 0 0}
.op-ph{display:flex;align-items:flex-start;gap:8px;margin-bottom:6px}
.op-pt{flex:1;min-width:0}
.op-title{margin:0;font-size:1.02rem;font-weight:800;font-family:var(--mono);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.op-pcust{display:block;margin-top:2px;font-size:.84rem;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.op-close{height:28px;min-width:28px;padding:0;font-size:1.05rem;line-height:1;width:auto}
.op-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 0 0;padding:10px 0 0;border-top:1px solid var(--line)}
.op-facts2{border-top:0;margin-top:6px;padding-top:0}
.op-fact .lab{display:block;font-size:.72rem;font-weight:700;color:var(--muted)}
.op-fact b{font-family:var(--mono);font-variant-numeric:tabular-nums;font-size:.88rem;font-weight:800;white-space:nowrap}
.op-fact.crit b{color:var(--crit)}
.op-note{margin:10px 0 0;font-size:.8rem;color:var(--warn);font-weight:650;line-height:1.4}
.op-lh{display:flex;align-items:center;margin:14px 0 4px;font-size:.82rem;font-weight:800}
.op-ledger{border:1px solid var(--line);border-radius:var(--r);background:var(--surface-2);padding:5px 12px}
.op-lr{display:flex;justify-content:space-between;align-items:baseline;gap:12px;padding:3px 0;font-size:.84rem}
.op-lr .l{color:var(--muted)}
.op-lr .v{font-family:var(--mono);font-variant-numeric:tabular-nums;white-space:nowrap}
.op-acts{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:16px}
.op-acts .op-primary{width:auto;color:#fff}
.op-acts .qh{margin-left:-2px}

/* ---- print: the list on paper, every partner opened, with the balance on top ---- */
.op-print-head{display:none}
@media print{
  @page{margin:14mm 12mm}
  html,body{background:#fff !important;color:#000 !important}
  .side,.topbar,.work-bar,.app-foot,.op-side,.op-chev,.qh,.qh-host,.page-head .ph-actions,#chx-cbot-fab,#chx-cbot,#pg-msg,.op-ages,.op-strip,.op-foreign .qh{display:none !important}
  .app{display:block !important}
  .main{display:block !important}
  .content{padding:0 !important;overflow:visible !important}
  .op-print-head{display:block;margin:0 0 10px}
  .op-print-head h2{margin:0 0 2px;font-size:15pt}
  .op-print-head p{margin:0;font-size:10pt}
  .op-print-sum{margin-top:6px !important;font-weight:700;font-size:11pt !important}
  .op .page-head{display:none}
  .op-grid{display:block !important}
  .card{border:0 !important;box-shadow:none !important;background:none !important}
  .op-tbl{table-layout:auto}
  .op-tbl th,.op-tbl td{font-size:9.5pt;border-bottom:1px solid #999 !important;color:#000 !important;background:none !important;box-shadow:none !important}
  .op-g td{font-weight:800}
  .op-d td:first-child{padding-left:20px}
  .op-tbl tr{break-inside:avoid}
  .op-tbl thead{display:table-header-group}
  .op-tbl th.op-c-gross,.op-tbl td.op-c-gross{display:table-cell !important}
  .op-age.late,.op-saldo b.neg,.op-amt.neg{color:#000 !important}
  .op-foot{color:#000;font-weight:700;border-top:1px solid #000}
  .op-foreign{break-inside:avoid}
}

/* ---- SEPA payment file: the ticks in the list and the dialog (2026-11-14) ---- */
.op-sepa-wrap{display:inline-flex;align-items:center}
.op-sepa-wrap[hidden],.op-selall[hidden]{display:none}
.op-sepa-wrap .badge{margin-left:6px}
.op-thf{display:flex;align-items:center;gap:6px}
.op-sel,.op-selall{display:inline-flex;align-items:center;justify-content:center;flex:none;width:24px;height:24px;margin:-4px 0;cursor:pointer}
.op-sel input,.op-selall input{width:16px;height:16px;margin:0;accent-color:var(--accent);cursor:pointer}
.op-what .op-sel{vertical-align:top;margin:-4px 2px -4px -6px}
.op-what .op-sel ~ .op-sub{padding-left:20px}
.sp .sp-note{margin:0 0 10px;font-size:.86rem;color:var(--muted);line-height:1.45}
.sp-ctl{display:flex;flex-wrap:wrap;gap:12px 18px;margin:4px 0 10px}
.sp-f{display:flex;flex-direction:column;gap:5px;min-width:240px;flex:1}
.sp-f label{font-size:.78rem;font-weight:650;color:var(--muted)}
.sp-f select,.sp-f input{min-width:0;background:var(--surface-2);border:1px solid var(--line-2);border-radius:8px;padding:7px 10px;color:var(--ink);font:inherit;font-size:.86rem;box-sizing:border-box}
.sp-f select:focus,.sp-f input:focus{border-color:var(--accent);background:var(--surface)}
.sp-hint{margin:4px 0;font-size:.8rem;color:var(--warn);line-height:1.4}
.sp-tbl{width:100%;table-layout:auto}
.sp-tbl th,.sp-tbl td{padding:8px 10px}
.sp-r td{vertical-align:top}
.sp-who{min-width:0}
.sp-who b{display:block;overflow-wrap:anywhere}
.sp-who .op-sub{white-space:normal}
.sp-ib{display:block;font-family:var(--mono);font-size:.84rem;letter-spacing:.02em;white-space:nowrap}
.sp-ib.new{color:var(--crit);font-weight:700}
.sp-iban .badge{margin-top:3px}
.sp-sub2{display:block;margin-top:2px;font-size:.74rem;color:var(--muted)}
.sp-thamt,.sp-amt{text-align:right}
.sp-amt b{font-family:var(--mono);white-space:nowrap}
.sp-amt .sp-ck{justify-content:flex-end;text-align:left}
.sp-w td{border-top:0}
.sp-warn{background:var(--crit-soft);border-left:3px solid var(--crit);padding:8px 12px !important}
.sp-wh{display:flex;align-items:center;gap:2px;font-size:.86rem}
.sp-cmp{display:flex;flex-wrap:wrap;gap:6px 28px;margin:6px 0}
.sp-cmp .lab{display:block;font-size:.72rem;font-weight:650;color:var(--muted)}
.sp-ck{display:flex;align-items:flex-start;gap:8px;margin-top:6px;font-size:.84rem;line-height:1.35;cursor:pointer}
.sp-ck input{flex:none;width:16px;height:16px;margin:1px 0 0;accent-color:var(--accent)}
.sp-none{margin:10px 0;font-size:.9rem;color:var(--muted)}
.sp-bad{margin-top:14px;padding:10px 12px;border:1px solid var(--line-2);border-radius:8px;background:var(--surface-2)}
.sp-bh{display:flex;align-items:center;gap:2px;font-size:.88rem}
.sp-bad ul{margin:6px 0 0;padding-left:18px;font-size:.84rem;line-height:1.45}
.sp-foot{display:flex;align-items:center;gap:10px;margin-top:14px;padding-top:12px;border-top:1px solid var(--line);position:sticky;bottom:-20px;background:var(--surface)}
.sp-foot .grow{flex:1}
.sp-sum{font-weight:700;font-size:.9rem}
.sp-need{margin-left:10px;font-size:.8rem;font-weight:650;color:var(--crit)}
.sp-gowrap{display:inline-flex;align-items:center}
@media print{.op-sel,.op-selall,.op-sepa-wrap{display:none !important}}
