/* =====================================================================
   GT Pneus — design moderno (claro/escuro), responsivo para celular, tablet e PC.
   Os campos se reorganizam pela largura disponível (container queries), sem encolher nem sobrepor.
   ===================================================================== */
:root {
  --navy: #0b1437; --navy-2: #162257; --navy-3: #2a3a85;
  --red: #e3262d; --red-2: #c3161d; --red-soft: #fdecec;
  --blue: #2f6fed; --blue-2: #1f5bd6; --blue-soft: #eaf1ff;
  --green: #16a34a; --green-soft: #e7f7ee; --orange: #ea7a0c; --yellow: #eab308;
  --bg: #f3f5fa; --card: #ffffff; --card-2: #f8fafc; --head: #f1f4f9; --head-txt: #0f172a;
  --border: #dfe4ee; --border-2: #edf0f6; --txt: #0f172a; --muted: #64748b;
  --input: #ffffff; --input-ro: #f4f6fa; --row-alt: #fafbfd; --row-hover: #f2f6ff;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 6px 20px rgba(15,23,42,.05);
  --shadow-lg: 0 18px 50px rgba(15,23,42,.18);
  --radius: 14px; --radius-sm: 10px; --sidebar: 252px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1020; --card: #121a30; --card-2: #0f1628; --head: #18213b; --head-txt: #e7ebf7;
  --border: #26304f; --border-2: #1c2541; --txt: #e7ebf7; --muted: #94a0bf;
  --input: #0f1628; --input-ro: #141c33; --row-alt: #111933; --row-hover: #1a2546;
  --blue: #5b8cff; --blue-2: #4677f0; --blue-soft: #18264a; --red-soft: #3a1418; --green-soft: #0f2d1d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--txt); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.r { text-align: right; } .c { text-align: center; }
.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
code { background: var(--head); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
::selection { background: rgba(47,111,237,.2); }

/* ---------- layout ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: linear-gradient(180deg, #070d27 0%, var(--navy) 45%, #0d1844 100%); color: #c9d0ee;
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .22s ease; }
.sidebar .brand { padding: 20px 18px 14px; }
.sidebar .brand img { width: 100%; display: block; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.sidebar .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #7d87b8; margin: 16px 10px 6px; font-weight: 600; }
.sidebar a.item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: #d6dbf3; text-decoration: none; font-weight: 500; font-size: 14px; margin: 1px 0; transition: background .15s; }
.sidebar a.item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar a.item.on { background: linear-gradient(90deg, var(--red), #f0444a); color: #fff; box-shadow: 0 6px 16px rgba(227,38,45,.35); }
.sidebar a.item .ic { width: 18px; height: 18px; opacity: .9; }
.sidebar .me { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); cursor: pointer; }
.sidebar .me:hover { background: rgba(255,255,255,.05); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--navy-3); color: #fff; display: grid; place-items: center; font-weight: 700; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar .me .n { font-weight: 600; color: #fff; font-size: 13.5px; line-height: 1.2; }
.sidebar .me .p { font-size: 12px; color: #8f98c6; }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.scrim { display: none; }

/* ---------- cabeçalho da página: título + ações ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border); padding: 10px 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 64px; }
.topbar .menu-btn { display: none; background: none; border: 0; color: var(--txt); padding: 6px; cursor: pointer; border-radius: 10px; }
.topbar .menu-btn:hover { background: var(--head); }
.topbar .title { flex: 1 1 220px; min-width: 0; font-weight: 700; font-size: 19px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--txt); order: 1; }
.topbar .title small { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .conexao { order: 2; }
.toolbar { order: 3; display: flex; gap: 8px; align-items: center; overflow-x: auto; scrollbar-width: none; max-width: 100%; padding: 2px; }
.toolbar::-webkit-scrollbar { display: none; }
.toolbar button { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--txt); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; text-transform: none; flex: none; }
.toolbar button .ic { width: 17px; height: 17px; }
.toolbar button:hover { background: var(--head); border-color: #c9d1e2; }
.toolbar button:active { transform: translateY(1px); }
.toolbar button.primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(227,38,45,.25); }
.toolbar button.primary:hover { background: var(--red-2); }
.toolbar button.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--border)); }
.toolbar button.danger:hover { background: var(--red-soft); }
.toolbar button:disabled { opacity: .45; cursor: default; }
.toolbar button[data-mais] { display: none; }
.content { padding: 18px 20px 48px; flex: 1; width: 100%; max-width: 1680px; margin: 0 auto; }
.pad { padding: 14px 2px; }

/* ---------- abas ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 16px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; scrollbar-width: none; box-shadow: var(--shadow); }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { padding: 9px 16px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; position: static; text-transform: none; letter-spacing: 0; }
.tabs button:hover { color: var(--txt); background: var(--head); }
.tabs button.on { background: var(--navy); color: #fff; box-shadow: 0 4px 12px rgba(11,20,55,.25); border: 0; }
:root[data-theme="dark"] .tabs button.on { background: var(--blue); }

/* ---------- cartões (painéis) ---------- */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 16px; overflow: hidden; box-shadow: var(--shadow); }
.panel > h3 { margin: 0; background: transparent; color: var(--head-txt); font-size: 15.5px; font-weight: 700; padding: 14px 18px 4px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; letter-spacing: -.005em; }
.panel > h3::before { content: ''; width: 4px; height: 16px; border-radius: 4px; background: var(--red); flex: none; }
.panel > h3 .ic { width: 18px; height: 18px; color: var(--muted); }
.panel > h3 .sp { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.panel > .body { padding: 10px 18px 18px; }
.panel.collapsed > .body { display: none; }
.panel.collapsed > h3 { padding-bottom: 14px; }
.panel > h3.toggle { cursor: pointer; user-select: none; }
.panel > h3.toggle::after { content: '▾'; margin-left: 6px; color: var(--muted); font-size: 12px; order: 99; }
.panel.collapsed > h3.toggle::after { content: '▸'; }
.panel[data-filtros] { margin: 0 0 16px !important; border-radius: var(--radius) !important; border: 1px solid var(--border) !important; }

/* ---------- campos ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: stretch; container-type: inline-size; }
.grid > * { grid-column: span var(--w, 3); min-width: 0; }
.fld { position: relative; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--input); min-height: 54px; padding: 6px 12px 6px;
  display: flex; flex-direction: column; justify-content: center; transition: border-color .15s, box-shadow .15s, background .15s; }
.fld > label { font-size: 11.5px; font-weight: 600; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; letter-spacing: .01em; }
.fld.req > label::after { content: ' *'; color: var(--red); }
.fld input, .fld select, .fld textarea { border: 0; outline: 0; background: transparent; width: 100%; padding: 2px 0 0; font-size: 15px; min-height: 24px; color: var(--txt); min-width: 0; }
.fld input::placeholder, .fld textarea::placeholder { color: color-mix(in srgb, var(--muted) 65%, transparent); }
.fld select { cursor: pointer; padding-right: 2px; }
.fld textarea { resize: vertical; min-height: 48px; line-height: 1.45; }
.fld .ctl { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fld .ctl input { flex: 1; }
.fld .adorno { color: var(--muted); font-size: 13.5px; font-weight: 600; flex: none; white-space: nowrap; }
.fld.num input { text-align: right; font-variant-numeric: tabular-nums; }
.fld:hover { border-color: #c5cede; }
.fld:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47,111,237,.14); }
.fld:focus-within > label { color: var(--blue); }
.fld.ro { background: var(--input-ro); border-style: dashed; }
.fld.ro:hover { border-color: var(--border); }
.fld.ro input, .fld.ro textarea { color: var(--txt); cursor: default; }
.fld.err { border-color: var(--red); box-shadow: 0 0 0 4px rgba(227,38,45,.12); }
.fld.err > label { color: var(--red); }
.fld.chk { justify-content: center; }
.fld.chk input { width: 22px; height: 22px; accent-color: var(--red); }
.fld .btn-in { position: static; border: 0; background: var(--head); color: var(--muted); cursor: pointer; padding: 5px; border-radius: 8px; display: inline-grid; place-items: center; flex: none; }
.fld .btn-in:hover { color: var(--blue); background: var(--blue-soft); }
.fld .btn-in .ic { width: 18px; height: 18px; }
.fld .btn-in.scan { color: var(--blue); }
.fld .btn-in.scan .ic { width: 22px; height: 22px; }
.fld > input + .btn-in, .fld > .btn-in { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.lk { display: flex; gap: 6px; align-items: stretch; }
.lk .fld { flex: 1; }
.lk .lupa { border: 1.5px solid var(--border); background: var(--card); cursor: pointer; color: var(--muted); padding: 0 10px; border-radius: var(--radius-sm); transition: all .15s; }
.lk .lupa:hover { color: var(--blue); border-color: var(--blue); background: var(--blue-soft); }
.lk .lupa .ic { width: 20px; height: 20px; }

/* reorganização automática dos campos pela largura disponível (tela, painel ou janela) */
@container (max-width: 980px) {
  .grid > .esp { display: none; }
  .grid > [data-w="1"], .grid > [data-w="2"] { grid-column: span 3; }
  .grid > [data-w="3"], .grid > [data-w="4"], .grid > [data-w="5"], .grid > [data-w="6"] { grid-column: span 6; }
  .grid > [data-w="7"], .grid > [data-w="8"], .grid > [data-w="9"], .grid > [data-w="10"], .grid > [data-w="11"] { grid-column: span 12; }
}
@container (max-width: 640px) {
  .grid > * { grid-column: span 12 !important; }
  .grid > [data-w="1"], .grid > [data-w="2"], .grid > [data-w="3"], .grid > .h6 { grid-column: span 6 !important; }
  .grid > .cel-foto { grid-row: auto !important; }
}
@container (max-width: 400px) {
  .grid > [data-w="3"] { grid-column: span 12 !important; }
}

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 16px; min-height: 40px; border-radius: 10px; border: 1px solid var(--blue);
  background: var(--blue); color: #fff; cursor: pointer; font-size: 14px; font-weight: 600; white-space: nowrap; transition: background .15s, box-shadow .15s, transform .05s; text-decoration: none !important; }
.btn:hover { background: var(--blue-2); box-shadow: 0 4px 14px rgba(47,111,237,.25); }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 17px; height: 17px; }
.btn.red { background: var(--red); border-color: var(--red); } .btn.red:hover { background: var(--red-2); box-shadow: 0 4px 14px rgba(227,38,45,.3); }
.btn.green { background: var(--green); border-color: var(--green); } .btn.green:hover { background: #12803b; box-shadow: 0 4px 14px rgba(22,163,74,.3); }
.btn.ghost { background: var(--card); color: var(--txt); border-color: var(--border); } .btn.ghost:hover { background: var(--head); box-shadow: none; }
.btn.sm { padding: 0 12px; min-height: 32px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .55; cursor: default; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 0 0; align-items: center; }
.icon-btn { border: 0; background: none; cursor: pointer; padding: 6px; border-radius: 9px; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--head); color: var(--txt); }

/* ---------- tabelas ---------- */
.tbl-wrap { overflow: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; box-shadow: var(--shadow); }
.panel .tbl-wrap { box-shadow: none; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { background: var(--card-2); color: var(--muted); font-weight: 700; text-align: left; padding: 11px 12px; white-space: nowrap; position: sticky; top: 0; z-index: 2;
  border-bottom: 1px solid var(--border); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; user-select: none; }
.tbl th.sort { cursor: pointer; } .tbl th.sort:hover { color: var(--txt); }
.tbl th .car { display: inline-block; margin-left: 5px; font-size: 10px; opacity: .7; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border-2); white-space: nowrap; color: var(--txt); vertical-align: middle; }
.tbl tbody tr:nth-child(even) td { background: var(--row-alt); }
.tbl tbody tr:hover td { background: var(--row-hover); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.act { width: 36px; padding: 4px 2px; text-align: center; }
.tbl td.act button { border: 0; background: none; cursor: pointer; padding: 6px; border-radius: 9px; display: inline-grid; opacity: .85; }
.tbl td.act button:hover { background: var(--head); opacity: 1; }
.tbl td.act .ic { width: 18px; height: 18px; }
.tbl tr.hl-green td { color: var(--green) !important; font-weight: 600; }
.tbl tr.hl-orange td { color: var(--orange) !important; font-weight: 600; }
.tbl tr.hl-red td { color: var(--red) !important; }
.tbl tr.inativo td { opacity: .5; }
.tbl td.thumb { width: 52px; padding: 4px 6px; }
.tbl td.thumb img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; display: block; }
.tbl tfoot td { font-weight: 700; background: var(--head) !important; color: var(--head-txt); }
.tbl .vazio { text-align: center; padding: 40px 16px; color: var(--muted); white-space: normal; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--card); border: 1px solid var(--border); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; margin-bottom: 16px; box-shadow: var(--shadow); }
.pager .pg { color: var(--muted); font-weight: 600; font-size: 13px; }
.pager .nav { display: flex; gap: 4px; align-items: center; }
.pager .nav button { border: 1px solid var(--border); background: var(--card); padding: 6px 10px; cursor: pointer; border-radius: 9px; display: inline-grid; }
.pager .nav button:hover { background: var(--head); }
.pager .nav span { padding: 6px 12px; background: var(--navy); color: #fff; border-radius: 9px; font-weight: 700; font-size: 13px; }
.pager .flt { margin-left: auto; font-size: 13px; }

/* cartões no celular (no lugar da tabela) */
.cards { display: none; }
.card-row { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 10px; padding: 12px 14px; display: flex; gap: 12px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.card-row::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--navy-3); }
.card-row.hl-green::before { background: var(--green); } .card-row.hl-orange::before { background: var(--orange); }
.card-row .cimg { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; flex: none; background: var(--head); }
.card-row .cbody { flex: 1; min-width: 0; cursor: pointer; }
.card-row .ct { font-weight: 700; margin-bottom: 4px; line-height: 1.3; }
.card-row .cs { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 3px 12px; }
.card-row .cs b { color: var(--txt); font-weight: 600; }
.card-row .cact { display: flex; flex-direction: column; gap: 2px; }

