:root {
  /* SEMALO claro — laranja + amarelo sobre base quente */
  color-scheme: light;
  --bg: #faf6ef;
  --card: #fffefb;
  --card-2: #fdfbf7;
  --ink: #2b2115;
  --muted: #7a6a56;
  --line: #eadfd0;
  --espresso: #241708;
  --espresso-2: #3a2410;
  --orange: #e8590c;
  --orange-d: #c94a05;
  --amber: #fab005;
  --amber-soft: #fff3d1;
  --ok: #2f9e44;
  --ok-bg: #ddf3e2;
  --warn: #a05e03;
  --warn-bg: #fceed2;
  --bad: #c92a2a;
  --bad-bg: #fae1e1;
  --merchan: #7048c8;
  --merchan-bg: #ece4fb;
  --info: #1864ab;
  --info-bg: #dcecfb;
  --gray-bg: #f0e9dd;
  --verificar-bg: #ffe4d4;
  --verificar-ink: #bf3f04;
  --vazio: #d8cbb8;
  --zebra: #fdf9f2;
  --row-hover: #fff3dd;
  --panel: #faf3e6;
  --readonly: #f5f0e6;
  --overlay: rgba(36,23,8,.55);
  --toast-bg: #241708;
  --toast-ink: #fff;
  --focus: rgba(232,89,12,.15);
  --act-sep: #e8c98f;
  --ghost-hover: rgba(0,0,0,.06);
  --on-ok: #fff;
  --on-bad: #fff;
  --shadow: 0 1px 2px rgba(43,33,21,.07), 0 8px 28px rgba(43,33,21,.08);
  --r: 12px;
  font-size: 15px;
}

