/* ConectExp - padrao visual Conect (mesmo do ConectProd). Tokens primeiro: troque a marca aqui. */
:root {
  color-scheme: light;
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f7f8fa; --linha: #e3e5e9; --linha-2: #eef0f3;
  --txt: #0f1113; --txt-2: #4a4e55; --txt-3: #757a83;
  --marca: #2a78d6; --marca-forte: #1c5cab; --marca-suave: #e6effb; --marca-txt: #ffffff;
  --st-good: #0ca30c; --st-warn: #fab219; --st-crit: #d03b3b;
  --good-bg: #e7f6e7; --good-txt: #0a6b0a; --warn-bg: #fff4d6; --warn-txt: #7a5200;
  --crit-bg: #fbe5e5; --crit-txt: #a11f1f; --info-bg: #e6effb; --info-txt: #1c5cab; --neutro-bg: #eef0f3; --neutro-txt: #4a4e55;
  --roxo-bg: #f2e1fa; --roxo-txt: #7a1fa2;
  --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --sombra-2: 0 12px 32px rgba(16, 24, 40, .18);
  --raio: 12px; --raio-sm: 8px;
  --lat: 248px;
  --fonte: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* nomes usados pelas telas da expedicao */
  --card: var(--surface); --ink: var(--txt); --ink-2: var(--txt-2); --ink-3: var(--txt-3); --line: var(--linha);
  --blue: var(--marca); --accent: #f2a31b; --accent-ink: #3b2600;
  --ok: var(--st-good); --ok-bg: var(--good-bg); --warn: var(--warn-txt); --warn-bg-c: var(--warn-bg);
  --err: var(--st-crit); --err-bg: var(--crit-bg); --crit: var(--roxo-txt); --crit-bg-c: var(--roxo-bg);
  --radius: var(--raio); --shadow: var(--sombra);
  --ok-suave: #f3fbf6; --amarelo: #fff7c2; --amarelo-2: #fffbe0; --amarelo-linha: #f0dc7a;
  --qtd-ok-bg: #c6f6d5; --qtd-ok-txt: #006400; --qtd-err-bg: #ffc9c9; --qtd-err-txt: #840000;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111315; --surface: #1a1c1f; --surface-2: #202327; --linha: #2c3036; --linha-2: #24272c;
  --txt: #f0efec; --txt-2: #c3c2b7; --txt-3: #8f9198;
  --marca: #3987e5; --marca-forte: #6da7ec; --marca-suave: #17283d; --marca-txt: #ffffff;
  --good-bg: #13301a; --good-txt: #7ddc7d; --warn-bg: #3a2e0d; --warn-txt: #ffd36b;
  --crit-bg: #3d1717; --crit-txt: #ff9a9a; --info-bg: #17283d; --info-txt: #86b6ef; --neutro-bg: #26292e; --neutro-txt: #c3c2b7;
  --roxo-bg: #2e1a3a; --roxo-txt: #d7a6f0;
  --sombra: 0 1px 2px rgba(0, 0, 0, .4); --sombra-2: 0 16px 40px rgba(0, 0, 0, .55);
  --ok-suave: #142319; --amarelo: #3a330f; --amarelo-2: #2f2a10; --amarelo-linha: #6b5c1c;
  --qtd-ok-bg: #13301a; --qtd-ok-txt: #7ddc7d; --qtd-err-bg: #3d1717; --qtd-err-txt: #ff9a9a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; overscroll-behavior-y: none; }
body { font: 15px/1.45 var(--fonte); color: var(--txt); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--marca); }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--marca); outline-offset: 2px; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--txt-3); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- botoes */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--linha); background: var(--surface); color: var(--txt); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--txt-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn.primary, .btn-pri { background: var(--marca); border-color: var(--marca); color: var(--marca-txt); }
.btn.primary:hover, .btn-pri:hover { background: var(--marca-forte); border-color: var(--marca-forte); }
.btn.ok { background: var(--st-good); border-color: var(--st-good); color: #fff; }
.btn.warn { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--st-crit); border-color: var(--st-crit); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--linha); color: var(--txt-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--txt-2); }
.btn-ghost:hover, .btn.ghost:hover { background: var(--surface-2); border-color: var(--linha); }
.btn.big { min-height: 52px; font-size: 16px; }
.btn.block, .btn-bloco { width: 100%; }
.btn.sm, .btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-ic, .icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 10px;
  cursor: pointer; color: var(--txt-2); flex: none; text-decoration: none;
}
.btn-ic:hover, .icon-btn:hover { background: var(--surface-2); color: var(--txt); }
.btn-ic.perigo:hover { color: var(--st-crit); background: var(--crit-bg); }
.btn-ic svg, .icon-btn svg { width: 20px; height: 20px; }

