/* app.css — mobile-first, aparência de app nativo iOS (cores do sistema,
 * títulos grandes, listas agrupadas, tab bar translúcida, sheets).
 * A versão desktop é só uma adaptação no final do arquivo. */
:root {
  --bg: #f2f2f7; --card: #ffffff; --card2: #f7f7fa; --label: #000; --sec: #6c6c70; --ter: #aeaeb2;
  --sep: rgba(60, 60, 67, .18); --fill: rgba(120, 120, 128, .12);
  --accent: #1a9e4b; --accent-ink: #fff; --green: #28a745; --red: #ff3b30; --orange: #ff9500; --grey: #b8b8bf;
  --blur: rgba(249, 249, 249, .86); --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --tabh: 66px; --r: 14px; --gut: 16px;
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #000; --card: #1c1c1e; --card2: #2c2c2e; --label: #fff; --sec: #98989f; --ter: #636366; --sep: rgba(84, 84, 88, .55); --fill: rgba(120, 120, 128, .24); --accent: #30d158; --green: #30d158; --red: #ff453a; --orange: #ff9f0a; --grey: #636366; --blur: rgba(29, 29, 31, .86); --shadow: none; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] { color-scheme: dark; --bg: #000; --card: #1c1c1e; --card2: #2c2c2e; --label: #fff; --sec: #98989f; --ter: #636366; --sep: rgba(84, 84, 88, .55); --fill: rgba(120, 120, 128, .24); --accent: #30d158; --green: #30d158; --red: #ff453a; --orange: #ff9f0a; --grey: #636366; --blur: rgba(29, 29, 31, .86); --shadow: none; }
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.sheet-open, html.sheet-open body { overflow: hidden; }
body { margin: 0; background: var(--bg); color: var(--label); font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Roboto, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
a { color: var(--accent); text-decoration: none; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
[hidden] { display: none !important; }
.muted { color: var(--sec); } .center { text-align: center; } .grow { flex: 1; }
.ico { flex: none; }

#app { min-height: 100vh; min-height: 100dvh; }
main#view { padding: calc(var(--sat) + 4px) calc(var(--gut) + var(--sal)) calc(var(--tabh) + var(--sab) + 28px) calc(var(--gut) + var(--sar)); outline: 0; }
.page { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

/* título grande */
.large-title { padding: 10px 0 0; }
.lt-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.large-title h1 { font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.lt-sub { color: var(--sec); font-size: 15px; margin-top: 2px; }
.lt-actions { display: flex; gap: 4px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--accent); }
.icon-btn:active { background: var(--fill); }
.icon-btn.plain { color: var(--sec); }

/* tab bar inferior */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; padding: 6px calc(4px + var(--sar)) calc(4px + var(--sab)) calc(4px + var(--sal)); background: var(--blur); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--sep); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 48px; padding-top: 2px; color: var(--sec); font-size: 10.5px; font-weight: 500; }
.tab.active { color: var(--accent); }
.tab-ico { position: relative; display: inline-flex; }
.badge { position: absolute; top: -5px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.tab-label { letter-spacing: -.01em; }

/* cartões / listas */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.card.pad, .pad { padding: 16px; }
.card.list { padding: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head b { font-size: 17px; }
.big { font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.section-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.link { color: var(--accent); font-size: 17px; background: none; min-height: 44px; display: inline-flex; align-items: center; }
.hint { font-size: 13px; color: var(--sec); padding: 0 4px; }
.empty { text-align: center; padding: 32px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty h2 { font-size: 20px; } .empty p { max-width: 38ch; font-size: 15px; }
.empty-ico { width: 64px; height: 64px; border-radius: 50%; background: var(--fill); display: flex; align-items: center; justify-content: center; color: var(--accent); }
.empty-sm { display: flex; align-items: center; gap: 10px; color: var(--sec); }

/* botões */
.btn { min-height: 50px; padding: 0 20px; border-radius: 14px; font-weight: 600; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.secondary { background: var(--fill); color: var(--accent); }
.btn.danger { background: rgba(255, 59, 48, .12); color: var(--red); }
.btn.text { color: var(--accent); background: none; padding: 0 10px; }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 16px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:active { opacity: .7; } .btn:disabled { opacity: .4; pointer-events: none; }
.danger-text { color: var(--red) !important; }
.row-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.row-actions.center { justify-content: center; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 18px; background: var(--fill); color: var(--accent); font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.chip.on { background: var(--accent); color: #fff; }

/* segmented control */
.segmented { display: flex; background: var(--fill); border-radius: 10px; padding: 2px; gap: 2px; width: 100%; }
.segmented.small { width: auto; flex: none; }
.seg { flex: 1; min-height: 40px; padding: 0 10px; border-radius: 8px; font-size: 14.5px; font-weight: 500; white-space: nowrap; color: var(--label); }
.segmented.small .seg { min-height: 34px; padding: 0 12px; }
.seg.active { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); font-weight: 600; }
:root[data-theme="dark"] .seg.active { background: #636366; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .seg.active { background: #636366; } }
.scroll-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gut)); padding: 0 var(--gut); }
.scroll-tabs::-webkit-scrollbar { display: none; }
.stab { flex: none; min-height: 40px; padding: 0 16px; border-radius: 20px; background: var(--fill); font-weight: 500; font-size: 15px; }
.stab.active { background: var(--accent); color: #fff; }

/* início */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: var(--card); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; box-shadow: var(--shadow); }
.tile span { font-size: 13px; color: var(--sec); font-weight: 500; }
.tile b { font-size: 18px; letter-spacing: -.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tile small { color: var(--sec); font-size: 12px; }
.tile.accent { background: var(--accent); } .tile.accent span, .tile.accent small { color: rgba(255, 255, 255, .8); } .tile.accent b { color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.kpi { background: var(--card); border-radius: var(--r); padding: 14px; min-width: 0; box-shadow: var(--shadow); }
.kpi.wide { grid-column: 1 / -1; }
.kpis .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
.kpi-label { font-size: 13px; color: var(--sec); font-weight: 500; }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-sub { font-size: 13px; color: var(--sec); margin-top: 2px; }
.banner { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--r); padding: 12px 14px; font-size: 15px; position: relative; }
.banner.info { background: rgba(26, 158, 75, .12); color: var(--label); } .banner.info .ico { color: var(--accent); }
.banner.warn { background: rgba(255, 149, 0, .16); } .banner.warn .ico { color: var(--orange); }
.banner-x { margin-left: auto; width: 32px; height: 32px; color: var(--sec); flex: none; }
.link-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; }
.lc-text { flex: 1; display: flex; flex-direction: column; } .lc-text small { color: var(--sec); font-size: 13px; line-height: 1.3; }

/* linhas de viagem */
.trow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px; border-bottom: .5px solid var(--sep); cursor: pointer; }
.trow:last-child { border-bottom: 0; } .trow:active { background: var(--fill); }
.sdot { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; color: #fff; }
.sdot.done { background: var(--green); } .sdot.cancelled { background: var(--red); } .sdot.pending { background: var(--orange); }
.sdot.big { width: 34px; height: 34px; }
.t-main { flex: 1; min-width: 0; }
.t-client { font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.t-sub { font-size: 14px; color: var(--sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-val { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.t-val small { font-size: 11px; font-weight: 500; color: var(--sec); } .t-val.struck { text-decoration: line-through; color: var(--sec); } .t-val.muted { color: var(--sec); }
.tag { font-size: 11px; font-weight: 600; color: var(--orange); background: rgba(255, 149, 0, .15); border-radius: 6px; padding: 1px 6px; }
.map-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--fill); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.map-btn.off { background: none; width: 8px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 10px; padding: 2px 9px; }
.pill.done { background: rgba(40, 167, 69, .16); color: var(--green); } .pill.cancelled { background: rgba(255, 59, 48, .14); color: var(--red); } .pill.pending { background: rgba(255, 149, 0, .18); color: var(--orange); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 6px 0; color: var(--sec); font-size: 14px; text-transform: uppercase; letter-spacing: .02em; }
.day-head b { font-weight: 600; } .day-head span { font-variant-numeric: tabular-nums; font-weight: 600; }

/* busca / período */
.searchbar { display: flex; align-items: center; gap: 8px; background: var(--fill); border-radius: 12px; padding: 0 12px; min-height: 44px; color: var(--sec); }
.searchbar input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 17px; color: var(--label); min-height: 44px; -webkit-appearance: none; }
.searchbar.slim { min-height: 40px; } .searchbar.slim input { min-height: 40px; }
.filter-block { background: var(--card); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); }
.period { display: flex; flex-direction: column; gap: 10px; }
.p-nav { display: flex; align-items: center; justify-content: space-between; }
.p-label { text-align: center; display: flex; flex-direction: column; } .p-label b { font-size: 18px; } .p-label small { color: var(--sec); font-size: 13px; }
.p-jump { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.date-chip { position: relative; cursor: pointer; } .date-chip input { background: none; border: 0; color: var(--accent); font-size: 15px; width: 150px; min-height: 34px; }
.p-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.p-range label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--sec); }
input[type="date"], input[type="time"] { min-height: 44px; -webkit-appearance: none; appearance: none; background: var(--fill); border: 0; border-radius: 10px; padding: 0 10px; font-size: 17px; color: var(--label); }
.mini-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: var(--card); border-radius: var(--r); padding: 12px; }
.mini-summary div { display: flex; flex-direction: column; min-width: 0; } .mini-summary small { color: var(--sec); font-size: 12px; } .mini-summary b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* grupos de formulário */
.group { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.group.pad-sm { padding: 12px; } .group.inner { background: none; box-shadow: none; margin-top: 8px; }
.frow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; min-height: 52px; border-bottom: .5px solid var(--sep); }
.frow:last-child { border-bottom: 0; }
.frow label { flex: none; }
.frow input:not([type="checkbox"]), .frow select { flex: 1; min-width: 0; text-align: right; background: none; border: 0; outline: 0; font-size: 17px; min-height: 48px; color: var(--accent); -webkit-appearance: none; appearance: none; }
.frow input[type="date"], .frow input[type="time"] { background: none; padding: 0; text-align: right; justify-content: flex-end; }
.fstack { padding: 10px 16px; border-bottom: .5px solid var(--sep); display: flex; flex-direction: column; gap: 2px; } .fstack:last-child { border-bottom: 0; }
.fstack label, .field-label { font-size: 13px; color: var(--sec); margin-bottom: 6px; }
.fstack input, .fstack textarea { background: none; border: 0; outline: 0; font-size: 17px; min-height: 36px; width: 100%; resize: none; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: .5px solid var(--sep); font-size: 16px; }
.kv:last-child { border-bottom: 0; } .kv span { color: var(--sec); flex: none; } .kv b { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-errors { color: var(--red); font-size: 14px; padding: 0 4px; }
.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--fill); position: relative; transition: background .2s; flex: none; border: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch:checked { background: var(--green); } .switch:checked::after { transform: translateX(20px); }
.list-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 16px; text-align: left; border-bottom: .5px solid var(--sep); color: var(--label); } .list-btn:last-child { border-bottom: 0; } .list-btn:active { background: var(--fill); }
.list-btn .ico:last-child { color: var(--ter); } .lb-text { flex: 1; display: flex; flex-direction: column; } .lb-text small { color: var(--sec); font-size: 13px; }
.lb-ico { width: 36px; height: 36px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; } .lb-ico.green { background: var(--green); } .lb-ico.red { background: var(--red); } .lb-ico.blue { background: var(--accent); }

/* importação */
.big-ta { width: 100%; min-height: 180px; border: 0; outline: 0; resize: vertical; background: var(--card2); border-radius: 12px; padding: 12px; font-size: 16px; line-height: 1.4; }
.fmt { margin-top: 12px; font-size: 14px; } .fmt summary { color: var(--accent); min-height: 36px; display: flex; align-items: center; cursor: pointer; } .fmt pre { background: var(--card2); border-radius: 10px; padding: 10px; margin: 6px 0; }
.sum-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sum-chip { font-size: 13px; font-weight: 600; border-radius: 12px; padding: 4px 10px; background: var(--fill); }
.sum-chip.good { background: rgba(40, 167, 69, .16); color: var(--green); } .sum-chip.warn { background: rgba(255, 149, 0, .18); color: var(--orange); } .sum-chip.bad { background: rgba(255, 59, 48, .14); color: var(--red); } .sum-chip.dup { background: rgba(175, 82, 222, .16); color: #af52de; }
.pcards { display: flex; flex-direction: column; gap: 10px; }
.pcard { display: flex; gap: 12px; background: var(--card); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); border: 1.5px solid transparent; }
.pcard.off { opacity: .55; } .pcard.has-error { border-color: var(--red); }
.check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ter); flex: none; display: inline-flex; align-items: center; justify-content: center; color: #fff; margin-top: 2px; }
.check.on { background: var(--accent); border-color: var(--accent); }
.pc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.pc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .pc-client { font-size: 17px; flex: 1; min-width: 0; overflow-wrap: anywhere; } .pc-val { font-weight: 600; font-variant-numeric: tabular-nums; } .pc-val.muted { color: var(--sec); }
.pc-sub { color: var(--sec); font-size: 14px; } .pc-loc { display: flex; align-items: center; gap: 4px; color: var(--sec); font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pc-edit { display: flex; align-items: center; gap: 4px; color: var(--accent); font-size: 13px; margin-top: 2px; }
.issue { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; line-height: 1.3; } .issue .ico { margin-top: 1px; }
.issue.error { color: var(--red); } .issue.warn { color: var(--orange); } .issue.info { color: var(--sec); }
.dupbox { border-radius: 10px; padding: 8px 10px; font-size: 13px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.dupbox.exact { background: rgba(175, 82, 222, .14); color: #af52de; } .dupbox.possible { background: rgba(255, 149, 0, .14); color: var(--orange); } .dupbox .ico { vertical-align: -2px; margin-right: 4px; }
.savebar { position: sticky; bottom: calc(var(--tabh) + var(--sab) + 10px); display: flex; gap: 8px; padding: 10px; border-radius: 18px; background: var(--blur); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: 0 4px 24px rgba(0, 0, 0, .18); z-index: 5; margin-top: 4px; }
.success { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; } .ok-ico { width: 56px; height: 56px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; }
.hist-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; min-height: 60px; border-bottom: .5px solid var(--sep); } .hist-row:last-child { border-bottom: 0; } .hr-main { display: flex; flex-direction: column; } .hr-main small { color: var(--sec); font-size: 13px; }

/* sheets */
.sheet-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0); display: flex; align-items: flex-end; justify-content: center; transition: background .25s; }
.sheet-backdrop.open { background: rgba(0, 0, 0, .4); }
.sheet { width: 100%; max-width: 640px; max-height: 92dvh; max-height: 92vh; display: flex; flex-direction: column; background: var(--bg); border-radius: 14px 14px 0 0; transform: translateY(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); padding-bottom: var(--sab); box-shadow: 0 -2px 30px rgba(0, 0, 0, .25); }
@supports (height: 1dvh) { .sheet { max-height: 92dvh; } }
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet-grab { width: 36px; height: 5px; border-radius: 3px; background: var(--ter); margin: 8px auto 2px; flex: none; opacity: .6; padding: 0; position: relative; }
.sheet-grab::before { content: ""; position: absolute; inset: -12px -40px; }
.sheet-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 8px; min-height: 48px; flex: none; }
.sheet-title { font-weight: 600; font-size: 17px; text-align: center; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-nav-side.right { text-align: right; } .nav-btn { min-height: 44px; padding: 0 10px; color: var(--accent); font-size: 17px; } .nav-btn.primary { font-weight: 600; } .nav-btn:disabled { opacity: .4; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 16px 20px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
.sheet.action-sheet { background: transparent; box-shadow: none; max-width: 480px; padding: 0 8px calc(8px + var(--sab)); } .action-sheet .sheet-grab { display: none; } .action-sheet .sheet-body { padding: 0; gap: 8px; overflow: visible; }
.action-wrap { display: flex; flex-direction: column; gap: 8px; }
.action-group { background: var(--card); border-radius: 14px; overflow: hidden; } :root[data-theme="dark"] .action-group { background: #2c2c2e; }
.action-head { padding: 14px 16px; text-align: center; border-bottom: .5px solid var(--sep); } .action-title { font-weight: 600; font-size: 14px; color: var(--sec); } .action-msg { font-size: 13px; color: var(--sec); margin-top: 4px; }
.action-btn { width: 100%; min-height: 56px; font-size: 20px; color: var(--accent); } .action-btn.destructive { color: var(--red); } .action-btn.bold { font-weight: 600; } .action-btn:active { background: var(--fill); }
.file-ready { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 6px 0 10px; }
.file-icon { width: 64px; height: 64px; border-radius: 16px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; } .file-name { font-weight: 600; overflow-wrap: anywhere; }
.detail-head { display: flex; align-items: center; gap: 12px; } .detail-head .sdot { width: 44px; height: 44px; } .detail-client { font-size: 22px; font-weight: 700; }
.note-card { background: rgba(255, 149, 0, .14); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; font-size: 14px; }
.raw { background: var(--card); border-radius: var(--r); padding: 4px 14px; } .raw summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); cursor: pointer; } .raw pre { padding: 4px 0 12px; color: var(--sec); }
#toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--tabh) + var(--sab) + 16px); z-index: 200; display: flex; justify-content: center; pointer-events: none; }
.toast { background: rgba(40, 40, 42, .95); color: #fff; padding: 12px 18px; border-radius: 22px; font-size: 15px; max-width: calc(100vw - 32px); opacity: 0; transform: translateY(10px); transition: all .25s; box-shadow: 0 4px 20px rgba(0, 0, 0, .3); text-align: center; } .toast.show { opacity: 1; transform: none; } .toast.warn { background: #c93400; }

/* gráficos */
.chart { display: flex; flex-direction: column; gap: 6px; }
.chart-tip { font-size: 14px; font-weight: 600; min-height: 20px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chart-area { position: relative; touch-action: pan-y; padding-left: 52px; }
.chart-grid { position: absolute; top: 0; bottom: 0; left: 52px; right: 0; border-top: .5px dashed var(--sep); pointer-events: none; } .chart-max { position: absolute; top: -7px; left: -52px; width: 48px; text-align: right; font-size: 10px; line-height: 1; color: var(--sec); white-space: nowrap; }
.bars { display: flex; align-items: flex-end; gap: 3px; border-bottom: .5px solid var(--sep); position: relative; user-select: none; -webkit-user-select: none; }
.bar-col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; min-width: 0; gap: 2px; }
.bar-col .bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .45; min-height: 0; transition: opacity .15s; } .bar-col.sel .bar { opacity: 1; } .bar.zero { min-height: 2px; background: var(--ter); opacity: .5; }
.bars.grouped .bar-col .bar { opacity: 1; width: 50%; }
.bar-labels { display: flex; gap: 3px; padding-left: 52px; font-size: 10.5px; color: var(--sec); text-align: center; } .bar-labels span { overflow: visible; white-space: nowrap; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--sec); } .legend-item { display: inline-flex; align-items: center; gap: 5px; } .legend-item i, .stack-leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(70px, 28%) 1fr auto; align-items: center; gap: 10px; min-height: 32px; } .hbar-row.tap { cursor: pointer; }
.hbar-label { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; flex-direction: column; } .hbar-label small { color: var(--sec); font-size: 11.5px; }
.hbar-track { background: var(--fill); border-radius: 6px; height: 14px; overflow: hidden; } .hbar-fill { height: 100%; background: var(--grey); border-radius: 6px; } .hbar-fill.hl { background: var(--accent); }
.hbar-val { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 56px; text-align: right; }
.stack { display: flex; height: 18px; border-radius: 9px; overflow: hidden; gap: 2px; } .stack-part { min-width: 0; transition: width .3s; }
.stack-legend { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; } .stack-leg { display: flex; gap: 8px; align-items: flex-start; } .stack-leg i { margin-top: 5px; } .stack-name { font-size: 13px; color: var(--sec); } .stack-val { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.linechart { width: 100%; height: 90px; display: block; overflow: visible; } .line-area { fill: var(--accent); opacity: .14; } .line-stroke { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.delta { font-size: 13px; font-weight: 600; } .delta.up { color: var(--green); } .delta.down { color: var(--red); } .delta.flat { color: var(--sec); font-weight: 500; }
.cmp-list { margin-top: 10px; display: flex; flex-direction: column; } .cmp-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 9px 0; border-top: .5px solid var(--sep); font-size: 15px; } .cmp-row.cur span:first-child { font-weight: 600; } .cmp-row b { font-variant-numeric: tabular-nums; } .cmp-row .delta { min-width: 70px; text-align: right; }
.card .cmp-row:first-child { border-top: 0; }
.crow { display: flex; align-items: center; gap: 10px; padding: 12px 14px; min-height: 60px; border-bottom: .5px solid var(--sep); cursor: pointer; } .crow:last-child { border-bottom: 0; } .crow:active { background: var(--fill); }
.c-main { flex: 1; min-width: 0; display: flex; flex-direction: column; } .c-main small { color: var(--sec); font-size: 13px; line-height: 1.3; } .c-val { font-weight: 700; font-variant-numeric: tabular-nums; } .crow .ico { color: var(--ter); }
.kpis.two { margin-bottom: 4px; }

/* tabela só em telas largas */
.wide-only { display: none; } .table { width: 100%; border-collapse: collapse; font-size: 15px; } .table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--sec); padding: 10px 12px; border-bottom: .5px solid var(--sep); } .table td { padding: 8px 12px; border-bottom: .5px solid var(--sep); } .table td.num { text-align: right; font-variant-numeric: tabular-nums; } .table td.actions { white-space: nowrap; }

