/* The add and edit sheet: Calendar's event sheet. A centred sheet on the desktop, a full-height sheet on a
   phone; the amount, then grouped rows (.w-gl/.w-gr from wally.css); Repeat, Category and Split as pages.
   Logical properties throughout, for right-to-left. */

/* Under confirmation dialogs (65) and toasts (70), over the page and its tooltips */
.w-addwrap{z-index:58}
/* On wide screens the sheet hangs from near the top, like a macOS sheet: rows that appear later
   (Split and Paid by, a receipt's lines) grow it downward instead of moving it */
@media (min-width:768px){.w-addwrap{place-items:start center;padding-top:max(20px,8vh)}}
html.w-addopen{overflow:hidden}
.w-add{--w-sep:rgba(20,22,27,.07);--w-grp:var(--w-panel2);--w-key:var(--w-panel);--w-keyop:var(--w-fill2);animation:w-addin 260ms var(--ease)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .w-add{--w-sep:rgba(255,255,255,.08);--w-grp:#26282F;--w-key:#2C2E36;--w-keyop:#3A3D47}}
:root[data-theme="dark"] .w-add{--w-sep:rgba(255,255,255,.08);--w-grp:#26282F;--w-key:#2C2E36;--w-keyop:#3A3D47}
@keyframes w-addin{from{transform:translateY(10px) scale(.985);opacity:0}to{transform:none;opacity:1}}
.w-add .vh{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.w-add .w-contents{display:contents}
.w-add.w-sheet{display:block;max-width:460px;padding:16px 18px 18px;border-radius:20px;max-height:calc(100vh - 40px);overflow-y:auto;overscroll-behavior:contain}
/* Hanging from near the top, it still ends 20px above the window's bottom */
@media (min-width:768px){.w-add.w-sheet{max-height:calc(100vh - max(20px,8vh) - 20px)}}
.w-add:focus{outline:0}
.w-apage{display:grid;gap:14px;align-content:start}
.w-apage[hidden]{display:none}

/* The top: the type and Close; Cancel and the type; or Cancel · title · Save */
.w-ah{display:flex;justify-content:space-between;align-items:center;gap:10px;min-height:34px}
.w-ah .w-atitle{font-size:16px;font-weight:600;text-align:center;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.w-ah > span:last-child{min-width:56px}
.w-alink{display:inline-flex;align-items:center;gap:2px;font-size:var(--fs-sub);color:var(--w-accent-ink);min-height:34px;padding:0 2px;white-space:nowrap}
.w-alink:hover{opacity:.75}
.w-alink svg.i{width:18px;height:18px;margin-inline-start:-4px}
.w-asave{font-weight:600}
.w-asave[aria-disabled="true"]{color:var(--w-ink3)}
.w-aback{min-width:56px}
.w-add .w-addx{margin-inline-start:auto}
.w-add #add-type button{padding:5px 12px;font-size:14px}
.w-atype{display:flex}
.w-atype .w-seg{flex:1;display:flex}
.w-atype .w-seg button{flex:1}

/* The amount: centred, grey until typed */
.w-add .w-amount{justify-content:center;align-items:baseline;border-bottom:0;padding:8px 0 6px;gap:4px;position:relative}
.w-add .w-amount input{font-size:46px;font-weight:650;letter-spacing:-.04em;text-align:center;min-width:.6em;max-width:100%;flex:0 1 auto;font-variant-numeric:tabular-nums}
.w-add .w-amount .cur,.w-addp .w-pamt .cur{font-size:22px;font-weight:600;color:var(--w-ink3)}
.w-add .w-amount input::placeholder{color:var(--w-ink3)}
.w-add .w-amount .w-calc{position:absolute;inset-inline-end:0;bottom:14px;font-size:var(--fs-foot);color:var(--w-accent-ink);font-weight:600}
.w-add .w-amount:focus-within input{caret-color:var(--w-accent)}
/* Empty, the caret blinks right after the 0.00, where the first digit goes (keys always add at the end),
   so the sheet opens showing where the amount is typed. The field is as wide as the 0.00, so nothing moves */
.w-add .w-amount input:placeholder-shown,.w-addp .w-pamt input:placeholder-shown{text-align:right}
.w-add .w-amount.err input{color:var(--w-bad)}
.w-acap{text-align:center;font-size:var(--fs-foot);color:var(--w-ink3);margin-top:-12px}
.w-acenter{text-align:center;margin:-10px 0 0}

/* Grouped rows, in the sheet's grey */
.w-add .w-gl{background:var(--w-grp);overflow:visible}
.w-add .w-gl + .w-gl,.w-add .w-glf + .w-gl,.w-add .w-err + .w-gl,.w-add .w-dup + .w-gl{margin-top:0}
.w-add .w-gr{font-size:16px;min-height:48px;padding:10px 16px;border-top-color:var(--w-sep)}
.w-add .w-acal{border-top-color:var(--w-sep)}
.w-add .w-gr:first-child{border-start-start-radius:var(--r-card);border-start-end-radius:var(--r-card)}
.w-add .w-gr:last-child{border-end-start-radius:var(--r-card);border-end-end-radius:var(--r-card)}
.w-add .w-gl > [hidden]{display:none}
/* Split, Paid by and each person's part are wrapped rows: the first one keeps its separator */
.w-add :is(.w-asplit,.w-acust) > .w-gr:first-child{border-top:1px solid var(--w-sep);border-radius:0}
/* Rows hidden at the top of a group leave the next one's border out */
.w-add .w-gl > [hidden]:first-child + .w-gr,.w-add .w-gl > [hidden] + [hidden] + .w-gr:not(:first-child){border-top:0}
.w-add .w-gr > .v{color:var(--w-ink2)}
.w-add .w-glf{padding:0 16px;margin-top:-6px}
.w-add .w-glf[hidden]{display:none}
.w-add .w-aname input,.w-add .w-acatrow .w-catbox input,.w-apop select,.w-anum,.w-adate,.w-add #add-tag,.w-add #add-note{font-size:16px!important}
.w-add .w-aname{position:relative}
.w-add .w-aname .w-sugg{top:calc(100% + 4px)}
/* Segmented controls end on the rows' right edge */
.w-add .w-aseg{flex:none;margin-inline-start:auto}
.w-add .w-aseg button{padding:5px 12px;font-size:14px;font-weight:500}
/* Pop-up rows: the value and a small chevron, the menu is the browser's own */
.w-apop{position:relative;display:inline-flex;align-items:center;gap:4px;min-width:0}
.w-apop select{-webkit-appearance:none;appearance:none;border:0;background:none;font:inherit;font-size:15px;color:var(--w-ink2);text-align:end;text-align-last:end;padding:2px 0;outline:0;cursor:pointer;max-width:100%;min-width:0}
.w-apop select:focus-visible{outline:2px solid var(--w-accent);outline-offset:2px;border-radius:6px}
.w-apop svg.chev{width:14px;height:14px}
.w-add .w-gr > svg.chev{margin-inline-start:-6px}
/* Category on the desktop: the value, its icon and a chevron, at the right; typing filters */
.w-acatrow .w-catbox{position:relative;display:flex;align-items:center;justify-content:flex-end;gap:6px;margin-inline-start:auto;min-width:0}
.w-acatrow .w-caticon{display:flex;color:var(--w-ink3)}
.w-acatrow .w-caticon .w-ico,.w-add #add-catv .w-ico{width:24px;height:24px;border-radius:6px}
.w-acatrow .w-caticon .w-ico svg.i,.w-add #add-catv .w-ico svg.i{width:13px;height:13px}
.w-add #add-catv{gap:8px}
.w-acatrow .w-caticon:empty{display:none}
.w-add .w-acatrow .w-catbox input{border:0;background:none;outline:0;font:inherit;font-size:15px;color:var(--w-ink2);text-align:end;width:150px;min-width:3ch;max-width:220px;padding:0;cursor:pointer}
.w-add .w-acatrow .w-catbox input:focus{width:150px!important}
.w-add .w-acatrow .w-catbox input:focus{cursor:text;color:var(--w-ink)}
.w-add .w-acatrow .w-catbox input::placeholder{color:var(--w-ink2)}
.w-acatrow .w-catchev{width:14px;height:14px;color:var(--w-ink3);flex:none}
.w-add .w-catlist{left:auto;inset-inline-end:-8px;inset-inline-start:auto;width:260px;top:calc(100% + 10px)}
.w-catlist{max-height:268px;overflow-y:auto;overscroll-behavior:contain}
.w-catlist button{grid-template-columns:26px minmax(0,1fr) auto;padding:5px 8px}
.w-catlist .w-ico{width:26px;height:26px;border-radius:var(--r-ctl)}
.w-catlist .w-ico svg.i{width:14px;height:14px}
.w-catlist .w-conew{background:var(--w-fill);color:var(--w-ink2)}
.w-coon{width:14px;height:14px;color:var(--w-accent-ink)}
.w-catlist .w-cosplit{border-top:1px solid var(--w-line2);border-radius:0 0 var(--r-ctl) var(--r-ctl);margin-top:3px;padding-top:8px}
.w-cosplit b{color:var(--w-ink2)}


/* Shares: each person's part when it's Custom */
.w-acust{display:contents}
.w-acust[hidden]{display:none}
.w-apct{font-size:var(--fs-foot);color:var(--w-ink3);min-width:36px;text-align:end;font-variant-numeric:tabular-nums;margin-inline-start:auto}
.w-aval{font-weight:400;font-size:16px;color:var(--w-ink);font-variant-numeric:tabular-nums;width:90px;text-align:end;flex:none}
.w-anum{border:0;background:none;outline:0;font:inherit;font-size:15px;color:var(--w-ink);text-align:end;padding:0;font-variant-numeric:tabular-nums}
.w-anum::placeholder{color:var(--w-ink3)}
.w-add .w-aamt,.w-add .w-gr input.w-aamt{width:90px;flex:none}
.w-add .w-gr input.w-anum{flex:none}
.w-add .w-gr input.w-adate{flex:none}
.w-add .w-aamt[aria-invalid="true"]{color:var(--w-bad)}
.w-add input[type="number"].w-anum{width:56px}
.w-aevery{display:inline-flex;align-items:center;gap:8px}
.w-adate{border:0;background:none;font:inherit;font-size:15px;color:var(--w-ink2);text-align:end;outline:0;margin-inline-start:auto}
/* A split receipt: its parts as rows */
.w-aparts,.w-aparts > div[role="group"]{display:block}
.w-aparts[hidden]{display:none}
.w-add .w-aparts .w-gr{border-radius:0}
.w-add .w-aparts .w-gr:first-child{border-top:1px solid var(--w-sep)}
.w-parth .w-link{font-size:var(--fs-foot)}
.w-partrow .w-cdot{width:10px;height:10px;border-radius:50%;flex:none}
.w-partcatw{flex:1;justify-content:flex-start}
.w-partcatw select{text-align:start;text-align-last:start;color:var(--w-ink)}
.w-partrow .w-x{flex:none;margin-inline-end:-8px}
.w-aleft .v{font-weight:600;color:var(--w-ink)}
.w-aleft.bad,.w-aleft.bad .v{color:var(--w-bad)}
.w-add .w-gr.add svg.i{width:16px;height:16px}
/* Tags and a note */
/* The label takes its own width, so several tags line up in one row before they wrap */
.w-add #add-tagrow > .k{flex:none}
/* The whole row is the field: anywhere on it opens the category list, or is where the next tag is typed */
.w-add .w-acatrow{cursor:pointer}
.w-add #add-tagrow{cursor:text}
.w-atags{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:6px;flex:1;min-width:0}
.w-atags .w-chip{height:26px;gap:2px;font-size:var(--fs-sub);font-weight:500;padding:0 2px;padding-inline-start:7px;border:0;border-radius:6px;background:var(--w-accent-soft);color:var(--w-accent-ink)}
/* Only the × removes a tag: a small circle, with a finger-sized area around it */
.w-atags .w-chipx{position:relative;display:grid;place-items:center;width:20px;height:20px;border-radius:50%;color:inherit;opacity:.7;cursor:pointer}
.w-atags .w-chipx::after{content:"";position:absolute;inset:-6px -4px}
.w-atags .w-chipx:hover{opacity:1;background:color-mix(in srgb,currentColor 14%,transparent)}
.w-atags .w-chipx svg.x{width:11px;height:11px}
/* The field takes the room the tags leave, the same width focused or not, so nothing jumps */
.w-add #add-tag{border:0;background:none;outline:0;font:inherit;font-size:15px;color:var(--w-ink);text-align:end;width:auto;min-width:5em;padding:0;flex:1 1 5em}
.w-add #add-tag::-webkit-calendar-picker-indicator{display:none!important}
.w-add #add-note{font-size:15px}
.w-add .w-gr.add{gap:10px}
/* Checkmarks in a page's list; the category tiles on the phone's page */
.w-ack{width:18px;height:18px;color:var(--w-accent-ink);flex:none;margin-inline-start:auto}
.w-ack.chev{width:16px;height:16px;color:var(--w-ink3)}
.w-apage .w-gr .w-ico{width:28px;height:28px}
.w-apage .w-conew{background:var(--w-fill);color:var(--w-ink2)}
.w-aplus{width:18px;height:18px;color:var(--w-accent-ink);flex:none}
.w-anext{color:var(--w-ink2)}
/* Notes under the groups */
.w-add .w-dup{margin:0;padding:10px 14px;border-radius:10px;font-size:var(--fs-foot);line-height:1.4;color:var(--w-ink2)}
.w-add .w-dup b{color:var(--w-ink)}
.w-add .w-err{font-size:var(--fs-foot);color:var(--w-bad)}
.w-add #add-rep-l .w-link{margin-inline-start:4px;font-size:var(--fs-foot)}
/* The main button names what is missing; it stays clickable to take you there */
.w-afoot{margin-top:4px}
/* Delete stands apart from what it deletes */
.w-add #add-delgrp{margin-top:6px}
.w-add .w-submit{width:100%;height:44px;border-radius:999px;font-size:var(--fs-sub);font-weight:600}
.w-add .w-btn.primary[aria-disabled="true"]{background:var(--w-fill);color:var(--w-ink3);box-shadow:none;filter:none;cursor:pointer}

/* The date's calendar: round days, today ringed, the day picked filled */
.w-dcal{animation:w-dcalin 180ms var(--ease)}
@keyframes w-dcalin{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
.w-add .w-sub.w-dcal{justify-self:start;gap:6px;padding:10px 12px 12px}
.w-dcalh{display:flex;align-items:center;gap:2px}
.w-dcalh b{flex:1;font-size:var(--fs-sub);font-weight:600;color:var(--w-ink);padding-inline-start:6px}
.w-dcalh b::first-letter{text-transform:uppercase}
.w-dcalh .w-x:disabled{opacity:.35;cursor:default}
.w-dcalg{display:grid;grid-template-columns:repeat(7,34px);gap:2px}
.w-dcalg .dow{font-size:var(--fs-cap);font-weight:500;color:var(--w-ink3);text-align:center;line-height:26px}
.w-dcalg button{height:34px;border-radius:50%;font-size:var(--fs-foot);color:var(--w-ink);font-variant-numeric:tabular-nums;display:grid;place-items:center}
.w-dcalg button:hover:not(:disabled){background:var(--w-fill)}
.w-dcalg button[aria-current="date"]{color:var(--w-accent-ink);font-weight:600;box-shadow:inset 0 0 0 1.5px var(--w-accent-line)}
.w-dcalg button[aria-pressed="true"],.w-dcalg button[aria-pressed="true"]:hover{background:var(--w-accent);color:var(--w-on-accent);font-weight:600;box-shadow:none}
.w-dcalg button:disabled{color:var(--w-ink3);opacity:.5;cursor:default}
.w-dcal .w-dcalg button:focus-visible{border-radius:50%;outline-offset:1px}

.w-add .w-acal{grid-column:1 / -1;padding:8px 12px 12px;border-top:1px solid var(--w-line2);display:grid;gap:6px;justify-content:center}
.w-add .w-acal[hidden]{display:none}

/* ---------- the offline queue ---------- */
.w-queue{position:fixed;inset-inline-start:16px;bottom:calc(16px + env(safe-area-inset-bottom,0px));z-index:50;display:flex;align-items:center;gap:8px;padding:7px 8px;padding-inline-start:12px;border-radius:999px;background:var(--w-panel);border:1px solid var(--w-line);box-shadow:var(--w-shadow);font-size:var(--fs-foot);color:var(--w-ink2);font-family:var(--w-font)}
.w-queue svg.i{width:14px;height:14px;color:var(--w-ink3)}
.w-queue .w-link{padding:4px 8px;border-radius:999px;font-size:var(--fs-foot)}
.w-queue .w-link:hover{background:var(--w-accent-soft)}

/* ---------- phone: the whole screen, as a new event in Calendar; the keypad while the amount is typed ----------
   Cancel and the type sit where a navigation bar would, under the notch when Wally runs from the home screen */
@media (max-width:767px){
  .w-addwrap{place-items:end stretch;padding:0}
  .w-add.w-addp{max-width:none;width:100%;height:100dvh;max-height:none;border-radius:0;
    padding:max(8px, env(safe-area-inset-top,0px)) 16px 0;display:block;overflow-y:auto;overscroll-behavior:contain;background:var(--w-raised);animation:w-up 260ms var(--ease)}
  .w-addp .w-apage{display:flex;flex-direction:column;gap:14px;min-height:100%;padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))}
  .w-addp .w-apage[hidden]{display:none}
  .w-add.w-addp:focus{outline:0}
  .w-addp .w-ah{min-height:44px}
  .w-addp .w-alink,.w-addp .w-ah .w-atitle{font-size:var(--fs-body)}
  .w-addp .w-ah .w-atitle{font-weight:600}
  .w-addp #add-type button{padding:6px 14px;font-size:15px}
  .w-addp .w-gr{font-size:16px;min-height:44px}
  .w-addp .w-aname input,.w-addp #add-note,.w-addp #add-tag,.w-addp .w-anum,.w-addp .w-apop select,.w-addp .w-adate{font-size:16px}
  .w-addp .w-aseg button{padding:4px 11px;font-size:13px}
  .w-addp .w-glf{font-size:13px}

  /* the amount */
  .w-addp .w-pamt{display:flex;justify-content:center;align-items:baseline;gap:4px;padding:14px 0 4px;font-size:46px;font-weight:650;letter-spacing:-.04em}
  .w-addp .w-pamt input{font:inherit;letter-spacing:inherit;border:0;background:none;outline:0;padding:0;color:var(--w-ink);caret-color:var(--w-accent);text-align:center;min-width:.6em;max-width:100%;font-variant-numeric:tabular-nums}
  .w-addp .w-pamt input::placeholder{color:var(--w-ink3)}
  .w-addp .w-pamt.err input{color:var(--w-bad)}
  .w-addp .w-pcalc{text-align:center;color:var(--w-accent-ink);font-weight:600;font-size:var(--fs-sub);min-height:0;margin-top:-12px;font-variant-numeric:tabular-nums}
  .w-addp .w-pcalc:empty{display:none}
  .w-addp .w-sugg button{min-height:52px}
  .w-addp .w-sugg .w-kbd{display:none}
  .w-addp .w-acal{justify-content:stretch}
  .w-addp .w-acal .w-dcalh b{font-size:var(--fs-sub);padding-inline-start:8px}
  .w-addp .w-acal .w-x{width:44px;height:44px}
  .w-addp .w-acal .w-x svg.i{width:18px;height:18px}
  .w-addp .w-acal .w-dcalg{grid-template-columns:repeat(7,minmax(0,1fr));gap:2px 0}
  .w-addp .w-acal .w-dcalg button{width:40px;height:40px;justify-self:center;font-size:var(--fs-sub)}
  .w-addp .w-atags .w-chip{height:28px}
  /* A tap leaves no highlight behind, as on iOS */
  .w-addp button.w-gr:hover{background:none}
  .w-addp button.w-gr:active{background:var(--w-fill)}

  /* The keypad, while the amount is typed: in thumb reach, in the main button's place */
  .w-add.w-addp:not(.kp) .w-pkeys,.w-add.w-addp.kp .w-pfoot{display:none}
  .w-add.w-addp.kp [data-pstep="main"]{padding-bottom:0}
  .w-addp .w-pkeys{position:sticky;bottom:0;z-index:4;display:grid;grid-template-columns:repeat(4,1fr);margin:auto -16px 0;padding:10px 16px calc(28px + env(safe-area-inset-bottom,0px));gap:7px;
    background:var(--w-raised);animation:w-up 180ms var(--ease)}
  .w-addp .w-pkeys button{height:50px;border-radius:12px;background:var(--w-key);display:grid;place-items:center;font-size:22px;font-weight:400;color:var(--w-ink);font-variant-numeric:tabular-nums}
  .w-addp .w-pkeys button:active{background:var(--w-fill2)}
  .w-addp .w-pkeys button.op{background:var(--w-keyop)}
  .w-addp .w-pkeys button.go{background:var(--w-accent);color:var(--w-on-accent);font-size:var(--fs-body);font-weight:600}
  .w-addp .w-pkeys svg.i{width:22px;height:22px}
  .w-addp .w-pfoot{position:sticky;bottom:calc(-14px - env(safe-area-inset-bottom,0px));margin-top:auto;padding:12px 0 calc(14px + env(safe-area-inset-bottom,0px));background:linear-gradient(to bottom,transparent,var(--w-raised) 14px);z-index:4}
  .w-addp .w-pfoot .w-submit{height:52px;font-size:var(--fs-body);border-radius:14px}
  .w-queue{bottom:calc(var(--tabbar) + 12px + env(safe-area-inset-bottom,0px))}
  /* The discard question is an action sheet: a tap leaves its buttons solid */
  .w-alert > .w-dlgx:hover,.w-alg > .w-dlgok:not([disabled]):hover{opacity:1}
}
@media (max-width:767px){
  .w-addp input[type="number"]{-moz-appearance:textfield;appearance:textfield}
  .w-addp input[type="number"]::-webkit-inner-spin-button,.w-addp input[type="number"]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
}
/* Sums and totals read left to right in every language */
[dir="rtl"] .w-add .w-amount input,[dir="rtl"] .w-addp .w-pamt input,.w-add .w-anum{direction:ltr}
[dir="rtl"] .w-add .w-anum{text-align:start}
.w-add .w-calc,.w-addp .w-pcalc{direction:ltr;unicode-bidi:isolate}
.w-addp .w-pkeys{direction:ltr}
[dir="rtl"] .w-addp .w-pkeys svg.i use{transform:none}
[dir="rtl"] .w-add .w-amount .w-calc{inset-inline-end:auto;inset-inline-start:0}