.seg { display: flex; background: var(--linha-2); border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 9px 8px; font-weight: 650; cursor: pointer; color: var(--txt-2); }
.seg button.on { background: var(--surface); color: var(--txt); box-shadow: var(--sombra); }
.seg.mode button.on[data-v="L"] { background: #1f4fa3; color: #fff; }
.seg.mode button.on[data-v="R"] { background: #ffd84a; color: #3b2d00; }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--neutro-bg); color: var(--neutro-txt); white-space: nowrap; }
.badge.ok { background: var(--good-bg); color: var(--good-txt); }
.badge.warn { background: var(--warn-bg); color: var(--warn-txt); }
.badge.err { background: var(--crit-bg); color: var(--crit-txt); }
.badge.crit { background: var(--roxo-bg); color: var(--roxo-txt); }
.badge.blue { background: var(--info-bg); color: var(--info-txt); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.pill-warn { background: var(--warn-bg); color: var(--warn-txt); }

/* ---------------------------------------------------------------- marca */
.marca { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 500; letter-spacing: -.02em; color: var(--txt); }
.marca svg { width: 28px; height: 28px; color: var(--marca); }
.marca b { font-weight: 800; }

/* ---------------------------------------------------------------- login */
.pg-login { background: var(--surface); }
:root[data-theme="dark"] .pg-login { background: var(--bg); }
.login { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-arte { background: linear-gradient(150deg, #0d2747 0%, #133a6b 55%, #1c5cab 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 18px; position: relative; overflow: hidden; }
.login-arte::after { content: ""; position: absolute; inset: auto -120px -160px auto; width: 520px; height: 520px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .05); }
.login-arte h1 { font-size: clamp(28px, 3.2vw, 42px); max-width: 15ch; }
.login-arte p { max-width: 46ch; color: #cfe0f6; font-size: 16px; margin: 0; }
.login-arte .marca { color: inherit; }
.login-arte .marca svg { color: #86b6ef; }
.login-fluxo { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.login-fluxo li { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 13.5px; }
.login-fluxo svg { width: 16px; height: 16px; }
:root[data-theme="light"] .login-arte { background: linear-gradient(150deg, #e9f1fc 0%, #d6e6fa 55%, #bcd6f6 100%); color: #0f1b2d; }
:root[data-theme="light"] .login-arte::after { border-color: rgba(28, 92, 171, .08); }
:root[data-theme="light"] .login-arte p { color: #3b4b63; }
:root[data-theme="light"] .login-arte .marca svg { color: var(--marca); }
:root[data-theme="light"] .login-fluxo li { background: rgba(255, 255, 255, .7); color: #1c3557; }
.login-form { position: relative; display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.login-form form { width: min(420px, 100%); padding: 32px; display: grid; gap: 14px; }
.login-form h2 { font-size: 26px; }
.login-form .muted { margin: -6px 0 4px; }
.login-form .err { color: var(--crit-txt); font-weight: 600; margin: 0; min-height: 0; }
.login-form .err:empty { display: none; }
.login-tema { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; }
.marca-mob { display: none; }
.versao { text-align: center; font-size: 12px; margin: 0 !important; }
.campo { display: grid; gap: 6px; }
.campo > span { font-size: 13px; font-weight: 600; color: var(--txt-2); }
.campo input { height: 46px; border-radius: 10px; border: 1.5px solid var(--linha); background: var(--surface); padding: 0 12px; width: 100%; outline: 0; }
.campo input:focus { border-color: var(--marca); }
.lic-emp { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--linha); border-radius: 10px; background: var(--surface-2); }
.lic-emp > svg { width: 22px; height: 22px; color: var(--marca); }
.lic-emp div { flex: 1; min-width: 0; display: grid; }
.lic-emp small { color: var(--txt-3); font-size: 12.5px; }
.btn-link { background: none; border: 0; color: var(--marca); text-decoration: underline; cursor: pointer; font-weight: 600; padding: 0; }
.nota-erro { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--crit-bg); color: var(--crit-txt); font-size: 14px; font-weight: 500; }
.nota-erro svg { width: 18px; height: 18px; margin-top: 1px; }
.inp-token { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; font-weight: 700; text-transform: uppercase; }
.usuario .lic-txt { color: var(--warn-txt); font-weight: 600; }
.senha { position: relative; display: block; }
.senha input { padding-right: 46px; }
.senha input::-ms-reveal, .senha input::-ms-clear { display: none; }
.senha .btn-ic { position: absolute; right: 2px; top: 3px; }

/* ---------------------------------------------------------------- casca */
.card { background: var(--surface); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); padding: 14px; }
.login-form form.card { padding: 32px; }
.card + .card { margin-top: 10px; }
#app { min-height: 100dvh; }
.lateral { position: fixed; inset: 0 auto 0 0; width: var(--lat); background: var(--surface); border-right: 1px solid var(--linha); display: flex; flex-direction: column; z-index: 30; padding-top: env(safe-area-inset-top); }
.lateral .marca { padding: 20px 20px 12px; }
.lateral nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; display: grid; gap: 2px; align-content: start; }
.lateral nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--txt-2); text-decoration: none; font-weight: 500; touch-action: manipulation; }
.lateral nav a svg { width: 20px; height: 20px; }
.lateral nav a:hover { background: var(--surface-2); color: var(--txt); }
.lateral nav a.on { background: var(--marca-suave); color: var(--marca-forte); font-weight: 700; }
:root[data-theme="dark"] .lateral nav a.on { color: #cfe0f6; }
.lateral nav a span { flex: 1; }
.nav-sec { margin: 14px 12px 4px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--txt-3); font-weight: 700; }
.lat-rodape { border-top: 1px solid var(--linha); padding: 12px 12px 6px 16px; display: flex; align-items: center; gap: 8px; }
.lat-versao { padding: 0 0 10px; }
.usuario { display: flex; gap: 10px; align-items: center; flex: 1; min-width: 0; }
.usuario svg { width: 20px; height: 20px; color: var(--txt-3); }
.usuario div { min-width: 0; display: grid; }
.usuario small { color: var(--txt-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lat-acoes { display: flex; }
.topo, .abas { display: none; }
.veu { display: none; }
#conteudo { margin-left: var(--lat); min-height: 100dvh; }

/* cabecalho da tela: titulo, voltar e acoes (sempre visivel) */
.topbar {
  position: sticky; top: 0; z-index: 19; display: flex; align-items: center; gap: 10px;
  padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--linha);
}
.topbar h1 { font-size: 20px; font-weight: 750; }
.topbar .sub { font-size: 13px; color: var(--txt-3); }
.tb-acoes { display: flex; gap: 4px; align-items: center; }
.tb-acoes:empty { display: none; }
.tb-acoes .icon-btn { color: var(--marca); }

/* ---------------------------------------------------------------- layout */
main#main, #main { display: block; padding: 20px 28px calc(96px + var(--safe-b)); max-width: 1440px; }
.section-title { font-size: 11.5px; font-weight: 700; color: var(--txt-3); text-transform: uppercase; letter-spacing: .08em; margin: 18px 2px 8px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) {
  .split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
  .split > .sticky { position: sticky; top: 84px; }
}

/* ---------------------------------------------------------------- KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.kpi {
  border: 1px solid var(--linha); background: var(--surface); border-radius: var(--raio); padding: 12px 14px;
  text-align: left; cursor: pointer; box-shadow: var(--sombra); color: var(--txt);
}
.kpi b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 11.5px; color: var(--txt-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi.sel { border-color: var(--marca); box-shadow: 0 0 0 2px var(--marca-suave); }
.kpi.urg b { color: var(--warn-txt); }
.kpi.crit b { color: var(--st-crit); }
.kpi.ok b { color: var(--st-good); }

/* ---------------------------------------------------------------- formularios */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--txt-2); min-width: 0; }
.inp, select.inp, textarea.inp {
  width: 100%; border: 1.5px solid var(--linha); background: var(--surface); border-radius: 10px;
  padding: 10px 12px; font-size: 16px; min-height: 46px; outline: none; color: var(--txt);
}
.inp:focus { border-color: var(--marca); box-shadow: 0 0 0 3px var(--marca-suave); }
.inp[readonly] { background: var(--surface-2); }
.inp.alert { background: var(--warn-bg); border-color: var(--st-warn); }
textarea.inp { min-height: 70px; resize: vertical; }
.inp-group { display: flex; gap: 6px; }
.inp-group .inp { flex: 1; min-width: 0; }
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; text-align: left; }

/* ---------------------------------------------------------------- listas */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  background: var(--surface); border-radius: var(--raio); border: 1px solid var(--linha); box-shadow: var(--sombra);
  padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; cursor: pointer; position: relative; transition: border-color .12s;
  touch-action: manipulation;
}
.item:hover { border-color: var(--marca); }
.item:active { transform: scale(.995); }
.item.ready { border-left: 5px solid var(--st-good); background: var(--ok-suave); }
.item.urg { border-left: 5px solid var(--accent); }
.item.crit { border-left: 5px solid var(--st-crit); }
.item .t { font-weight: 700; }
.item .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--txt-2); margin-top: 3px; }
.item .badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.item .side { text-align: right; flex: none; }
.item .pnum { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 40px 10px; color: var(--txt-3); }
@media (min-width: 1100px) { .list:has(> .item .pnum) { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); align-items: start; } }

/* itens da liberacao */
.prod { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 11px 12px; border-radius: var(--raio); background: var(--surface); border: 1px solid var(--linha); cursor: pointer; }
.prod.sel { border-color: var(--marca); box-shadow: 0 0 0 2px var(--marca-suave); }
.prod .ck { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; }
.ck.c0 { background: var(--surface-2); color: var(--txt-3); border: 2px dashed var(--linha); }
.ck.c1 { background: var(--st-good); color: #fff; }
.ck.c3 { background: var(--accent); color: var(--accent-ink); }
.prod .nm { font-weight: 650; }
.prod .st { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; color: var(--txt-3); margin-top: 2px; }
.qty-pill { font-weight: 800; padding: 5px 10px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.qty-pill.ok { background: var(--qtd-ok-bg); color: var(--qtd-ok-txt); }
.qty-pill.err { background: var(--qtd-err-bg); color: var(--qtd-err-txt); }
.progress { height: 8px; background: var(--linha-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--st-good); transition: width .3s; }

/* ---------------------------------------------------------------- card de pedido (lista da expedicao) */
.item.ped { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 16px; border-left: 4px solid var(--linha); }
.item.ped.ready { border-left-color: var(--st-good); background: var(--surface); }
.item.ped.urg { border-left-color: var(--accent); }
.item.ped.crit { border-left-color: var(--st-crit); }
.pc-h { display: flex; align-items: flex-start; gap: 8px; }
.pc-num { font-size: 12px !important; font-weight: 700 !important; color: var(--marca); letter-spacing: .03em; }
.pc-cli { font-size: 15.5px; line-height: 1.25; margin-top: 2px; }
.pc-h .icon-btn { margin: -6px -8px 0 0; color: var(--txt-3); }
.pc-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; font-size: 13px; color: var(--txt-2); }
.pc-i { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pc-i svg { width: 15px; height: 15px; color: var(--txt-3); }
.pc-i span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-obs { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-txt); font-size: 12.5px; font-weight: 600; }
.pc-obs svg { width: 15px; height: 15px; margin-top: 1px; }
.pc-est { display: grid; gap: 5px; font-size: 13px; font-weight: 600; }
.pc-est svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 2px; }
.pc-est.ok { color: var(--good-txt); }
.pc-est.falta { color: var(--crit-txt); }
.pc-est.falta .progress > i { background: var(--st-crit); }
.pc-est .progress { height: 6px; }
.pc-f { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--linha-2); }
.pc-f .badges { margin: 0; }
.pc-datas { display: grid; justify-items: end; font-size: 12px; color: var(--txt-3); margin-left: auto; }
.pc-datas b { color: var(--txt-2); font-weight: 600; }
@media (max-width: 520px) { .pc-info { grid-template-columns: 1fr; } .pc-datas { justify-items: start; margin-left: 0; } }

