:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --ink: #1d2320;
  --muted: #6b726e;
  --line: #e4e2db;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --accent-soft: #e5f0ec;
  --warn: #a35c12;
  --warn-soft: #fbefe0;
  --bad: #a33a2a;
  --bad-soft: #f8e5e1;
  --radius: 14px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.5; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: .9rem; }
.hidden { display: none !important; }

button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); padding: .55rem 1rem; border-radius: 10px; font-weight: 500;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.small { padding: .3rem .7rem; font-size: .85rem; }

label { display: block; font-size: .85rem; font-weight: 600; margin: .9rem 0 .3rem; }
input, select, textarea {
  width: 100%; font: inherit; padding: .6rem .75rem; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; font-size: .9rem; }
.check input { width: auto; margin-top: .25rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.neutral { background: #eeede8; color: var(--muted); }
.error { color: var(--bad); font-size: .9rem; margin-top: .6rem; }
.demo-banner { background: var(--warn-soft); color: var(--warn); font-size: .85rem; padding: .5rem 1rem; text-align: center; }

/* ---------- Candidato ---------- */
.candidate { max-width: 720px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; padding: 1.5rem 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.2rem; }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.chat { flex: 1; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-height: 70vh; }
.chat-head { padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.msgs { flex: 1; overflow-y: auto; padding: 1.2rem; display: flex; flex-direction: column; gap: .7rem; }
.msg { max-width: 82%; padding: .7rem 1rem; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.assistant { background: #f1f0eb; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.typing { align-self: flex-start; color: var(--muted); font-size: .9rem; padding: .3rem .5rem; }
.composer { display: flex; gap: .6rem; padding: .8rem; border-top: 1px solid var(--line); }
.composer textarea { min-height: 46px; max-height: 160px; }
.done { padding: 1rem 1.2rem; border-top: 1px solid var(--line); background: var(--accent-soft); color: var(--accent); font-weight: 500; }

/* ---------- Admin ---------- */
.admin { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: #17201c; color: #d9e0dc; padding: 1.2rem .8rem; }
.side .brand { color: #fff; padding: 0 .4rem; }
.side nav button { display: block; width: 100%; text-align: left; background: transparent; border: 0; color: inherit; padding: .6rem .8rem; border-radius: 8px; margin-bottom: 2px; }
.side nav button.active, .side nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.main { padding: 1.8rem 2.2rem; overflow-x: auto; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
.stack > * + * { margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); font-size: .92rem; vertical-align: top; }
th { background: #faf9f6; font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #faf9f6; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.stat b { display: block; font-size: 1.6rem; }
.empty { text-align: center; padding: 2.5rem; color: var(--muted); }

.drawer-bg { position: fixed; inset: 0; background: rgba(20, 25, 22, .35); display: flex; justify-content: flex-end; z-index: 10; }
.drawer { width: min(980px, 96vw); height: 100%; background: var(--bg); overflow-y: auto; padding: 1.6rem 2rem; }
.report { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.2rem; align-items: start; }
.dim { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.dim:last-child { border-bottom: 0; }
.bar { height: 8px; background: #eeede8; border-radius: 99px; overflow: hidden; margin: .35rem 0; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.transcript { max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; }
.transcript .msg { max-width: 92%; font-size: .9rem; }
ul.clean { margin: .3rem 0 0; padding-left: 1.1rem; }
.big-score { font-size: 2.6rem; font-weight: 700; line-height: 1; }
.phone { max-width: 420px; background: #e9e4da; border-radius: 18px; padding: 1rem; height: 520px; display: flex; flex-direction: column; }
.phone .msgs { background: transparent; padding: .4rem; }
.phone .msg.user { background: #d8f5c8; color: var(--ink); }
.phone .msg.assistant { background: #fff; }
code { background: #eeede8; padding: .1rem .35rem; border-radius: 5px; font-size: .88em; word-break: break-all; }

@media (max-width: 800px) {
  .admin { grid-template-columns: 1fr; }
  .side { padding: .6rem; }
  .side nav { display: flex; overflow-x: auto; }
  .side nav button { white-space: nowrap; }
  .main { padding: 1rem; }
  .grid2, .report, .stats { grid-template-columns: 1fr; }
  .msg { max-width: 92%; }
}

/* ---------- Tipo de participante, microfone e gravação ---------- */
.segmented { display: flex; gap: .6rem; flex-wrap: wrap; }
.segmented label { margin: 0; flex: 1; min-width: 200px; display: flex; gap: .5rem; align-items: center; font-weight: 500; font-size: .92rem; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; cursor: pointer; background: #fff; }
.segmented label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.segmented input { width: auto; margin: 0; }
button.mic { display: grid; place-items: center; padding: 0 .8rem; color: var(--accent); }
button.mic:hover { background: var(--accent-soft); }
.recording { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; border-top: 1px solid var(--line); background: #fdf3f1; }
.recording #rec-tempo { font-weight: 700; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.badge.info { background: #e6eef8; color: #2b5c8f; }

/* ---------- Seletor de empresa e cultura ---------- */
.side-empresa { margin: 0 .4rem 1rem; }
.side-empresa span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #8fa198; margin-bottom: .3rem; }
.side-empresa select { background: #233029; color: #fff; border-color: #33443b; }
.side-status { margin: 1.4rem .8rem 0; font-size: .78rem; color: #8fa198; line-height: 1.6; }
.aviso { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: .8rem 1rem; font-size: .9rem; }
a.btn { display: inline-block; text-decoration: none; }
.btn.small { padding: .3rem .7rem; font-size: .85rem; }