[data-theme="dark"] {
  /* SEMALO escuro — ops: preto quente, acentos acesos */
  color-scheme: dark;
  --bg: #14100c;
  --card: #201a14;
  --card-2: #2b2218;
  --ink: #f0e7da;
  --muted: #b0a089;
  --line: #3a2f24;
  --orange: #f2661b;
  --orange-d: #d95408;
  --amber-soft: rgba(250,176,5,.13);
  --ok: #51e08c;
  --ok-bg: rgba(81,224,140,.13);
  --warn: #f6b73c;
  --warn-bg: rgba(246,183,60,.13);
  --bad: #ff6b6b;
  --bad-bg: rgba(255,107,107,.13);
  --merchan: #b48cf2;
  --merchan-bg: rgba(180,140,242,.15);
  --info: #6db3f2;
  --info-bg: rgba(109,179,242,.14);
  --gray-bg: rgba(255,255,255,.06);
  --verificar-bg: rgba(242,102,27,.16);
  --verificar-ink: #ff9a5c;
  --vazio: #5c5145;
  --zebra: rgba(255,255,255,.022);
  --row-hover: rgba(250,176,5,.07);
  --panel: rgba(255,255,255,.025);
  --readonly: #231c14;
  --overlay: rgba(0,0,0,.62);
  --toast-bg: #2c2317;
  --toast-ink: #f0e7da;
  --focus: rgba(242,102,27,.15);
  --act-sep: #6b543a;
  --ghost-hover: rgba(255,255,255,.08);
  --on-ok: #0f2b1a;
  --on-bad: #3a0d0d;
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
@font-face { font-family: "Inter"; font-weight: 400; src: url("/static/fonts/inter-400.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 600; src: url("/static/fonts/inter-600.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 700; src: url("/static/fonts/inter-700.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 800; src: url("/static/fonts/inter-800.woff2") format("woff2"); font-display: swap; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* nenhum filho pode estourar a largura da página (mobile) — clip não cria
   scroll container, então o sticky da topbar/thead continua funcionando */
html, body { overflow-x: clip; }
#app { display: flex; flex-direction: column; min-height: 100vh; }
.hidden { display: none !important; }
::placeholder { color: var(--muted); opacity: .75; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { opacity: .6; }
svg.ic { width: 15px; height: 15px; flex: none; display: inline-block; vertical-align: -2px; }
.step .dot .ic { width: 10px; height: 10px; }
.rem-check .ic { width: 11px; height: 11px; }
.ph-del .ic, .rem-del .ic { width: 11px; height: 11px; }
.hist-undo .ic { width: 11px; height: 11px; margin-right: .15rem; }
.empty-icon svg { width: 36px; height: 36px; }
.muted { color: var(--muted); font-size: .85rem; }

/* ---------- LOGIN ---------- */
.login-screen {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(250,176,5,.28), transparent 60%),
    linear-gradient(155deg, var(--espresso) 0%, #3d2408 55%, #7a3c05 100%);
}
.login-card {
  background: var(--card); padding: 2.4rem 2.2rem; border-radius: 18px;
  width: min(390px, 92vw); box-shadow: 0 22px 70px rgba(0,0,0,.45);
  border-top: 5px solid var(--orange);
}
.login-logo { display: flex; justify-content: center; margin-bottom: .7rem; }
.logo-login { height: 64px; filter: drop-shadow(0 4px 14px rgba(232,89,12,.3)); }
.login-sub { text-align: center; color: var(--muted); margin: 0 0 1.5rem; font-size: .88rem; }
.login-disclaimer {
  margin: 1.5rem 0 0; text-align: center;
  font-size: .66rem; line-height: 1.5; color: var(--muted); opacity: .75;
}
.login-card label { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: .9rem; }
.login-card input, .login-card select {
  width: 100%; margin-top: .3rem; padding: .68rem .8rem; border: 1px solid var(--line);
  border-radius: 9px; font-size: .95rem; background: var(--card-2); color: var(--ink);
}
.login-card input:focus, .login-card select:focus {
  outline: 2px solid var(--focus); border-color: var(--orange);
}
.login-error {
  background: var(--bad-bg); color: var(--bad); padding: .55rem .7rem;
  border-radius: 8px; font-size: .85rem; margin-bottom: .8rem;
}

/* ---------- TOPBAR ---------- */
.topbar {
  background: linear-gradient(90deg, var(--espresso), var(--espresso-2));
  color: #fff; display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1.2rem; position: sticky; top: 0; z-index: 30;
  border-bottom: 3px solid var(--orange);
}
.brand { display: flex; align-items: center; gap: .7rem; }
.brand-logo { height: 38px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); }
.brand-sub { font-size: .72rem; color: #d8b78c; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: .8rem; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); }
.live-dot.on { background: #51e08c; box-shadow: 0 0 8px #51e08c; }
.live-dot.off { background: var(--bad); }
.live-label { font-size: .73rem; color: #e8cba0; }
.topbar-actions { display: flex; gap: .3rem; }
.user-chip {
  display: flex; align-items: center; gap: .5rem; background: rgba(250,176,5,.12);
  padding: .28rem .55rem; border-radius: 999px; font-size: .85rem;
}
.role-badge {
  background: var(--orange); padding: .13rem .55rem; border-radius: 999px;
  font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
}
.topbar svg.ic { width: 15px; height: 15px; }

/* ---------- dropdown de menu (topbar) ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70;
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  box-shadow: 0 10px 34px rgba(0,0,0,.3); min-width: 200px; padding: .35rem;
  display: flex; flex-direction: column; animation: fade .12s;
}
.menu-item {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  padding: .6rem .7rem; border-radius: 7px; font-size: .85rem; font-weight: 600;
  color: var(--ink); background: none; border: 0; cursor: pointer;
  text-decoration: none; text-align: left;
}
.menu-item:hover { background: var(--amber-soft); color: var(--espresso); }
.menu-item svg.ic { width: 15px; height: 15px; }

/* ---------- BUTTONS ---------- */
.btn {
  border: 0; border-radius: 9px; padding: .55rem .95rem; font-size: .86rem;
  font-weight: 700; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; gap: .4rem; transition: background .15s, transform .05s;
  color: var(--ink);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-d); }
.btn-amber { background: var(--amber); color: var(--espresso); }
.btn-amber:hover { background: #f0a500; }
.btn-ghost { background: transparent; color: inherit; }
.topbar .btn-ghost { color: #f3dcba; }
.btn-ghost:hover { background: var(--ghost-hover); }
.topbar .btn-ghost:hover { background: rgba(250,176,5,.15); }
.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-sm { padding: .3rem .6rem; font-size: .75rem; }

/* ---------- KPIs ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .8rem; padding: 1rem 1.2rem 0;
}
.kpi {
  background: var(--card); border-radius: var(--r); padding: .85rem 1rem;
  box-shadow: var(--shadow); border-left: 4px solid var(--line);
}
.kpi .k-label {
  font-size: .7rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; font-weight: 700; line-height: 1.3; min-height: 2.6em;
}
.kpi .k-value { font-size: 1.5rem; font-weight: 800; margin-top: .15rem; color: var(--ink); }
.kpi-link { cursor: pointer; transition: transform .1s, border-left-color .1s; }
.kpi-link:hover { transform: translateY(-2px); }
.kpi .k-sub { font-size: .72rem; color: var(--muted); }
.k-m3-sel {
  margin-top: .35rem; width: 100%; font-size: .64rem; font-weight: 700;
  color: var(--muted); background: var(--card-2); border: 1px solid var(--line);
  border-radius: 6px; padding: .2rem .3rem; cursor: pointer;
}
.k-m3-sel:hover, .k-m3-sel:focus { border-color: var(--amber); color: var(--ink); outline: none; }
.kpi.ok { border-left-color: var(--ok); } .kpi.ok .k-value { color: var(--ok); }
.kpi.warn { border-left-color: var(--amber); } .kpi.warn .k-value { color: var(--warn); }
.kpi.bad { border-left-color: var(--bad); } .kpi.bad .k-value { color: var(--bad); }
.kpi.info { border-left-color: var(--info); } .kpi.info .k-value { color: var(--info); }
.kpi.orange { border-left-color: var(--orange); } .kpi.orange .k-value { color: var(--orange); }

/* ---------- TOOLBAR ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: .55rem; align-items: center;
  padding: .9rem 1.2rem;
}
.toolbar .search { flex: 1 1 240px; }
.toolbar input, .toolbar select {
  padding: .52rem .7rem; border: 1px solid var(--line); border-radius: 9px;
  font-size: .86rem; background: var(--card-2); color: var(--ink);
}
.toolbar input:focus, .toolbar select:focus, .drawer input:focus, .drawer select:focus {
  outline: 2px solid var(--focus); border-color: var(--orange);
}

/* ---------- TABLE ---------- */
/* ---------- scrollbars: invisíveis, rolagem intacta ---------- */
html { scrollbar-width: none; }
::-webkit-scrollbar { width: 0; height: 0; display: none; }
/* a tabela larga mantém uma dica fina de rolagem — só aparece no hover (desktop) */
@media (hover: hover) {
  .table-wrap { scrollbar-width: thin; scrollbar-color: transparent transparent; }
  .table-wrap:hover { scrollbar-color: var(--line) transparent; }
  .table-wrap::-webkit-scrollbar { display: block; width: 6px; height: 6px; }
  .table-wrap::-webkit-scrollbar-thumb { background: transparent; border-radius: 99px; }
  .table-wrap:hover::-webkit-scrollbar-thumb { background: var(--line); }
  .table-wrap::-webkit-scrollbar-corner { background: transparent; }
}

.table-wrap {
  margin: 0 1.2rem 1.4rem; background: var(--card); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 320px);
}
#grid { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 1060px; font-variant-numeric: tabular-nums; }
#grid thead th {
  position: sticky; top: 0; background: var(--espresso); color: #e9cfa8;
  text-align: left; padding: .65rem .8rem; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .6px; white-space: nowrap;
  user-select: none; z-index: 2;
}
#grid thead th[data-sort] { cursor: pointer; }
#grid thead th[data-sort]:hover { color: #fff; }
#grid tbody td { padding: .58rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
#grid tbody tr { cursor: pointer; }
#grid tbody tr:hover { background: var(--row-hover); }
#grid td.num, #grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.td-cliente { font-weight: 600; max-width: 290px; }
.td-oco { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--warn); font-size: .8rem; }
.td-fotos { text-align: center; }
.filial-tag {
  font-size: .66rem; font-weight: 800; padding: .15rem .45rem; border-radius: 6px;
  background: var(--gray-bg); color: var(--muted); white-space: nowrap;
}
.filial-tag.cba { background: var(--amber-soft); color: var(--amber); }
.foto-count {
  display: inline-flex; align-items: center; gap: .2rem;
  background: var(--amber-soft); color: var(--amber); border-radius: 6px;
  font-size: .72rem; font-weight: 800; padding: .15rem .45rem;
}
.foto-count svg { width: 12px; height: 12px; }
.empty { padding: 3.5rem 2rem; text-align: center; color: var(--muted); }
.empty-icon { font-size: 2rem; opacity: .5; margin-bottom: .6rem; }
.empty-title { font-size: 1rem; font-weight: 700; color: var(--ink); margin-bottom: .3rem; }
.empty-sub { font-size: .82rem; margin-bottom: 1rem; }

/* ---------- barra do dia ---------- */
.daybar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .55rem 1.4rem; flex-wrap: wrap;
  margin: .75rem 1.2rem 0; padding: .68rem 1.05rem;
  background: var(--card); border-radius: var(--r);
  box-shadow: var(--shadow); border-left: 4px solid var(--orange);
}
.day-hello { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap; }
#day-greet { font-size: 1.02rem; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.day-date { font-size: .78rem; color: var(--muted); }
.day-date::before { content: "·"; margin-right: .55rem; opacity: .6; }
.day-date::first-letter { text-transform: uppercase; }
.day-summary { display: flex; gap: .45rem; flex-wrap: wrap; }
.day-chip {
  display: inline-flex; align-items: center; gap: .42rem;
  font-size: .74rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: .3rem .75rem;
}
.day-chip b { color: var(--ink); }
.day-chip .dot { width: 7px; height: 7px; border-radius: 99px; flex: none; }
.dot.d-info { background: var(--info); }
.dot.d-warn { background: var(--warn); }
.dot.d-bad { background: var(--bad); }
.dot.d-mut { background: var(--muted); }

/* ---------- rodapé ---------- */
.app-footer {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem 1.4rem; flex-wrap: wrap;
  padding: .75rem 1.2rem;
  background: var(--card); border-top: 1px solid var(--line);
  font-size: .68rem; color: var(--muted);
}
.foot-brand { font-weight: 700; color: var(--ink); }
.foot-note { opacity: .85; }
@media (max-width: 640px) {
  .app-footer { justify-content: center; text-align: center; }
}

/* ---------- BADGES ---------- */
.badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.b-entregue, .b-sim { background: var(--ok-bg); color: var(--ok); }
.b-atrasado { background: var(--bad-bg); color: var(--bad); }
.b-proximo { background: var(--warn-bg); color: var(--warn); }
.b-noprazo { background: var(--info-bg); color: var(--info); }
.b-nao { background: var(--gray-bg); color: var(--muted); }
.b-recusado { background: var(--bad-bg); color: var(--bad); }
.b-verificar { background: var(--verificar-bg); color: var(--verificar-ink); }
.b-retido {
  background: var(--warn-bg); color: var(--warn);
  font-size: .6rem; padding: .14rem .45rem; vertical-align: 1px;
}
.b-merchan { background: var(--merchan-bg); color: var(--merchan); }
.b-vazio { color: var(--vazio); }

/* ---------- DRAWER ---------- */
.backdrop {
  position: fixed; inset: 0; background: var(--overlay); z-index: 40;
  animation: fade .18s;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 96vw);
  background: var(--card); z-index: 50; box-shadow: -14px 0 44px rgba(0,0,0,.28);
  display: flex; flex-direction: column; animation: slide .2s ease;
}
@keyframes slide { from { transform: translateX(60px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 1.1rem 1.45rem .75rem; border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, var(--card-2), var(--card));
}
.drawer-head h2 { margin: 0; font-size: 1.15rem; color: var(--ink); }
.drawer-body { overflow-y: auto; padding: 1.15rem 1.45rem 2.2rem; flex: 1; }

/* stepper do ciclo do pedido */
.stepper {
  display: flex; align-items: flex-start; margin: .2rem 0 1.1rem;
}
.step { flex: 1; text-align: center; position: relative; }
.step::before {
  content: ""; position: absolute; top: 11px; left: -50%; width: 100%;
  height: 2px; background: var(--line); z-index: 0;
}
.step:first-child::before { display: none; }
.step .dot {
  width: 22px; height: 22px; border-radius: 50%; margin: 0 auto .25rem;
  background: var(--gray-bg); border: 2px solid var(--line); position: relative;
  z-index: 1; display: grid; place-items: center; color: var(--muted);
  font-size: .65rem; font-weight: 800;
}
.step.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.done::before { background: var(--ok); }
.step.warn .dot { background: var(--bad); border-color: var(--bad); color: #fff; }
.step.warn::before { background: var(--bad); }
.step .s-label { font-size: .68rem; font-weight: 700; color: var(--ink); }
.step .s-sub { font-size: .62rem; color: var(--muted); line-height: 1.25; min-height: 1.6em; }
.step.done .s-label { color: var(--ok); }
.step.warn .s-label { color: var(--bad); }

fieldset {
  border: 1px solid var(--line); border-radius: 12px; margin: 0 0 1.15rem;
  padding: .95rem 1.1rem 1.15rem; background: var(--panel);
}
legend {
  font-size: .72rem; font-weight: 800; color: var(--orange);
  text-transform: uppercase; letter-spacing: .6px; padding: 0 .45rem;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .95rem 1rem; }
.grid2 .span2 { grid-column: span 2; }
.drawer label { display: block; font-size: .74rem; font-weight: 700; color: var(--muted); }
.drawer input, .drawer select {
  width: 100%; margin-top: .38rem; padding: .58rem .7rem; font-size: .9rem;
  border: 1.5px solid var(--line); border-radius: 9px; background: var(--card-2); color: var(--ink);
}
.drawer input:focus, .drawer select:focus {
  outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--focus);
}
.drawer input[readonly], .drawer select[disabled] { background: var(--readonly); color: var(--muted); }
.drawer-status { display: flex; gap: .5rem; margin: .4rem 0 .9rem; flex-wrap: wrap; align-items: center; }
.drawer-actions { display: flex; gap: .6rem; }
.drawer-actions #d-delete { margin-right: auto; }

/* ---------- FOTOS ---------- */
.photos-section { margin: 0 0 1rem; }
.photo-cat { margin-bottom: .9rem; }
.photo-cat-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .4rem;
}
.photo-cat-head .pc-label { font-size: .75rem; font-weight: 800; color: var(--ink); }
.photo-cat-head .pc-hint { font-size: .65rem; color: var(--muted); }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; }
.thumb {
  width: 76px; height: 76px; border-radius: 9px; overflow: hidden; position: relative;
  border: 1px solid var(--line); cursor: zoom-in; background: var(--gray-bg);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph-del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  border-radius: 50%; border: 0; background: rgba(201,42,42,.92); color: #fff;
  font-size: 11px; line-height: 1; cursor: pointer; display: none;
}
.thumb:hover .ph-del { display: grid; place-items: center; }
/* touch não tem hover — o botão de apagar foto fica sempre visível */
@media (hover: none) { .thumb .ph-del { display: grid; place-items: center; } }
.thumb-add {
  width: 76px; height: 76px; border-radius: 9px; border: 2px dashed var(--line);
  background: transparent; color: var(--muted); cursor: pointer; font-size: .65rem;
  font-weight: 700; display: grid; place-items: center; gap: 2px; padding: 4px;
}
.thumb-add:hover { border-color: var(--orange); color: var(--orange); background: var(--amber-soft); }
.ph-meta { font-size: .62rem; color: var(--muted); margin-top: .15rem; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(20,13,5,.88); z-index: 90;
  display: grid; place-items: center; cursor: zoom-out; animation: fade .15s;
}
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 10px; box-shadow: 0 10px 60px rgba(0,0,0,.6); }
.lightbox .lb-cap {
  position: absolute; bottom: 18px; left: 0; right: 0; text-align: center;
  color: #f3e4c8; font-size: .82rem;
}

/* ---------- HISTORY / ACTIVITY (timeline) ---------- */
.history h3 { font-size: .82rem; color: var(--ink); margin: 1.2rem 0 .5rem; text-transform: uppercase; letter-spacing: .5px; }
#d-history, .activity-list { list-style: none; margin: 0; padding: 0; }
.hist-ev {
  position: relative; padding: .55rem 0 .6rem 1.4rem;
  border-bottom: 1px dashed var(--line);
}
.hist-ev:last-child { border-bottom: none; }
.hist-ev::before {
  content: ""; position: absolute; left: 5px; top: 0; bottom: 0;
  width: 2px; background: var(--line);
}
.hist-ev:first-child::before { top: .9rem; }
.hist-ev:last-child::before { bottom: auto; height: .9rem; }
.hist-dot {
  position: absolute; left: 0; top: .85rem; width: 12px; height: 12px;
  border-radius: 50%; background: var(--card-2); border: 2.5px solid var(--muted);
}
.hist-a-create .hist-dot { border-color: var(--ok); }
.hist-a-update .hist-dot { border-color: var(--amber); }
.hist-a-delete .hist-dot { border-color: var(--bad); }
.hist-a-photo .hist-dot { border-color: var(--info); }
.hist-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.hist-act { font-size: .8rem; color: var(--ink); }
.hist-undo {
  font-size: .64rem; font-weight: 800; color: var(--warn);
  background: transparent; border: 1.5px solid var(--warn); border-radius: 999px;
  padding: .14rem .5rem; cursor: pointer; white-space: nowrap;
}
.hist-undo:hover { background: var(--warn); color: #fff; }
.hist-diff {
  display: flex; justify-content: space-between; gap: .6rem;
  font-size: .74rem; padding: .14rem 0;
}
.hist-f { color: var(--muted); font-weight: 600; }
.hist-v { color: var(--ink); text-align: right; }
.hist-v s { color: var(--muted); text-decoration-color: var(--bad); opacity: .8; }
.hist-v i { font-style: normal; color: var(--muted); padding: 0 .3rem; }
.hist-v b { font-weight: 700; }
.hist-meta { font-size: .66rem; color: var(--muted); margin-top: .3rem; }
.hist-photo .hist-f { color: var(--info); }
.hist-empty { padding: .6rem 0; list-style: none; }
/* mini-meta reaproveitada por paletes e caixa de dúvidas */
.hist-when { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.hist-user { font-weight: 700; color: var(--ink); }

/* ---------- MODAL ---------- */
.modal {
  position: fixed; inset: 0; background: var(--overlay); z-index: 60;
  display: grid; place-items: center; animation: fade .15s;
}
.modal-card {
  background: var(--card); border-radius: 14px; width: min(640px, 94vw);
  max-height: 80vh; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.2rem .6rem; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 1.02rem; color: var(--ink); }
.activity-list { overflow-y: auto; padding: .4rem 1.2rem 1.2rem; }

/* ---------- DIÁLOGO PRÓPRIO ---------- */
.modal { z-index: 70; }
.dlg-card { width: min(400px, 92vw); animation: dlgpop .16s ease; }
@keyframes dlgpop { from { transform: scale(.94) translateY(8px); opacity: 0; } }
.dlg-head { border-bottom: none; padding-bottom: 0; }
.dlg-sub {
  margin: 0; padding: .15rem 1.2rem .7rem; font-size: .82rem; color: var(--muted);
  white-space: pre-line;
}
.dlg-form { padding: 0 1.2rem 1.15rem; display: flex; flex-direction: column; gap: .9rem; }
.dlg-label { display: block; font-size: .74rem; font-weight: 700; color: var(--muted); }
.dlg-label input, .dlg-label select {
  width: 100%; margin-top: .35rem; padding: .6rem .75rem; font-size: .95rem;
  border: 1.5px solid var(--line); border-radius: 9px; background: var(--card-2); color: var(--ink);
}
.dlg-label select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a08d78' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 15px;
}
.dlg-label input:focus, .dlg-label select:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--focus); }
.dlg-actions { display: flex; justify-content: flex-end; gap: .55rem; margin-top: .2rem; }

