/* «دنگ» — a chadorshab on the loom. Fog ground, walnut ink, kraft paper, six dyed yarns. */

:root {
  --fog: #cbd2cc; --fog-deep: #b9c2bb; --fog-lit: #d8ded9;
  --ink: #231a15; --ink-2: #463d36; --ink-3: #5b5149;
  --kraft: #cea36b; --kraft-ink: #241911; --kraft-edge: #a9824f;
  --wood: #4a2d1a; --wool: #efe6d2;
  --madder: #a8312a; --indigo: #2e3f7a; --weld: #d6a11e; --leaf: #3f7b3b;
  --ease-out: cubic-bezier(.23, 1, .32, 1); --ease-io: cubic-bezier(.77, 0, .175, 1); --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  --pad: 16px;
  color-scheme: light;
  accent-color: var(--madder);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: #6d5a49 var(--fog); background: var(--fog); }
body { margin: 0; background: var(--fog); color: var(--ink); font: 400 16px/1.8 "Estedad", system-ui, sans-serif;
  font-feature-settings: "kern"; -webkit-font-smoothing: antialiased; caret-color: var(--madder); }
:lang(fa) { letter-spacing: 0 !important; font-synthesis: none; }
::selection { background: var(--weld); color: var(--ink); }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--fog), 0 0 0 4px var(--madder); border-radius: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
input { font: inherit; color: inherit; }
h1, h2, p, ol, li { margin: 0; padding: 0; }
ol { list-style: none; }
[hidden] { display: none !important; }

/* ── layout: phone first ───────────────────────────────────────────── */
.app { position: relative; overflow-x: clip; padding: 0 var(--pad) 0; max-width: 820px; margin: 0 auto; }
.mast { display: flex; align-items: center; gap: 12px; padding: 14px 0 10px; }
.label { flex: none; width: 66px; height: 35px; display: block; filter: drop-shadow(1px 2px 1.5px rgba(30, 18, 10, .28)); transform: rotate(-1.5deg); }
.label svg { width: 100%; height: 100%; display: block; }
.trip { flex: 1; min-width: 0; }
.trip h1 { font: 800 23px/1.2 "Mikhak", "Estedad", sans-serif; }
.trip p { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.ghost { font-size: 14px; font-weight: 600; color: var(--ink); padding: 10px 4px; min-height: 44px;
  /* a running stitch in madder thread, not a link underline */
  text-decoration: underline dashed var(--madder); text-decoration-thickness: 1.5px; text-underline-offset: .55em; }
.ghost:hover { text-decoration-style: solid; }
.newtrip { flex: none; }
.aside { display: none; }

/* ── the loom head: beam, tags, warps, reed, shed ───────────────────── */
.loom { position: relative; }
.head { position: relative; height: var(--headH, 236px); }
.beam { position: absolute; inset-inline: -6px; top: 0; height: var(--beamH, 18px); border-radius: 9px 7px 8px 10px / 8px 9px 9px 7px;
  background: url(../img/beam.webp) center / 100% 100% no-repeat, var(--wood);
  box-shadow: 0 3px 4px -1px rgba(25, 14, 6, .45), inset 0 1px 0 rgba(255, 230, 190, .18); z-index: 3; }
#warpCv { position: absolute; top: var(--beamH, 18px); left: 0; z-index: 1; }
.reed { position: absolute; height: 7px; top: calc(var(--headH) - 62px); z-index: 2; border-radius: 3px 4px 3px 4px;
  background: url(../img/wood.webp) center / cover, var(--wood); box-shadow: 0 2px 2px rgba(25, 14, 6, .35); }
.preview { position: absolute; z-index: 6; bottom: 0; pointer-events: none; opacity: 0; transition: opacity .18s var(--ease-out); }
.app.has-amount.adding .preview, .app.weaving .preview { opacity: 1; }
.app.adding .head { z-index: 45; }
.col-cap { position: absolute; bottom: 4px; left: 0; font-size: 12px; line-height: 1; color: var(--ink-2); }

.tags { position: absolute; inset: 0; z-index: 4; }
.tag { position: absolute; z-index: var(--z, 1); width: max-content; min-width: calc(var(--tagW, 100px) - 14px); max-width: calc(var(--tagW, 100px) + 8px); padding: 9px 9px 7px; text-align: start; line-height: 1.3;
  transform-origin: var(--sx, 50%) -14px; transform: rotate(var(--rot, 0deg)); transition: transform .26s var(--ease-drawer), filter .2s;
  filter: drop-shadow(1px 2px 1.5px rgba(30, 18, 10, .3)); }
.tag::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: url(../img/kraft.webp) var(--kx, 0) var(--ky, 0) / 380px auto, var(--kraft);
  clip-path: polygon(var(--c1, 14%) 0, var(--c2, 86%) 0, 100% var(--c3, 16%), var(--c5, 100%) 100%, var(--c6, 0%) 100%, 0 var(--c4, 16%)); border-radius: 0 0 3px 2px; }
