:root {
  --bg: #0E1116; --side: #12161C; --card: #161B22; --deep: #0F1318; --line: #262D36; --line2: #2E3641;
  --text: #E6EAF0; --text2: #C3CAD4; --muted: #9AA4B2;
  --green: #3DD68C; --green-text: #6FE3A8; --green-bg: #12291F; --green-dark: #0B1A12;
  --orange: #F5A524; --orange-text: #F5C46B; --orange-bg: #3A2A12;
  --blue: #5B9DFF; --blue-text: #8FB8FF; --blue-bg: #14233B;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2 { margin: 0; }
h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand img { width: 32px; height: 32px; }
.code-input { font-size: 26px !important; letter-spacing: 10px; text-align: center; height: 56px !important; }

/* campos */
label.field { display: flex; flex-direction: column; gap: 6px; color: var(--text2); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=tel], select, textarea {
  height: 42px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg); color: var(--text); padding: 0 12px; width: 100%;
}
textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

/* botões */
.btn { height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line2); background: transparent; color: var(--text); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { background: #1D242D; }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--green-dark); font-weight: 700; }
.btn.primary:hover { background: #57E19E; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.danger { color: var(--orange-text); border-color: #4A3420; }
.btn.link { border: 0; background: none; color: var(--blue-text); padding: 0 4px; }
.btn:disabled { opacity: .6; cursor: default; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; background: var(--bg); border: 1px solid var(--line2); border-radius: 10px; padding: 4px; }
.seg button { height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--text2); font-weight: 600; cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--green); color: var(--green-dark); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; color: var(--text2); font-weight: 600; font-size: 13px; cursor: pointer; }
.pill[aria-pressed=true], .pill[aria-selected=true] { background: var(--text); color: var(--bg); border-color: var(--text); }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg); cursor: pointer; width: 100%; text-align: left; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: #4A5361; padding: 2px; display: flex; flex: none; }
.switch .knob { width: 18px; height: 18px; border-radius: 50%; background: #fff; }
.switch[aria-pressed=true] .track { background: var(--green); justify-content: flex-end; }

/* layout */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 232px; max-width: 100%; background: var(--side); border-right: 1px solid #222932; padding: 20px 14px; display: flex; flex-direction: column; gap: 20px; }
.side nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav-btn { flex: 1 1 180px; display: flex; justify-content: space-between; align-items: center; height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text2); cursor: pointer; font-weight: 500; text-align: left; }
.nav-btn:hover { background: #1A2028; }
.nav-btn[aria-current=page] { background: #1F2A24; color: var(--green-text); font-weight: 600; }
.badge-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--orange); color: #1A1206; }
.side-foot { margin-top: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; flex: none; }
.dot.off { background: var(--orange); }
.main { flex: 999 1 560px; min-width: 0; padding: 24px clamp(16px, 3vw, 40px) 48px; display: flex; flex-direction: column; gap: 24px; }
.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }

/* cartões */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.grow2 { flex: 2 1 420px; } .card.grow1 { flex: 1 1 280px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.kpi .label { color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 30px; font-weight: 650; letter-spacing: -0.01em; }
.kpi.good { border-color: #2B4A3A; } .kpi.good .value { color: var(--green-text); }
.kpi.warn { border-color: #4A3420; } .kpi.warn .value { color: var(--orange); }
.line { display: flex; justify-content: space-between; gap: 8px; }
.sep { height: 1px; background: var(--line2); }
.chart { display: flex; align-items: flex-end; gap: 12px; height: 200px; border-bottom: 1px solid var(--line2); }
.chart .col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.chart .bar { width: 100%; max-width: 56px; border-radius: 6px 6px 0 0; background: #2C5B45; min-height: 2px; }
.chart .bar.now { background: var(--green); }
.chart-labels { display: flex; gap: 12px; } .chart-labels span { flex: 1 1 0; text-align: center; color: var(--muted); font-size: 12px; }
.mix { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--line); }
.mix .a { background: var(--green); } .mix .b { background: var(--blue); }

/* tabelas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 8px 10px; }
td { padding: 11px 10px; border-top: 1px solid #222932; color: var(--text2); vertical-align: middle; }
td.strong { color: var(--text); font-weight: 500; }
td .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.active { background: var(--green-bg); color: var(--green-text); }
.tag.late { background: var(--orange-bg); color: var(--orange-text); }
.tag.trial { background: var(--blue-bg); color: var(--blue-text); }
.tag.cancelled, .tag.paused { background: var(--line); color: var(--text2); }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed #3A424E; border-radius: 12px; }

/* planos */
.plans { flex: 2 1 420px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; align-content: start; }
.plan { display: flex; flex-direction: column; gap: 8px; text-align: left; min-height: 160px; padding: 18px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); cursor: pointer; color: var(--text); }
.plan[aria-pressed=true] { border-color: var(--green); }
.plan .price { font-size: 30px; font-weight: 650; }
.plan.add { border-style: dashed; border-color: #4A5361; align-items: center; justify-content: center; color: var(--text2); font-weight: 600; background: transparent; }

/* fluxo e conversa */
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.flow li { background: var(--deep); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.flow .n { width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: var(--green-dark); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.bubble { align-self: flex-start; max-width: 92%; background: #1B3A2B; border-radius: 12px; padding: 10px 12px; white-space: pre-line; line-height: 1.45; }
.preview { background: var(--deep); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.notice { background: var(--orange-bg); color: var(--orange-text); border-radius: 10px; padding: 12px 14px; font-weight: 500; }
.notice.info { background: var(--blue-bg); color: var(--blue-text); }

/* diálogo e aviso */
dialog { background: var(--card); color: var(--text); border: 1px solid var(--line2); border-radius: 16px; padding: 24px; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5, 8, 12, .7); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 10px; font-weight: 600; z-index: 50; max-width: calc(100vw - 32px); }
.toast.err { background: var(--orange); color: #1A1206; }
.err-text { color: var(--orange-text); font-weight: 500; min-height: 1em; }