/* selects nativos fora do visual padrão do navegador */
.toolbar select, .drawer select, .users-form select, .k-m3-sel {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a08d78' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .6rem center; background-size: 14px;
}
select option { background: var(--card); color: var(--ink); }

/* ---------- USUÁRIOS ---------- */
.users-body { padding: .4rem 1.2rem 1.2rem; max-height: 70vh; overflow-y: auto; }
.users-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.u-item {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .55rem .2rem; border-bottom: 1px dashed var(--line);
}
.u-id { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .82rem; }
.u-login { color: var(--muted); font-size: .74rem; }
.u-role {
  font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
  background: var(--gray-bg); color: var(--muted); padding: .1rem .45rem; border-radius: 999px;
}
.u-role-admin { background: var(--amber-soft); color: var(--amber); }
.u-eu { font-size: .62rem; color: var(--ok); font-weight: 800; }
.u-acts { display: flex; gap: .4rem; }
.u-btn {
  font-size: .66rem; font-weight: 800; color: var(--muted);
  background: transparent; border: 1.5px solid var(--line); border-radius: 999px;
  padding: .18rem .55rem; cursor: pointer;
}
.u-btn:hover { border-color: var(--orange); color: var(--orange); }
.u-del:hover { border-color: var(--bad); color: var(--bad); }
.users-sub {
  font-size: .78rem; color: var(--ink); margin: .9rem 0 .5rem;
  text-transform: uppercase; letter-spacing: .5px;
}
.users-form { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.users-form input, .users-form select {
  padding: .55rem .7rem; font-size: .86rem; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 8px; background: var(--card-2);
}
.users-form input:focus, .users-form select:focus {
  outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--focus);
}
.users-form .btn-primary { grid-column: 1 / -1; }