.tag::after { /* the string, in the friend's own yarn */ content: ""; position: absolute; left: calc(var(--sx, 50%) - 1px); bottom: calc(100% - 6px);
  width: 2px; height: var(--str, 10px); background: var(--yarn); border-radius: 1px; box-shadow: .5px 0 0 rgba(0, 0, 0, .2); }
.tag.round::before { clip-path: none; border-radius: 13px 13px 3px 4px / 11px 11px 3px 3px; }
.tag .hole { position: absolute; left: calc(var(--sx, 50%) - 4px); top: 3px; width: 8px; height: 8px; border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, #3b2a1d 0 45%, #6a4c30 70%, transparent 72%); }
.tag .who { display: flex; align-items: center; gap: 6px; font: 600 17px/1.15 "Mikhak", "Estedad", sans-serif; color: var(--kraft-ink); margin-top: 3px; }
.tag .who i { flex: none; width: 13px; height: 13px; border-radius: 50%; background: var(--sw) center / cover; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .25); }
.tag .bal { display: block; font-size: 13px; font-weight: 700; color: var(--kraft-ink);  white-space: nowrap; margin-top: 2px; }
.tag .bal em { font-style: normal; font-weight: 500; font-size: 12px; margin-inline-start: 3px; }
.app:not(.adding) .tag { pointer-events: none; }
.app.adding .tag { cursor: pointer; }
.app.adding .tag:hover { filter: drop-shadow(1px 3px 2px rgba(30, 18, 10, .38)); }
.tag[aria-pressed="false"] { transform: rotate(calc(var(--rot) - 9deg)) translateY(-7px); }
.tag[aria-pressed="false"] .who { text-decoration: line-through; text-decoration-thickness: 2px; }

.shuttle-fly { position: absolute; z-index: 7; width: 88px; height: 20px; top: calc(var(--headH) - 36px); left: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 220, 170, .2), rgba(20, 8, 0, .35)), url(../img/wood.webp) 30% 40% / 240px auto, var(--wood);
  clip-path: polygon(0 50%, 7% 26%, 18% 11%, 36% 3%, 64% 3%, 82% 11%, 93% 26%, 100% 50%, 93% 74%, 82% 89%, 64% 97%, 36% 97%, 18% 89%, 7% 74%);
  opacity: 0; }
.shuttle-fly::after { content: ""; position: absolute; left: 33%; top: 28%; width: 34%; height: 44%; border-radius: 5px; background: var(--bobbin, var(--madder));
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .3); }

/* ── the cloth and its margin labels ───────────────────────────────── */
.cloth { position: relative; z-index: 5; }
#clothCv { position: absolute; top: 0; left: calc(var(--clothX, 84px) - 4px); filter: drop-shadow(2px 4px 3px rgba(28, 18, 10, .28)); }
.rows { position: relative; }
.row { display: block; }
.rowbtn { display: grid; grid-template-columns: minmax(0, 1fr) var(--clothW, 156px) var(--amtW, 74px); column-gap: var(--gap, 10px);
  width: 100%; height: var(--h, 48px); text-align: start; align-items: center; }
