/* feat-money: styles for the 09-28 traveller features. Theme tokens only (var(--ink) …), never literal colours.
   Trip money (web/tripmoney.js) — every class is prefixed tm-. */

.tm{display:flex;flex-direction:column;gap:14px;padding-bottom:calc(96px + var(--safe-b,0px));min-width:0}
.tm h2.tm-h{font-size:1.02rem;margin:0 0 8px}
.tm section{min-width:0}

/* 10-02 layout: the trip switcher in the title's lede, ⋯ beside the title, a
   total card, one Add button, then tabs (Expenses · By category · Split). */
.tm-lede{margin:2px 0 0}
.tm-switch{position:relative;display:inline-flex;align-items:center;gap:6px;max-width:100%;min-height:32px;
  color:var(--ink-2);font-weight:600;border-radius:6px}
.tm-switch-t{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tm-switch-c{flex:0 0 7px;height:7px;margin:-3px 2px 0;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg)}
.tm-switch .tm-trip-sel{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;font-size:16px;border:0}
.tm-switch:focus-within{outline:2px solid var(--datum);outline-offset:2px}
.tm-switch:hover{color:var(--ink)}
.tm-head-a{align-self:center;padding-top:0}

/* total card */
.tm-sum{background:var(--panel);border:1px solid var(--line);border-radius:var(--r);padding:16px}
.tm-total-n{font-size:2.1rem;font-weight:700;line-height:1.1;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;letter-spacing:-.01em}
.tm-of{display:flex;justify-content:space-between;gap:10px;margin-top:4px;color:var(--ink-2);font-size:.92rem;font-variant-numeric:tabular-nums}
.tm-pct{color:var(--ink-3)}
.tm-sum-n{margin:8px 0 0;font-variant-numeric:tabular-nums}
.tm-disp{margin:4px 0 0;color:var(--ink-3);font-size:.9rem;font-variant-numeric:tabular-nums}
.tm-disp b{color:var(--ink-2);font-weight:600}
.tm-disp-n{margin:6px 2px 0}

