/* WA-Action — painel */
:root { --pri: #0f766e; --pri-d: #115e59; --bg: #f3f4f1; --card: #fff; --txt: #1c2321; --mut: #6b7571; --line: #e2e5e0; --bad: #b42318; --warn: #b54708; --r: 10px; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--txt); }
a { color: var(--pri-d); }
code { background: #eef1ed; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
h3 { margin: 0 0 12px; font-size: 17px; }
h4 { margin: 18px 0 8px; font-size: 14px; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--mut); }
.bad { color: var(--bad); }

/* topo */
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: #10201d; color: #e8efec; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--pri); color: #fff; font-size: 13px; font-weight: 800; }
.bar select { background: #1d322e; color: #fff; border: 1px solid #2f4a44; border-radius: 8px; padding: 6px 8px; font: inherit; max-width: 220px; }
#tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
#tabs button { background: none; border: 0; color: #b9c9c4; padding: 8px 12px; border-radius: 8px; font: inherit; cursor: pointer; white-space: nowrap; }
#tabs button.on, #tabs button:hover { background: #1f3934; color: #fff; }
.user { display: flex; gap: 10px; align-items: center; }
.user a { color: #9fd6c9; }
@media (max-width: 760px) { .hide-sm { display: none; } .bar { gap: 8px; } }

main { padding: 16px; max-width: 1600px; margin: 0 auto; }
.empty { padding: 40px; text-align: center; color: var(--mut); }

/* números */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stats[hidden] { display: none; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; display: flex; flex-direction: column; }
.stat small { color: var(--mut); font-size: 12px; }
.stat b { font-size: 20px; margin: 2px 0; }
.stat b.sm { font-size: 14px; }

/* barra de ferramentas */
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 200px; max-width: 420px; }

/* formulários */
label { display: block; font-size: 13px; color: var(--mut); margin-bottom: 10px; }
input, select, textarea { display: block; width: 100%; margin-top: 3px; padding: 8px 10px; font: inherit; color: var(--txt); background: #fff; border: 1px solid #cfd5d0; border-radius: 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #99d3c7; border-color: var(--pri); }
textarea.mono { font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--txt); }
label.check input { width: auto; margin: 0; }
select.sm { display: inline-block; width: auto; padding: 4px 6px; margin: 0; font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1; min-width: 180px; margin: 0; }
details { margin: 8px 0 12px; } summary { cursor: pointer; color: var(--pri-d); font-weight: 600; margin-bottom: 8px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid #cfd5d0; background: #fff; color: var(--txt); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f4f6f3; }
.btn.primary { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.primary:hover { background: var(--pri-d); }
.btn.danger { color: var(--bad); border-color: #f1c6c2; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; margin-top: 6px; }
.btn:disabled { opacity: .55; cursor: default; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 14px; overflow-x: auto; }
.alert { background: #fdecea; color: var(--bad); padding: 10px 12px; border-radius: 8px; margin-bottom: 10px; }
.alert.ok { background: #e6f6f1; color: #0b5d4f; }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: #e8ebe6; border-radius: var(--r); display: flex; flex-direction: column; max-height: calc(100vh - 250px); min-height: 120px; }
.col.over { outline: 2px dashed var(--pri); background: #dcefe9; }
.col-h { display: flex; justify-content: space-between; padding: 10px 12px 6px; font-weight: 700; font-size: 13px; }
.count { background: #fff; border-radius: 99px; padding: 0 8px; font-size: 12px; color: var(--mut); }
.col-b { overflow-y: auto; padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 6px; }
.col-empty { color: #a3aba7; text-align: center; padding: 10px; }
.lead { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.lead:hover { border-color: #a9cfc5; }
.lead.drag { opacity: .4; }
.lead-n { font-weight: 600; }
.lead-m { color: var(--mut); font-size: 12px; }
.lead-f { display: flex; gap: 6px; align-items: center; font-size: 11px; color: var(--mut); margin-top: 4px; }
.lead-f .ago { margin-left: auto; }
.tag { background: #eef1ed; border-radius: 4px; padding: 0 5px; }
.tag.warn { background: #fff1e0; color: var(--warn); }

/* tabelas */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: 12px; color: var(--mut); font-weight: 600; }
.tbl td.r { text-align: right; white-space: nowrap; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover { background: #f6f8f5; }
.st { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #eef1ed; white-space: nowrap; }
.st-pending_payment { background: #fff4e0; color: #93500b; }
.st-paid { background: #e3f1ff; color: #144f8c; }
.st-delivered, .st-wa-active { background: #e2f5ee; color: #0b5d4f; }
.st-canceled, .st-refunded, .st-wa-banned { background: #fde8e7; color: var(--bad); }
.st-wa-disconnected { background: #fff1e0; color: var(--warn); }

/* galeria (admin) */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.g-item { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 8px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.g-item.off { opacity: .5; }
.g-item img, .ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.ph { display: grid; place-items: center; background: linear-gradient(135deg, #d9ece8, #f0e9db); font-size: 34px; font-weight: 700; color: var(--pri-d); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(9, 20, 17, .5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; overflow-y: auto; z-index: 20; }
.modal[hidden] { display: none; }
.modal-card { position: relative; background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-card.wide { max-width: 1100px; }
.close { position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 26px; color: var(--mut); cursor: pointer; }
.lead-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; padding-right: 26px; }
.lead-head h3 { margin: 0 0 2px; }
.lead-head .row { max-width: 520px; flex: 1; }
.lead-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .lead-grid { grid-template-columns: 1fr; } }
.gens { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.gen-th { display: flex; flex-direction: column; gap: 2px; font-size: 11px; }
.gen-th img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.gen-th .ph { font-size: 22px; }
.acts { list-style: none; padding: 0; margin: 0; max-height: 180px; overflow-y: auto; font-size: 12px; }
.acts li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.chat-wrap { display: flex; flex-direction: column; }
.chat { background: #efe9df; border-radius: var(--r); padding: 10px; height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 82%; padding: 6px 9px; border-radius: 8px; background: #fff; align-self: flex-start; white-space: pre-wrap; word-break: break-word; }
.msg.out { background: #d9fdd3; align-self: flex-end; }
.msg small { display: block; color: var(--mut); font-size: 10px; text-align: right; }
.send { display: flex; gap: 8px; margin-top: 8px; align-items: flex-end; }
.send textarea { margin: 0; }
.settings { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; align-items: start; }
.settings > form:last-child { grid-column: 1 / -1; }
@media (max-width: 960px) { .settings { grid-template-columns: 1fr; } }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #10201d; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 40; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 92vw; }
.toast[hidden] { display: none; }

/* login / instalador */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #10201d, #0f766e); }
.login-card { background: #fff; border-radius: 16px; padding: 28px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card.wide { max-width: 680px; }
.login-card .brand { color: var(--txt); font-size: 20px; margin-bottom: 4px; }
.login-card h3 { margin-top: 18px; font-size: 15px; }

/* v1.1 — produtos, kits, envios */
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px 4px; margin: 0 0 14px; }
legend { font-weight: 700; padding: 0 6px; color: var(--pri-d); }
.muted.sm, p.sm { font-size: 12px; margin: -4px 0 10px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 2px 0 12px; }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; flex-direction: column; padding: 10px 12px; border: 1px solid #cfd5d0; border-radius: 10px; color: var(--txt); font-weight: 600; }
.seg small { font-weight: 400; color: var(--mut); }
.seg input:checked + span { border-color: var(--pri); background: #e8f5f1; box-shadow: inset 0 0 0 1px var(--pri); }
.seg.sm { display: inline-grid; grid-template-columns: repeat(3, auto); }
.seg.sm span { padding: 6px 12px; flex-direction: row; gap: 6px; }
input[type=color] { height: 38px; padding: 3px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.logo-prev { height: 28px; vertical-align: middle; margin-left: 6px; border-radius: 4px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 10px; }
@media (max-width: 760px) { .grid4 { grid-template-columns: 1fr 1fr; } }
.kit-form { margin-top: 10px; background: #f7f9f6; }
tr.off td { opacity: .45; }
.w-auto { width: auto; display: inline-block; }
.code { background: var(--pri); color: #fff; border-radius: 4px; padding: 0 5px; font-size: 11px; font-weight: 700; }
.ship-h { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; margin-bottom: 8px; }
.ship-b { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .ship-b { grid-template-columns: 1fr; } }
.addr { margin: 0; background: #f4f6f3; border-radius: 8px; padding: 10px; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; }
.ship-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ship-side .row input { min-width: 160px; }
.st-shipped { background: #ede7ff; color: #4b2aa3; }
.row label.check { margin: 0; }
.row label.check input { flex: none; min-width: 0; width: auto; }