.rowbtn .t { min-width: 0; line-height: 1.32; }
.rowbtn .t b { display: block; font-size: 14px; font-weight: 650; color: var(--ink); text-wrap: balance; }
.rowbtn .t small { display: block; font-size: 12.5px; font-weight: 500; color: #3a322c; line-height: 1.45; }
.rowbtn .t .day { display: block; font-size: 12px; font-weight: 800; color: var(--ink); margin-bottom: 1px; }
.rowbtn .band { height: 100%; position: relative; }
.rowbtn .a { font-size: 14px; font-weight: 650; text-align: start; white-space: nowrap; color: var(--ink); line-height: 1.35; }
.rowbtn .a small { display: block; font-size: 12.5px; font-weight: 500; color: #3a322c; }
.rowbtn:hover .t b, .rowbtn:hover .a { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: .45em; text-decoration-color: rgba(35, 26, 21, .5); }
.rowbtn:hover .band::after { content: ""; position: absolute; inset: 0 -3px; border-radius: 2px;
  box-shadow: inset 0 0 0 2px rgba(239, 230, 210, .85), 0 0 0 1.5px rgba(35, 26, 21, .55); }
.row.on .band::after { content: ""; position: absolute; inset: -2px -5px; border-radius: 3px; z-index: 2;
  box-shadow: inset 0 0 0 2px rgba(239, 230, 210, .95), 0 0 0 2.5px var(--ink), 3px 6px 10px rgba(20, 12, 6, .38); }
.row.on .a { font-weight: 850; }
.rowbtn:active .band::after { box-shadow: inset 0 0 0 2px rgba(239, 230, 210, 1), 0 0 0 2px var(--ink); }
.empty { padding: 26px 0 30px; max-width: 34ch; }
.empty .e1 { font-size: 20px; font-weight: 800; }
.empty .e2 { font-size: 15px; color: var(--ink-2); margin: 4px 0 6px; }

.roll { display: none; }
.tail { position: relative; padding: 40px 0 14px; }
#tailCv { position: absolute; top: 0; display: block; }
.cloth.bare { min-height: 236px; }
.cloth.bare .empty { padding-top: 250px; }
.tail p { font-size: 13px; color: var(--ink-2); text-align: center; margin-top: 6px; line-height: 1.7; }

/* ── buttons that are objects ──────────────────────────────────────── */
/* the wood and the kraft are painted on ::before (clipped to the object's shape); the button declares an image ground
   so contrast tools measure the text against that surface, not the fog behind it */
.shuttle-btn, .tag-btn { background-image: linear-gradient(rgba(74, 45, 26, 0), rgba(74, 45, 26, 0)); }
.shuttle-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 34px;
  color: var(--wool); font-size: 16px; font-weight: 750; isolation: isolate; transition: transform .14s var(--ease-out); }
.shuttle-btn::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(255, 220, 170, .14), rgba(20, 8, 0, .38)), url(../img/wood.webp) 20% 30% / 300px auto, var(--wood);
  clip-path: polygon(0 50%, 7% 22%, 16% 9%, 30% 3%, 70% 3%, 84% 9%, 93% 22%, 100% 50%, 93% 78%, 84% 91%, 70% 97%, 30% 97%, 16% 91%, 7% 78%);
  filter: drop-shadow(0 2px 2px rgba(20, 10, 4, .4)); }
.shuttle-btn span { position: relative; text-shadow: 0 1px 1px rgba(10, 4, 0, .6); }
.shuttle-btn:active { transform: scale(.97); }
.tag-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 26px 0 22px;
  font-size: 16px; font-weight: 750; color: var(--kraft-ink); isolation: isolate; filter: drop-shadow(1px 2px 1.5px rgba(30, 18, 10, .32));
  transition: transform .14s var(--ease-out); }
