/* Tuva eier-app: the Customers tab (SPEC-crm-list.md). Phone first; from 900 px the list and the open card sit side by side. No inline styles (CSP). */
.custscreen{padding-bottom:calc(112px + env(safe-area-inset-bottom))}              /* room to scroll the last thing clear of the bottom tab bar */
@media (min-width:900px){.custscreen{padding-bottom:24px}}
.custtools{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}                   /* narrow list (a phone, a card open): search on its own row, the two buttons side by side under it */
.custtools[hidden],.custchips[hidden]{display:none}
.custsearch{flex:1 1 100%;min-width:0;display:block}
.custtools .btn{flex:1 1 150px;min-width:0;min-height:44px;white-space:nowrap}
/* the five quick views stay on ONE row that scrolls sideways; the fade on the right edge says there is more */
.custchips{display:flex;flex-wrap:wrap;gap:8px;padding:6px 0 4px;margin-top:2px}      /* the chips wrap onto more lines: nothing is clipped, nothing needs a sideways swipe */
.custchips::-webkit-scrollbar{display:none}
.custchips button{flex:none;white-space:nowrap}
.custchips button{min-height:44px;padding:0 14px;border-radius:999px;border:1px solid var(--line-strong);background:transparent;font-weight:600;font-size:14px;color:var(--text)}
.custchips button[aria-pressed="true"]{background:var(--text);color:var(--surface);border-color:var(--text)}
.custintro{margin-top:16px;padding:16px 18px;border-radius:var(--radius);background:var(--surface-3);border:1px solid var(--line)}
.custintro p{margin:0 0 8px}
.custintro .btnrow{margin-top:12px}
@media (max-width:899.98px){.custintro .btnrow{flex-direction:column}.custintro .btnrow .btn{flex:none;width:100%;white-space:nowrap}}
/* an open delete question is never covered by a toast (one that arrives late stays away until the question is closed) */
body:has(#cust-confirm:not([hidden])) .toast{display:none}

/* the list: on a phone one column (name, number, tags); the other columns come with the width */
.custtbl{width:100%;table-layout:fixed;border-collapse:collapse;margin-top:2px;font-size:15px}
.custtbl th{text-align:left;font-size:13px;font-weight:600;color:var(--muted);padding:8px 10px;border-bottom:1px solid var(--line-strong);white-space:nowrap}
.custtbl td{padding:8px 10px;border-bottom:1px solid var(--line);vertical-align:middle;overflow-wrap:anywhere}
.custtbl td.custname{min-width:0;overflow:hidden}                                  /* a name never widens the list: the name button cuts it with … (the full name is in its title) */
.custrow{cursor:pointer}
.custrow:hover td{background:var(--surface-3)}
.custrow.is-open td{background:rgba(242,198,109,.10)}
.custcell{display:flex;align-items:center;gap:10px;min-width:0}
/* line 1: the name (cut with …) and the number (never wraps); line 2: who added it and YES/STOP. Two lines at most. */
.custnm{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;flex:1;min-width:0}
.custopen{display:block;width:100%;min-width:0;min-height:44px;padding:0;border:0;background:transparent;color:var(--text);font-weight:600;font-size:16px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.s-phone{margin-left:10px;color:var(--muted);font-size:13px;white-space:nowrap}
.custsub{grid-column:1 / -1;display:flex;flex-wrap:wrap;gap:6px;align-items:center;color:var(--muted);font-size:13px;margin-top:-6px;padding-bottom:6px}
.custav{width:36px;height:36px;border-radius:50%;flex:none;display:grid;place-items:center;background:var(--forest);color:#fff;font-weight:800;font-size:13px}
.custav.big{width:52px;height:52px;font-size:19px}
.c-phone,.c-next,.c-offers,.c-from{display:none}
.c-phone,.c-from{white-space:nowrap}
.c-next{font-size:14px}
.custtbl th.c-phone{width:140px}.custtbl th.c-offers{width:84px}.custtbl th.c-from{width:104px}.custtbl th.c-next{width:200px}
.custtbl thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}

/* tags: every colour pair is at least 4.5:1 in the light and the dark theme */
.rowtag.cyes{background:rgba(134,171,132,.22);color:var(--accent)}
@media (prefers-color-scheme: light){.custscreen .rowtag.warnt,#sheet .rowtag.warnt{color:#8f4509}}

/* the card */
.custcard{display:none}
.custsplit.open .custcard{display:block}
.custsplit.open .custlist{display:none}
.custcard h2{font-size:28px;line-height:1.1;margin:0;max-width:100%;overflow-wrap:break-word}
.custback{margin-bottom:12px}
.custhead{display:flex;align-items:center;gap:12px}
.custcard{container-type:inline-size}
.custwho{flex:1;min-width:0;overflow-wrap:anywhere}
.custx{display:none}
.custfacts{display:grid;grid-template-columns:repeat(auto-fit,minmax(132px,1fr));gap:8px;margin-top:16px}
.custfacts div{padding:10px 12px;border-radius:12px;background:var(--surface-3);border:1px solid var(--line);min-width:0}
.custfacts b{display:block;font-weight:700;overflow-wrap:break-word}
.custfacts b.nw{white-space:nowrap}
.custfacts span{font-size:12px;color:var(--muted)}
.custh{font-size:18px;font-weight:700;margin:22px 0 8px;font-family:Figtree,system-ui,sans-serif}
.custsum{display:flex;flex-direction:column;gap:2px;padding:10px 12px;border-radius:12px;background:var(--surface-3);border:1px solid var(--line);margin-top:8px;overflow-wrap:break-word}
.custsum small{color:var(--muted);font-size:12.5px}
.custsvc{flex-direction:row;justify-content:space-between;gap:12px}
.custoffers{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.custoffers .segctl{min-width:190px}
.custoffers .segctl input:checked + span{background:var(--text);color:var(--surface);box-shadow:none}    /* the pressed chip's colours: clearly different from the track, 4.5:1 text, in both themes */
.custhelp{flex-basis:100%;margin:0}
.custsrc{font-size:13px;color:var(--muted);margin:18px 0 0}
.custsaved{min-height:1.2em;margin-top:2px}
.custconfirm{overflow-wrap:anywhere;margin-top:12px;padding:12px 14px;border-radius:14px;border:1px solid var(--danger);background:var(--surface-3)}
.custconfirm[hidden]{display:none}
.custvis{scroll-margin-bottom:calc(120px + env(safe-area-inset-bottom))}            /* a confirm or an error scrolled into view stays clear of the bottom tab bar */
#cust-del{max-width:100%;overflow-wrap:anywhere;white-space:normal;text-align:center}
.btn.danger.solid{background:var(--danger);border-color:var(--danger);color:#1a0a07}

/* the dialogs */
#sheet .err{color:var(--danger);font-weight:600}
.custcheck{display:flex;gap:10px;align-items:center;min-height:44px;margin-top:16px;font-size:15px;cursor:pointer}     /* the whole row is the tap target: 44 px */
.custcheck input{width:22px;height:22px;margin-top:1px;accent-color:var(--sage);flex:none}
.custblock{display:block}
.custfilerow{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.custfile{position:relative;cursor:pointer;margin-top:0}
.custfile:focus-within{outline:3px solid var(--focus);outline-offset:2px}
.custsumline{font-size:18px;margin:16px 0 4px}
.custprev{width:100%;border-collapse:collapse;margin-top:8px;font-size:14px}
.custprev td{padding:8px 4px;border-bottom:1px solid var(--line);vertical-align:top;overflow-wrap:anywhere}
.nwrap{white-space:nowrap}
.custprev td:last-child{text-align:right}

@media (min-width:900px){
  /* the list is never narrower than 300 px; the card goes down to 320 px in the 900-1023 band. No card open: the right panel is only a short note */
  .custsplit{display:grid;grid-template-columns:minmax(300px,1fr) clamp(320px,36vw,380px);gap:12px;align-items:start}
  .custsplit:not(.open){grid-template-columns:minmax(0,1fr) 200px}
  .custsplit.none{grid-template-columns:minmax(0,1fr)}
  .custsplit.none .custcard{display:none}
  .custsplit.open .custlist{display:block}
  .custcard{display:block;position:sticky;top:16px;max-height:calc(100vh - 32px);overflow-y:auto;background:var(--surface-2);border:1px solid var(--line);border-radius:var(--radius);padding:18px;min-width:0}
  .custback{display:none}
  .custx{display:grid}
  .custvis{scroll-margin-bottom:16px}
  .view > .pad.custscreen{padding-left:24px;padding-right:24px}
  .custtbl thead{position:static;width:auto;height:auto;overflow:visible;clip:auto}
}
@media (min-width:900px) and (max-width:1023.98px){.view > .pad.custscreen{padding-left:16px;padding-right:16px}}
@media (min-width:1180px){
  .custsplit{grid-template-columns:minmax(300px,1fr) 400px;gap:24px}
  .custsplit:not(.open){grid-template-columns:minmax(0,1fr) 200px}
  .custsplit.none{grid-template-columns:minmax(0,1fr)}
  .view > .pad.custscreen{padding-left:32px;padding-right:32px}
}
/* the other columns come with the width the LIST has (it is narrower when the card is open); what is not a column stays on the name's two lines */
.custlist{container-type:inline-size}
@media (min-width:900px){
  /* a table only where the name column keeps 180 px or more; below that the 2-line rows. With no card open the list shares the screen with a small note only, so it can go to a table sooner */
  @container (min-width:440px){.custsplit:not(.open) :is(.c-offers,.c-from){display:table-cell}.custsplit:not(.open) .custsub{display:none}}
  @container (min-width:600px){.c-offers,.c-from{display:table-cell}.custsub{display:none}}
  @container (min-width:640px){.custsplit:not(.open) .c-phone{display:table-cell}.custsplit:not(.open) .s-phone{display:none}}
  @container (min-width:680px){.c-phone{display:table-cell}.s-phone{display:none}}
  @container (min-width:740px){.c-next{display:table-cell}}
}
@container (min-width:600px){.custsearch{flex:1 1 220px}.custtools .btn{flex:none}}

/* a narrow card (a card open at 900-1250 px): the edit and close buttons get their own row above, so the name has the whole width beside the avatar */
@media (min-width:900px){
  @container (max-width:419.98px){
    .custhead{display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;column-gap:12px;row-gap:4px}
    .custhead .custav{grid-column:1;grid-row:2}
    .custhead .custwho{grid-column:2 / -1;grid-row:2}
    .custhead [data-act=custEdit]{grid-column:3;grid-row:1}
    .custhead .custx{grid-column:4;grid-row:1}
    .custcard h2{font-size:26px}
  }
}
/* a toast with a very long name stays inside its pill and inside the screen */
.toast span{min-width:0;overflow-wrap:anywhere}
.consentpanel{margin-top:12px;padding:12px 14px;border-radius:14px;border:1px solid var(--line);background:var(--surface-3)}
.consentpanel[hidden]{display:none}
.consentbox .field{margin-top:12px}
.cxchan{margin-top:4px}
.custh2{font-size:15px;font-weight:700;margin:14px 0 4px}