/* Your currency · Show totals in: two compact pickers under the total */
.tm-ccybar{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;margin-top:-4px}
.tm-ccybar-n{grid-column:1 / -1;margin:0}
.tm-left{font-weight:600;color:var(--ok)}
.tm-left.is-over{color:var(--magenta)}
.tm-bar-t{height:8px;margin-top:10px;border-radius:4px;background:var(--panel-2);overflow:hidden}
.tm-bar-t i,.tm-cat-bar i{display:block;height:100%;background:var(--datum);border-radius:inherit}
.tm-bar-t i.is-near{background:var(--warn)}
.tm-bar-t i.is-over,.tm-cat-bar i.is-over{background:var(--magenta)}
.tm-card{background:var(--panel);border:1px solid var(--line);border-radius:var(--r);padding:14px}
.tm-cats{display:flex;flex-direction:column;gap:11px}
.tm-cat,.tm-day{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 10px;align-items:baseline;font-size:.9rem}
.tm-cat-n{display:flex;gap:7px;align-items:center;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tm-cat-v{font-variant-numeric:tabular-nums;color:var(--ink-2);text-align:right}
.tm-cat-d{display:block;font-size:.78rem;color:var(--ink-3)}
.tm-cat-bar{grid-column:1 / -1;height:5px;border-radius:3px;background:var(--panel-2);overflow:hidden}
.tm-ico{display:inline-grid;place-items:center;width:1.4em;flex:0 0 auto}
.tm-more{margin-top:10px}
.tm-more summary{cursor:pointer;min-height:44px;display:flex;align-items:center;color:var(--ink-2);font-size:.92rem}
.tm-days{display:flex;flex-direction:column;gap:10px}
.tm .ui-tabs{margin:2px 0 0;background:var(--ground)}
.tm .ui-head{margin:16px 0 8px}
.tm .ui-head:first-child{margin-top:2px}

/* fapiao reminder */
.tm-fp{border:1px solid color-mix(in srgb,var(--warn) 55%,var(--line));background:color-mix(in srgb,var(--warn) 10%,var(--panel));
  border-radius:var(--r);padding:12px 14px}
.tm-fp strong{display:block;line-height:1.35}
.tm-fp-say{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;margin-top:10px}
.tm-fp-zh{font-size:2rem;font-weight:700;letter-spacing:.06em;line-height:1.1}
.tm-fp-py{color:var(--ink-2)}
.tm-fp-co{display:flex;flex-direction:column;gap:4px;margin-top:6px;padding:10px;border-radius:8px;background:var(--ground);
  font-size:1.05rem;overflow-wrap:anywhere}
.tm .btn.tm-fp-miss{margin-top:10px;min-height:44px;white-space:normal;text-align:left}

/* Add expense + Receipt */
.tm-acts{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(0,1fr);gap:10px}
.tm-acts .btn{min-height:50px;font-size:1rem;font-weight:600;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;gap:8px}
.tm-cam svg{width:20px;height:20px;fill:currentColor;flex:0 0 auto}

/* Expenses tab: one filter line, then the list by day */
.tm-fbar{display:flex;align-items:center;gap:10px;min-height:44px;margin:0 2px}
.tm-fbar-t{flex:1;min-width:0;color:var(--ink-3);font-size:.86rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tm .btn.tm-fbar-b{min-height:36px;display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:18px;font-size:.86rem}
.tm .btn.tm-fbar-b.is-on{border-color:var(--datum);color:var(--datum)}
.tm .tm-fbar-x{min-height:36px;font-size:.86rem}
.tm-fs-h{margin:4px 0 8px;font-size:.76rem;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--ink-3)}
.tm-fs .seg{margin:0 0 18px}
.tm-fs .seg-b{min-height:42px}
.tm-fs-cats{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:6px;margin-bottom:12px}
.tm-fs-cat{display:flex;align-items:center;gap:8px;min-height:44px;padding:8px 10px;border:1px solid var(--line);border-radius:10px;
  background:var(--panel);color:var(--ink);font:inherit;font-size:.9rem;text-align:left;cursor:pointer;min-width:0}
.tm-fs-cat.is-on{border-color:var(--datum);background:color-mix(in srgb,var(--datum) 14%,var(--panel));font-weight:600}
.tm-fs-l{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tm-fs-clear{width:100%;min-height:44px;margin-top:12px}
.tm-list{display:flex;flex-direction:column}
.tm-dayh{display:flex;justify-content:space-between;gap:10px;padding:12px 4px 6px;font-size:.78rem;font-weight:700;
  color:var(--ink-3);text-transform:uppercase;letter-spacing:.06em;font-variant-numeric:tabular-nums}
.tm-group{display:flex;flex-direction:column;background:var(--panel);border:1px solid var(--line);border-radius:var(--r);overflow:hidden}
.tm-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:12px;align-items:center;width:100%;min-height:60px;
  padding:10px 14px 10px 12px;border:0;border-top:1px solid var(--line);background:none;color:var(--ink);text-align:left;cursor:pointer;
  font:inherit}
.tm-row:first-child{border-top:0}
.tm-row:hover,.tm-row:focus-visible{background:var(--panel-2)}
.tm-row-ico{display:grid;place-items:center;width:38px;height:38px;border-radius:10px;font-size:1.15rem;
  background:color-mix(in srgb,var(--ink) 8%,transparent)}
.tm-row-b{display:flex;flex-direction:column;min-width:0}
.tm-row-t{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tm-row-m{margin:2px 0 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tm-row-p{margin-top:0;color:var(--ink-3);font-size:.78rem}
.tm .ui-head .tm-link{text-decoration:none;font-weight:600;min-height:36px}
.tm-card .tm-xfer-n+.tm-xfer{border-top:0}
.tm-row-a{display:flex;flex-direction:column;align-items:flex-end;text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.tm-row-a b{font-weight:600}
.tm-row-o{margin-top:2px;font-size:.78rem;color:var(--ink-3)}
.tm-tags{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
.tm-tag{font-size:.7rem;padding:1px 7px;border-radius:9px;border:1px solid var(--line);color:var(--ink-2);white-space:nowrap}
.tm-tag.is-ok{border-color:color-mix(in srgb,var(--ok) 50%,var(--line));color:var(--ok)}
.tm-tag.is-warn{border-color:var(--warn);background:var(--warn);color:var(--on-accent);font-weight:600}
.tm-more-btn{margin-top:10px;min-height:44px}
.tm .ui-empty .btn{min-height:44px}

/* Split tab */
.tm-people{display:flex;flex-direction:column;gap:10px}
.tm-person{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 10px;align-items:baseline}
.tm-pn{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tm-person .fine{grid-column:1 / -1;margin:1px 0 0;grid-row:2}
.tm-bal{grid-column:2;grid-row:1;font-size:.9rem;font-variant-numeric:tabular-nums}
.tm-bal.is-pos{color:var(--ok)} .tm-bal.is-neg{color:var(--orange)}
.tm-xfer-n{margin:0 0 4px}
.tm-xfer{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 0;border-top:1px solid var(--line)}
.tm-xfer-t{min-width:0;overflow-wrap:anywhere}
.tm-xfer .btn{min-height:44px;flex:0 0 auto}
.tm-even{color:var(--ok);margin:10px 0 0}

/* dialogs */
.tm-dlg{max-height:92dvh;overflow:auto;padding:0 16px calc(18px + var(--safe-b,0px))}
.tm-top{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:8px;
  margin:0 -16px 10px;padding:6px 8px 6px 16px;background:var(--panel);border-bottom:1px solid var(--line)}
.tm-top h2{margin:0;font-size:1.1rem}
.tm-x{width:44px;height:44px;border:0;border-radius:50%;background:var(--panel-2);color:var(--ink);font-size:24px;line-height:1;cursor:pointer;flex:0 0 auto}
.tm-form{display:flex;flex-direction:column;gap:12px}
/* One look for every box in trip money — inputs and selects alike: same
   height, padding, radius and border; selects get their own chevron. */
.tm-form input,.tm-form select,.tm-form textarea,.tm-ccybar select{
  box-sizing:border-box;min-height:44px;padding:8px 10px;border-radius:8px;border:1px solid var(--line);background:var(--ground);color:var(--ink);
  font-size:16px;line-height:1.25;min-width:0;width:100%;font-family:inherit;margin:0}
.tm-form select,.tm-ccybar select{appearance:none;-webkit-appearance:none;height:44px;padding-right:30px;cursor:pointer;
  text-overflow:ellipsis;white-space:nowrap;overflow:hidden;
  background-image:linear-gradient(45deg,transparent 50%,var(--ink-3) 50%),linear-gradient(135deg,var(--ink-3) 50%,transparent 50%);
  background-position:calc(100% - 16px) 50%,calc(100% - 11px) 50%;background-size:5px 5px;background-repeat:no-repeat}
.tm-form select:hover,.tm-ccybar select:hover{border-color:color-mix(in srgb,var(--ink-3) 60%,var(--line))}
.tm-form select option,.tm-ccybar select option{background:var(--panel);color:var(--ink)}
.tm-form select optgroup,.tm-ccybar select optgroup{background:var(--panel);color:var(--ink-3);font-style:normal;font-weight:600}
.tm-f{display:flex;flex-direction:column;gap:5px;min-width:0}
.tm label,.tm-dlg label{display:flex;margin:0;font-size:inherit;text-transform:none;letter-spacing:normal;color:var(--ink)}
.tm-fl{font-size:11px;text-transform:uppercase;letter-spacing:.1em;color:var(--ink-3)}
.tm-f.tm-read input,.tm-f.tm-read select{border-color:var(--datum);box-shadow:0 0 0 1px var(--datum)}
.tm-r2{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;align-items:end}
.tm-r2.tm-amt-row{grid-template-columns:minmax(0,1fr) 7.5em}
.tm-amt input{font-size:18px;font-variant-numeric:tabular-nums}
.tm-rate{margin:-4px 0 0;min-height:1.2em;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.tm-home-n{margin:-4px 0 0}
.tm-home-n:empty{display:none}
.tm-hint{margin:-4px 0 0}
.tm-link{align-self:flex-start;background:none;border:0;color:var(--datum);padding:0;min-height:32px;font:inherit;font-size:.85rem;cursor:pointer;text-decoration:underline}
.tm-status{margin:0;min-height:0}
.tm-status:empty{display:none}
.tm-form.is-reading .tm-status{color:var(--datum)}
.tm-pic img{display:block;max-width:100%;max-height:220px;margin:0 auto;border-radius:8px;border:1px solid var(--line);object-fit:contain}
.tm-pic:empty{display:none}
.tm-check{display:flex;align-items:center;gap:10px;min-height:44px;cursor:pointer}
.tm-check input{width:22px;height:22px;min-height:0;flex:0 0 auto;accent-color:var(--datum)}
.tm-split{display:flex;flex-direction:column;gap:4px;margin-top:-4px}
.tm-paid-row .seg{display:flex;align-self:stretch;height:44px;box-sizing:border-box;margin:0}
.tm-paid-row .seg button{flex:1 1 0;min-width:0;min-height:0;padding:6px 6px;font-size:.85rem;font-family:inherit;border-radius:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tm-sp{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;align-items:center;min-height:44px}
.tm-sp-l{display:flex;align-items:center;gap:10px;min-width:0;min-height:44px;cursor:pointer}
.tm-sp-l input{width:22px;height:22px;min-height:0;flex:0 0 auto;accent-color:var(--datum)}
.tm-sp-n{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tm-form .tm-sp input[type=text]{width:4.5em}
.tm-share{margin:0;font-variant-numeric:tabular-nums;min-width:4.5em;text-align:right}
.tm-fpf{display:flex;flex-direction:column;gap:6px;padding:10px;border-radius:8px;border:1px dashed var(--line)}
.tm-item{display:flex;justify-content:space-between;gap:10px;font-size:.85rem;padding:3px 0;border-top:1px solid var(--line)}
.tm-dlg-acts .btn{min-height:44px}
.tm-ppl{display:flex;flex-direction:column;gap:6px}
.tm-ppl-r{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:6px;align-items:center}
.tm-ppl-x{width:44px;min-width:44px;min-height:44px;padding:0}
.tm-ppl-x.is-none{visibility:hidden}
.tm-f > .btn.sm{align-self:flex-start;min-height:40px;margin-top:2px}
/* Budget per category: label | amount, one category a row */
.tm-cb{display:grid;grid-template-columns:minmax(0,1fr) 8em;gap:6px 12px;align-items:center;margin:2px 0 4px}
.tm-dlg label.tm-cb-r{display:contents}
.tm-cb-l{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ink-2);font-size:.92rem}
.tm-form .tm-cb input{text-align:right;font-variant-numeric:tabular-nums}
.tm-cam-dlg video{display:block;width:100%;max-height:60dvh;background:var(--ground);border-radius:8px;object-fit:contain}
.tm-cam-acts .btn{min-height:48px}

/* the expense report, on screen */
.tm-rep-dlg{max-width:min(860px,calc(100vw - 16px))}
.tm-report{font-size:.88rem}
.tm-report h1{font-size:1.15rem;margin:10px 0 8px}
.tm-report h2{font-size:1rem;margin:16px 0 6px}
.tm-rep-meta{display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px 12px;margin:0 0 10px}
.tm-rep-meta dt{color:var(--ink-3)} .tm-rep-meta dd{margin:0;overflow-wrap:anywhere}
.tm-report table{width:100%;border-collapse:collapse}
.tm-rep-t{display:block;overflow-x:auto}
.tm-report th,.tm-report td{padding:5px 6px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}
.tm-report th{font-size:.75rem;color:var(--ink-3);white-space:nowrap}
.tm-report td.num{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.tm-report tfoot td{font-weight:700;border-bottom:0}
.tm-report td.c-date{white-space:nowrap}
.tm-report td.c-rate small{display:block;color:var(--ink-3);font-size:.75em}
.tm-rep-note{color:var(--ink-3);font-size:.8rem}
/* On a phone screen the report's table reads as a list of cards; print keeps the table. */
@media screen and (max-width:600px){
  .tm-rep-t,.tm-rep-t tbody,.tm-rep-t tfoot{display:block}
  .tm-rep-t thead{display:none}
  .tm-rep-t tr{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 12px;padding:8px 0;border-bottom:1px solid var(--line)}
  .tm-rep-t td{border:0;padding:0}
  .tm-rep-t td.c-merch{grid-area:1/1;font-weight:600}
  .tm-rep-t td.c-home{grid-area:1/2;font-weight:600}
  .tm-rep-t td.c-date{grid-area:2/1;color:var(--ink-3)}
  .tm-rep-t td.c-paid{grid-area:2/2;color:var(--ink-3)}
  .tm-rep-t td.c-cat{grid-area:3/1;color:var(--ink-3)}
  .tm-rep-t td.c-rate{grid-area:3/2;color:var(--ink-3)}
  .tm-rep-t td.c-rate small{display:inline;margin-left:4px}
  .tm-rep-t td.c-rc{grid-area:4/1/5/3;color:var(--ink-3)}
  .tm-rep-t td.c-rc:empty{display:none}
  .tm-rep-t tfoot tr{border-bottom:0}
}
.tm-rep-pics{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.tm-rep-pics figure{margin:0}
.tm-rep-pics img{display:block;width:100%;border:1px solid var(--line);border-radius:6px}
.tm-rep-pics figcaption{font-size:.75rem;color:var(--ink-3);margin-top:3px}

#tm-print{display:none}

@media (max-width:380px){
  .tm-total-n{font-size:1.8rem}
}
@media (max-width:359px){
  .tm-r2,.tm-ccybar{grid-template-columns:minmax(0,1fr)}
  .tm-cb{grid-template-columns:minmax(0,1fr) 6.5em}
}
@media (max-width:300px){
  .tm-r2.tm-amt-row{grid-template-columns:minmax(0,1fr)}
}

/* Print: only the report, dark on paper whatever the look — system colours
   (Canvas/CanvasText), not literals. The app's chrome and the map stay off the page. */
@media print{
  html.tm-printing body > *:not(#tm-print){display:none!important}
  html.tm-printing, html.tm-printing body{color-scheme:light;background:Canvas!important;color:CanvasText!important;height:auto!important;overflow:visible!important}
  html.tm-printing #tm-print{display:block!important;position:static!important}
  #tm-print .tm-report{font:10.5pt/1.4 ui-sans-serif,system-ui,sans-serif;color:CanvasText}
  #tm-print .tm-report h1{font-size:15pt}
  #tm-print .tm-rep-brand{display:flex;align-items:center;gap:6pt;margin:0 0 4pt;font-weight:700;color:GrayText}
  #tm-print .tm-rep-logo{width:16pt;height:16pt;border:0;border-radius:3pt}
  #tm-print .tm-rep-t{display:table}
  #tm-print th,#tm-print td{border-bottom:.5pt solid GrayText;color:CanvasText}
  #tm-print th,#tm-print .tm-rep-meta dt,#tm-print .tm-rep-note,#tm-print figcaption{color:GrayText}
  #tm-print tr{break-inside:avoid}
  #tm-print .tm-rep-break{break-before:page}
  #tm-print .tm-rep-pics{grid-template-columns:1fr 1fr}
  #tm-print .tm-rep-pics figure{break-inside:avoid}
  #tm-print .tm-rep-pics img{max-height:120mm;object-fit:contain;border-color:GrayText}
  @page{margin:14mm}
}
