:root {
  --ink: #0f172a; --muted: #5b6577; --line: #e3e7ee; --bg: #f5f7fa; --card: #fff;
  --accent: #0f766e; --accent-dk: #115e59; --accent-lt: #e6f4f2;
  --warn: #92400e; --warn-bg: #fff7e6; --warn-line: #f6d39a;
  --err: #b42318; --err-bg: #fef3f2; --err-line: #f5c2bd;
  --ok: #157f3b; --ok-bg: #effaf3; --ok-line: #b7e4c7;
  --radius: 12px; --shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 16px rgba(15,23,42,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 80px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* header */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1120px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand img { width: 28px; height: 28px; }
.brand span { color: var(--muted); font-weight: 500; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 8px 14px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tab:hover { background: var(--bg); color: var(--ink); }
.tab.on { background: var(--accent-lt); color: var(--accent-dk); }
.who { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.lang { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.menu { position: relative; }
.menu-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.menu-list { position: absolute; right: 0; top: 40px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 200px; padding: 6px; }
.menu-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 6px; cursor: pointer; }
.menu-list button:hover { background: var(--bg); }

main { max-width: 1120px; margin: 0 auto; padding: 24px 20px 140px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.note { border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; border: 1px solid; }
.note.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.note.err { background: var(--err-bg); border-color: var(--err-line); color: var(--err); }
.note.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.note.info { background: var(--accent-lt); border-color: #bfe3dd; color: var(--accent-dk); }
.note b { color: inherit; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff; padding: 9px 16px; border-radius: 9px; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: #c7cdd8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dk); }
.btn.big { padding: 13px 26px; font-size: 16px; border-radius: 11px; }
.btn.danger { color: var(--err); }
.btn.link { border: 0; background: none; padding: 4px 6px; color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }

/* forms */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid .wide { grid-column: 1 / -1; }
.f label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.f .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.f .ferr { font-size: 12px; color: var(--err); margin-top: 4px; }
.f input, .f select, .f textarea { width: 100%; border: 1px solid #cfd5df; background: #fff; border-radius: 8px; padding: 9px 11px; }
.f input:focus, .f select:focus, .f textarea:focus { outline: 2px solid #99d5cc; border-color: var(--accent); }
.f.bad input, .f.bad select, .f.bad textarea { border-color: var(--err); background: var(--err-bg); }
.f input[readonly] { background: var(--bg); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 18px; height: 18px; margin-top: 2px; }
.inline-input { display: flex; gap: 8px; }
.inline-input input { flex: 1; }

/* login */
.login { max-width: 400px; margin: 9vh auto; }
.login .brand { justify-content: center; font-size: 20px; margin-bottom: 18px; }
.login .card { padding: 28px; }
.login .f { margin-bottom: 14px; }
.login .btn { width: 100%; }

/* steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.step { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; }
.step .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-lt); color: var(--accent-dk); font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.step b { display: block; font-size: 14px; }
.step span { font-size: 13px; color: var(--muted); }

/* drop zone */
.drop { border: 2px dashed #b9c2cf; border-radius: 16px; background: #fff; padding: 40px 20px; text-align: center; transition: .15s; cursor: pointer; }
.drop:hover { border-color: var(--accent); }
.drop.over { border-color: var(--accent); background: var(--accent-lt); transform: scale(1.005); }
.drop .big-ico { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.drop h2 { margin: 0 0 6px; font-size: 20px; }
.drop p { margin: 0 0 16px; color: var(--muted); }
.drop.compact { padding: 18px; }
.drop.compact .big-ico { display: none; }
.drop.compact h2 { font-size: 16px; }
.drop.compact p { margin-bottom: 10px; }

/* recording cards */
.rec { padding: 0; overflow: hidden; }
.rec-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fbfcfd; }
.rec-head .ico { font-size: 22px; flex: none; }
.rec-head > div:nth-child(2) { min-width: 0; flex: 1 1 auto; }
.rec-head .name { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.rec-head .meta { color: var(--muted); font-size: 13px; }
.rec-body { padding: 16px 18px; }
.rec-path { margin-top: 12px; font-size: 12px; color: var(--muted); }
.rec-path .mono { font-size: 12px; color: var(--ink); background: var(--bg); padding: 2px 6px; border-radius: 5px; }
.rec.st-done { border-color: var(--ok-line); }
.rec.st-done .rec-head { background: var(--ok-bg); }
.rec.st-error { border-color: var(--err-line); }
.rec.st-already .rec-head { background: var(--warn-bg); }
.status-chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.status-chip.ok { background: var(--ok-bg); color: var(--ok); }
.status-chip.run { background: var(--accent-lt); color: var(--accent-dk); }
.status-chip.err { background: var(--err-bg); color: var(--err); }
.status-chip.warn { background: var(--warn-bg); color: var(--warn); }
.prog { height: 8px; background: #e9edf3; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.prog > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.prog.ok > div { background: #22a35a; }
.prog-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.split-offer { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.file-list { max-height: 160px; overflow: auto; font-size: 12px; background: var(--bg); border-radius: 8px; padding: 8px 10px; margin-top: 10px; }
.file-list div { display: flex; justify-content: space-between; gap: 10px; }

/* bottom bar */
.bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(15,23,42,.06); z-index: 15; }
.bar-in { max-width: 1120px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 16px; }
.bar .sum { font-size: 14px; }
.bar .sum b { font-size: 16px; }
.bar .prog { width: 260px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #fafbfc; }
.table-wrap { overflow-x: auto; }
.empty { text-align: center; color: var(--muted); padding: 26px; }

/* setup sections */
.sect-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sect-head h2 { margin: 0; }
.editor { background: #fbfcfd; border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.editor .actions { display: flex; gap: 10px; margin-top: 16px; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); font-weight: 600; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }

.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 18px; background: #fff; border: 1px dashed var(--accent); padding: 8px 12px; border-radius: 8px; display: inline-block; letter-spacing: .03em; }
pre.json { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 10px; overflow: auto; font-size: 12px; max-height: 420px; }
.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 50; box-shadow: var(--shadow); }

@media (max-width: 820px) {
  .top-in { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .tabs { order: 3; width: 100%; }
  .steps { grid-template-columns: 1fr; }
  .grid.three { grid-template-columns: 1fr; }
  .bar-in { flex-wrap: wrap; }
  .bar .prog { width: 100%; }
}

/* simpler flow */
.first-run h2 { margin-bottom: 4px; }
.setup-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.setup-step { display: flex; gap: 12px; align-items: center; text-align: left; border: 2px solid var(--accent); background: #fff; border-radius: 12px; padding: 16px; cursor: pointer; font: inherit; color: var(--ink); }
.setup-step:hover { background: var(--accent-lt); }
.setup-step .n { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center; }
.setup-step b { display: block; font-size: 15px; }
.setup-step small { color: var(--muted); }
.setup-step.done { border-color: var(--ok-line); background: var(--ok-bg); cursor: default; }
.setup-step.done .n { background: var(--ok); }
.rec-summary { margin-top: 12px; font-size: 13px; color: var(--muted); }
.card-foot { margin-top: 6px; }
.details { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.seg { display: inline-flex; border: 1px solid #cfd5df; border-radius: 9px; overflow: hidden; width: 100%; }
.seg button { flex: 1; border: 0; background: #fff; padding: 9px 10px; cursor: pointer; font: inherit; border-right: 1px solid #cfd5df; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }
.f.bad .seg { border-color: var(--err); }
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: min(760px, 100%); box-shadow: 0 20px 60px rgba(15,23,42,.3); }
.modal .editor { border: 0; background: none; margin: 0; padding: 24px; }
.modal .editor h2 { margin: 2px 0 16px; }
body.modal-open { overflow: hidden; }
body.dragging::after { content: attr(data-drop-text); position: fixed; inset: 10px; border: 4px dashed var(--accent); border-radius: 18px; background: rgba(230,244,242,.92);
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: var(--accent-dk); z-index: 60; pointer-events: none; }
@media (max-width: 820px) { .setup-steps { grid-template-columns: 1fr; } }

/* v3: location search, short forms, languages */
.lang-sel { width: auto !important; max-width: 140px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 4px; font-size: 13px; cursor: pointer; }
.lang-sel.plain { border-color: transparent; color: var(--accent); }
.setup-steps.two { grid-template-columns: repeat(2, 1fr); }
.place-search { position: relative; }
.place-search input { width: 100%; }
.sugg { margin-top: 6px; border-radius: 10px; overflow: hidden; }
.sugg:empty { display: none; }
.sugg { border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.sugg-item { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 10px 12px; cursor: pointer; }
.sugg-item:last-child { border-bottom: 0; }
.sugg-item:hover, .sugg-item:focus { background: var(--accent-lt); outline: none; }
.sugg-note { padding: 10px 12px; color: var(--muted); font-size: 14px; }
.place-actions { margin-top: 8px; gap: 10px; }
.place-actions .hint { margin: 0; }
.place-chip { display: flex; gap: 10px; align-items: center; border: 1px solid var(--ok-line); background: var(--ok-bg); border-radius: 10px; padding: 10px 12px; }
.place-chip .pin { font-size: 20px; }
.more-toggle { margin: 10px 0 2px; padding-left: 0; }
.grid.more { margin-top: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.consent-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fafbfc; }
.consent-files { margin-top: 8px; gap: 8px; }
.file-btn { cursor: pointer; }
.ok-hint { color: var(--ok); }
.inline-email { width: 100%; min-width: 160px; border: 1px dashed #cfd5df; border-radius: 8px; padding: 6px 8px; }
button.pill { border: 0; cursor: pointer; font: inherit; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
@media (max-width: 820px) { .setup-steps.two { grid-template-columns: 1fr; } }