/* ---------------------------------------------------------------- tela de liberacao (passo a passo) */
.lib { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.lib-col { min-width: 0; display: grid; gap: 12px; align-content: start; }
.lib-col > .section-title, .lib-lado > .section-title { margin: 6px 2px 0; }
.lib-lado { position: sticky; top: 84px; display: grid; gap: 10px; }
.lib .card + .card { margin-top: 0; }
.passo { display: flex; align-items: center; gap: 8px; }
.passo b { width: 22px; height: 22px; border-radius: 50%; background: var(--marca); color: #fff; display: grid; place-items: center; font-size: 12px; letter-spacing: 0; }
.lib-cli-nome { font-size: 17px; font-weight: 750; }
.lib-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--linha-2); font-size: 13.5px; }
.lib-meta span { display: grid; min-width: 0; }
.lib-meta small { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--txt-3); font-weight: 600; }
.lib-obs { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-txt); font-weight: 600; font-size: 13.5px; }
.lib-obs svg { width: 18px; height: 18px; margin-top: 1px; }
.lib-obs.err { background: var(--crit-bg); color: var(--crit-txt); margin: 10px 0 0; }
.lib-topo { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.lib-topo-l { flex: 1 1 340px; display: grid; gap: 12px; min-width: 0; }
.lib-topo-r { display: grid; gap: 6px; justify-items: stretch; flex: 0 1 240px; }
.lib-opt { cursor: pointer; color: var(--txt-2); justify-content: center; }
.lib-prog { display: grid; gap: 6px; }
.lib-dica { margin-top: -4px; }
.lib-final { display: grid; gap: 10px; }
.lib-final-st { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; padding: 10px 12px; border-radius: 10px; }
.lib-final-st svg { width: 18px; height: 18px; }
.lib-final-st.pend { background: var(--warn-bg); color: var(--warn-txt); }
.lib-final-st.ok { background: var(--good-bg); color: var(--good-txt); }
/* item em sanfona: os lotes abrem dentro do proprio item */
.item-lib { background: var(--surface); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; border-left: 4px solid var(--linha); transition: border-color .12s; }
.item-lib.ck1 { border-left-color: var(--st-good); }
.item-lib.ck3 { border-left-color: var(--st-crit); }
.item-lib.aberto { border-color: var(--marca); box-shadow: 0 0 0 3px var(--marca-suave); }
.item-lib.aberto.ck1 { border-left-color: var(--st-good); }
.item-lib .prod { border: 0; border-radius: 0; background: transparent; grid-template-columns: 34px 1fr auto 20px; padding: 12px 14px; }
.item-lib .prod:hover { background: var(--surface-2); }
.item-lib .st { gap: 4px 12px; align-items: center; margin-top: 4px; }
.item-lib .st .cod { color: var(--txt-3); }
.item-lib .st.est b { color: var(--txt-2); font-weight: 650; }
.item-lib .st.est b.neg { color: var(--crit-txt); }
.item-lib .qtd { display: grid; justify-items: end; gap: 2px; }
.item-lib .qtd small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--txt-3); font-weight: 600; }
.item-lib .chev { color: var(--txt-3); transition: transform .15s; display: grid; }
.item-lib .chev svg { width: 18px; height: 18px; }
.item-lib.aberto .chev { transform: rotate(90deg); color: var(--marca); }
.painel { border-top: 1px solid var(--linha); padding: 14px; background: var(--surface-2); }
.painel-h { display: flex; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--txt-3); margin-bottom: 10px; }
.painel-h b { color: var(--txt); }
.painel-f { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.painel-tot { flex: 1; font-size: 15px; white-space: nowrap; }
.painel-tot b { font-size: 17px; }
@media (max-width: 1200px) {
  .lib { grid-template-columns: 1fr; }
  .lib-lado { position: static; }
}
@media (min-width: 901px) { .actionbar.so-mob { display: none; } }
@media (max-width: 900px) {
  .lib-final { display: none; }
  .passo-final { display: none !important; }
  .lib-topo-r { flex-basis: 100%; }
  .item-lib .prod { grid-template-columns: 30px 1fr auto; padding: 12px; }
  .item-lib .chev { display: none; }
  .painel { padding: 12px; }
  .painel-f .btn.ok { flex-basis: 100%; }
  .painel-f .btn.ghost { flex: 1; }
}

/* tabela de lotes */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--txt-3); font-weight: 700; text-transform: uppercase; padding: 6px; border-bottom: 1px solid var(--linha); }
.tbl td { padding: 6px; border-bottom: 1px solid var(--linha-2); vertical-align: middle; }
.tbl tr.vence td { background: var(--amarelo); }
.tbl tr.picked td { background: var(--ok-suave); }
.tbl .inp { min-height: 40px; padding: 7px 9px; }
.lote-card { border: 1px solid var(--linha); border-radius: var(--raio); padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--surface); }
.lote-card.vence { background: var(--amarelo-2); border-color: var(--amarelo-linha); }
/* lote com quantidade a retirar: azul (verde fica só para o item já conferido) */
.lote-card.picked { border-color: var(--marca); box-shadow: inset 4px 0 0 var(--marca); }
.lote-card .lh { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.lote-card .lh b { font-size: 16px; }
.barcode-ok { color: var(--good-txt); font-weight: 700; }
.f-l { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.f-l .barcode-ok { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--info-bg); color: var(--info-txt); }
.lote-card .inp-group { align-items: stretch; }
.lote-card .inp-group .btn { min-height: 0; }

/* ---------------------------------------------------------------- barra de acoes inferior */
.actionbar {
  position: fixed; left: var(--lat); right: 0; bottom: 0; z-index: 15;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px);
  border-top: 1px solid var(--linha); padding: 10px 12px calc(10px + var(--safe-b));
  display: flex; gap: 8px; justify-content: center;
}
.actionbar > * { flex: 1; max-width: 360px; }
.fab {
  position: fixed; right: 20px; bottom: calc(86px + var(--safe-b)); z-index: 16;
  width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--marca); color: #fff;
  box-shadow: var(--sombra-2); display: grid; place-items: center; cursor: pointer;
}
.fab svg { width: 30px; height: 30px; }