/* ---------- TRANSPORTADORAS ---------- */
.transps-form { display: flex; gap: .55rem; }
.transps-form input {
  flex: 1; padding: .55rem .7rem; font-size: .86rem; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 8px; background: var(--card-2);
}
.transps-form input:focus {
  outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--focus);
}
.transps-form .btn-primary { white-space: nowrap; }
.t-hint { font-size: .72rem; margin-top: .8rem; line-height: 1.45; }

/* ---------- AJUDA ---------- */
.ajuda-body { overflow-y: auto; padding: .5rem 1.3rem 1.3rem; }
.ajuda-sec { margin-top: .9rem; }
.ajuda-sec h3 {
  font-size: .72rem; font-weight: 800; color: var(--orange);
  text-transform: uppercase; letter-spacing: .6px; margin: 0 0 .5rem;
}
.ajuda-list { margin: 0; padding-left: 1.1rem; font-size: .84rem; line-height: 1.55; color: var(--ink); }
.ajuda-list li { margin-bottom: .45rem; }
.ajuda-list b { color: var(--ink); }
#ajuda-form { display: flex; flex-direction: column; gap: .6rem; }
#ajuda-msg {
  width: 100%; resize: vertical; min-height: 72px; padding: .65rem .75rem;
  font-size: .88rem; font-family: inherit; border: 1.5px solid var(--line);
  border-radius: 9px; background: var(--card-2); color: var(--ink);
}
#ajuda-msg:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--focus); }
.ajuda-inbox { list-style: none; margin: 0; padding: 0; font-size: .82rem; }
.ajuda-inbox li {
  display: flex; flex-wrap: wrap; gap: .45rem; padding: .45rem 0;
  border-bottom: 1px solid var(--line); align-items: baseline;
}
.inbox-msg { flex-basis: 100%; white-space: pre-wrap; }