.tag-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url(../img/kraft.webp) 40% 60% / 420px auto, var(--kraft);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 70%, 12px 50%, 0 30%); border-radius: 2px; }
.tag-btn:active { transform: scale(.97); }
.tag-btn .scissors { width: 30px; height: 18px; fill: none; stroke: var(--kraft-ink); stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }

/* ── tools: a wooden shuttle adds a row, a wooden bar with scissors settles ── */
.acts { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.acts .shuttle-btn { flex: 1.35; }
.acts .wood-btn { flex: 1; }
.wood-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px;
  color: var(--wool); font-size: 16px; font-weight: 750; isolation: isolate; transition: transform .14s var(--ease-out); }
.wood-btn::before { content: ""; position: absolute; inset: 3px 0; z-index: -1; border-radius: 10px 7px 9px 12px / 9px 11px 8px 10px;
  background: linear-gradient(180deg, rgba(255, 225, 180, .16), rgba(20, 8, 0, .36)), url(../img/beam.webp) 40% 50% / 900px 100%, var(--wood);
  box-shadow: 0 3px 4px -1px rgba(25, 14, 6, .45), inset 0 1px 0 rgba(255, 230, 190, .18); }
.wood-btn span { text-shadow: 0 1px 1px rgba(10, 4, 0, .6); }
.wood-btn .scissors { width: 28px; height: 17px; fill: none; stroke: var(--wool); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wood-btn:active { transform: scale(.97); }
.wood-btn { background-image: linear-gradient(rgba(74, 45, 26, 0), rgba(74, 45, 26, 0)); }
.app[data-mode="settle"] .acts { display: none; }
.label-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 30px;
  font-size: 16px; font-weight: 800; color: var(--ink); isolation: isolate; transform: rotate(var(--lr, -0.8deg));
  filter: drop-shadow(1px 3px 2px rgba(30, 18, 10, .32)); transition: transform .14s var(--ease-out); }
.label-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--weave, #e6dcc6) center / 220px auto, #e6dcc6;
  border-radius: 2px; box-shadow: inset 7px 0 0 -1px rgba(120, 96, 66, .35), inset -7px 0 0 -1px rgba(120, 96, 66, .35); }
.label-btn::after { content: ""; position: absolute; inset: 6px 12px; z-index: -1; border-top: 1.5px dashed rgba(154, 50, 38, .85); border-bottom: 1.5px dashed rgba(154, 50, 38, .85); }
.label-btn:active { transform: rotate(var(--lr, -0.8deg)) scale(.97); }
.label-btn { background-image: linear-gradient(rgba(230, 220, 198, 0), rgba(230, 220, 198, 0)); }
.acts .label-btn { flex: 1; }
.ink-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px; font-size: 16px; font-weight: 750;
  color: var(--wool); background: #33241b; border-radius: 6px 9px 7px 10px / 9px 6px 10px 7px; box-shadow: 0 2px 0 #1d140f, 0 4px 8px -3px rgba(25, 14, 6, .45);
  transition: transform .14s var(--ease-out), background-color .15s; }
