@font-face { font-family: Archivo; font-style: normal; font-weight: 400 800; font-stretch: 62% 125%; font-display: swap; src: url(/fonts/archivo-latin.woff2) format('woff2'); }
@font-face { font-family: 'Red Hat Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/redhatmono-latin.woff2) format('woff2'); }

:root {
  --paper: #F7F8F4;
  --field: #FCFDFA;
  --tint: #E1EADF;
  --ink: #121814;
  --ink-2: #434D46;
  --mute: #56625A;
  --line: #A7B2A9;
  --cobalt: #1C4DB0;
  --cobalt-press: #163E8F;
  --violet: #5B2DA3;
  --alert: #A3261B;
  --accent: #1C4DB0;          /* cobalto como texto/linha: total, foco, cursor */
  --on-cobalt: #FFFFFF;
  --cobalt-active: #10306F;
  --cobalt-disabled: #5F7BB8;
  --on-violet: #F7F8F4;
  --on-alert: #FFFFFF;
  --ink-press: #000000;
  --placeholder: #69746C;
  --focus-bg: #FFFFFF;
  --shimmer: #EEF3EC;
  --stub-hover: rgba(247, 248, 244, .55);
  --shadow: rgba(18, 24, 20, .5);
  --guilloche: url("/guilloche.svg");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.4 5.8 10 11 4' fill='none' stroke='%23F7F8F4' stroke-width='1.8'/%3E%3C/svg%3E");
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

/* Tema escuro: o mesmo carnê impresso em papel verde-noite. theme.js põe data-theme antes da primeira pintura. */
:root[data-theme="dark"] {
  --paper: #121714;
  --field: #171D19;
  --tint: #1C241F;
  --ink: #E6EBE4;
  --ink-2: #C3CBC4;
  --mute: #9AA59D;
  --line: #46524A;
  --cobalt: #2F5FCC;
  --cobalt-press: #2552B5;
  --violet: #B59BEF;
  --alert: #D9786C;
  --accent: #79A2FF;
  --on-cobalt: #FFFFFF;
  --cobalt-active: #1E4699;
  --cobalt-disabled: #2B3F6B;
  --on-violet: #121714;
  --on-alert: #121714;
  --ink-press: #FFFFFF;
  --placeholder: #86918A;
  --focus-bg: #1B231E;
  --shimmer: #253029;
  --stub-hover: rgba(18, 23, 20, .5);
  --shadow: rgba(0, 0, 0, .6);
  --guilloche: url("/guilloche-dark.svg");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.4 5.8 10 11 4' fill='none' stroke='%23121714' stroke-width='1.8'/%3E%3C/svg%3E");
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line) var(--paper); }
body {
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: Archivo, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  caret-color: var(--accent);
}
::selection { background: var(--cobalt); color: var(--on-cobalt); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex: none; }
[hidden] { display: none !important; }

.lab {
  font-stretch: 75%;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--mute);
}