/* ---- adaptação secundária: tablets e desktop ---- */
@media (min-width: 820px) {
  .page { max-width: 900px; }
  .kpis { grid-template-columns: repeat(3, 1fr); } .kpis.two { grid-template-columns: repeat(2, 1fr); }
  .kpis .kpi:last-child:nth-child(odd) { grid-column: auto; } .kpi.wide { grid-column: span 3; }
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: min(560px, 100%); bottom: 12px; border-radius: 28px; border: .5px solid var(--sep); }
  main#view { padding-bottom: 100px; }
  #toast-host { bottom: 84px; }
  .sheet { border-radius: 14px; margin-bottom: 4vh; }
  .wide-only { display: block; margin-top: 8px; } .mobile-only { display: none !important; }
}
@media (hover: hover) { .trow:hover, .crow:hover, .list-btn:hover { background: var(--fill); } .btn:hover { opacity: .85; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.status-tap { all: unset; display: inline-flex; padding: 6px; margin: -6px; cursor: pointer; -webkit-tap-highlight-color: transparent; } .status-tap:active { transform: scale(.88); transition: transform .12s; }
.toast-act { all: unset; margin-left: 12px; font-weight: 600; color: var(--accent); cursor: pointer; }

.kpi.tap { appearance: none; border: 0; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .12s; } .kpi.tap:active { transform: scale(.97); }

/* ---- Barra inferior "glass" (vidro) ---- */
.tabbar { left: 12px; right: 12px; bottom: calc(8px + var(--sab)); padding: 6px; gap: 2px; border-radius: 30px; border: .5px solid rgba(255, 255, 255, .6);
  background: linear-gradient(160deg, rgba(255, 255, 255, .70), rgba(255, 255, 255, .34));
  -webkit-backdrop-filter: blur(28px) saturate(200%); backdrop-filter: blur(28px) saturate(200%);
  box-shadow: 0 10px 32px rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -1px 0 rgba(255, 255, 255, .25); }
:root[data-theme="dark"] .tabbar { border-color: rgba(255, 255, 255, .16); background: linear-gradient(160deg, rgba(70, 70, 74, .62), rgba(28, 28, 30, .42)); box-shadow: 0 10px 32px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .18); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .tabbar { border-color: rgba(255, 255, 255, .16); background: linear-gradient(160deg, rgba(70, 70, 74, .62), rgba(28, 28, 30, .42)); box-shadow: 0 10px 32px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .18); } }
.tab { position: relative; border-radius: 24px; transition: background .3s ease, color .3s ease, transform .15s ease; -webkit-tap-highlight-color: transparent; }
.tab:active { transform: scale(.93); }
.tab.active { background: rgba(26, 158, 75, .16); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }
.tab .tab-ico { transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.tab.active .tab-ico { transform: translateY(-1px) scale(1.14); }
@media (min-width: 700px) { .tabbar { left: 50%; right: auto; bottom: 12px; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
main#view.enter { animation: viewIn .32s cubic-bezier(.2, .8, .2, 1); }

/* Resumo da tela Viagens: 2 colunas no telemóvel, sem texto sobreposto */
.mini-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
.mini-summary div { overflow: hidden; }
.mini-summary small, .mini-summary b { display: block; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
.mini-summary b { font-size: 17px; }
@media (min-width: 700px) { .mini-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---- Tipografia equilibrada ---- */
.large-title h1 { font-size: 28px; } .lt-sub { font-size: 14px; }
.big { font-size: 26px; } .section-head h2 { font-size: 19px; } .empty h2 { font-size: 18px; }
.tile b { font-size: 16px; } .kpi-value { font-size: 20px; } .p-label b { font-size: 16px; }
.detail-client { font-size: 19px; } .stack-val { font-size: 16px; } .mini-summary b { font-size: 15px; }
.t-val small, .tag { font-size: 11.5px; } .chart-grid, .bar-labels { font-size: 11px; } .hbar-label { font-size: 13.5px; }
.kpi-label, .tile span, .mini-summary small, .p-label small { font-size: 12.5px; }
.tile-delta { display: block; font-size: 11.5px; color: var(--sec); line-height: 1.3; margin-top: 2px; }
.tile .delta, .tile-delta .delta { font-size: 12px; }
.tile b { white-space: nowrap; }
.tile { min-width: 0; }

/* ---- Liquid glass na barra inferior ---- */
.tabbar { background: linear-gradient(150deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, .12));
  -webkit-backdrop-filter: blur(22px) saturate(220%) brightness(1.08); backdrop-filter: blur(22px) saturate(220%) brightness(1.08);
  border: 1px solid rgba(255, 255, 255, .6);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .2), inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .35), inset 0 0 22px rgba(255, 255, 255, .28); overflow: hidden; }
.tabbar::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0) 62%, rgba(255, 255, 255, .28) 100%); }
:root[data-theme="dark"] .tabbar { background: linear-gradient(150deg, rgba(120, 120, 128, .34), rgba(40, 40, 44, .2)); border-color: rgba(255, 255, 255, .22); box-shadow: 0 14px 36px rgba(0, 0, 0, .55), inset 0 1.5px 0 rgba(255, 255, 255, .28), inset 0 0 22px rgba(255, 255, 255, .06); }
:root[data-theme="dark"] .tabbar::before { background: linear-gradient(115deg, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0) 62%, rgba(255, 255, 255, .1) 100%); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .tabbar { background: linear-gradient(150deg, rgba(120, 120, 128, .34), rgba(40, 40, 44, .2)); border-color: rgba(255, 255, 255, .22); box-shadow: 0 14px 36px rgba(0, 0, 0, .55), inset 0 1.5px 0 rgba(255, 255, 255, .28), inset 0 0 22px rgba(255, 255, 255, .06); }
  :root[data-theme="auto"] .tabbar::before { background: linear-gradient(115deg, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0) 62%, rgba(255, 255, 255, .1) 100%); }
}
.tab { z-index: 1; }
.tab.active { background: none; box-shadow: none; color: var(--accent); }
.tab-liquid { position: absolute; top: 5px; bottom: 5px; left: 0; width: 0; border-radius: 26px; z-index: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(120% 140% at 25% 10%, rgba(255, 255, 255, .9), rgba(255, 255, 255, .3) 55%, rgba(26, 158, 75, .18)), rgba(26, 158, 75, .12);
  border: 1px solid rgba(255, 255, 255, .8); -webkit-backdrop-filter: blur(8px) saturate(180%); backdrop-filter: blur(8px) saturate(180%);
  box-shadow: 0 4px 14px rgba(26, 158, 75, .25), inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -2px 6px rgba(26, 158, 75, .15);
  transition: transform .5s cubic-bezier(.34, 1.35, .4, 1), width .5s cubic-bezier(.34, 1.35, .4, 1), opacity .2s; }