/* ---------- etiquetas de situação ---------- */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--head); color: var(--muted); white-space: nowrap; }
.tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.st-Aberto { background: #e8f0ff; color: #2457c5; } .st-Enviado { background: #f1e9ff; color: #6d3fd0; }
.st-Aprovado { background: #e4f7ec; color: #12803e; } .st-Em-execução { background: #fff1de; color: #b45c00; }
.st-Aguardando-peça { background: #fdf3d3; color: #8f6800; } .st-Concluído { background: #d8f4e4; color: #0a6634; }
.st-Entregue { background: var(--navy); color: #fff; } .st-Recusado { background: #fde7e7; color: #b3171d; } .st-Cancelado { background: #eceef2; color: #646b7a; }
:root[data-theme="dark"] .tag:not(.st-Entregue) { filter: saturate(1.1) brightness(.95); }

/* ---------- painel (indicadores) ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 0 0 16px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; min-width: 0; }
.kpi::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--k, var(--navy-3)); }
.kpi .kl { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.kpi .kv { font-size: 26px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow-wrap: anywhere; }
.kpi .ks { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.dash-grid > .panel { margin: 0 0 16px; }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 180px; padding: 10px 4px 0; }
.bars .b { flex: 1; background: linear-gradient(180deg, #ff5a5f, var(--red)); border-radius: 6px 6px 2px 2px; min-height: 2px; transition: filter .15s; }
.bars .b:hover { filter: brightness(1.12); }
.bars-x { display: flex; gap: 5px; padding: 4px 4px 4px; font-size: 10.5px; color: var(--muted); }
.bars-x span { flex: 1; text-align: center; overflow: hidden; }
.meta-bar { height: 8px; background: var(--border-2); border-radius: 9px; overflow: hidden; margin-top: 5px; }
.meta-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); border-radius: 9px; }
.list-mini { list-style: none; margin: 0; padding: 0; }
.list-mini li { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border-2); }
.list-mini li:last-child { border-bottom: 0; }
.status-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 14px; scrollbar-width: thin; }
.status-strip .sc { flex: 1 0 140px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, transform .1s; }
.status-strip .sc:hover { border-color: var(--blue); }
.status-strip .sc.on { outline: 2px solid var(--blue); outline-offset: -2px; }
.status-strip .sc .n { font-size: 22px; font-weight: 800; margin-top: 4px; }
.status-strip .sc .v { font-size: 12px; color: var(--muted); }

/* ---------- janelas (modal) ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(8,12,30,.55); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; backdrop-filter: blur(3px); }
.modal { background: var(--card); border-radius: 18px; width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .2s; border: 1px solid var(--border); }
.modal.lg { width: min(1100px, 100%); } .modal.md { width: min(780px, 100%); }
.modal > header { background: var(--card); color: var(--txt); padding: 16px 20px; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.modal > header .x { margin-left: auto; background: var(--head); border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 10px; display: inline-grid; }
.modal > header .x:hover { color: var(--txt); }
.modal > .mb { padding: 16px 20px; overflow: auto; }
.modal > footer { padding: 12px 20px 16px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--border-2); }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }

/* ---------- avisos (toast) ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { background: #111a36; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); max-width: 400px; border-left: 4px solid var(--green); animation: pop .2s; font-size: 14px; }
.toast.err { border-left-color: var(--red); } .toast.warn { border-left-color: var(--yellow); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.login-hero { background: radial-gradient(circle at 25% 20%, #24307a 0, var(--navy) 55%, #050a1f 100%); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 48px; color: #c8cff0; }
.login-hero::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.06) 1.5px, transparent 1.6px); background-size: 16px 16px; }
.login-hero img { width: min(520px, 90%); position: relative; filter: drop-shadow(0 12px 32px rgba(0,0,0,.5)); }
.login-hero p { position: relative; margin-top: 28px; text-align: center; max-width: 440px; line-height: 1.65; font-size: 15px; }
.login-box { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login-card { width: min(420px, 100%); background: var(--card); padding: 30px 28px; border-radius: 20px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
.login-card .sub { color: var(--muted); margin-bottom: 22px; }
.login-card .fld { min-height: 56px; margin-bottom: 12px; }
.login-card .fld input { font-size: 16px; }
.login-card .btn { width: 100%; min-height: 48px; font-size: 16px; }
.login-card .lnk { background: none; border: 0; color: var(--blue); cursor: pointer; padding: 10px 0; font-size: 14px; font-weight: 600; }
.login-mobile-logo { display: none; }

/* ---------- fotos ---------- */
.fotos { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0; }
.foto { width: 120px; height: 120px; border-radius: 12px; overflow: hidden; position: relative; border: 1px solid var(--border); background: var(--input-ro); }
.foto img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.foto .del { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; display: grid; place-items: center; }
.foto .del .ic { width: 15px; height: 15px; }
.foto .badge { position: absolute; left: 6px; bottom: 6px; background: var(--red); color: #fff; font-size: 10.5px; padding: 2px 8px; border-radius: 9px; font-weight: 700; }
.foto.add { display: grid; place-items: center; cursor: pointer; border: 2px dashed var(--border); color: var(--muted); text-align: center; font-size: 12.5px; background: var(--card-2); }
.foto.add:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.foto-perfil { width: 150px; height: 180px; border-radius: 14px; }
.cel-foto .btns { justify-content: center; }
.zoom-img { max-width: 100%; max-height: 80vh; display: block; margin: auto; border-radius: 10px; }

/* ---------- assinatura ---------- */
.sig-wrap { border: 2px dashed var(--border); border-radius: 14px; background: #fff; position: relative; touch-action: none; }
.sig-wrap canvas { width: 100%; height: 220px; display: block; cursor: crosshair; }
.sig-wrap .linha { position: absolute; left: 8%; right: 8%; bottom: 46px; border-bottom: 1px solid #999; pointer-events: none; }
.sig-wrap .dica { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: #999; font-size: 12px; pointer-events: none; }

/* ---------- orçamento ---------- */
.itens-tbl td { white-space: normal; vertical-align: middle; }
.itens-tbl input { width: 100%; border: 1.5px solid var(--border); border-radius: 9px; padding: 7px 8px; background: var(--input); text-align: right; min-width: 70px; font-variant-numeric: tabular-nums; }
.itens-tbl input:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,111,237,.14); }
.itens-tbl input.desc { text-align: left; min-width: 220px; }
.cel-in { display: flex; align-items: center; gap: 4px; border: 1.5px solid var(--border); border-radius: 9px; background: var(--input); padding: 0 8px; min-width: 110px; }
.cel-in:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,111,237,.14); }
.cel-in input { border: 0 !important; box-shadow: none !important; padding: 7px 0; min-width: 50px; background: transparent; }
.cel-in span { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tipo-pill { font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: 7px; text-transform: uppercase; letter-spacing: .03em; }
.tipo-pill.produto { background: #e8f0ff; color: #2457c5; } .tipo-pill.servico { background: #fde8e8; color: #b3171d; }
.totais { display: grid; gap: 8px; min-width: 280px; background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.totais .ln { display: flex; justify-content: space-between; gap: 20px; font-size: 14.5px; }
.totais .ln.big { font-size: 24px; font-weight: 800; color: var(--red); border-top: 1px solid var(--border); padding-top: 8px; letter-spacing: -.02em; }
.add-bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 18px; align-items: stretch; }
.search-drop { position: relative; flex: 1; min-width: 240px; }
.search-drop .res { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 20; max-height: 360px; overflow: auto; }
.search-drop .res div { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border-2); display: flex; gap: 10px; align-items: center; }
.search-drop .res div:hover, .search-drop .res div.on { background: var(--row-hover); }
.search-drop .res small { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0; }
.chip { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 6px 13px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all .15s; }
.chip:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.aceite-box { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.aceite-box img { max-height: 90px; background: #fff; border: 1px solid var(--border); border-radius: 10px; }

/* permissões */
.perm-tbl td, .perm-tbl th { text-align: center; }
.perm-tbl td:first-child, .perm-tbl th:first-child { text-align: left; }
.perm-tbl input { width: 18px; height: 18px; accent-color: var(--red); cursor: pointer; }
.perm-tbl .grp td { background: var(--head) !important; font-weight: 800; color: var(--head-txt); text-align: left; }
/* leitor de código de barras */


.scan-box { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 60vh; margin: 0 auto; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-mira { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.scan-mira i { width: 78%; height: 34%; border: 3px solid rgba(255,255,255,.9); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); position: relative; overflow: hidden; }
.scan-mira i::after { content: ''; position: absolute; left: 0; right: 0; height: 2px; background: var(--red); box-shadow: 0 0 10px var(--red); animation: scanline 1.6s ease-in-out infinite alternate; }
@keyframes scanline { from { top: 8%; } to { top: 90%; } }
.scan-msg { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; color: #fff; font-size: 14px; text-shadow: 0 1px 3px #000; padding: 0 10px; }
/* manual / assistente (markdown) */
.md { line-height: 1.6; }
.md .md-h { margin: 18px 0 6px; color: var(--navy-2); }
:root[data-theme="dark"] .md .md-h { color: #fff; }
.md h2.md-h { font-size: 24px; } .md h3.md-h { font-size: 19px; border-bottom: 2px solid var(--red); padding-bottom: 4px; } .md h4.md-h { font-size: 16px; }
.md p { margin: 6px 0; }
.md code { background: var(--head); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.md .md-code { background: #0b0d1c; color: #d7dbf0; padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 13px; white-space: pre-wrap; }
.md .md-lista { margin: 6px 0; padding-left: 22px; } .md .md-lista li { margin: 3px 0; }
@media (max-width: 900px) { .manual-grid { grid-template-columns: 1fr !important; } .manual-grid nav { position: static !important; } }

/* ---------- indicador Online/Offline ---------- */
.conexao { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 12.5px; cursor: pointer; white-space: nowrap; flex: none; }
.conexao i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.conexao.on { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.conexao.on i { animation: pulso 2.2s infinite; }
.conexao.off { background: var(--red); color: #fff; animation: piscar 1.4s infinite; }
.conexao small { font-weight: 500; opacity: .9; }
.conexao b { background: #fff; color: var(--navy); border-radius: 999px; padding: 0 6px; font-size: 11px; }
.conexao.on b { background: var(--navy); color: #fff; }
.conexao b.falha { background: var(--yellow); color: #111; }
@keyframes pulso { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.55); } 70% { box-shadow: 0 0 0 7px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
@keyframes piscar { 50% { opacity: .78; } }
.faixa-offline { background: var(--red-soft); color: #8f1418; border-bottom: 1px solid color-mix(in srgb, var(--red) 40%, transparent); padding: 10px 20px; font-size: 13.5px; cursor: pointer; line-height: 1.5; }
:root[data-theme="dark"] .faixa-offline { color: #ffd0d2; }

/* aviso "instale o app" (celular) */
.aviso-app { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 90; background: var(--navy); color: #fff; border-radius: 16px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow-lg); animation: pop .25s; font-size: 13.5px; }
.aviso-app img { width: 44px; height: 44px; border-radius: 11px; }
.aviso-app span { opacity: .85; font-size: 12.5px; }

/* menu "Mais ações" (celular) */
.mais-lista { display: grid; gap: 8px; }
.mais-lista button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); font-size: 15px; font-weight: 600; cursor: pointer; text-align: left; color: var(--txt); }
.mais-lista button:hover { background: var(--head); }
.mais-lista button .ic { color: var(--muted); }
.mais-lista button.danger { color: var(--red); }

/* ---------- responsivo ---------- */
@media (max-width: 1200px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: 10px 0 40px rgba(0,0,0,.35); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(8,12,30,.5); z-index: 35; backdrop-filter: blur(2px); }
  .main { margin-left: 0; }
  .topbar { padding: 8px 12px; gap: 8px 10px; min-height: 56px; }
  .topbar .menu-btn { display: inline-grid; order: 0; }
  .topbar .title { font-size: 17px; flex: 1 1 0; }
  .toolbar { flex: 1 0 100%; order: 3; }
  .content { padding: 14px 14px 40px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-mobile-logo { display: block; background: var(--navy); border-radius: 14px; padding: 18px; margin-bottom: 20px; }
  .login-mobile-logo img { width: 100%; display: block; }
  .manual-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .content { padding: 12px 10px 90px; }
  .topbar .title { font-size: 16px; }
  .topbar .title small { font-size: 12px; }
  .conexao span { display: none; } .conexao small { display: none; } .conexao { padding: 7px 9px; }
  /* ações: as 2 primeiras ficam visíveis; o resto vai para "Mais" */
  .toolbar { overflow: visible; gap: 6px; }
  .toolbar button { flex: 1 1 0; justify-content: center; padding: 0 10px; height: 42px; min-width: 0; }
  .toolbar button span { overflow: hidden; text-overflow: ellipsis; }
  .toolbar button:nth-child(n+3):not([data-mais]) { display: none; }
  .toolbar button[data-mais] { display: inline-flex; flex: 0 0 auto; }
  .tbl-wrap.resp { display: none; }
  .tbl-wrap.resp + .cards + .pager { border-top: 1px solid var(--border); border-radius: var(--radius); }
  .cards { display: block; }
  .pager .flt { display: none; }
  .panel > h3 { font-size: 15px; padding: 12px 14px 2px; }
  .panel > .body { padding: 8px 14px 14px; }
  .tabs { margin-bottom: 12px; }
  .tabs button { padding: 9px 12px; font-size: 13.5px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; } .kpi .kv { font-size: 20px; }
  .modal-bg { padding: 0; place-items: end center; }
  .modal { border-radius: 20px 20px 0 0; max-height: 94dvh; width: 100% !important; }
  .fld input, .fld select, .fld textarea { font-size: 16px; } /* evita zoom automático no iPhone */
  .btns .btn { flex: 1 1 auto; }
  .add-bar { padding: 10px 14px; }
  .search-drop { min-width: 100%; }
  .totais { min-width: 0; width: 100%; }
  .status-strip .sc { flex-basis: 120px; }
  .login-card { padding: 22px 18px; border-radius: 16px; }
}
@media (max-width: 380px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- impressão ---------- */
#print-area { display: none; }
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  body.printing #app, body.printing #toasts, body.printing .modal-bg { display: none !important; }
  body.printing #print-area { display: block; }
}
.doc { font-family: 'Inter', Arial, sans-serif; color: #111; font-size: 12px; background: #fff; }
.doc .timbre { display: flex; align-items: center; gap: 16px; border-bottom: 3px solid #e3262d; padding-bottom: 10px; margin-bottom: 10px; }
.doc .timbre img { height: 62px; }
.doc .timbre .emp { margin-left: auto; text-align: right; font-size: 10.5px; line-height: 1.45; color: #333; }
.doc .timbre .emp b { font-size: 12.5px; color: #0e1030; }
.doc h2 { font-size: 16px; margin: 6px 0; color: #0e1030; display: flex; justify-content: space-between; align-items: baseline; }
.doc .bloco { border: 1px solid #c9ccd4; border-radius: 6px; padding: 6px 8px; margin-bottom: 8px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px 12px; }
.doc .bloco div small { display: block; color: #666; font-size: 9px; text-transform: uppercase; }
.doc table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.doc th { background: #0e1030; color: #fff; font-weight: 500; padding: 5px; text-align: left; font-size: 11px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc td { padding: 4px 5px; border-bottom: 1px solid #ddd; font-size: 11px; }
.doc .tot { margin-left: auto; width: 260px; }
.doc .tot div { display: flex; justify-content: space-between; padding: 2px 0; }
.doc .tot .g { font-size: 16px; font-weight: 800; border-top: 2px solid #111; padding-top: 4px; color: #c21a21; }
.doc .termos { font-size: 9.5px; color: #444; border-top: 1px solid #ccc; padding-top: 6px; margin-top: 8px; line-height: 1.45; }
.doc .assin { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 30px; text-align: center; font-size: 10.5px; }
.doc .assin .l { border-top: 1px solid #111; padding-top: 4px; }
.doc .assin img { max-height: 70px; display: block; margin: 0 auto -6px; }
.doc .rodape { text-align: center; color: #888; font-size: 9px; margin-top: 14px; }
.doc .lista th, .doc .lista td { font-size: 10px; }
* { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.itens-tbl td.nowrap, .tbl td.nowrap { white-space: nowrap; }
.itens-tbl td:nth-child(3) { min-width: 240px; }
/* DDD sempre ao lado do número do telefone em telas estreitas */
@container (max-width: 640px) {
  .grid > [data-w]:has(input[data-t="ddd"]) { grid-column: span 4 !important; }
  .grid > [data-w]:has(input[data-t="ddd"]) + [data-w]:has(input[data-t="fone"]) { grid-column: span 8 !important; }
}