/* botões */
.ghost, .sm {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--ink); background: var(--field);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.ghost:hover:not(:disabled), .sm:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.ghost:active:not(:disabled), .sm:active:not(:disabled) { background: var(--ink-press); color: var(--paper); }
.ghost:disabled, .sm:disabled { border-color: var(--line); color: var(--mute); }
.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.quiet {
  height: 40px; padding: 0 6px; white-space: nowrap; font-size: 14px; color: var(--mute);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line);
}
.quiet:hover { color: var(--ink); text-decoration-color: var(--ink); }
.quiet.theme { display: inline-flex; align-items: center; gap: 6px; }
.brand-actions { display: flex; align-items: center; gap: 2px; }
.gear { width: 36px; height: 40px; display: grid; place-items: center; color: var(--mute); transition: color .15s, background-color .15s; }
.gear:hover { color: var(--ink); background: var(--stub-hover); }
.gear[aria-current="page"] { color: var(--ink); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.quiet.danger, .sm.danger { color: var(--alert); border-color: var(--alert); }
.sm.danger:hover:not(:disabled) { background: var(--alert); color: var(--on-alert); }
.pri {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 132px; padding: 0 28px;
  background: var(--cobalt); color: var(--on-cobalt);
  font-size: 16px; font-weight: 600; white-space: nowrap;
  transition: background-color .15s;
}
.pri:hover:not(:disabled) { background: var(--cobalt-press); }
.pri:active:not(:disabled) { background: var(--cobalt-active); }
.pri:disabled { background: var(--cobalt-disabled); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* campos estilo boleto */
.box { display: flex; border: 1px solid var(--line); background: var(--field); }
.box label, .box .cell {
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  min-height: 60px; padding: 8px 14px; border-left: 1px solid var(--line); min-width: 0;
}
.box > :first-child { border-left: 0; }
.box label:focus-within { background: var(--focus-bg); box-shadow: inset 0 -2px 0 var(--accent); }
.box input { width: 100%; border: 0; background: transparent; font-size: 16px; outline: 0; }
.box input[readonly] { text-overflow: ellipsis; }
.box .cell strong { font-size: 16px; font-weight: 600; }
.box.stack { flex-direction: column; }
.box.stack label { border-left: 0; border-top: 1px solid var(--line); }
.box.stack label:first-child { border-top: 0; }
.box.wrap { flex-wrap: wrap; }
.box.wrap > * { flex: 1 1 0; }
.box.wrap > .full { flex: 1 1 100%; border-left: 0; border-bottom: 1px solid var(--line); }
.box.wrap > .full + * { border-left: 0; }
.box input::placeholder, .mi input::placeholder { color: var(--placeholder); }
.grow { flex: 1 1 0; }
.grow-2 { flex: 1.6 1 0; }
.qty { flex: 0 0 84px; }
.price { flex: 0 0 150px; }

.msg:empty { min-height: 0; margin-top: 0; }
.msg { min-height: 20px; margin-top: 8px; font-size: 13px; color: var(--mute); }
.msg.err { color: var(--alert); font-weight: 500; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--tint) var(--guilloche) 0 0 / 240px 48px repeat; }
.slip { width: min(440px, 100%); background: var(--paper); border: 1px solid var(--line); box-shadow: 0 10px 30px -18px var(--shadow); }
.slip-head { display: flex; justify-content: space-between; align-items: baseline; padding: 24px 24px 20px; border-bottom: 1px dashed var(--line); }
.slip form { padding: 24px; }
.slip .box { margin-bottom: 4px; }
.slip .pri { width: 100%; height: 52px; margin-top: 16px; }
.slip .intro { margin-bottom: 16px; color: var(--mute); }
.slip .switch { margin-top: 12px; text-align: center; }

/* app */
.app { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: 100dvh; }

.rail {
  display: flex; flex-direction: column;
  border-right: 1px dashed var(--line);
  background: var(--tint) var(--guilloche) 0 0 / 240px 48px repeat;
}
.brand { display: flex; justify-content: space-between; align-items: center; padding: 28px 28px 26px; }
.wordmark { font-weight: 800; font-size: 36px; letter-spacing: -.025em; line-height: 1; }
.stubs { list-style: none; border-bottom: 1px dashed var(--line); }
.stub {
  display: block; width: 100%; text-align: left;
  padding: 20px 28px 22px; border-top: 1px dashed var(--line);
  transition: background-color .15s;
}
.stub:hover { background: var(--stub-hover); }
.stub b { display: block; font-size: 19px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.stub-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 10px; }
.stub em { font-style: normal; font-size: 21px; font-weight: 600; white-space: nowrap; }
.stub[aria-current="true"] {
  position: relative; z-index: 1; margin-right: -1px; width: calc(100% + 1px);
  background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 1px 0 var(--line);
}
.stub .by { display: block; margin-top: 4px; font-size: 12.5px; color: var(--mute); }
/* compartilhadas comigo vêm depois das minhas, separadas por picote duplo; o "de maria · só ver" do canhoto diz o resto */
.stubs li.split { border-top: 1px dashed var(--line); padding-top: 16px; }
.new-list { padding: 22px 28px; }
.new-list .box label { min-height: 56px; }
.new-list .row { display: flex; gap: 8px; margin-top: 10px; }

.doc { padding: 28px 48px 56px 44px; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 40px; margin-bottom: 18px; }
.top p { font-size: 14px; color: var(--mute); }
.top .actions { display: flex; align-items: center; gap: 4px; }
.top .actions .ghost { margin-left: 12px; }

.fields { display: grid; grid-template-columns: minmax(180px, 1.3fr) 96px repeat(2, minmax(150px, 1fr)) minmax(300px, 1.9fr); border: 1px solid var(--line); background: var(--field); }
.f { min-height: 108px; padding: 10px 14px 14px; border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-width: 0; }
.f:first-child { border-left: 0; }
.f strong { font-size: 26px; font-weight: 600; line-height: 1.1; overflow-wrap: anywhere; }
.f.name strong { font-size: 24px; }
.f.name input { width: 100%; border: 0; border-bottom: 2px solid var(--accent); background: transparent; font-size: 22px; font-weight: 600; outline: 0; }
.f.total { align-items: flex-end; text-align: right; }
.f.total .lab { align-self: flex-start; }
.f.total strong { font-size: 56px; font-weight: 700; line-height: 1; letter-spacing: -.02em; color: var(--accent); white-space: nowrap; }
.f.total small { font-size: 26px; font-weight: 600; margin-right: 8px; letter-spacing: 0; }
.bar { display: flex; height: 6px; margin-top: 10px; background: var(--tint); box-shadow: inset 0 0 0 1px var(--line); }
.bar i { width: 0; background: var(--violet); transition: width .3s var(--ease); }

.add { margin-top: 30px; }
.add .box .pri, .settings .box .pri { flex: none; }

/* lista de pessoas / convites: caixa de boleto com uma linha por registro */
.ledger { border: 1px solid var(--line); background: var(--field); }
.ledger + .ledger { margin-top: 16px; }
.ledger-h { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.ledger ul { list-style: none; }
.ledger li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; min-height: 60px; padding: 10px 14px; border-top: 1px solid var(--line); }
.ledger li:first-child { border-top: 0; }
.ledger .who { min-width: 0; }
.ledger li > b, .ledger .who b { font-weight: 600; overflow-wrap: anywhere; }
.ledger .acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-left: auto; }
.ledger .note { flex: 1 1 100%; font-size: 13px; }
.ledger .temp { flex: 1 1 100%; padding-bottom: 4px; }
.ledger li.ledger-empty { justify-content: flex-start; gap: 8px; color: var(--mute); }
.ledger-empty.err { color: var(--alert); font-weight: 500; }
.share .row, .set .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.row .msg { margin-top: 0; }