/* ---------------------------------------------------------------- modal / sheet */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(10, 14, 20, .5); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .2s; }
.modal {
  background: var(--surface); color: var(--txt); width: min(560px, 100%); max-height: min(88dvh, 820px); overflow: auto;
  border-radius: 18px; padding: 18px 22px; box-shadow: var(--sombra-2); animation: up .2s ease-out;
}
.modal.wide { width: min(920px, 100%); }
.modal h2 { margin: 0 0 4px; font-size: 19px; }
.modal .mh { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.modal .mf { display: flex; gap: 10px; justify-content: flex-end; margin: 14px -22px -18px; padding: 14px 22px; border-top: 1px solid var(--linha); flex-wrap: wrap; position: sticky; bottom: -18px; background: var(--surface); }
.modal .msg { white-space: pre-wrap; color: var(--txt-2); font-size: 15.5px; }
@keyframes up { from { transform: translateY(16px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.lista-sel { display: grid; gap: 4px; }
.item-sel { display: flex; align-items: center; gap: 12px; padding: 10px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; text-align: left; color: var(--txt); }
.item-sel:hover { background: var(--surface-2); }
.item-sel.on { background: var(--marca-suave); }
.item-sel .t { flex: 1; display: grid; }
.item-sel small { color: var(--txt-3); }
.item-sel > svg { width: 20px; height: 20px; color: var(--marca); }
.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--marca-suave); color: var(--marca); }
.av svg { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- toast */
.toasts { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(460px, calc(100% - 24px)); pointer-events: none; }
.toast { padding: 12px 14px; border-radius: 12px; background: #16191d; color: #fff; box-shadow: var(--sombra-2); font-weight: 500; animation: up .2s; white-space: pre-wrap; border-left: 4px solid transparent; }
.toast.ok { border-left-color: #7ddc7d; }
.toast.err { border-left-color: #ff6b6b; }
:root[data-theme="dark"] .toast { background: #f0efec; color: #111; }

.loading { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 55%, transparent); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--marca); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- scanner (camera: sempre escuro) */
.scanner { position: fixed; inset: 0; z-index: 70; background: #000; color: #fff; display: flex; flex-direction: column; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .sc-top, .scanner .sc-bottom { position: relative; z-index: 2; padding: 12px; background: linear-gradient(rgba(0, 0, 0, .7), rgba(0, 0, 0, 0)); display: flex; align-items: center; gap: 8px; padding-top: calc(env(safe-area-inset-top, 0px) + 12px); }
.scanner .sc-bottom { margin-top: auto; background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .85)); flex-direction: column; align-items: stretch; padding-bottom: calc(14px + var(--safe-b)); }
.scanner .sc-title { font-weight: 700; flex: 1; }
.scanner .frame { position: absolute; z-index: 1; left: 8%; right: 8%; top: 32%; height: 26%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); transition: border-color .15s; }
.scanner .frame::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: rgba(255, 60, 60, .85); animation: scanline 1.6s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { transform: translateY(-40px); } 50% { transform: translateY(40px); } }
.scanner.flash-ok .frame { border-color: #34d27b; }
.scanner.flash-err .frame { border-color: #ff4d4d; }
.scanner .sc-msg { font-size: 18px; font-weight: 750; text-align: center; min-height: 26px; text-shadow: 0 1px 3px #000; }
.scanner .sc-msg.ok { color: #6ff0a6; }
.scanner .sc-msg.err { color: #ff8a8a; }
.scanner .sc-sub { text-align: center; opacity: .85; font-size: 13.5px; min-height: 18px; }
.scanner .sc-manual { display: flex; gap: 6px; margin-top: 8px; }
.scanner .sc-manual .inp { background: rgba(255, 255, 255, .95); color: #000; border-color: transparent; }
.scanner .sc-log { max-height: 92px; overflow: auto; font-size: 12.5px; opacity: .85; margin-top: 6px; }
.scanner .icon-btn, .scanner .btn-ic { background: rgba(0, 0, 0, .35); color: #fff; }

/* ---------------------------------------------------------------- PWA: "Instalar app" so quando da para instalar */
[data-install] { display: none !important; }
body.can-install [data-install] { display: inline-flex !important; }
body.can-install .lateral nav a[data-install] { display: flex !important; }
@media (display-mode: standalone) { [data-install] { display: none !important; } }

/* ---------------------------------------------------------------- responsivo */
@media (min-width: 901px) and (max-width: 1279px) {
  :root { --lat: 216px; }
  .lateral .marca { padding: 16px 16px 10px; font-size: 18px; }
  .topbar { padding: 12px 20px; }
  #main { padding: 18px 20px calc(96px + var(--safe-b)); }
}
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-arte { display: none; }
  .marca-mob { display: flex; margin-bottom: 4px; }
  .lateral { transform: translateX(-102%); transition: transform .22s; box-shadow: var(--sombra-2); width: min(300px, 86vw); }
  body.menu-aberto .lateral { transform: none; }
  body.menu-aberto .veu { display: block; position: fixed; inset: 0; background: rgba(10, 14, 20, .45); z-index: 25; }
  .topo { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20; height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0; background: var(--surface); border-bottom: 1px solid var(--linha); }
  .topo .marca { flex: 1; font-size: 18px; }
  .topo .marca svg { width: 24px; height: 24px; }
  #conteudo { margin-left: 0; }
  .topbar { top: calc(56px + env(safe-area-inset-top)); padding: 8px 10px 8px 14px; }
  .topbar h1 { font-size: 17px; }
  .topbar .sub { font-size: 12px; }
  #main { padding: 14px 14px calc(150px + var(--safe-b)); }
  .abas { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--linha); padding-bottom: env(safe-area-inset-bottom); }
  .abas a, .abas button { display: grid; justify-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11.5px; color: var(--txt-3); text-decoration: none; background: none; border: 0; cursor: pointer; }
  .abas svg { width: 22px; height: 22px; }
  .abas .on { color: var(--marca); font-weight: 700; }
  /* telas com barra de acoes propria: ela fica por cima das abas */
  body:has(.actionbar) .abas { display: none; }
  .actionbar { left: 0; }
  .fab { bottom: calc(76px + var(--safe-b)); }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; padding-bottom: calc(18px + var(--safe-b)); }
  .modal .mf { bottom: calc(-18px - var(--safe-b)); padding-bottom: calc(14px + var(--safe-b)); margin-bottom: calc(-18px - var(--safe-b)); }
  .modal .mf .btn { flex: 1; }
  .toasts { bottom: calc(76px + var(--safe-b)); }
}
@media (pointer: coarse) {
  .btn { min-height: 48px; padding: 0 18px; }
  .btn.sm, .btn-sm { min-height: 42px; }
  .btn-ic, .icon-btn { width: 46px; height: 46px; }
  .lateral nav a { padding: 13px 14px; }
  .campo input, .login-form input { height: 50px; font-size: 16px; }
  .item:hover { border-color: var(--linha); }
  .item:active { border-color: var(--marca); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- splash padrao Conect (igual ao ConectProd) */
#splash {
  --sp-ease: cubic-bezier(.2, .8, .2, 1);
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: radial-gradient(520px 420px at 50% 42%, rgba(92,70,255,.26), transparent 70%), linear-gradient(160deg, #050a1c, #0a1030 55%, #070b20);
  color: #fff; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  transition: opacity .5s ease, visibility .5s, transform .5s var(--sp-ease);
  --sp-c1: #6ea8ff; --sp-c2: #2f62ff; --sp-v1: #c4a6ff; --sp-v2: #7c4dff;
}
:root[data-theme="light"] #splash { --sp-c1: #1746e0; --sp-c2: #0a1f96; --sp-v1: #8a3ffc; --sp-v2: #5a26f0;
  background: radial-gradient(520px 420px at 50% 42%, rgba(92,70,255,.12), transparent 70%), linear-gradient(160deg, #ffffff, #f1f4fc); color: #0f1b2d; }
:root[data-theme="light"] .splash-logo { filter: drop-shadow(0 8px 18px rgba(60,50,220,.22)); }
:root[data-theme="light"] .splash-name em { background-image: linear-gradient(95deg, #1746e0, #6a2cf0); }
:root[data-theme="light"] .splash-by { color: #5d6c86; }
:root[data-theme="light"] .splash-bar { background: rgba(16,30,54,.1); }
#splash.hide { opacity: 0; visibility: hidden; transform: scale(1.03); }
.splash-inner { display: flex; flex-direction: column; align-items: center; }
.splash-logo { width: 168px; height: auto; margin-bottom: 26px; overflow: visible; filter: drop-shadow(0 0 22px rgba(112,92,255,.55)); }
.splash-logo path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: splash-draw .75s var(--sp-ease) forwards; }
.splash-logo .d2 { animation-delay: .3s; }
.splash-logo .d3 { animation-delay: .42s; }
.splash-logo .d4 { animation-delay: .5s; }
.splash-name { font-size: 30px; font-weight: 700; letter-spacing: -.025em; opacity: 0; animation: splash-rise .6s var(--sp-ease) .7s forwards; }
.splash-name em { font-style: normal; background: linear-gradient(95deg, #9ec2ff, #c4a6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.splash-by { margin-top: 6px; color: #a3aed0; font-size: 11px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; opacity: 0; animation: splash-rise .6s var(--sp-ease) .85s forwards; }
.splash-bar { width: 120px; height: 2px; border-radius: 2px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 30px; }
.splash-bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #4f86ff, #a57bff); width: 0; animation: splash-fill 1.5s ease-in-out forwards; }
@keyframes splash-draw { to { stroke-dashoffset: 0; } }
@keyframes splash-fill { to { width: 100%; } }
@keyframes splash-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .splash-logo path { stroke-dashoffset: 0; animation: none; }
  .splash-name, .splash-by { opacity: 1; animation: none; }
}

/* ---------------------------------------------------------------- impressao */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  html, body { background: #fff; color: #000; }
  @page { margin: 10mm; }
}
.pr { font: 11px/1.3 Arial, Helvetica, sans-serif; color: #000; }
.pr h1 { font-size: 16px; margin: 0; }
.pr h2 { font-size: 12px; margin: 10px 0 4px; border-bottom: 1px solid #000; }
.pr table { width: 100%; border-collapse: collapse; }
.pr th, .pr td { border: 1px solid #999; padding: 3px 4px; text-align: left; vertical-align: top; }
.pr th { background: #eee; }
.pr .r { text-align: right; }
.pr .hdr { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 6px; }
.pr .hdr img { max-height: 54px; max-width: 160px; }
.pr .kv { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 2px 8px; }
.pr .kv b { white-space: nowrap; }
.pr .sign { display: flex; gap: 30px; margin-top: 30px; }
.pr .sign div { flex: 1; border-top: 1px solid #000; text-align: center; padding-top: 3px; }
.labels { display: flex; flex-wrap: wrap; gap: 4mm; }
.label { width: 100mm; min-height: 50mm; border: 1px dashed #888; padding: 3mm; page-break-inside: avoid; break-inside: avoid; font: 11px Arial, sans-serif; display: flex; flex-direction: column; gap: 1.5mm; color: #000; background: #fff; }
.label .big { font-size: 22px; font-weight: 800; }
.label .lg { font-size: 15px; font-weight: 700; }
.label svg.bc { height: 14mm; width: 100%; }
.label img { max-height: 12mm; max-width: 40mm; }
@media print { .label { border: 1px solid #000; } }
