*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green: #25D366; --green-dark: #128C7E; --green-deep: #075E54;
  --bg: #f0f2f5; --white: #ffffff; --bubble: #DCF8C6;
  --text: #111b21; --text-muted: #667781; --border: #e9edef; --accent: #1DA462;
}
body { font-family: 'Plus Jakarta Sans', sans-serif; background: var(--bg); min-height: 100vh; color: var(--text); }

/* HEADER */
.header { background: var(--green-deep); color: white; padding: 0 32px; height: 64px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 200; box-shadow: 0 2px 12px rgba(0,0,0,0.18); }
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-icon { width: 36px; height: 36px; background: var(--green); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.header-icon svg { width: 20px; height: 20px; fill: white; }
.header h1 { font-size: 17px; font-weight: 600; }
.header-sub { font-size: 12px; opacity: 0.65; margin-top: 1px; }
.badge-demo { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25); color: white; font-size: 11px; font-weight: 600; letter-spacing: 0.8px; padding: 4px 10px; border-radius: 20px; }

/* NAV */
.nav-tabs { background: var(--white); border-bottom: 1px solid var(--border); padding: 0 32px; display: flex; position: sticky; top: 64px; z-index: 100; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.nav-tab { padding: 0 20px; height: 48px; display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.18s; white-space: nowrap; user-select: none; text-decoration: none; }
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--green-deep); border-bottom-color: var(--green); }
.tab-count { background: var(--bg); color: var(--text-muted); font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
.nav-tab.active .tab-count { background: #e8f8ef; color: var(--accent); }

/* LAYOUT */
.container { max-width: 1160px; margin: 0 auto; padding: 28px 24px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.three-col { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 20px; }

/* CARD */
.card { background: var(--white); border-radius: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.05); overflow: hidden; }
.card-header { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.ch-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.card-header h2 { font-size: 14px; font-weight: 600; }
.card-header p { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.card-header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px 22px 22px; }

/* STAT */
.stat-card { background: var(--white); border-radius: 14px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.05); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.4px; text-transform: uppercase; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -1px; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* FORM */
label { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; letter-spacing: 0.4px; text-transform: uppercase; }
.form-group { margin-bottom: 15px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type="text"], input[type="tel"], input[type="email"], select, textarea { width: 100%; padding: 0 13px; height: 42px; border: 1.5px solid var(--border); border-radius: 10px; font-family: inherit; font-size: 13px; color: var(--text); background: #fafafa; outline: none; transition: border-color 0.18s, box-shadow 0.18s; }
textarea { height: auto; padding: 10px 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(37,211,102,0.12); background: white; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23667781' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 10px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.18s; border: none; text-decoration: none; }
.btn-primary { background: var(--green); color: white; box-shadow: 0 3px 12px rgba(37,211,102,0.3); }
.btn-primary:hover { background: #1db954; transform: translateY(-1px); }
.btn-primary:active { transform: none; }
.btn-primary:disabled { background: #b0bec5; box-shadow: none; cursor: not-allowed; transform: none; }
.btn-outline { background: white; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--green); color: var(--green-deep); background: #f0fdf4; }
.btn-full { width: 100%; height: 46px; font-size: 14px; }

/* TABLE */
.leads-table { width: 100%; border-collapse: collapse; }
.leads-table th { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.4px; text-transform: uppercase; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); background: #fafafa; }
.leads-table td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.leads-table tr:last-child td { border-bottom: none; }
.leads-table tr:hover td { background: #fafffd; }
.lead-cell { display: flex; align-items: center; gap: 10px; }
.av { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.av-0{background:#dbeafe;color:#1d4ed8} .av-1{background:#fce7f3;color:#9d174d} .av-2{background:#d1fae5;color:#065f46} .av-3{background:#fef3c7;color:#92400e} .av-4{background:#ede9fe;color:#5b21b6} .av-5{background:#fee2e2;color:#991b1b}
.lead-name { font-weight: 600; font-size: 13px; }
.lead-sub { font-size: 11px; color: var(--text-muted); }
.mono { font-family: 'DM Mono', monospace; font-size: 12px; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid var(--border); background: white; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 13px; transition: all 0.15s; text-decoration: none; color: inherit; }
.icon-btn:hover { border-color: var(--green); background: #f0fdf4; }
.icon-btn.del:hover { border-color: #ef4444; background: #fef2f2; }

/* STATUS SELECT */
.status-sel { height: 28px; font-size: 11px; padding: 0 26px 0 8px; border-radius: 20px; border-color: var(--border); background-size: 10px; }

/* TEMPLATE OPTIONS */
.tpl-grid { display: flex; flex-direction: column; gap: 9px; }
.tpl-opt { border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: all 0.18s; position: relative; background: #fafafa; }
.tpl-opt:hover { border-color: var(--green); background: #f0fdf4; }
.tpl-opt.sel { border-color: var(--green); background: #f0fdf4; box-shadow: 0 0 0 3px rgba(37,211,102,0.1); }
.tpl-opt.sel::after { content:'✓'; position:absolute; right:13px; top:50%; transform:translateY(-50%); width:20px; height:20px; background:var(--green); color:white; border-radius:50%; font-size:10px; font-weight:700; display:flex; align-items:center; justify-content:center; }
.tpl-tag { display:inline-block; background:#e8f8ef; color:var(--accent); font-size:10px; font-weight:600; letter-spacing:.5px; padding:2px 8px; border-radius:20px; margin-bottom:4px; text-transform:uppercase; }
.tpl-name { font-size:13px; font-weight:600; margin-bottom:2px; }
.tpl-desc { font-size:11px; color:var(--text-muted); line-height:1.5; }

/* LEAD PICKER */
.lead-picker { border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; max-height: 190px; overflow-y: auto; background: #fafafa; }
.lp-item { padding: 9px 13px; display: flex; align-items: center; gap: 9px; cursor: pointer; transition: background 0.15s; }
.lp-item:hover { background: #f0fdf4; }
.lp-item.sel { background: #f0fdf4; }
.lp-item + .lp-item { border-top: 1px solid var(--border); }
.lp-av { width: 28px; height: 28px; border-radius: 50%; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lp-name { font-size: 13px; font-weight: 600; }
.lp-sub { font-size: 11px; color: var(--text-muted); }
.lp-check { margin-left: auto; color: var(--green); display: none; font-size: 14px; }
.lp-item.sel .lp-check { display: block; }

/* VARS BOX */
.vars-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 13px 15px; }
.vars-box label { margin-bottom: 4px; }
.vars-box input { margin-bottom: 9px; background: white; height: 38px; }
.vars-box input:last-child { margin-bottom: 0; }

/* CONFIG NOTICE */
.cfg-notice { background: #fff8e1; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 13px; font-size: 12px; color: #78350f; margin-bottom: 15px; line-height: 1.5; }
.cfg-notice code { font-family: 'DM Mono', monospace; background: rgba(0,0,0,0.07); padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* PHONE FRAME */
.phone-wrap { display: flex; justify-content: center; padding: 22px 22px 18px; }
.phone-frame { width: 266px; border-radius: 34px; border: 6px solid #1a1a2e; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,0.22); }
.phone-notch { background: #1a1a2e; height: 26px; display: flex; align-items: center; justify-content: center; }
.phone-pill { width: 72px; height: 9px; background: #0d0d1a; border-radius: 10px; }
.wa-top { background: var(--green-deep); padding: 9px 11px 7px; display: flex; align-items: center; gap: 8px; }
.wa-av { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: white; }
.wa-cname { font-size: 12px; font-weight: 600; color: white; }
.wa-cstatus { font-size: 9px; color: rgba(255,255,255,0.6); }
.wa-dots { margin-left: auto; display: flex; gap: 3px; }
.wa-dots span { width: 3px; height: 3px; background: rgba(255,255,255,0.5); border-radius: 50%; }
.wa-chat { padding: 9px; min-height: 200px; background: #e5ddd5; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.wa-datepill { align-self: center; background: rgba(255,255,255,0.75); font-size: 9px; font-weight: 600; color: var(--text-muted); padding: 2px 8px; border-radius: 10px; margin-bottom: 4px; }
.wa-bubble { background: var(--bubble); border-radius: 12px 2px 12px 12px; padding: 8px 10px 20px; max-width: 88%; position: relative; font-size: 11px; line-height: 1.5; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.1); word-break: break-word; animation: bpop 0.3s ease; }
@keyframes bpop { from{transform:scale(0.87);opacity:0} 70%{transform:scale(1.02)} to{transform:scale(1);opacity:1} }
.wa-bubble::before { content:''; position:absolute; top:0; right:-7px; border:7px solid transparent; border-top-color:var(--bubble); border-right:none; }
.wa-time { position:absolute; bottom:4px; right:8px; font-size:9px; color:var(--text-muted); display:flex; align-items:center; gap:3px; }
.wa-cta { margin-top:8px; padding-top:8px; border-top:1px solid rgba(0,0,0,0.08); font-size:10px; font-weight:700; color:var(--green-dark); text-align:center; }
.wa-ibar { background:var(--bg); padding:6px 8px; display:flex; align-items:center; gap:5px; }
.wa-ifake { flex:1; background:white; height:26px; border-radius:20px; font-size:10px; color:var(--text-muted); display:flex; align-items:center; padding:0 9px; }
.wa-mic { width:26px; height:26px; background:var(--green); border-radius:50%; display:flex; align-items:center; justify-content:center; }
.wa-mic svg { width:13px; height:13px; fill:white; }

/* TIMELINE */
.timeline { display: flex; flex-direction: column; }
.tl-step { display: flex; align-items: flex-start; gap: 11px; padding-bottom: 14px; position: relative; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step::before { content:''; position:absolute; left:11px; top:26px; width:2px; height:calc(100% - 4px); background:var(--border); }
.tl-step:last-child::before { display:none; }
.tl-dot { width:24px; height:24px; border-radius:50%; border:2px solid var(--border); background:white; display:flex; align-items:center; justify-content:center; font-size:10px; flex-shrink:0; z-index:1; position:relative; transition:all 0.3s; }
.tl-dot.active { border-color:var(--green); background:#f0fdf4; }
.tl-dot.done { border-color:var(--green); background:var(--green); color:white; }
.tl-dot.fail { border-color:#ef4444; background:#fef2f2; color:#ef4444; }
.tl-label { font-size:12px; font-weight:600; color:var(--text-muted); }
.tl-label.active { color:var(--text); }
.tl-time { font-size:10px; color:var(--text-muted); margin-top:1px; font-family:'DM Mono',monospace; }
.tl-time.fail { color:#ef4444; }
.spin-ring { width:9px; height:9px; border:2px solid var(--green); border-top-color:transparent; border-radius:50%; animation:spin 0.8s linear infinite; }
@keyframes spin { to{transform:rotate(360deg)} }

/* SUCCESS BANNER */
.ok-banner { background:#f0fdf4; border:1.5px solid #86efac; border-radius:12px; padding:11px 15px; display:flex; align-items:center; gap:10px; margin-top:12px; }
.ok-banner p { font-size:13px; color:#166534; font-weight:500; }
.err-banner { background:#fef2f2; border:1.5px solid #fca5a5; border-radius:12px; padding:11px 15px; display:flex; align-items:center; gap:10px; margin-top:12px; }
.err-banner p { font-size:13px; color:#991b1b; font-weight:500; }

/* EMPTY STATE */
.es { text-align:center; padding:40px 20px; }
.es-icon { font-size:36px; margin-bottom:10px; }
.es h3 { font-size:15px; font-weight:600; margin-bottom:6px; }
.es p { font-size:13px; color:var(--text-muted); line-height:1.6; max-width:260px; margin:0 auto 14px; }

/* MODAL */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.38); z-index:500; display:flex; align-items:center; justify-content:center; padding:24px; }
.modal { background:white; border-radius:20px; width:100%; max-width:520px; box-shadow:0 20px 60px rgba(0,0,0,0.2); overflow:hidden; animation:modalIn 0.22s ease; }
@keyframes modalIn { from{transform:scale(0.93);opacity:0} to{transform:scale(1);opacity:1} }
.modal-hd { padding:20px 24px 16px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.modal-hd h3 { font-size:15px; font-weight:700; }
.modal-close { width:30px; height:30px; border-radius:8px; border:none; background:var(--bg); cursor:pointer; font-size:16px; display:flex; align-items:center; justify-content:center; }
.modal-close:hover { background:var(--border); }
.modal-bd { padding:20px 24px 10px; }
.modal-ft { padding:14px 24px 20px; display:flex; gap:10px; justify-content:flex-end; }

/* FUNNEL */
.funnel-row { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.funnel-lbl { font-size:12px; font-weight:600; color:var(--text-muted); width:82px; flex-shrink:0; }
.funnel-wrap { flex:1; height:8px; background:var(--border); border-radius:10px; overflow:hidden; }
.funnel-bar { height:100%; border-radius:10px; transition:width 0.6s ease; }
.funnel-n { font-size:11px; font-weight:600; color:var(--text-muted); width:22px; text-align:right; }

/* SEARCH */
.search-wrap { position:relative; }
.search-wrap input { padding-left:32px; height:36px; font-size:12px; }
.search-ico { position:absolute; left:10px; top:50%; transform:translateY(-50%); font-size:13px; color:var(--text-muted); pointer-events:none; }

::-webkit-scrollbar { width:5px; } ::-webkit-scrollbar-thumb { background:#ccc; border-radius:10px; }
@media(max-width:768px){ .two-col,.three-col{grid-template-columns:1fr} .form-row{grid-template-columns:1fr} }

/* BLAZOR */
.blazor-error-boundary { background: #b32121; padding: 1rem 1rem 1rem 1.5rem; color: white; border-radius: 12px; margin: 12px; }
.blazor-error-boundary::after { content: "Ocorreu um erro."; }
.validation-message { color: #e50000; font-size: 11px; margin-top: 4px; }
#blazor-error-ui { background: #ffd166; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.2); display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