/* escolha de acesso: três opções coladas, a marcada impressa em tinta */
.seg { display: inline-flex; margin-left: auto; border: 1px solid var(--line); background: var(--field); }
.seg label {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 12px; border-left: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--mute); white-space: nowrap; cursor: pointer;
  transition: background-color .15s, color .15s;
}
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.seg label:hover { color: var(--ink); }
.seg label:has(input:checked) { background: var(--ink); color: var(--paper); }
.seg label:has(input:focus-visible) { z-index: 1; outline: 2px solid var(--accent); outline-offset: 2px; }

.share { margin-top: 20px; }

/* configurações */
.settings { max-width: 760px; }
.set-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; min-height: 40px; }
.set-top h1 { font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.set { margin-top: 28px; padding-top: 24px; border-top: 1px dashed var(--line); }
.set h2 { font-size: 20px; font-weight: 600; margin-bottom: 12px; }
.set .hint { max-width: 65ch; margin: -4px 0 4px; color: var(--mute); }
.set #people-msg:not(:empty) { margin-bottom: 4px; }
.set #people { margin-top: 16px; }
.invite-new { margin-bottom: 20px; }

.items { list-style: none; margin-top: 28px; border-top: 1px solid var(--ink); }
.it {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) 200px 132px 132px 44px;
  align-items: center; column-gap: 12px; min-height: 66px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.n { font-stretch: 75%; font-size: 13px; font-weight: 600; letter-spacing: .06em; color: var(--mute); }
.d b { display: block; font-size: 15px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.d b a { color: inherit; text-decoration: none; }
.d b a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.meta { display: block; margin-top: 3px; font-size: 12.5px; color: var(--mute); }
.meta svg { vertical-align: -2px; margin-right: 4px; }
.meta .warn { color: var(--ink); font-weight: 500; }
.q { text-align: right; font-size: 14px; color: var(--mute); white-space: nowrap; }
.s { text-align: right; font-size: 17px; font-weight: 600; white-space: nowrap; }
.s.none { color: var(--mute); font-weight: 500; }
.busy .s { color: var(--mute); font-weight: 500; }

.c {
  justify-self: end; display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px 0 10px; border: 1px solid var(--line); background: var(--field);
  font-stretch: 75%; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mute);
  cursor: pointer; transition: border-color .15s, color .15s;
}
.c:hover { border-color: var(--ink); color: var(--ink); }
.c:has(input:checked) { border-color: var(--violet); color: var(--violet); }
.c input {
  appearance: none; width: 18px; height: 18px; flex: none;
  border: 1.5px solid var(--ink); background: var(--field);
  display: grid; place-items: center; cursor: pointer;
  transition: background-color .12s;
}
.c input:hover { background: var(--tint); }
.c input:checked { border-color: var(--violet); background: var(--violet) var(--check) center / 14px no-repeat; }
/* só ver: a marcação continua visível, mas não responde */
.c:has(input:disabled), .c input:disabled { cursor: default; }
.c:has(input:disabled:not(:checked)):hover { border-color: var(--line); color: var(--mute); }
.c input:disabled:not(:checked) { border-color: var(--line); background: var(--field); }

.edit { width: 40px; height: 40px; display: grid; place-items: center; justify-self: end; color: var(--mute); }
.edit:hover, .edit[aria-expanded="true"] { color: var(--ink); background: var(--tint); }

.paid .q, .paid .s { color: var(--ink-2); }
.aut {
  display: inline-block; margin-top: 6px;
  font: 500 13px/1.2 'Red Hat Mono', ui-monospace, monospace; letter-spacing: .02em;
  color: var(--violet); opacity: .92; transform: rotate(-1.2deg); transform-origin: left center; white-space: nowrap;
}
.aut.print { animation: print .24s var(--ease) both; }
@keyframes print { from { clip-path: inset(0 100% 0 0); opacity: .4; } to { clip-path: inset(0 0 0 0); opacity: .92; } }

.manual { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.mi { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 8px; border: 1px solid var(--line); background: var(--field); font-size: 14px; }
.mi:focus-within { border-color: var(--accent); }
.mi input { width: 70px; border: 0; background: transparent; font-size: 14px; outline: 0; }
.q-m { display: none; }

.editor { grid-column: 2 / -1; padding: 6px 0 8px; }
.editor .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.editor .row .spacer { flex: 1; }

.pending .d b { color: var(--mute); }

.empty { padding: 36px 0 12px; max-width: 60ch; }
.empty h2 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.empty p { color: var(--mute); }

.foot { display: grid; grid-template-columns: 46px minmax(0, 1fr) 200px 132px 132px 44px; column-gap: 12px; align-items: center; min-height: 70px; }
.foot p { grid-column: 1 / 3; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.foot div { grid-column: 3 / 5; justify-self: end; display: flex; gap: 14px; align-items: baseline; }
.foot strong { font-size: 22px; font-weight: 700; }

.start { max-width: 520px; padding-top: 12vh; }
.start h1 { font-size: 32px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 8px; }
.start p { color: var(--mute); margin-bottom: 24px; }

.skeleton { display: block; height: 14px; background: linear-gradient(90deg, var(--tint), var(--shimmer), var(--tint)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* tablet / celular */
/* Balão de instalação (só celular): um canhoto destacado, preso ao rodapé da tela pelo picote. */
.install {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px 12px; align-items: start;
  padding: 14px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--field); border-top: 1px dashed var(--line);
  animation: rise .2s var(--ease) both;
}
.install img { display: block; width: 44px; height: 44px; border: 1px solid var(--line); }
.install-text p { font-size: 14px; line-height: 1.4; color: var(--mute); }
.install-text b { color: var(--ink); font-weight: 600; }
.install-text .install-title { margin-bottom: 2px; font-size: 16px; font-weight: 700; color: var(--ink); }
.install-text .share { vertical-align: -2px; margin: 0 3px 0 1px; color: var(--ink); }
.install-actions {
  grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 8px;
  padding-top: 10px; border-top: 1px dashed var(--line);
}
.install .pri { min-width: 0; height: 44px; padding: 0 22px; font-size: 15px; }
.install .quiet { height: 44px; }
/* Safari do iPhone: balão solto, com o bico apontando para a barra de baixo, onde ficam Compartilhar e o menu */
.install.tail {
  left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding: 14px 14px 12px;
  border: 1px solid var(--line); box-shadow: 0 10px 30px -18px var(--shadow);
}
.install.tail::after {
  content: ''; position: absolute; left: 50%; bottom: -8px; width: 14px; height: 14px;
  background: var(--field); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: translateX(-50%) rotate(45deg);
}
body.has-install .doc { padding-bottom: calc(var(--install-h, 220px) + 24px); } /* --install-h vem do install.js */
body:has(#app[hidden]) .install { display: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } }
@media (min-width: 901px) { .install { display: none; } }

@media (max-width: 1180px) {
  .app { grid-template-columns: 240px minmax(0, 1fr); }
  .brand, .stub, .new-list { padding-left: 22px; padding-right: 22px; }
  .t-name { display: none; } /* trilho de 240px: o tema fica só no ícone (o nome segue no aria-label) */
  .top { flex-wrap: wrap; }
  .fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .f strong { font-size: 22px; white-space: nowrap; }
  .f.total { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); flex-direction: row; align-items: flex-end; justify-content: space-between; min-height: 92px; }
  .doc { padding: 24px 28px 48px; }
  .it, .foot { grid-template-columns: minmax(0, 1fr) 140px 108px 120px 40px; }
  .it .n { display: none; }
  .foot p { grid-column: 1 / 2; }
  .foot div { grid-column: 2 / 4; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); align-content: start; } /* o trilho fica da altura do conteúdo */
  .rail { min-width: 0; border-right: 0; border-bottom: 1px dashed var(--line); }
  .brand { padding: 14px 16px 10px; }
  .t-name { display: inline; }
  .wordmark { font-size: 28px; }
  .stubs { display: flex; overflow-x: auto; border-bottom: 0; scroll-snap-type: x proximity; scrollbar-width: none; }
  .stubs li { flex: 0 0 auto; scroll-snap-align: start; }
  .stub { width: auto; min-width: 180px; max-width: 240px; padding: 12px 16px 14px; border-top: 0; border-left: 1px dashed var(--line); }
  .stubs li:first-child .stub { border-left: 0; }
  .stub b { font-size: 16px; }
  .stub em { font-size: 17px; }
  .stub-row { margin-top: 6px; }
  .stub[aria-current="true"] { margin: 0; width: auto; border-top: 0; box-shadow: none; }
  .new-list { padding: 10px 16px 14px; }
  .new-list .ghost { height: 36px; }
  .stubs li.split { border-top: 0; padding: 0 0 0 12px; border-left: 1px dashed var(--line); }

  /* o documento primeiro: Valor do documento e Falta; ações depois */
  .doc { display: flex; flex-direction: column; padding: 14px 16px 40px; }
  .doc > .fields { order: 1; }
  .doc > .bar { order: 2; }
  .doc > .top { order: 3; margin: 12px 0 0; flex-wrap: wrap; gap: 4px; }
  .doc > .share { order: 3; margin-top: 12px; }
  .doc > #doc-msg { order: 4; }
  .doc > .add { order: 5; }
  .doc > .items { order: 6; }
  .doc > .foot { order: 7; }
  .top .actions { width: 100%; flex-wrap: wrap; }
  .top .actions .ghost { margin-left: auto; }
  .fields { display: flex; flex-direction: column; }
  .f { min-height: 0; padding: 8px 12px 10px; border-left: 0; }
  .f.name, .f:nth-child(2), .f:nth-child(3) { display: none; }
  .fields.renaming .f.name { display: flex; border-bottom: 1px solid var(--line); }
  .f.total { order: -1; min-height: 84px; border-top: 0; flex-direction: column; align-items: flex-end; }
  .f.total strong { font-size: 40px; }
  .f.total small { font-size: 20px; margin-right: 6px; }
  .f:nth-child(4) { flex-direction: row; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
  .f:nth-child(4) strong { font-size: 19px; }

  .box { flex-wrap: wrap; }
  .box label, .box .cell { flex: 1 1 100%; border-left: 0; border-top: 1px solid var(--line); min-height: 56px; }
  .box > :first-child { border-top: 0; }
  .box.wrap > .full { border-bottom: 0; }
  .box label.qty { flex: 0 0 96px; border-right: 1px solid var(--line); }
  .box label.price { flex: 1 1 0; }
  .add .box .pri, .settings .box .pri, .start .box .pri { flex: 1 1 0; min-height: 56px; border-top: 1px solid var(--cobalt); }
  .seg { flex: 1 1 100%; margin-left: 0; }
  .seg label { flex: 1 1 0; height: 40px; padding: 0 6px; }
  .set-top h1 { font-size: 26px; }
  .set-top .quiet { margin-left: -6px; } /* quebrado sob o título, o texto alinha na margem de 16px */
  .add { margin-top: 16px; }
  .items { margin-top: 20px; }

  /* linha de item: descrição + subtotal; procedência (com qtd) + editar */
  .it {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "d s s" "d c e";
    row-gap: 2px; column-gap: 10px; padding: 12px 0;
  }
  .it .n, .it > .q { display: none; }
  .q-m { display: block; margin-top: 3px; font-size: 12.5px; color: var(--mute); }
  .long, .aut-amt { display: none; }
  .aut { white-space: normal; } /* em 320px a autenticação quebra antes de PAGO em vez de passar por baixo da caixa Comprado */
  .it .c { grid-area: c; align-self: end; height: 36px; padding: 0 10px 0 8px; }
  .it .d { grid-area: d; }
  .it .s { grid-area: s; align-self: start; }
  .it .edit { grid-area: e; align-self: end; }
  .it .manual { grid-column: 1 / -1; grid-row: 3; justify-content: flex-start; margin-top: 8px; }
  .pending .q { display: none; }
  .editor { grid-column: 1 / -1; }
  .editor .row .spacer { display: none; }
  .foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }
  .foot div { margin-left: auto; }
  .start { padding-top: 6vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
