:root {
  --accent: #f8b80c;
  --accent-dark: #d99a00;
  --accent-soft: #fff5d6;
  --ink: #17171b;
  --muted: #6d6d76;
  --line: #e7e5df;
  --bg: #f4f3ef;
  --card: #ffffff;
  --side: #0a0a0a;
  --side-ink: #cfcfcf;
  --red: #c0392b;
  --red-soft: #fde8e5;
  --green: #1e8449;
  --green-soft: #e3f3e8;
  --blue: #2f6fb3;
  --blue-soft: #e4eef9;
  --gray-soft: #efeee9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Sofia Sans", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: -.3px; }
h2 { font-size: 17px; font-weight: 800; margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* layout */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.app > div, .orc > div, .grid2 > div { min-width: 0; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; text-decoration: none; }
.side .brand img { width: 44px; height: 44px; border-radius: 8px; }
.side .brand b { color: #fff; font-size: 16px; line-height: 1.1; display: block; }
.side .brand span { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px; text-decoration: none; font-weight: 600; margin-bottom: 2px; }
.nav a:hover { background: #1b1b1f; color: #fff; }
.nav a.on { background: var(--accent); color: #0a0a0a; }
.nav svg { width: 19px; height: 19px; flex: none; }
.side .eu { margin-top: auto; border-top: 1px solid #222; padding: 14px 8px 0; font-size: 13px; }
.side .eu b { color: #fff; display: block; font-size: 14px; }
.side .eu button { background: none; border: none; color: var(--side-ink); padding: 0; margin: 8px 14px 0 0; cursor: pointer; text-decoration: underline; font-size: 13px; }
.side .eu button:hover { color: #fff; }
.main { padding: 28px 32px 60px; min-width: 0; }
.topo { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topo .acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.mobile-bar { display: none; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi b { display: block; font-size: 26px; font-weight: 900; margin: 4px 0 2px; letter-spacing: -.5px; }
.kpi.y { background: var(--side); color: #fff; border-color: var(--side); }
.kpi.y b { color: var(--accent); }
.kpi.y span, .kpi.y .muted { color: #bdbdbd; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: #fff; padding: 9px 15px; border-radius: 9px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; font-size: 14px; }
.btn:hover { border-color: #cfccc3; background: #fafaf7; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #0a0a0a; }
.btn.pri:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.dark { background: var(--side); border-color: var(--side); color: #fff; }
.btn.dark:hover { background: #222; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-soft); border-color: #f2c4bd; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: none; background: none; cursor: pointer; padding: 6px; border-radius: 7px; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: var(--gray-soft); color: var(--ink); }
.icon-btn.del:hover { background: var(--red-soft); color: var(--red); }
.icon-btn svg { width: 17px; height: 17px; }

/* formulários */
label.f { display: block; font-size: 13px; font-weight: 700; color: #45454c; margin-bottom: 12px; }
label.f > span { display: block; margin-bottom: 5px; }
.in, select.in, textarea.in { width: 100%; border: 1px solid #dad8d1; background: #fff; border-radius: 9px; padding: 9px 11px; font-size: 15px; font-weight: 500; outline: none; }
.in:focus { border-color: var(--accent-dark); box-shadow: 0 0 0 3px rgba(248,184,12,.25); }
textarea.in { resize: vertical; min-height: 72px; line-height: 1.45; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(var(--c, 2), 1fr); }
.chk { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; cursor: pointer; }
.busca { position: relative; }
.busca svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.busca .in { padding-left: 36px; }
.filtros { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filtros .busca { flex: 1; min-width: 220px; max-width: 420px; }
.seg { display: inline-flex; background: var(--gray-soft); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.seg button { border: none; background: none; padding: 6px 12px; border-radius: 7px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg button i { font-style: normal; font-weight: 600; opacity: .7; margin-left: 3px; }

/* tabelas */
.tabela { width: 100%; border-collapse: collapse; }
.tabela th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tabela td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabela tr.click { cursor: pointer; }
.tabela tr.click:hover td { background: #fbfaf6; }
.tabela tr:last-child td { border-bottom: none; }
.salvo-ok { width: 64px; height: 64px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; margin: 4px auto 14px; }
.salvo-ok svg { width: 34px; height: 34px; stroke-width: 3; }
.tabela .acoes-linha { width: 1%; text-align: right; }
.tabela tr.destaque td { animation: destaque 3s ease-out; }
@keyframes destaque { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
.tabela .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabela-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.vazio { text-align: center; padding: 40px 20px; color: var(--muted); }
.vazio b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* pills */
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.st-rascunho { background: var(--gray-soft); color: #55555c; }
.st-enviado { background: var(--blue-soft); color: var(--blue); }
.st-aprovado { background: var(--green-soft); color: var(--green); }
.st-recusado { background: var(--red-soft); color: var(--red); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--gray-soft); font-size: 12px; font-weight: 700; color: #55555c; }
.warn { color: var(--red); font-weight: 700; font-size: 12px; }

/* orçamento */
.orc { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
.resumo { position: sticky; top: 20px; }
.resumo .linha { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; }
.resumo .total { border-top: 2px solid var(--ink); margin-top: 8px; padding-top: 12px; display: flex; justify-content: space-between; align-items: baseline; }
.resumo .total b { font-size: 26px; font-weight: 900; letter-spacing: -.5px; }
.resumo .desc { display: flex; gap: 6px; align-items: center; }
.resumo .desc .in { width: 100px; text-align: right; padding: 6px 8px; }
.resumo .acoes { display: grid; gap: 8px; margin-top: 16px; }
.margem { background: var(--accent-soft); border-radius: 9px; padding: 9px 12px; margin-top: 10px; font-size: 13px; }
.cliente-pick { position: relative; }
.drop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); z-index: 30; max-height: 330px; overflow-y: auto; }
.drop .op { padding: 9px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: center; border-bottom: 1px solid #f2f1ec; }
.drop .op:last-child { border-bottom: none; }
.drop .op:hover, .drop .op.sel { background: var(--accent-soft); }
.drop .op small { color: var(--muted); }
.drop .op .p { font-weight: 800; white-space: nowrap; }
.drop .op .mais { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #222; font-weight: 800; font-size: 18px; line-height: 26px; text-align: center; }
.drop .op .nome { flex: 1; min-width: 0; }
.cliente-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); background: #fbfaf6; padding: 10px 12px; border-radius: 9px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 5px 12px; font-size: 13px; font-weight: 700; cursor: pointer; }
.chip:hover { border-color: var(--accent-dark); }
.chip.on { background: var(--side); color: #fff; border-color: var(--side); }
.itens td { padding: 7px 8px; }
.itens .cat td { background: #faf9f5; font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; padding: 9px 8px; }
.itens .in { padding: 6px 8px; font-size: 14px; }
.itens .qtd { width: 72px; text-align: right; }
.itens .preco { width: 104px; text-align: right; }
.itens .desc-in { min-width: 200px; border-color: transparent; background: transparent; }
.itens .desc-in:hover { border-color: #dad8d1; }
.itens .desc-in:focus { background: #fff; }
.escala .st-esc { width: auto; margin-top: 4px; padding: 3px 6px; font-size: 12px; font-weight: 800; border-radius: 20px; }
select.in.st-esc { padding: 4px 8px; font-size: 12px; font-weight: 800; border-radius: 20px; }
select.in.st-ct-gerado { background: var(--gray-soft); }
select.in.st-ct-enviado { background: var(--blue-soft); color: var(--blue); border-color: #bcd3ee; }
select.in.st-ct-assinado { background: var(--green-soft); color: var(--green); border-color: #b9dfc6; }
.st-esc-pendente { background: var(--gray-soft); }
.st-esc-confirmado { background: var(--green-soft); color: var(--green); border-color: #b9dfc6; }
.st-esc-recusou { background: var(--red-soft); color: var(--red); border-color: #f2c4bd; }
.thumb { width: 38px; height: 38px; border-radius: 7px; object-fit: cover; background: var(--gray-soft); display: block; }
.sujo { color: var(--accent-dark); font-weight: 700; font-size: 13px; }

code { background: var(--gray-soft); border-radius: 4px; padding: 1px 5px; font-size: 12px; white-space: nowrap; }
.contrato-box { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.contrato-box .linha { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 0 8px; }
.contrato-box .acoes { display: grid; gap: 6px; }
.contrato-box .btn { width: 100%; }

/* financeiro */
.fin tr.pago td { background: #fbfcfa; }
.fin tr.pago td b { opacity: .7; }
.fin tfoot td { border-top: 2px solid var(--line); padding-top: 12px; }
.fin-linha { display: flex; justify-content: space-between; gap: 10px; padding: 7px 4px; border-bottom: 1px solid #f2f1ec; font-size: 14px; }
.fin-linha:last-child { border-bottom: none; }
a.kpi:hover { border-color: var(--accent-dark); }

/* agenda */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-cab { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--muted); padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #faf9f5; }
.cal-dia { min-height: 108px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-dia .n { font-size: 13px; font-weight: 700; color: #55555c; margin-bottom: 2px; }
.cal-dia.fora { background: #fbfaf7; }
.cal-dia.fora .n { color: #b9b7b0; }
.cal-dia.hoje .n { background: var(--accent); color: #0a0a0a; border-radius: 20px; padding: 1px 7px; align-self: flex-start; }
.ev-chip { display: block; width: 100%; text-align: left; border: none; border-radius: 6px; padding: 3px 7px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-chip.st-aprovado { background: var(--side); color: var(--accent); }
.ev-chip.st-enviado { background: var(--blue-soft); color: var(--blue); }
.ev-chip.st-rascunho { background: var(--gray-soft); color: #55555c; border: 1px dashed #c9c7c0; }
.ev-chip.st-avulso { background: #ece4fb; color: #5b2ca0; }
.ev-chip.cont { opacity: .75; }
.pill.st-avulso { background: #ece4fb; color: #5b2ca0; }
.cal-dia.clicavel { cursor: pointer; }
.cal-dia.clicavel:hover { background: #fffbea; }
.cal-dia.clicavel:hover .n::after { content: " +"; color: var(--accent-dark); font-weight: 900; }
.menu-dia { display: grid; gap: 8px; }
.menu-dia .btn { justify-content: flex-start; padding: 12px 14px; }
.lista-dia { display: grid; gap: 4px; }
.ev-linha { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.ev-linha:hover { background: #faf9f5; }
.ev-linha .ev-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ev-linha input { width: 17px; height: 17px; }
.ev-chip:hover { filter: brightness(1.15); }
.ev-mais { border: none; background: none; color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; cursor: pointer; padding: 0 4px; }
.legenda { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.legenda i.ev { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }
.legenda i.st-aprovado { background: var(--side); }
.legenda i.st-enviado { background: var(--blue-soft); border: 1px solid var(--blue); }
.legenda i.st-rascunho { background: var(--gray-soft); border: 1px dashed #b5b3ac; }
.legenda i.st-avulso { background: #ece4fb; border: 1px solid #b89be8; }
.equipe-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.tag.ok { background: var(--green-soft); color: var(--green); }
.ag-item.passado { opacity: .55; }
@media (max-width: 820px) {
  .cal-dia { min-height: 64px; padding: 3px; }
  .ev-chip { font-size: 10px; padding: 2px 4px; }
  .cal-cab { padding: 6px 2px; text-align: center; font-size: 10px; }
}

.soltar { display: flex; align-items: center; gap: 14px; border: 2px dashed #d8d5cc; border-radius: 12px; padding: 16px 18px; cursor: pointer; margin-top: 12px; background: #fcfbf8; }
.soltar:hover, .soltar.sobre { border-color: var(--accent-dark); background: var(--accent-soft); }
.soltar svg { width: 26px; height: 26px; color: var(--accent-dark); flex: none; }

/* modal / toast */
.fundo { position: fixed; inset: 0; background: rgba(10,10,10,.5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.lg { max-width: 760px; }
.modal.xl { max-width: 1000px; }
.kit-grade { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.kit-h { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 4px 0 8px; }
.kit-lista { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.kit-op { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid #f2f1ec; cursor: pointer; }
.kit-op:last-child { border-bottom: none; }
.kit-op:hover { background: var(--accent-soft); }
.kit-op span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.kit-op .p { font-weight: 800; font-size: 13px; white-space: nowrap; }
.kit-op.dentro { opacity: .5; cursor: default; }
.kit-op input { width: 17px; height: 17px; flex: none; }
.kit-total { display: flex; justify-content: space-between; border-top: 2px solid var(--ink); padding-top: 8px; margin-top: 4px; }
.kit-item { display: inline-block; background: var(--gray-soft); border-radius: 6px; padding: 2px 7px; margin: 2px 4px 2px 0; }
.kit-item.inativo { text-decoration: line-through; opacity: .6; }
.chip.chip-kit { border-color: var(--accent-dark); }
.tag-kit { background: var(--accent); color: #0a0a0a; font-size: 10px; font-weight: 900; padding: 1px 5px; border-radius: 4px; vertical-align: 1px; }
@media (max-width: 820px) { .kit-grade { grid-template-columns: 1fr; } }
.modal h2 { font-size: 19px; margin-bottom: 18px; }
.modal .rodape { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.modal .rodape > div { display: flex; gap: 8px; margin-left: auto; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--side); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 700; z-index: 80; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 90vw; }
.toast.erro { background: var(--red); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: #000; padding: 20px; }
.login .box { background: #fff; border-radius: 16px; padding: 30px 30px 24px; width: 100%; max-width: 380px; }
.login img { width: 130px; display: block; margin: 0 auto 18px; }
.login .logo-wrap { background: #000; margin: -30px -30px 24px; border-radius: 16px 16px 0 0; padding: 18px 0 8px; }
.login h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login p { text-align: center; margin: 0 0 18px; }
.login .btn { width: 100%; padding: 11px; margin-top: 6px; }
.login .erro { color: var(--red); font-weight: 700; font-size: 14px; margin: 4px 0 8px; min-height: 20px; text-align: center; }

.lista-mini { display: grid; gap: 2px; }
.lista-mini a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 10px; border-radius: 9px; text-decoration: none; align-items: center; }
.lista-mini a:hover { background: #faf9f5; }
.lista-mini .data { background: var(--side); color: #fff; border-radius: 8px; text-align: center; padding: 4px 0; width: 46px; flex: none; line-height: 1.05; }
.lista-mini .data b { display: block; font-size: 18px; color: var(--accent); }
.lista-mini .data small { font-size: 10px; text-transform: uppercase; font-weight: 700; }

@media (max-width: 1100px) {
  .orc { grid-template-columns: 1fr; }
  .resumo { position: static; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .filtros .busca { min-width: 0; flex-basis: 100%; max-width: none; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .app.menu .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; background: var(--side); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 40; }
  .mobile-bar button { background: none; border: none; color: #fff; padding: 4px; display: flex; cursor: pointer; }
  .mobile-bar svg { width: 26px; height: 26px; }
  .mobile-bar img { height: 30px; }
  .main { padding: 18px 16px 50px; }
  h1 { font-size: 22px; }
  .grid2, .row { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .tabela-wrap { margin: 0 -16px; padding: 0 16px; }
  .hide-m { display: none; }
}

/* histórico */
.hist { display: grid; }
.hist-linha { display: flex; gap: 14px; padding: 10px 4px; border-bottom: 1px solid #f2f1ec; }
.hist-linha:last-child { border-bottom: none; }
.hist-quando { width: 78px; flex: none; font-size: 12px; font-weight: 700; color: #45454c; }
.hist-quando span { color: var(--muted); font-weight: 600; }
.hist-txt { min-width: 0; }
.hist-txt .small { word-break: break-word; }
details.horarios { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 10px; }
details.horarios summary { cursor: pointer; font-weight: 700; font-size: 14px; color: #45454c; }
.ev-chip.fase { background: repeating-linear-gradient(45deg, #fff6d6, #fff6d6 4px, #fdeeb7 4px, #fdeeb7 8px); color: #6b4b00; }
.aviso-leve { color: #8a6100; font-weight: 700; font-size: 12px; }
.disp-livre { font-weight: 800; }

/* checklist */
.ck-modo { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
.ck-modo button { padding: 12px; font-size: 15px; }
.ck-barra { height: 8px; background: var(--gray-soft); border-radius: 8px; margin-top: 12px; overflow: hidden; }
.ck-barra div { height: 100%; background: var(--green); transition: width .25s; }
.ck-grupo h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 6px; }
.ck-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f2f1ec; flex-wrap: wrap; }
.ck-linha:last-child { border-bottom: none; }
.ck-linha.ok .ck-nome b { color: var(--green); }
.ck-linha.defeito { background: #fff8f7; }
.ck-nome { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.ck-nome small { color: var(--muted); }
.ck-ctrl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ck-b { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 20px; font-weight: 800; cursor: pointer; }
.ck-b:active { background: var(--accent-soft); }
.ck-n { min-width: 30px; text-align: center; font-weight: 900; font-size: 17px; }
.ck-tudo { height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 900; font-size: 18px; cursor: pointer; }
.ck-tudo.on { background: var(--green); border-color: var(--green); color: #fff; }
.led-res { background: var(--soft, #faf8f1); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.led-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.led-grid span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.led-grid b { font-size: 16px; }
@media (max-width: 820px) { .led-grid { grid-template-columns: 1fr 1fr; } }
.aviso-local { background: #fff1c7; color: #6b4b00; border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 14px; margin-bottom: 14px; }

/* avisos da tela inicial e relatórios */
.avisos { display: grid; gap: 12px; margin-bottom: 18px; }
.aviso-card { background: #fffcf2; border: 1px solid #efdca0; border-radius: var(--radius); padding: 14px 18px; display: grid; gap: 4px; }
.aviso-card.ok { background: var(--green-soft); border-color: #b9dfc6; }
.aviso-card.alerta { background: #fff6f4; border-color: #f2c4bd; }
.aviso-card a { text-decoration: none; font-size: 14px; padding: 3px 0; }
.aviso-card a:hover { text-decoration: underline; }
.barras { display: grid; gap: 8px; }
.barra-linha { display: grid; grid-template-columns: 130px 1fr 110px; gap: 10px; align-items: center; font-size: 13px; }
.br-rot { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-fundo { background: var(--gray-soft); border-radius: 6px; height: 14px; overflow: hidden; }
.br-val { display: block; height: 100%; border-radius: 6px; }
.br-num { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 820px) { .barra-linha { grid-template-columns: 90px 1fr 90px; } }

.viagem-tot { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding-bottom: 8px; }
.viagem-tot span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.viagem-tot b { font-size: 17px; }

/* cores suaves por categoria (corCat no app.js) */
.chip.cor { background: var(--cat-bg); border-color: color-mix(in srgb, var(--cat-b) 35%, transparent); }
.chip.cor:hover { border-color: var(--cat-b); }
.chip.cor.on { background: var(--cat-b); border-color: var(--cat-b); color: #fff; }
.itens tr.cat[style] td { background: var(--cat-bg); }
.itens tr.cat[style] td:first-child { box-shadow: inset 4px 0 var(--cat-b); }
.itens tr.cor td:first-child { box-shadow: inset 4px 0 color-mix(in srgb, var(--cat-b) 45%, transparent); }

/* cadastro de cliente: preencher pelo CNPJ */
label.f > span.com-botao { display: flex; gap: 6px; margin-bottom: 0; }
.com-botao .in { flex: 1; min-width: 0; }
.com-botao .btn { white-space: nowrap; }
.auto-res { border: 1px solid #efdca0; background: #fffaf0; border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; font-size: 14px; }
.auto-res.erro { border-color: #f1c4c4; background: #fff5f5; color: var(--red); }
.auto-tit { font-weight: 800; margin: 0 0 8px; }
.auto-aviso { background: #fff0e0; border-radius: 7px; padding: 6px 9px; margin: 0 0 8px; }
.auto-dados { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin-bottom: 10px; }
.auto-dados div { display: flex; flex-direction: column; min-width: 0; }
.auto-dados span { font-size: 12px; }
.auto-dados b { overflow-wrap: anywhere; font-weight: 700; }
.auto-lista { margin: 0 0 12px; display: grid; gap: 4px; }
.auto-res .acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.in.preenchido { background: #fff6d6; transition: background .6s; }
@media (max-width: 820px) { .auto-dados { grid-template-columns: minmax(0, 1fr); } }
.hosp-repasse { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; margin: 2px 0 4px; }
.hosp-pct { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.hosp-pct .in { width: 70px; text-align: right; }
.viagem-tot small { font-size: 12px; }

/* barra fixa com o total do orçamento (telas estreitas: o resumo fica no fim da página) */
.barra-total { display: none; }
@media (max-width: 1100px) {
  .barra-total { display: flex; position: sticky; bottom: 0; z-index: 30; margin: 14px -32px -60px; padding: 10px 32px calc(10px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(0,0,0,.07); align-items: center; justify-content: space-between; gap: 12px; transition: transform .2s; }
  .barra-total.oculta { transform: translateY(110%); }
  .bt-total { background: none; border: 0; padding: 0; text-align: left; display: flex; flex-direction: column; cursor: pointer; font-family: inherit; color: var(--ink); }
  .bt-total b { font-size: 22px; font-weight: 900; letter-spacing: -.4px; line-height: 1.1; }
}
@media (max-width: 820px) { .barra-total { margin: 14px -16px -50px; padding-left: 16px; padding-right: 16px; } }
/* itens do orçamento no celular: cada item vira um cartão (descrição em cima; qtd, preço e total embaixo) */
@media (max-width: 820px) {
  #itens .tabela-wrap { overflow: visible; margin: 0; padding: 0; }
  #itens table, #itens tbody { display: block; width: 100%; }
  #itens thead { display: none; }
  #itens tr.cat { display: flex; justify-content: space-between; align-items: center; }
  #itens tr.cat td { display: block; border: 0; }
  #itens tr.cat td:first-child { flex: 1; }
  #itens tr.cat td:last-child { display: none; }
  #itens tr[data-idx] { display: grid; grid-template-columns: 1fr 1.3fr 1fr auto; grid-template-areas: "desc desc desc del" "qtd preco tot tot"; gap: 4px 8px; padding: 8px 4px 10px 10px; border-bottom: 1px solid var(--line); }
  #itens tr[data-idx] td { display: block; padding: 0; border: 0; text-align: left; }
  #itens tr[data-idx] td:nth-child(1) { grid-area: desc; }
  #itens tr[data-idx] td:nth-child(2) { grid-area: qtd; }
  #itens tr[data-idx] td:nth-child(4) { grid-area: preco; }
  #itens tr[data-idx] td:nth-child(5) { grid-area: tot; align-self: end; text-align: right; padding-bottom: 7px; }
  #itens tr[data-idx] td:nth-child(6) { grid-area: del; }
  #itens tr[data-idx] td:nth-child(2)::before { content: "Qtd"; }
  #itens tr[data-idx] td:nth-child(4)::before { content: "Preço unit."; }
  #itens tr[data-idx] td:nth-child(2)::before, #itens tr[data-idx] td:nth-child(4)::before { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
  #itens .desc-in { min-width: 0; width: 100%; font-weight: 700; padding-left: 0; }
  #itens .qtd, #itens .preco { width: 100%; }
  #itens tr[data-idx] td:nth-child(3) { grid-column: 1; font-size: 11px; margin-top: -2px; }
}

/* catálogo: títulos de coluna clicáveis para ordenar */
th.ord { cursor: pointer; user-select: none; white-space: nowrap; }
th.ord:hover { color: var(--ink); }
th.ord .seta { margin-left: 4px; font-size: 10px; opacity: .35; }
th.ord.on { color: var(--ink); }
th.ord.on .seta { opacity: 1; color: var(--accent-dark); }

/* item do orçamento: marcar como sublocado */
.chk-sub { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); margin: 3px 0 0 8px; cursor: pointer; }
.chk-sub input { width: 14px; height: 14px; margin: 0; }
.chk-sub.on { color: #8a5a00; }

/* bloco Sublocação: um cartão por item */
.sub-lista { display: grid; gap: 10px; margin-bottom: 12px; }
.sub-card { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, .9fr) 70px minmax(0, 1fr) 32px; grid-template-areas: "oque oque qtd st rm" "forn cont cont cont ."; gap: 8px 10px;
  padding: 12px 12px 12px 14px; border: 1px solid var(--line); border-left: 4px solid #d8d6cf; border-radius: 10px; background: #fcfbf8; }
.sub-card.adm { grid-template-areas: "oque oque qtd st rm" "forn cont cont custo ."; }
.sub-card label.f { margin: 0; min-width: 0; }
.sub-card label.f > span { font-size: 11.5px; margin-bottom: 3px; }
.sub-card .in { width: 100%; padding: 7px 9px; font-size: 14px; }
.sc-oque { grid-area: oque; } .sc-qtd { grid-area: qtd; } .sc-st { grid-area: st; } .sc-rm { grid-area: rm; align-self: end; margin-bottom: 4px; }
.sc-forn { grid-area: forn; } .sc-cont { grid-area: cont; } .sc-custo { grid-area: custo; }
.sc-qtd .in, .sc-custo .in { text-align: right; }
.sub-card.st-pedido { border-left-color: #e0a100; }
.sub-card.st-confirmado { border-left-color: #3d8cc4; }
.sub-card.st-retirado { border-left-color: #8b6fdc; }
.sub-card.st-devolvido { border-left-color: #3a9a66; background: #f6fbf7; }
@media (max-width: 820px) {
  .sub-card, .sub-card.adm { grid-template-columns: minmax(0, 1fr) 76px 32px; grid-template-areas: "oque oque rm" "qtd st st" "forn forn forn" "cont cont cont" "custo custo custo"; }
  .sc-qtd { grid-area: qtd; }
}
.sub-custo-rapido { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 12px; font-weight: 600; color: #8a5a00; margin: 4px 0 0 8px; }
.sub-custo-rapido .grp { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.sub-custo-rapido [data-subqtd] { width: 64px; }
.sub-custo-rapido .in { width: 90px; padding: 3px 7px; font-size: 13px; text-align: right; }

/* lista de ordens de serviço: no celular cada OS vira um cartão */
@media (max-width: 820px) {
  .os-lista, .os-lista tbody { display: block; }
  .os-lista thead { display: none; }
  .os-lista tr { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "os data" "ev ev" "and and" "ac ac"; gap: 4px 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
  .os-lista td { display: block; padding: 0; border: 0; }
  .os-lista td:nth-child(1) { grid-area: os; }
  .os-lista td:nth-child(3) { display: none; }
  .os-lista td:nth-child(2) { grid-area: ev; }
  .os-lista td:nth-child(4) { grid-area: data; text-align: right; }
  .os-lista td:nth-child(5) { grid-area: and; }
  .os-lista td:nth-child(6) { grid-area: ac; display: flex; gap: 8px; margin-top: 4px; }
}

/* sublocação parada (ninguém pediu ao fornecedor) */
.sub-card.st-parado { border-left-color: #c0392b; background: #fff7f6; }
.tag-parado { display: inline-block; background: #fde8e5; color: #b0352a; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 10px; }
.sub-parado-aviso { color: #b0352a; font-weight: 700; }

/* equipe do evento: um cartão por pessoa */
.esc-lista { display: grid; gap: 10px; }
.esc-card { display: grid; grid-template-columns: minmax(0, 1.6fr) 64px minmax(0, 1fr) minmax(0, 1fr) auto; grid-template-areas: "pessoa pessoa pessoa st acoes" "srv qtd un un ."; gap: 8px 10px;
  padding: 12px 12px 12px 14px; border: 1px solid var(--line); border-left: 4px solid #d8d6cf; border-radius: 10px; background: #fcfbf8; }
.esc-card.adm { grid-template-areas: "pessoa pessoa pessoa st acoes" "srv qtd un val tot"; }
.esc-card.st-confirmado { border-left-color: #3a9a66; }
.esc-card.st-pendente { border-left-color: #e0a100; }
.esc-card.st-recusou { opacity: .55; }
.esc-card label.f { margin: 0; min-width: 0; }
.esc-card label.f > span { font-size: 11.5px; margin-bottom: 3px; }
.esc-card .in { width: 100%; padding: 7px 9px; font-size: 14px; }
.ec-pessoa { grid-area: pessoa; align-self: center; min-width: 0; } .ec-st { grid-area: st; align-self: center; }
.ec-acoes { grid-area: acoes; display: flex; align-items: center; } .ec-srv { grid-area: srv; } .ec-qtd { grid-area: qtd; } .ec-un { grid-area: un; } .ec-val { grid-area: val; }
.ec-tot { grid-area: tot; display: flex; flex-direction: column; justify-content: flex-end; text-align: right; padding-bottom: 7px; white-space: nowrap; }
.ec-tot span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.ec-qtd .in, .ec-val .in { text-align: right; }
@media (max-width: 820px) {
  .esc-card, .esc-card.adm { grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr) auto; grid-template-areas: "pessoa pessoa pessoa acoes" "st st st st" "srv srv srv srv" "qtd un un un" "val val tot tot"; }
}
.esc-card .st-esc { width: auto; justify-self: end; padding: 5px 10px; font-size: 12.5px; font-weight: 800; border-radius: 20px; }
/* "entrar de novo" depois de ficar parado: cobre a tela toda (esconde os dados) */
.login.trava { position: fixed; inset: 0; z-index: 1000; min-height: 0; }
