/* smileface palette: ivory background, espresso text and accents */
:root {
  --bg: #f6f1e8; --card: #fffdf8; --fg: #2b1f17; --muted: #84756a; --line: #e7ddcf; --soft: #f1e9dc;
  --espresso: #3b2a20; --espresso-2: #57402f;
  --ok: #3f7a4c; --bad: #a5432f; --warn: #a8731c;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 14px; color: var(--fg); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
[hidden] { display: none !important; }
main { max-width: 1180px; margin: 0 auto; padding: 22px 20px 40px; }
h1 { font-size: 20px; margin: 0 0 4px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 13px; font-weight: 600; margin: 16px 0 8px; }
p { margin: 0 0 8px; line-height: 1.45; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); min-height: 1em; }
.top { margin-bottom: 16px; }
.top p { max-width: 720px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(59, 42, 32, .04); }
.layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--espresso); color: var(--card); font-size: 12px; }

/* controls */
label { display: block; margin: 6px 0; font-size: 12px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--fg); font-size: 13px; }
label.inline { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--fg); }
label.inline select { width: auto; min-width: 160px; margin: 0; }
input, select, textarea { width: 100%; font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; margin-top: 3px; }
input[type=checkbox] { width: auto; margin: 0; accent-color: var(--espresso); }
input[type=range] { padding: 0; border: 0; accent-color: var(--espresso); }
button { font: inherit; border-radius: 9px; padding: 8px 14px; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--fg); }
button.primary { background: var(--espresso); color: #fff8ee; border-color: var(--espresso); }
button.primary:hover { background: var(--espresso-2); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--soft); }
button:disabled { opacity: .5; cursor: default; }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.big { font-size: 16px; font-weight: 600; padding: 12px 22px; border-radius: 12px; }
button.linkish { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 4px; font-size: 12px; }
.small-btn { font-size: 12px; padding: 4px 9px; }
pre { white-space: pre-wrap; font-size: 11px; background: var(--soft); padding: 8px; border-radius: 8px; max-height: 260px; overflow: auto; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.row-between h2 { margin: 0; }

/* choice tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tiles.one { grid-template-columns: 1fr; }
@media (max-width: 520px) { .tiles { grid-template-columns: 1fr; } }
.tile { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 11px 12px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--card); }
.tile b { font-size: 14px; font-weight: 600; }
.tile span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.tile:hover:not(:disabled) { border-color: var(--muted); }
.tile.on { border-color: var(--espresso); background: var(--soft); box-shadow: inset 0 0 0 1px var(--espresso); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tags i { font-style: normal; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #e9f0e6; color: var(--ok); }
.tags i.warn { background: #f6ead3; color: var(--warn); }

/* call */
.callbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 0 8px; }
.live { display: flex; flex-direction: column; gap: 6px; }
.state { font-size: 14px; color: var(--fg); }
.meter { width: 140px; height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; }
.meter div { height: 100%; width: 0; background: var(--muted); transition: width 60ms linear; }
.meter.voice div { background: var(--ok); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 4px; }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr; } }
.stat { background: var(--soft); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 19px; font-weight: 650; margin: 2px 0; font-variant-numeric: tabular-nums; }
.tone-ok { color: var(--ok); } .tone-bad { color: var(--bad); } .tone-warn { color: var(--warn); } .tone-info { color: var(--fg); }

/* transcript */
.log { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; }
.log li { padding: 8px 11px; border-radius: 11px; max-width: 88%; line-height: 1.4; }
.log li.bot, .log li.guest { background: var(--soft); }
.log .who { display: block; font-size: 11px; color: var(--muted); margin-bottom: 1px; }
.log .lat { display: block; font-size: 11px; color: var(--muted); margin: -1px 0 2px; }
.log .t { font-size: 11px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; display: none; }
.log .t b { color: var(--fg); font-weight: 600; }
.log li.sys { display: none; color: var(--muted); font-size: 12px; padding: 2px 4px; }
.log li.info { color: var(--muted); font-size: 12px; padding: 2px 4px; align-self: center; }
.log li.err { color: var(--bad); font-size: 12px; padding: 2px 4px; }
/* robot on the left, guest on the right */
.log li.bot { align-self: flex-start; }
.log li.guest { align-self: flex-end; background: #efe2cf; }
body.dev .log .t { display: block; }
body.dev .log li.sys { display: block; }
.dev-only { display: none; }
body.dev .dev-only { display: inline-block; }

/* cost */
.costbox { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.costbox h3 { margin-top: 0; }
.costs { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.costs td { padding: 5px 0; border-bottom: 1px solid var(--line); }
.costs td:last-child { text-align: right; white-space: nowrap; padding-left: 12px; }
.costs tr.total td { font-weight: 650; border-bottom: 0; }
.month { background: var(--soft); border-radius: 10px; padding: 10px 12px; margin: 8px 0 10px; }
.month .big { font-size: 18px; font-weight: 650; color: var(--espresso); }

/* tests table */
.tablewrap { overflow-x: auto; }
.tests { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin-top: 8px; }
.tests th { text-align: left; font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
.tests td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }

/* compare voices */
.cmpbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.cmplist { list-style: none; padding: 0; margin: 0; }
.cmplist li { display: grid; grid-template-columns: 28px 1fr auto auto auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.cmplist .t { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* developer panel */
footer { text-align: center; margin: 6px 0 14px; }
.dev .devgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 860px) { .dev .devgrid { grid-template-columns: 1fr; } }
.row3 { display: grid; grid-template-columns: 1.4fr .7fr .8fr; gap: 8px; }
.seg { display: flex; flex-direction: column; gap: 4px; }
.seg button { text-align: left; }
.seg button.on { background: var(--soft); border-color: var(--espresso); }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 12px 0 6px; }
.actions #summary { margin-right: auto; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: 320px; display: flex; flex-direction: column; gap: 10px; }

/* builder ("Собрать самому") */
.builder h3 { margin-top: 12px; }
.builder .row-between { gap: 10px; flex-wrap: wrap; }
.moments { display: flex; flex-direction: column; gap: 8px; }
.moment { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--soft); border-radius: 10px; padding: 9px 11px; }
.moment b { display: block; font-size: 13px; font-weight: 600; }
.moment .small { display: block; margin-top: 2px; line-height: 1.35; }
@media (max-width: 520px) { .moment { grid-template-columns: 1fr; } }
.seg2 { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg2 button { border: 0; background: transparent; padding: 5px 10px; font-size: 12px; border-radius: 7px; white-space: nowrap; }
.seg2 button.on { background: var(--espresso); color: #fff8ee; }
.seg2 button:disabled.on { opacity: .85; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 620px) { .tiles.three { grid-template-columns: 1fr; } }
.bgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; margin-top: 6px; }
@media (max-width: 520px) { .bgrid { grid-template-columns: 1fr; } }
