:root {
  --bg: #f7f7f8; --card: #fff; --ink: #0b0b0f; --ink2: #3f3f46; --mute: #71717a; --line: #e7e7ea; --soft: #f1f1f3;
  --navy: #2e3192; --orange: #f7941d; --red: #e8452c; --ok: #15803d; --bad: #b91c1c;
  --r: 14px; --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 Inter, -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", Roboto, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { color: inherit; cursor: pointer; }
h1 { font-size: 22px; font-weight: 650; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 20px; margin: 18px 0 4px; }
h3 { font-size: 15px; font-weight: 650; margin: 0 0 12px; }
.muted, .ph p { color: var(--mute); margin: 0; }
label { display: block; font-size: 12.5px; color: var(--ink2); font-weight: 550; margin: 12px 0 0; }
label > span { display: block; margin-bottom: 6px; }
label.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
label.inline > span { margin: 0; white-space: nowrap; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; outline: none; transition: border .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: #a1a1aa; box-shadow: 0 0 0 3px rgba(0,0,0,.05); }
textarea { resize: vertical; }
input[type=range] { padding: 0; border: 0; box-shadow: none; accent-color: var(--ink); height: 22px; }
input[type=checkbox] { width: auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, transform .05s; }
.btn:hover { background: var(--soft); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #27272a; }
.btn.small { padding: 5px 12px; font-size: 12.5px; }
.btn.wide { width: 100%; margin-top: 18px; padding: 11px; }
.btn:disabled { opacity: .5; cursor: wait; }
.row { display: flex; align-items: flex-end; flex-wrap: wrap; }
.row.gap { gap: 10px; margin-top: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; }
.grow { flex: 1; }
.msg { margin-top: 10px; font-size: 13px; white-space: pre-wrap; }
.msg.err { color: var(--bad); } .msg.ok { color: var(--ok); }
.hint { color: var(--mute); font-size: 12px; margin-top: 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two > .card { margin-bottom: 16px; }

/* auth */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 500px at 50% -10%, #eef0ff, transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: 0 10px 40px rgba(0,0,0,.06); text-align: left; }
.auth-crest { width: 64px; display: block; margin: 0 auto 10px; }
.auth-brand { text-align: center; font-weight: 700; color: var(--navy); letter-spacing: .02em; }
.auth-app { text-align: center; color: var(--mute); font-size: 13px; }
.auth-lang { margin-top: 18px; justify-content: center; }
.ver { color: #a1a1aa; font-size: 11px; text-align: center; margin-top: 8px; }

/* layout */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand img { width: 34px; }
.brand b { display: block; font-size: 13px; color: var(--navy); }
.brand span { display: block; font-size: 12px; color: var(--mute); }
nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink2); font-weight: 550; text-decoration: none; margin-bottom: 2px; }
nav a:hover { background: var(--soft); }
nav a.on { background: var(--soft); color: var(--ink); }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 8px 0; font-size: 12.5px; }
.me span { display: block; font-weight: 600; } .me small { color: var(--mute); }
.side-links { margin: 6px 0; color: var(--mute); }
.lang { display: flex; gap: 4px; margin-bottom: 10px; }
.lang button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.lang button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
main { padding: 28px 32px 60px; max-width: 1280px; width: 100%; }
.ph { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.search { max-width: 300px; }

/* icons (CSS masks) */
.ic { width: 18px; height: 18px; display: inline-block; background: currentColor; -webkit-mask: var(--i) center/contain no-repeat; mask: var(--i) center/contain no-repeat; flex: none; }
.ic-wave { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 12h2M7 8v8M11 4v16M15 7v10M19 10v4M21 12h0'/%3E%3C/svg%3E"); }
.ic-stack { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 3 3 8l9 5 9-5-9-5zM3 13l9 5 9-5M3 17l9 5 9-5'/%3E%3C/svg%3E"); }
.ic-mic { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5 11a7 7 0 0 0 14 0M12 18v3'/%3E%3C/svg%3E"); }
.ic-clock { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
.ic-chart { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 20V10M10 20V4M16 20v-7M22 20H2'/%3E%3C/svg%3E"); }
.ic-plug { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M9 2v5M15 2v5M6 7h12v4a6 6 0 0 1-12 0V7zM12 17v5'/%3E%3C/svg%3E"); }
.ic-gear { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z'/%3E%3C/svg%3E"); }
.ic-play-w { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4v16l13-8z'/%3E%3C/svg%3E"); width: 14px; height: 14px; }

/* studio */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.editor { padding: 0; overflow: hidden; }
.editor-top { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.editor-top input { max-width: 260px; }
.editor textarea { border: 0; border-radius: 0; min-height: 360px; padding: 18px; font-size: 16px; line-height: 1.75; box-shadow: none; }
.editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fcfcfd; }
.stats { color: var(--mute); font-size: 12.5px; }
.panel { position: sticky; top: 20px; }
.panel h3 { margin-bottom: 4px; }
.scale { display: flex; justify-content: space-between; color: var(--mute); font-size: 11.5px; margin-top: -2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.chip:hover { background: var(--soft); }
.more { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.more summary { cursor: pointer; color: var(--ink2); font-size: 12.5px; font-weight: 550; }
.panel-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.dim { opacity: .45; pointer-events: none; }
.result { display: flex; flex-direction: column; gap: 10px; }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.result audio, .list audio, .tbl audio { width: 100%; height: 36px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; background: var(--soft); color: var(--ink2); font-weight: 600; }
.pill.ok { background: #dcfce7; color: var(--ok); } .pill.bad { background: #fee2e2; color: var(--bad); } .pill.run { background: #e0e7ff; color: var(--navy); }
.list .item { display: grid; grid-template-columns: 1fr 260px auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.list .item:first-child { border-top: 0; }
.item b { display: block; } .item small { color: var(--mute); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--mute); font-weight: 550; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
.tbl td.script { max-width: 420px; color: var(--ink2); }
.tbl td.script div { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.paste { min-height: 120px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; margin-top: 10px; }
.progress { height: 6px; background: var(--soft); border-radius: 999px; overflow: hidden; margin-top: 14px; }
.progress div { height: 100%; width: 0; background: var(--ink); transition: width .3s; }

/* voices */
.voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 16px; }
.vcard { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.vcard.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.vhead { display: flex; gap: 12px; align-items: center; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; background: linear-gradient(135deg, var(--navy), var(--orange)); flex: none; }
.vhead b { display: block; } .vhead small { color: var(--mute); font-size: 11.5px; word-break: break-all; }
.vactions { display: flex; gap: 6px; flex-wrap: wrap; }
.drop { display: grid; place-items: center; text-align: center; border: 1.5px dashed #d4d4d8; border-radius: 12px; padding: 26px; color: var(--mute); cursor: pointer; margin-top: 12px; font-weight: 500; }
.drop.over { border-color: var(--ink); background: var(--soft); }
.check { display: flex; gap: 8px; align-items: center; margin: 12px 0; font-weight: 500; }

/* usage */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi small { color: var(--mute); display: block; }
.kpi b { font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
.bar { height: 8px; background: var(--soft); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar div { height: 100%; background: var(--ink); }

/* codex */
.code { background: #0b0b0f; color: #e4e4e7; border-radius: 12px; padding: 14px 16px; font: 12.5px/1.6 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; margin: 0 0 10px; }
.tok-new { margin: 14px 0; padding: 14px; border-radius: 12px; background: #fffbeb; border: 1px solid #fde68a; }
.tok-new code { display: block; font: 13px ui-monospace, Menlo, Consolas, monospace; margin: 8px 0; word-break: break-all; }

/* settings */
.model-rows .mrow { display: grid; grid-template-columns: 120px 1.4fr 1fr 1fr 1fr 1fr; gap: 10px; align-items: end; padding: 10px 0; border-top: 1px solid var(--soft); }
.model-rows .mrow:first-child { border-top: 0; }
.model-rows label { margin: 0; }
.rep-rows .rrow { display: grid; grid-template-columns: 120px 1fr 36px; gap: 8px; margin-bottom: 6px; }
.keyrow { display: grid; grid-template-columns: 110px 1fr auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }

/* modal + toast */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.3); display: grid; place-items: center; z-index: 50; }
.modal-card { background: #fff; border-radius: 16px; padding: 22px; width: 360px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; opacity: 0; transition: .2s; pointer-events: none; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .studio, .two { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .panel { position: static; }
  .list .item { grid-template-columns: 1fr; }
  .model-rows .mrow { grid-template-columns: 1fr 1fr; }
}
.row.gap > input, .row.gap > select { width: auto; flex: 1 1 180px; }

/* microphone recording */
.mic { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fcfcfd; }
.mic-head { display: flex; align-items: center; gap: 12px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; display: inline-block; }
#micBtn.recording { background: #ef4444; border-color: #ef4444; }
#micBtn.recording .rec-dot { background: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.mic-time { font: 600 14px ui-monospace, Menlo, Consolas, monospace; min-width: 48px; }
.meter { flex: 1; height: 8px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.meter div { height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #eab308, #ef4444); transition: width .08s; }
.read-this { margin: 10px 0 0; padding: 12px 14px; border-left: 3px solid var(--navy); background: #fff; border-radius: 8px; font-size: 15px; line-height: 1.7; color: var(--ink); }
.or { display: flex; align-items: center; gap: 10px; color: var(--mute); font-size: 12px; margin: 14px 0 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Show / hide password eye */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 42px; width: 100%; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px;
  display: grid; place-items: center; border: 0; background: transparent; color: #6b7280; cursor: pointer; border-radius: 8px; padding: 0; }
.pw-eye:hover { background: #f3f4f6; color: #111; }
.pw-eye svg { width: 18px; height: 18px; }