.ink-btn:hover { background: #3f2d22; }
.ink-btn:active { transform: translateY(1px) scale(.98); box-shadow: 0 1px 0 #1d140f; }
.acts .ink-btn { flex: 1; min-height: 50px; }

/* ── dock (phone): only appears once the tools above have scrolled away ── */
.dock { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: none; align-items: center; justify-content: flex-start;
  gap: 10px; padding: 18px var(--pad) calc(12px + env(safe-area-inset-bottom));
  pointer-events: none; }
.dock > * { pointer-events: auto; }
.dock .shuttle-btn { min-width: 168px; }
.app.float-dock[data-mode="home"]:not(.adding):not(.sheet-open) .dock { display: flex; animation: dockIn .22s var(--ease-out); }
@keyframes dockIn { from { transform: translateY(18px); opacity: 0; } }

/* ── sheets (kraft) ────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(46, 52, 48, .42); }
.sheet { background: url(../img/kraft.webp) 0 0 / 760px auto, var(--kraft); color: var(--kraft-ink); }
.app:not(.adding) .sheet.add { display: none; }
.sheet.add, .trip-form, .detail-sheet { position: fixed; z-index: 50; inset-inline: 0; bottom: 0; max-height: 86vh; overflow: auto;
  padding: 10px 20px calc(18px + env(safe-area-inset-bottom)); border-radius: 14px 18px 0 0 / 12px 14px 0 0;
  box-shadow: 0 -10px 24px -8px rgba(25, 18, 12, .45); animation: sheetIn .32s var(--ease-drawer); }
@keyframes sheetIn { from { transform: translateY(40px); opacity: .4; } }
.sheet-grip { width: 46px; height: 5px; margin: 0 auto 8px; border-radius: 3px; background: rgba(36, 25, 17, .3); }
.sheet-title { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.field { display: block; border: 0; padding: 0; margin: 0 0 10px; min-width: 0; }
.lab { display: block; font-size: 13px; font-weight: 700; color: var(--kraft-ink); padding: 0; margin-bottom: 2px; }
.lab small { font-weight: 500; font-size: 12px; }
.field input { width: 100%; background: transparent; border: 0; border-bottom: 2px solid rgba(36, 25, 17, .78); border-radius: 0;
  padding: 6px 0 5px; font-size: 16px; color: var(--kraft-ink); }
.field input::placeholder { color: #5e4a33; opacity: 1; }
.amount input::placeholder { font-size: 18px; font-weight: 500; }
.field input:focus-visible { box-shadow: none; border-bottom-color: var(--madder); }
.amt-line { display: flex; align-items: baseline; gap: 8px; }
.amount input { font-size: 28px; font-weight: 800;  padding: 2px 0; line-height: 1.3; }
.unit { font-size: 15px; font-weight: 700; flex: none; }
.words { display: block; min-height: 22px; font-size: 13px; color: #3d2c1d; margin-top: 3px; line-height: 1.6; }
.quick { display: flex; flex-wrap: wrap; gap: 0 14px; margin: -4px 0 8px; }
.quick button { font-size: 14px; padding: 8px 0; min-height: 40px; text-decoration: underline dotted; text-underline-offset: .5em; text-decoration-color: rgba(36, 25, 17, .55); }
.quick button:hover { text-decoration-color: var(--kraft-ink); }
.swatches { display: flex; gap: 4px; flex-wrap: wrap; justify-content: space-between; }
.sw { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 48px; min-height: 58px; padding: 4px 2px 2px;
  font-size: 13px; font-weight: 600; color: var(--kraft-ink); position: relative; }
.sw img { width: 30px; height: 30px; display: block; transition: transform .18s var(--ease-out); }
.sw[aria-pressed="true"] { font-weight: 850; }
.sw[aria-pressed="true"] img { transform: scale(1.18) rotate(-8deg); }
.sw[aria-pressed="true"]::after { content: ""; position: absolute; bottom: 1px; left: 10%; right: 10%; height: 3px; border-radius: 2px;
  background: var(--yarn); box-shadow: 0 1px 0 rgba(0, 0, 0, .25); transform: rotate(-2deg); }
.shares { font-size: 14px; font-weight: 700; min-height: 24px; }
.hint { font-size: 13px; color: #3d2c1d; min-height: 21px; }
.err { font-size: 13px; font-weight: 700; color: #7d1d17; min-height: 4px; }
.actions { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.actions .shuttle-btn { flex: 1; }
.note { font-size: 13px; color: #3d2c1d; margin: 4px 0; }
.people li { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.people img { width: 26px; height: 26px; flex: none; }
.people input { flex: 1; }

/* expense detail */
.detail-sheet h3, .detail h3 { font-size: 19px; font-weight: 800; margin: 0; line-height: 1.4; }
.d-amt { font-size: 26px; font-weight: 800;  line-height: 1.35; margin-top: 2px; }
.d-words { font-size: 13px; color: inherit; opacity: 1; }
.d-meta { font-size: 14px; margin: 8px 0 6px; }
.d-who { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 10px; padding: 0; list-style: none; font-size: 14px; }
.d-who li { display: flex; align-items: center; gap: 6px; }
.d-who li i { width: 12px; height: 12px; border-radius: 50%; background: var(--sw) center / cover; }
.d-who li.out { text-decoration: line-through; }
.d-actions { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.d-note { font-size: 14px; margin-bottom: 4px; }
.danger { color: #7d1d17; }

/* ── settle: the cloth off the loom ────────────────────────────────── */
.app.empty-trip .col-cap { display: none; }
.app[data-mode="settle"] .loom { display: none; }
.settle-top { padding: 4px 0 4px; }
.settle-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "t t" "s b"; column-gap: 14px; align-items: start; }
.settle-top h2 { grid-area: t; }
.settle-top .sub { grid-area: s; }
.back2 { grid-area: b; margin-top: -6px; }
.settle-top h2 { font: 800 31px/1.3 "Mikhak", "Estedad", sans-serif; }
.settle-top h2 .n {  }
.settle-top .sub { font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.fringe { position: relative; margin-top: 6px; }
#settleCv { display: block; }
.bands { position: absolute; inset: 0; pointer-events: none; }
.pband { position: absolute; width: var(--bw, 140px); padding: 9px 8px 7px; line-height: 1.3; color: var(--kraft-ink); text-align: center;
  transform: rotate(var(--rot, 0deg)); transform-origin: 50% -6px; filter: drop-shadow(1px 3px 2px rgba(30, 18, 10, .32)); }
.pband::after { content: ""; position: absolute; left: calc(50% - 1px); bottom: 100%; width: 2px; height: 9px; background: var(--yarn); border-radius: 1px; }
.pband::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url(../img/kraft.webp) var(--kx, 0) var(--ky, 0) / 420px auto, var(--kraft);
  clip-path: polygon(0 var(--p1, 3%), 100% 0, var(--p2, 99%) var(--p3, 97%), var(--p4, 1%) 100%); }
.pband .who { display: block; font: 700 17px/1.15 "Mikhak", "Estedad", sans-serif; }
.pband .amt { display: block; font-size: 15px; font-weight: 850; white-space: nowrap; margin-top: 2px; }
.pband .to { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; }
.app.animating .pband { animation: bandIn .5s var(--ease-out) both; animation-delay: var(--d, 0ms); }
@keyframes bandIn { from { opacity: 0; transform: translateY(-14px) rotate(calc(var(--rot) + 7deg)); } }
.transfers { margin: 8px 0 0; }
.transfers li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; align-items: baseline; font-size: 15px; line-height: 1.6; padding: 7px 0; }
.transfers li i { width: 12px; height: 12px; border-radius: 50%; transform: translateY(1px); background: linear-gradient(90deg, var(--a) 50%, var(--b) 50%); box-shadow: inset 0 0 0 .5px rgba(0,0,0,.3); }
.transfers li b { font-weight: 800;  }
.transfers .even { font-size: 14px; color: var(--ink-2); padding-top: 2px; }
.copy-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.copied { font-size: 14px; font-weight: 700; min-width: 5em; }

/* ── tablet ────────────────────────────────────────────────────────── */
@media (min-width: 700px) {
  :root { --pad: 28px; }
  .trip h1 { font-size: 26px; }
  .settle-top h2 { font-size: 40px; }
}

/* ── desktop: an app on one screen; the cloth scrolls inside the loom ── */
@media (min-width: 1100px) {
  body { overflow: hidden; }
  .app { max-width: none; height: 100vh; padding: 0 44px; display: grid; grid-template-columns: 330px minmax(0, 1fr) 300px; column-gap: 46px; }
  .start { height: 100vh; overflow: auto; padding: 26px 0 24px; scrollbar-width: thin; }
  .mast { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "label new" "trip trip"; align-items: start; gap: 14px 10px; padding: 0; }
  .label { grid-area: label; width: 96px; height: 50px; }
  .newtrip { grid-area: new; justify-self: end; margin-top: -4px; }
  .trip { grid-area: trip; }
  .trip h1 { font-size: 42px; line-height: 1.15; }
  .trip p { font-size: 15px; margin-top: 4px; }
  .aside { display: block; font-size: 15px; line-height: 1.75; color: var(--ink-2); margin: 12px 0 18px; max-width: 30ch; }
  .aside b { color: var(--ink); font-weight: 800;  }
  .app:not(.adding) .sheet.add, .sheet.add { display: block; position: relative; inset: auto; max-height: none; overflow: visible; animation: none;
    padding: 18px 22px 20px; border-radius: 4px 7px 5px 3px; box-shadow: 2px 6px 14px -6px rgba(25, 18, 12, .45); }
  .sheet.add .sheet-grip { display: none; }
  #cancelAdd { display: none; }
  .app.editing #cancelAdd { display: inline-flex; }
  .loom { height: 100vh; display: flex; flex-direction: column; padding-top: 22px; min-width: 0; }
  .head { flex: none; }
  .loom { position: relative; }
  .cloth-scroll { flex: 1; min-height: 0; overflow: auto; scrollbar-width: none; padding-bottom: 40px;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 76px), transparent calc(100% - 24px)); mask-image: linear-gradient(to bottom, #000 calc(100% - 76px), transparent calc(100% - 24px)); }
  .roll { display: block; position: absolute; z-index: 8; bottom: 14px; left: calc(var(--clothX) - 16px); width: calc(var(--clothW) + 32px); height: 24px;
    border-radius: 12px 10px 11px 13px / 11px 12px 12px 10px; background: url(../img/beam.webp) 30% 50% / 1100px 100%, var(--wood);
    box-shadow: 0 4px 6px -2px rgba(25, 14, 6, .5), inset 0 1px 0 rgba(255, 230, 190, .2); }
  .roll::before { content: ""; position: absolute; left: 16px; right: 16px; bottom: 60%; height: 40px; border-radius: 0 0 6px 6px;
    background: linear-gradient(to bottom, rgba(20, 12, 6, 0), rgba(20, 12, 6, .42)); }
  .cutting { display: block; width: 100%; height: 16px; margin: 0 0 12px; border-radius: 1px; filter: drop-shadow(1px 2px 1.5px rgba(30, 18, 10, .3)); }
  .cloth { margin-top: 0; }
  .rowbtn .t { text-align: end; }
  .app.fit .rowbtn .t { display: flex; justify-content: flex-end; align-items: baseline; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
  .app.fit .rowbtn .t .day { display: none; }
  .app.fit .rowbtn .t b { display: block; flex: none; white-space: nowrap; text-wrap: nowrap; }
  .app.fit .rowbtn .t small { display: flex; align-items: center; gap: 5px; flex: 0 1 auto; min-width: 0; white-space: nowrap; }
  .app.fit .rowbtn .t small .pf { display: none; }
  .app.fit .rowbtn .t small::before { content: ""; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--py); box-shadow: inset 0 0 0 .5px rgba(0,0,0,.3); }
  .app.fit .tail p { display: none; }
  .app.fit .rowbtn .t b { font-size: 15px; }
  .app.fit .rowbtn .t small { font-size: 13.5px; }
  .app.fit .rowbtn .a { font-size: 15px; }
  .app.fit .tail { padding-top: 34px; }
  .app.fit .tail p { font-size: 13px; line-height: 1.6; }
  .app.fit .rowbtn .a { display: flex; gap: 8px; align-items: baseline; line-height: 1.2; font-size: 14px; }
  .app.fit .rowbtn .a small { display: inline; }
  .app.fit .roll { display: none; }
  .app.fit .cloth-scroll { -webkit-mask-image: none; mask-image: none; }
  .mini { display: none !important; }
  .rowbtn .t b { font-size: 15px; }
  .rowbtn .t small, .rowbtn .t .day { font-size: 13px; }
  .rowbtn .a { font-size: 15px; }
  .end { height: 100vh; overflow: auto; padding: 30px 0 24px; display: flex; flex-direction: column; gap: 22px; scrollbar-width: thin; position: relative; }
  .end .settle-cta { order: -1; }
  .detail { transition: margin-top .26s var(--ease-drawer); }
  .detail::before { content: ""; position: absolute; top: 34px; left: 100%; width: 34px; height: 2px; background: var(--ink); }
  .detail { padding: 18px 20px 16px; background: url(../img/kraft.webp) 60% 20% / 700px auto, var(--kraft); color: var(--kraft-ink);
    border-radius: 3px 5px 4px 6px; box-shadow: 2px 6px 14px -6px rgba(25, 18, 12, .45); transform: rotate(.6deg); }
  .detail .cap { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
  .mini { flex: 1; min-height: 160px; display: flex; flex-direction: column; gap: 8px; }
  .mini .cap { font-size: 13px; font-weight: 700; color: var(--ink-2); }
  .mini-box { flex: 1; min-height: 0; position: relative; overflow: hidden; }
  #miniCv { display: block; cursor: pointer; filter: drop-shadow(2px 4px 3px rgba(28, 18, 10, .26)); }
  #miniFrame { position: absolute; pointer-events: none; border: 2px solid var(--ink); border-radius: 3px; box-shadow: 0 0 0 2px rgba(239,230,210,.55); }
  .settle-cta p { font-size: 15px; line-height: 1.7; margin-bottom: 10px; color: var(--ink-2); }
  .settle-cta p b { color: var(--ink);  }
  .swatches { gap: 0; }
  .sw { min-width: 44px; }
  .settle-top { grid-template-areas: "t b" "s b"; }
  .settle-top .back2 { margin-top: 18px; }
  .sum-cap { margin-top: 26px; }
  .people-sum li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 5px 0; font-size: 14px; line-height: 1.5; }
  .people-sum li span small { display: block; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
  .people-sum li i { width: 12px; height: 12px; border-radius: 50%; background: var(--sw) center / cover; transform: translateY(5px); }
  .people-sum b { font-weight: 800; }
  .tag { padding: 9px 9px 7px; }
  .tag .bal { font-size: 12.5px; }
  .tag-btn.big { min-height: 60px; font-size: 18px; padding: 0 30px 0 26px; }
  .dock, .acts { display: none !important; }
  .settle { height: 100vh; overflow: auto; padding-top: 26px; grid-column: 2; grid-row: 1; scrollbar-width: thin; }
  .app[data-mode="settle"] .settle-cta { display: none; }
  .app[data-mode="settle"] .detail, .app[data-mode="settle"] .mini { display: none; }
  .end-cap { font-size: 15px; font-weight: 800; margin-bottom: 2px; }
  .settle-top h2 { font-size: 60px; line-height: 1.15; }
  .settle-top .sub { font-size: 16px; margin-top: 6px; }
  #transfersMain { display: none; }
  .settle-sum { display: grid; grid-template-columns: repeat(var(--n, 6), minmax(0, 1fr)); gap: 6px; margin: 10px 30px 0; }
  .settle-sum li { font-size: 14px; line-height: 1.5; }
  .settle-sum li b { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 800; }
  .settle-sum li b i { width: 10px; height: 10px; border-radius: 50%; background: var(--sw) center / cover; }
  .settle-sum li span { display: block; color: #3a322c; font-size: 12.5px; white-space: nowrap; }
  .pband .who { font-size: 21px; }
  .pband .amt { font-size: 19px; }
  .pband .to { font-size: 14px; }
  .transfers li { font-size: 16px; }
}
@media (max-width: 1099px) { .end { display: none; } .meta-wd { display: none; } .settle-sum { display: none; } }
@media (hover: none) { .rowbtn:hover .band::after { content: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .dock, .start .sheet, .newtrip, .scrim { display: none !important; } body { background: #fff; } }