:root[data-theme="dark"] .tab-liquid { background: radial-gradient(120% 140% at 25% 10%, rgba(255, 255, 255, .35), rgba(255, 255, 255, .08) 55%, rgba(48, 209, 88, .22)), rgba(48, 209, 88, .12); border-color: rgba(255, 255, 255, .3); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .tab-liquid { background: radial-gradient(120% 140% at 25% 10%, rgba(255, 255, 255, .35), rgba(255, 255, 255, .08) 55%, rgba(48, 209, 88, .22)), rgba(48, 209, 88, .12); border-color: rgba(255, 255, 255, .3); } }

/* ---- Repasses ---- */
.check-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; font-size: 15px; cursor: pointer; }
.check-row input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.tag.tr { color: var(--accent); background: rgba(26, 158, 75, .14); }
.t-sub.transfer { color: var(--accent); font-weight: 500; }
/* Repasses: diferença discreta entre pagar e receber */
.kpi.owe .kpi-value { color: #b5524a; } .kpi.recv .kpi-value { color: var(--accent); }
:root[data-theme="dark"] .kpi.owe .kpi-value { color: #e08a82; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .kpi.owe .kpi-value { color: #e08a82; } }

/* Repassada já paga ao motorista: vermelho fraco */
.tag.tr.paid { color: #b5524a; background: rgba(181, 82, 74, .12); } .t-sub.transfer.paid { color: #b5524a; }
:root[data-theme="dark"] .tag.tr.paid, :root[data-theme="dark"] .t-sub.transfer.paid { color: #e08a82; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .tag.tr.paid, :root[data-theme="auto"] .t-sub.transfer.paid { color: #e08a82; } }

/* Repassada: vermelho = ainda não paguei ao motorista · verde = já paguei */
.tag.tr { color: var(--red); background: rgba(255, 59, 48, .12); } .t-sub.transfer { color: var(--red); }
.tag.tr.paid { color: var(--accent); background: rgba(26, 158, 75, .14); } .t-sub.transfer.paid { color: var(--accent); }
:root[data-theme="dark"] .tag.tr.paid, :root[data-theme="dark"] .t-sub.transfer.paid { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .tag.tr.paid, :root[data-theme="auto"] .t-sub.transfer.paid { color: var(--accent); } }

/* ---- Início: ambiente de trabalho ---- */
.today-hero .big { font-size: 30px; margin: 2px 0 2px; }
.hero-line { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; padding-top: 10px; border-top: .5px solid var(--sep, rgba(128,128,128,.25)); font-size: 13px; color: var(--sec); }
.hero-line b { color: inherit; font-weight: 700; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quick-btn { appearance: none; border: 0; font: inherit; color: inherit; cursor: pointer; background: var(--card); border-radius: var(--r); padding: 12px 4px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; -webkit-tap-highlight-color: transparent; transition: transform .12s; }
.quick-btn svg { color: var(--accent); } .quick-btn:active { transform: scale(.94); }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
button.trow { width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: 0; }

.tag.po { color: var(--orange); background: rgba(255, 149, 0, .14); } .tag.po.ok { color: var(--accent); background: rgba(26, 158, 75, .14); }
