:root {
  /* Marca Tutus Seller: azul-marinho + verde + azul */
  --bg: #060b2e;
  --panel: #111a4a;
  --panel-2: #1b2660;
  --text: #e6ecff;
  --muted: #9aa6cf;
  --primary: #1f6fef;
  --brand-green: #10c48a;
  --success: #16a34a;
  --danger: #dc2626;
  --warn: #f59e0b;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
.hidden { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 5; background: #000d54; border-bottom: 1px solid #1b2660; padding: 8px 12px; }
.brand { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.brand-icon { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.28); }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -.3px; color: #fff; }
.brand-name b { color: var(--brand-green); font-weight: 800; margin-left: 4px; }
.brand-tag { font-size: 12px; color: var(--muted); margin-left: auto; }
@media (max-width: 360px) { .brand-tag { display: none; } }
.tabs { display: flex; gap: 6px; overflow-x: auto; }
.tab { flex: 1 0 auto; min-width: 0; font-size: 14px; background: var(--panel); color: var(--muted); border: 0; border-radius: 999px; padding: 8px 10px; font-weight: 600; cursor: pointer; }
.tab.active { background: var(--brand-green); color: #04112e; }

main { max-width: 980px; margin: 0 auto; padding: 12px 16px 40px; }
.view { display: none; }
.view.active { display: block; }

.stage { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
#canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
#src { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.camera-off { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 16px; background: #000; }
.rec-badge { position: absolute; top: 10px; right: 10px; background: var(--danger); color: #fff; padding: 4px 10px; border-radius: 999px; font-weight: 700; animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: .6; } }

.order-panel { margin-top: 12px; background: var(--panel); border-radius: var(--radius); padding: 12px 14px; border-left: 6px solid var(--muted); }
.order-panel.recording { border-left-color: var(--danger); }
.order-panel.saved { border-left-color: var(--success); }
.order-panel.warn { border-left-color: var(--warn); }
.label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.order-title { font-size: 22px; font-weight: 800; word-break: break-all; }
.order-buyer { color: var(--muted); margin-top: 4px; }
.order-items { list-style: none; padding: 0; margin: 8px 0 0; }
.order-items li { font-size: 20px; padding: 6px 0; border-top: 1px solid #2c3a52; }
.order-items .qty { display: inline-block; min-width: 54px; font-weight: 800; color: #facc15; font-size: 26px; }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.controls .btn.big { grid-column: 1 / -1; }

.btn { background: var(--panel-2); color: var(--text); border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 15px; cursor: pointer; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.success { background: var(--success); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.big { padding: 16px; font-size: 18px; }
.btn.file { display: inline-block; }

.hint { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.row.small { font-size: 14px; color: var(--muted); }
.spacer { flex: 1; }
input[type=search], input[type=text], input[type=number], select {
  width: 100%; background: var(--panel); color: var(--text); border: 1px solid #334155; border-radius: 10px; padding: 10px 12px; font-size: 16px;
}

.card { background: var(--panel); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.card h2, .card h3 { margin: 0 0 8px; }
.card .btn { margin: 6px 6px 0 0; }
.form label { display: block; margin: 10px 0; color: var(--muted); font-size: 14px; }
.form label select, .form label input[type=number] { margin-top: 4px; }
.form label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; }
.form label.check input { width: 20px; height: 20px; }
.status { color: var(--muted); font-size: 14px; }
.tips li { margin-bottom: 6px; }
.pre { white-space: pre-wrap; word-break: break-word; background: #0b1222; border-radius: 8px; padding: 10px; font-size: 13px; min-height: 0; }
.pre:empty { display: none; }

.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--panel); border-radius: var(--radius); padding: 10px 12px; }
.item-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.item-code { font-weight: 800; word-break: break-all; }
.item-date { color: var(--muted); font-size: 13px; }
.item-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.item-actions .btn { padding: 8px 10px; font-size: 14px; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

dialog#player { width: min(960px, 96vw); max-height: 94vh; background: var(--panel); color: var(--text); border: 0; border-radius: var(--radius); padding: 12px; }
dialog::backdrop { background: rgba(0,0,0,.7); }
.player-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 700; word-break: break-all; }
#player-video { width: 100%; max-height: 60vh; background: #000; border-radius: 8px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); background: #111827; color: #fff; padding: 12px 18px; border-radius: 999px; box-shadow: 0 6px 24px rgba(0,0,0,.4); transition: transform .25s; z-index: 50; max-width: 92vw; text-align: center; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--success); }

.filter { width: 132px; flex: 0 0 132px; }
.badge { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-right: 4px; background: #475569; color: #fff; }
.badge.shopee { background: #ee4d2d; }
.badge.tiktok { background: #111; border: 1px solid #25f4ee; box-shadow: 2px 0 0 #fe2c55; }

.badge.repeat { background: #f59e0b; color: #111; }
dialog.dup { width: min(520px, 94vw); background: #3b1d06; color: var(--text); border: 3px solid var(--warn); border-radius: var(--radius); padding: 18px; text-align: center; }
dialog.dup h2 { margin: 6px 0 10px; color: #fde68a; }
.dup-icon { font-size: 48px; }
.dup-code { font-size: 20px; font-weight: 800; word-break: break-all; background: rgba(0,0,0,.35); border-radius: 8px; padding: 8px; }
dialog.dup ul { list-style: none; padding: 0; margin: 6px 0; }
.dup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }

.badge.drive-ok { background: #15803d; }
.badge.drive-up { background: #2563eb; }
.badge.drive-wait { background: #475569; }
.badge.drive-err { background: #b91c1c; }
a.btn { text-decoration: none; display: inline-block; }
.drive-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: var(--radius); background: #1e3a8a; }

.badge.mercado-livre { background: #ffe600; color: #2d3277; }
.quick { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.quick .btn.muted { background: #7f1d1d; color: #fff; }
.zoom { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 10px; padding: 6px 12px; }
.zoom input { flex: 1; accent-color: var(--primary); }
#zoom-val { min-width: 40px; text-align: right; font-weight: 700; }
.folders { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.folder { flex: 0 0 auto; background: var(--panel); color: var(--text); border: 2px solid transparent; border-radius: 10px; padding: 8px 10px; font-weight: 700; cursor: pointer; }
.folder span { color: var(--muted); font-weight: 600; margin-left: 2px; }
.folder.active { border-color: var(--primary); background: #1e3a8a; }
.folder.shopee.active { border-color: #ee4d2d; background: #4a1a10; }
.folder.tiktok.active { border-color: #25f4ee; background: #0b2b2b; }
.folder.mercado-livre.active { border-color: #ffe600; background: #3d3700; }
#drive-platforms label.check { margin: 6px 0; }

.badge.none { background: #475569; }
.folder[style].active { border-color: var(--fc); }
.plat-list { list-style: none; padding: 0; margin: 8px 0; }
.plat-list li { padding: 6px 0; border-top: 1px solid #2c3a52; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn.small { padding: 4px 10px; font-size: 13px; margin: 0; }
.teach-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: var(--radius); background: #4c1d95; }
dialog.plat-dlg { width: min(420px, 94vw); background: var(--panel); color: var(--text); border: 0; border-radius: var(--radius); padding: 16px; }
.plat-options { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.plat-options .btn { text-align: left; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.mode { background: var(--panel); color: var(--muted); border: 2px solid transparent; border-radius: 10px; padding: 10px; font-weight: 800; font-size: 16px; cursor: pointer; }
.mode.active { color: #fff; border-color: var(--primary); background: #1e3a8a; }
#mode-return.active { border-color: #f87171; background: #7f1d1d; }
body.mode-return .stage { outline: 4px solid #dc2626; outline-offset: -4px; }
.order-panel.return { border-left-color: #f87171; }
.btn.photo { grid-column: 1 / -1; background: #b45309; color: #fff; padding: 14px; font-size: 17px; }
.stage.flash::after { content: ''; position: absolute; inset: 0; background: #fff; opacity: .7; }
.ret-outcome { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: #475569; color: #fff; }
.ret-outcome.ok { background: #15803d; } .ret-outcome.bad { background: #b91c1c; } .ret-outcome.pending { background: #a16207; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; cursor: pointer; }
dialog.ret-dlg { width: min(520px, 94vw); background: var(--panel); color: var(--text); border: 0; border-radius: var(--radius); padding: 16px; }
.outcomes { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 10px 0; }
.outcomes .btn { text-align: left; }
.outcomes .btn.sel { outline: 3px solid var(--primary); }
dialog.ret-dlg textarea, dialog.ret-dlg select { width: 100%; background: #0b1222; color: var(--text); border: 1px solid #334155; border-radius: 8px; padding: 8px; font-size: 15px; margin-top: 4px; }
dialog.cmp-dlg { width: min(980px, 98vw); max-height: 96vh; background: var(--panel); color: var(--text); border: 0; border-radius: var(--radius); padding: 12px; }
.cmp-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 760px) { .cmp-grid { grid-template-columns: 1fr 1fr; } }
.cmp-grid video { width: 100%; background: #000; border-radius: 8px; max-height: 40vh; }
.cmp-label { font-weight: 800; margin: 4px 0; }

/* ---------- Computador (monitor): câmera grande à esquerda, painel à direita ---------- */
.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.big-timer { font-size: 30px; font-weight: 800; color: #f87171; font-variant-numeric: tabular-nums; white-space: nowrap; }
.station-label { margin-left: 8px; color: var(--brand-green); text-transform: none; letter-spacing: 0; font-weight: 700; }
.kbd-hint { display: none; }
kbd { background: #1b2660; border: 1px solid #3b4a8a; border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; font-size: 12px; color: #fff; }
input#set-station { width: 100%; background: var(--panel); color: var(--text); border: 1px solid #334155; border-radius: 10px; padding: 10px 12px; font-size: 16px; margin-top: 4px; }
#view-gravar.active { display: flex; flex-direction: column; }
#view-gravar .side { display: contents; }
#view-gravar .side > .modes { order: -1; }
@media (min-width: 1100px) {
  main { max-width: 1600px; }
  #view-gravar.active { display: grid; grid-template-columns: minmax(0, 1fr) 440px; column-gap: 20px; align-items: start; }
  #view-gravar .side { display: block; }
  #view-gravar .side > .modes { margin-bottom: 0; }
  .order-title { font-size: 26px; }
  .order-items li { font-size: 22px; }
  .big-timer { font-size: 40px; }
  .kbd-hint { display: inline; }
}

#drive-clean input[type=number] { margin-top: 4px; }