/* ---------- TOASTS ---------- */
#toasts { position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 95; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  background: var(--toast-bg); color: var(--toast-ink); padding: .7rem 1rem; border-radius: 10px;
  font-size: .85rem; box-shadow: var(--shadow); animation: slide .2s;
  display: flex; gap: .5rem; align-items: center; max-width: 340px;
  border-left: 3px solid var(--amber);
}
.toast.ok { background: var(--ok); color: var(--on-ok); border-left-color: var(--toast-ink); }
.toast.err { background: var(--bad); color: var(--on-bad); border-left-color: var(--toast-ink); }

/* ---------- CHIPS DE FILA ---------- */
.chips {
  display: flex; gap: .45rem; flex-wrap: wrap; margin: 0 1.2rem .75rem;
}
.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .38rem .8rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: var(--card); color: var(--muted); border: 1.5px solid var(--line);
  cursor: pointer; transition: all .12s;
}
.chip:hover { border-color: var(--amber); color: var(--ink); }
.chip.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.chip-n {
  background: var(--gray-bg); color: var(--muted); border-radius: 999px;
  font-size: .68rem; font-weight: 800; padding: .08rem .45rem; min-width: 1.4rem;
  text-align: center;
}
.chip.on .chip-n { background: rgba(255,255,255,.25); color: #fff; }
.chip-atrasada .chip-n { background: var(--bad-bg); color: var(--bad); }
.chip-atrasada.on .chip-n { background: rgba(255,255,255,.25); color: #fff; }
.chip-retido .chip-n { background: var(--warn-bg); color: var(--warn); }
.chip-retido.on .chip-n { background: rgba(255,255,255,.25); color: #fff; }
.chip-devolucao .chip-n { background: var(--bad-bg); color: var(--bad); }
.chip-devolucao.on .chip-n { background: rgba(255,255,255,.25); color: #fff; }
.chip-merchan .chip-n { background: var(--merchan-bg); color: var(--merchan); }
.chip-merchan.on .chip-n { background: rgba(255,255,255,.25); color: #fff; }
.chip-concluida .chip-n { background: var(--ok-bg); color: var(--ok); }
.chip-concluida.on .chip-n { background: rgba(255,255,255,.25); color: #fff; }

/* ---------- LINHAS POR ETAPA ---------- */
#grid tbody tr:nth-child(even) { background: var(--zebra); }
#grid tbody tr:hover { background: var(--row-hover); }
#grid tbody tr.tr-late td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
#grid tbody tr.tr-devolucao td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
#grid tbody tr.tr-concluida td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
#grid tbody tr.tr-em_rota td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
#grid tbody tr.tr-retido td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
#grid tbody tr.tr-merchan td:first-child { box-shadow: inset 3px 0 0 var(--merchan); }
.rel-tag {
  font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
  background: var(--amber-soft); color: var(--amber); padding: .1rem .35rem;
  border-radius: 5px; vertical-align: 1px; margin-left: .2rem;
}

/* ---------- AÇÃO RÁPIDA ---------- */
.col-acao { text-align: center; white-space: nowrap; }
.act-group { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.btn-act {
  width: 92px; padding: .32rem .2rem; text-align: center;
  font-size: .72rem; font-weight: 800; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card-2); color: var(--ink);
  cursor: pointer; transition: all .12s; white-space: nowrap; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis;
}
.btn-act:hover { border-color: var(--orange); background: var(--orange); color: #fff; }
.act-separar { border-color: var(--act-sep); }
.act-saiu { border-color: var(--amber); color: var(--amber); }
.act-entregue { border-color: var(--ok); color: var(--ok); }
.act-canhoto { border-color: var(--info); color: var(--info); }
.act-retido { border-color: var(--warn); color: var(--warn); }
.act-retido:hover { background: var(--warn); border-color: var(--warn); color: #fff; }
.act-merchan { border-color: var(--merchan); color: var(--merchan); }
.act-merchan:hover { background: var(--merchan); border-color: var(--merchan); color: #fff; }
.act-ghost { border-color: var(--line); color: var(--muted); }
.act-ghost:hover { background: var(--card-2); border-color: var(--muted); color: var(--ink); }

/* ---------- PALETES (livro-caixa) ---------- */
.fiscais { margin-top: .8rem; border-top: 1px dashed var(--line); padding-top: .55rem; }
.fiscais summary {
  font-size: .73rem; color: var(--muted); cursor: pointer; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: .55rem;
  list-style: none; display: flex; align-items: center; gap: .5rem;
}
.fiscais summary::-webkit-details-marker { display: none; }
.fiscais summary::before {
  content: ""; width: 7px; height: 7px; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .15s;
}
.fiscais[open] summary::before { transform: rotate(45deg); }
.fiscais summary:hover { color: var(--ink); }
.erp-extras { margin-top: .7rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.erp-title {
  width: 100%; font-size: .68rem; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.erp-chip {
  font-size: .73rem; color: var(--muted); background: var(--readonly);
  border: 1px solid var(--line); border-radius: 999px; padding: .22rem .6rem;
}
.erp-chip b { color: var(--ink); font-weight: 700; margin-right: .25rem; }
.modal-wide { max-width: 660px; width: 94vw; }
.pl-card { max-height: 88vh; }
.pl-body { overflow-y: auto; padding: .4rem 1.3rem 1.2rem; }
.pl-hero {
  display: flex; align-items: center; gap: 1.1rem; margin: .6rem 0 .9rem;
  padding: .95rem 1.15rem; border-radius: 12px;
  background: linear-gradient(135deg, var(--espresso) 0%, #4a2a08 100%);
  color: #e9cfa8;
}
.pl-hero-n { font-size: 2.6rem; font-weight: 800; line-height: 1; min-width: 2ch; text-align: center; }
.pl-hero-n.pl-warn { color: var(--amber); }
.pl-hero-n.pl-ok { color: #51e08c; }
.pl-hero-info { flex: 1; }
.pl-hero-label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.pl-bar {
  height: 6px; border-radius: 999px; background: rgba(255,255,255,.14);
  margin: .45rem 0 .35rem; overflow: hidden;
}
.pl-bar-out { display: block; height: 100%; background: #51e08c; border-radius: 999px; transition: width .3s; }
.pl-hero-sub { font-size: .72rem; opacity: .85; }
.pl-ledger { margin-bottom: .9rem; }
.pl-row {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .2rem;
  border-bottom: 1px solid var(--line); font-size: .84rem;
}
.pl-row-name { font-weight: 800; color: var(--ink); min-width: 90px; }
.pl-row-mov { color: var(--muted); font-size: .78rem; flex: 1; }
.pl-row-mov b { color: var(--ink); }
.pl-row-saldo { font-size: .74rem; font-weight: 800; padding: .18rem .55rem; border-radius: 999px; white-space: nowrap; }
.pl-deve { background: var(--warn-bg); color: var(--warn); }
.pl-zerado { background: var(--ok-bg); color: var(--ok); }
.pl-empty { color: var(--muted); font-size: .8rem; padding: .6rem 0; }
.pl-form {
  display: flex; flex-direction: column; gap: .55rem;
  padding: .8rem; border-radius: 10px; background: var(--panel);
  border: 1.5px dashed var(--line);
}
.pl-fields { display: flex; gap: .45rem; flex-wrap: wrap; }
.pl-form input {
  padding: .5rem .65rem; border: 1.5px solid var(--line); border-radius: 8px;
  font-size: .82rem; background: var(--card-2); color: var(--ink);
}
.pl-form input[name=motorista] { flex: 1.3; min-width: 110px; }
.pl-form input[name=qtd] { width: 62px; }
.pl-form input[name=num_nota] { width: 105px; }
.pl-form input[name=obs] { flex: 1; min-width: 80px; }
.pl-toggle { display: flex; gap: .4rem; }
.pl-tipo {
  padding: .4rem .85rem; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--card-2); color: var(--ink); font-weight: 800; font-size: .78rem; cursor: pointer;
}
.pl-tipo.on { background: var(--orange); color: #fff; border-color: var(--orange); }
.pl-hist-title {
  font-size: .72rem; margin: 1rem 0 .3rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.pl-moves { list-style: none; padding: 0; margin: 0; max-height: 190px; overflow: auto; font-size: .78rem; }
.pl-moves li { display: flex; gap: .5rem; align-items: center; padding: .32rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pl-badge { font-weight: 800; padding: .08rem .45rem; border-radius: 6px; }
.pl-badge.pl-saida { background: var(--bad-bg); color: var(--bad); }
.pl-badge.pl-retorno { background: var(--ok-bg); color: var(--ok); }
.pl-by { margin-left: auto; font-size: .68rem; }

/* ---------- NOTIFICAÇÕES ---------- */
.btn-icon { position: relative; padding: .45rem .55rem; }
.notif-badge {
  position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px;
  border-radius: 999px; background: var(--bad); color: #fff; font-size: .62rem;
  font-weight: 800; display: grid; place-items: center; padding: 0 4px;
}
.notif-panel {
  position: fixed; top: 62px; right: 14px; width: min(360px, 92vw); z-index: 65;
  background: var(--card); border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.55);
  padding: .9rem 1rem 1rem; animation: dlgpop .14s ease;
}
.notif-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .6rem; }
.notif-title { font-size: .88rem; font-weight: 800; color: var(--ink); flex: 1; }
.notif-mini {
  border: 1px solid var(--line); background: var(--card-2); color: var(--muted);
  border-radius: 7px; padding: .28rem .55rem; font-size: .7rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.notif-mini:hover { color: var(--ink); border-color: var(--muted); }
.notif-sec-title {
  font-size: .68rem; font-weight: 800; color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; margin: .8rem 0 .35rem;
}
.notif-alerts { max-height: 230px; overflow-y: auto; margin: 0 -.25rem; padding: 0 .25rem; }
.notif-item {
  display: flex; gap: .55rem; align-items: center; font-size: .8rem; width: 100%;
  padding: .5rem .6rem; border-radius: 8px; margin-bottom: .3rem;
  border: 0; font-family: inherit; cursor: pointer; text-align: left;
  transition: opacity .12s, transform .12s;
}
button.notif-item:hover { transform: translateX(2px); }
.notif-item.n-ok { cursor: default; }
.n-txt { flex: 1; }
.n-arrow { font-size: 1.05rem; font-weight: 800; opacity: .35; flex-shrink: 0; }
.notif-item:hover .n-arrow { opacity: .9; }
.n-seen { opacity: .4; }
.n-seen:hover { opacity: .75; }
.n-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.n-warn { background: var(--warn-bg); color: var(--warn); }
.n-warn .n-dot { background: var(--warn); }
.n-bad { background: var(--bad-bg); color: var(--bad); }
.n-bad .n-dot { background: var(--bad); }
.n-info { background: var(--info-bg); color: var(--info); }
.n-info .n-dot { background: var(--info); }
.n-ok { color: var(--ok); font-size: .8rem; }
.notif-reminders { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow: auto; }
.notif-reminders li {
  display: flex; align-items: center; gap: .55rem; padding: .4rem .1rem;
  border-bottom: 1px solid var(--line); font-size: .82rem;
}
.rem-check {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line);
  background: var(--card-2); color: var(--ok); font-weight: 800; font-size: .75rem;
  cursor: pointer; flex-shrink: 0; line-height: 1;
}
.rem-done .rem-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.rem-done .rem-txt { text-decoration: line-through; color: var(--muted); }
.rem-txt { flex: 1; }
.rem-by { font-size: .66rem; color: var(--muted); }
.rem-del {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: .72rem; padding: .15rem .3rem;
}
.rem-del:hover { color: var(--bad); }
.rem-empty { border: none !important; font-size: .78rem; }
.rem-form { display: flex; gap: .4rem; margin-top: .6rem; }
.rem-form input {
  flex: 1; padding: .45rem .65rem; font-size: .8rem; border: 1.5px solid var(--line);
  border-radius: 8px; background: var(--card-2); color: var(--ink);
}
.rem-form input:focus { outline: none; border-color: var(--orange); }
.btn-sm { padding: .4rem .7rem; font-size: .85rem; }

/* ---------- MERCHAN (aguardando coleta) ---------- */
.mc-body { overflow-y: auto; padding: .4rem 1.3rem 1.3rem; max-height: 74vh; }
.mc-count { font-size: .85rem; color: var(--muted); margin-bottom: .7rem; }
.mc-count b { color: var(--merchan); font-size: 1.05rem; }
.mc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.mc-item {
  display: flex; align-items: center; gap: .8rem;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 10px;
  border-left: 3px solid var(--merchan); padding: .65rem .85rem;
}
.mc-main { flex: 1; min-width: 0; }
.mc-top { font-size: .9rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: baseline; }
.mc-tags { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-top: .35rem; }
.mc-obs {
  font-size: .78rem; color: var(--muted); font-style: italic;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mc-meta { font-size: .74rem; margin-top: .3rem; }
.mc-actions { display: flex; gap: .35rem; flex: none; }
.mc-coletar { border-color: var(--merchan); color: var(--merchan); }
.mc-coletar:hover { background: var(--merchan); border-color: var(--merchan); color: #fff; }
.mc-sub {
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); margin: 1.1rem 0 .55rem;
}
.mc-empty { padding: 1.4rem .5rem; text-align: center; font-size: .85rem; line-height: 1.5; }
#mc-done .mc-item { border-left-color: var(--ok); opacity: .82; }

@media (max-width: 760px) {
  /* topbar em 2 linhas limpas: identidade+status na 1ª, ações (só ícone) na 2ª.
     nada aqui pode passar de 100vw — era isso que "quebrava" o mobile inteiro */
  .topbar { flex-wrap: wrap; gap: .35rem .6rem; padding: .5rem .7rem; }
  .topbar-right { flex-wrap: wrap; gap: .3rem; flex: 1; justify-content: flex-end; }
  .live-label { display: none; }
  .topbar .btn { padding: .42rem .55rem; }
  .topbar-actions { order: 4; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; gap: .15rem; }
  .topbar-actions .btn { font-size: 0; gap: 0; flex: none; }
  .topbar-actions .menu-wrap { flex: none; }
  #user-name { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .grid2 .span2 { grid-column: span 1; }
  .step .s-sub { display: none; }
  .toolbar { flex-wrap: wrap; padding: .7rem .6rem; gap: .45rem; }
  .toolbar .search { min-width: 100%; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .chips { margin: 0 .6rem .6rem; gap: .35rem; }
  .chip { font-size: .72rem; padding: .32rem .6rem; }
  /* a tabela vira um painel próprio: rola nos dois eixos dentro do card,
     com altura generosa — a página continua rolando normal */
  .table-wrap { margin: 0 .6rem 1rem; max-height: calc(100dvh - 170px); }
  #grid { font-size: .78rem; min-width: 900px; }
  .notif-panel { top: 8px; right: 8px; left: 8px; width: auto; max-height: 80dvh; }
  .drawer { width: 100%; max-width: none; }
  .drawer-head { position: sticky; top: 0; background: var(--card); z-index: 3; }
}
