:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #edf2f8;
  --surface-3: #f9fbfd;
  --ink: #182230;
  --muted: #64748b;
  --line: #dbe4ef;
  --green: #2563eb;
  --green-dark: #1d4ed8;
  --green-soft: #e8f0ff;
  --amber: #9a5d00;
  --amber-soft: #fff1d5;
  --danger: #b42318;
  --sidebar: #0f172a;
  --sidebar-muted: #a7b3c7;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #111827;
  --surface-2: #1f2937;
  --surface-3: #0f172a;
  --ink: #e5edf7;
  --muted: #9aa8bb;
  --line: #2b3648;
  --green: #60a5fa;
  --green-dark: #bfdbfe;
  --green-soft: #172a46;
  --amber: #ffd27a;
  --amber-soft: #332714;
  --danger: #ff8d83;
  --sidebar: #070b14;
  --sidebar-muted: #9aa8bb;
}

* { box-sizing: border-box; }
html { width: 100%; height: 100%; overflow: hidden; background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body { width: 100%; height: 100%; }
body { background: var(--bg); color: var(--ink); overflow: hidden; }
button, input, textarea { font: inherit; letter-spacing: 0; }
button, input, textarea, select { max-width: 100%; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 4px; color: var(--green); font-size: 11px; font-weight: 700; text-transform: uppercase; }
h1, h2, h3, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 28px; }
h2 { margin: 0; font-size: 18px; }
h3 { margin: 0; }

.app-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); width: 100%; height: var(--app-height, 100dvh); }
.sidebar { display: flex; flex-direction: column; background: var(--sidebar); color: #ffffff; padding: 18px 12px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #2bb673; color: #07170e; }
.brand-mark svg { width: 20px; }
.brand span:last-child, .page-identity span:last-child { min-width: 0; display: flex; flex-direction: column; }
.brand strong { font-size: 15px; }
.brand small, .page-identity small { margin-top: 2px; color: var(--sidebar-muted); font-size: 11px; }
.main-nav { display: grid; gap: 4px; }
.nav-button { position: relative; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--sidebar-muted); text-align: left; }
.nav-button:hover, .nav-button.active { background: var(--surface-2); color: #ffffff; }
.nav-button svg { width: 18px; }
.nav-button b { min-width: 20px; padding: 2px 6px; border-radius: 999px; background: #2bb673; color: #07170e; font-size: 11px; text-align: center; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 12px 6px 0; border-top: 1px solid #2b342e; }
.page-identity { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.page-identity strong { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.page-identity select { max-width: 140px; border: 0; outline: 0; background: transparent; color: #ffffff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.page-identity select option { background: #17211b; color: #ffffff; }
.avatar-page { background: #263a2f !important; color: #75d6a4; }

.workspace { display: grid; grid-template-columns: minmax(260px, 340px) minmax(380px, 1fr) 260px; min-width: 0; min-height: 0; height: var(--app-height, 100dvh); overflow: hidden; }
.conversation-panel, .chat-panel, .details-panel { min-width: 0; min-height: 0; overflow: hidden; background: var(--surface); }
.conversation-panel { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.panel-header, .chat-header, .content-header { display: flex; align-items: center; justify-content: space-between; }
.panel-header { height: 76px; padding: 14px 16px; }
.panel-actions { display: flex; align-items: center; gap: 6px; }
.mobile-page-select { display: none; max-width: 150px; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--ink); font-weight: 700; }
.icon-button { display: grid; flex: 0 0 auto; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: inherit; }
.icon-button:hover { background: var(--surface-2); }
.sidebar .icon-button:hover { background: var(--surface-2); }
.theme-toggle { display: none; }
#desktop-theme-toggle span { display: none; }
.icon-button svg { width: 18px; }
.search-box { display: flex; align-items: center; gap: 8px; margin: 0 12px 10px; padding: 0 10px; height: 38px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--muted); }
.search-box svg { width: 16px; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.filter-row { display: flex; gap: 6px; padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.filter-button, .mode-button { border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.filter-button { padding: 6px 10px; }
.filter-button.active, .filter-button:hover { background: var(--green-soft); color: var(--green-dark); }
.conversation-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.conversation-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; width: 100%; padding: 12px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; }
.conversation-item:hover, .conversation-item.active { background: var(--green-soft); }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; overflow: hidden; border-radius: 50%; background: var(--surface-2); color: var(--green-dark); font-size: 13px; font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.conversation-body { min-width: 0; }
.conversation-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conversation-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.conversation-top time, .conversation-body p { color: var(--muted); font-size: 11px; }
.conversation-body p { margin: 5px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-badge { align-self: center; min-width: 20px; padding: 3px 6px; border-radius: 999px; background: var(--green); color: #ffffff; font-size: 10px; text-align: center; }

.chat-panel { position: relative; display: flex; flex-direction: column; background: var(--surface-3); }
.empty-state { display: grid; place-content: center; justify-items: center; height: 100%; padding: 30px; text-align: center; }
.empty-state p, .details-empty p { color: var(--muted); font-size: 13px; }
.empty-icon { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 14px; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.active-chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-header { min-height: 68px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); gap: 10px; }
.chat-heading { min-width: 0; flex: 1; }
.chat-heading h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.chat-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.chat-heading p.closed { color: var(--danger); }
.message-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding: 24px clamp(14px, 4vw, 52px); }
.message-row { display: flex; margin: 8px 0; }
.message-row.outbound { justify-content: flex-end; }
.message-bubble { min-width: 0; max-width: min(82%, 680px); padding: 9px 11px 6px; overflow: visible; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 1px rgb(20 34 24 / 4%); }
.outbound .message-bubble { border-color: var(--green); background: var(--green-soft); }
.message-author { display: block; margin-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.message-bubble p { width: 100%; max-height: none; margin: 0; overflow: visible; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; text-overflow: clip; font-size: 13px; line-height: 1.45; }
.message-bubble a { color: var(--green-dark); }
.message-audio { display: block; width: min(320px, 100%); max-width: 100%; margin: 3px 0 5px; }
.message-media-link { display: block; margin: 3px 0 6px; }
.message-image, .message-video { display: block; width: min(420px, 100%); max-height: 420px; border-radius: 7px; background: var(--surface-2); object-fit: contain; }
.message-video { margin: 3px 0 6px; }
.audio-fallback { margin-top: 3px; }
.message-transcript { margin-top: 6px; border-top: 1px solid rgb(0 0 0 / 6%); padding-top: 5px; }
.message-transcript strong { display: block; color: var(--green-dark); font-size: 10px; font-weight: 700; }
.message-transcript p { margin-top: 6px; max-height: 160px; overflow-y: auto; color: var(--muted); font-size: 12px; }
.transcript-pending { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; font-style: italic; }
.message-meta { display: flex; justify-content: flex-end; gap: 5px; margin-top: 4px; color: var(--muted); font-size: 9px; }
.attachment-link { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; font-size: 12px; }
.composer { padding: 10px 16px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.compose-mode { display: flex; gap: 4px; margin-bottom: 8px; }
.mode-button { display: flex; align-items: center; gap: 6px; padding: 6px 8px; }
.mode-button svg { width: 14px; }
.mode-button.active { background: var(--surface-2); color: var(--ink); }
.voice-tools { margin-bottom: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-3); }
.voice-picker-row { display: grid; grid-template-columns: auto minmax(120px, 1fr) 30px auto; align-items: center; gap: 7px; margin-bottom: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.voice-picker-row label { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 650; }
.voice-picker-row label svg { width: 14px; }
.voice-picker-row select { width: 100%; min-width: 0; height: 32px; padding: 0 28px 0 8px; border: 1px solid var(--line); border-radius: 5px; outline: 0; background: var(--surface); color: var(--ink); font-size: 11px; }
.voice-picker-row select:focus { border-color: #6aaa86; box-shadow: 0 0 0 2px rgb(24 121 78 / 10%); }
.compact-icon { width: 30px; height: 30px; border: 1px solid var(--line); background: var(--surface); }
.compact-icon svg { width: 14px; }
.model-badge { padding: 4px 7px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; font-weight: 700; }
.voice-tools-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.voice-tools-heading > span:first-child { display: flex; min-width: 0; flex-direction: column; }
.voice-tools-heading strong { font-size: 11px; }
.voice-tools-heading small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.voice-tool-actions { display: flex; gap: 5px; flex: 0 0 auto; }
.tool-button { display: inline-flex; align-items: center; gap: 5px; min-height: 29px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 10px; font-weight: 650; }
.tool-button svg { width: 13px; }
.tool-button-accent { border-color: #a8d4bb; background: var(--green-soft); color: var(--green-dark); }
.tool-button:disabled { opacity: .55; cursor: wait; }
.tag-row { display: flex; gap: 5px; margin-top: 9px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.tag-row button { flex: 0 0 auto; min-height: 27px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 9px; }
.tag-row button:hover { border-color: #91bca2; color: var(--green-dark); }
.compose-row { display: flex; align-items: flex-end; gap: 8px; }
.compose-row textarea { width: 100%; min-height: 42px; max-height: 112px; resize: none; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: var(--bg); color: var(--ink); }
.compose-row textarea:focus { border-color: #6aaa86; box-shadow: 0 0 0 3px rgb(24 121 78 / 10%); }
.send-button { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border: 0; border-radius: 8px; background: var(--green); color: #ffffff; }
.send-button:hover, .primary-button:hover { background: var(--green-dark); }
.send-button:disabled { opacity: .5; cursor: wait; }
.send-button svg { width: 18px; }
.composer-help { margin: 6px 0 0; color: var(--muted); font-size: 10px; }
.voice-preview { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--amber-soft); }
.voice-preview audio { width: min(350px, 100%); height: 36px; }
.preview-actions { display: flex; gap: 6px; }

.details-panel { padding: 22px 18px; border-left: 1px solid var(--line); }
.details-empty { display: grid; justify-items: center; padding-top: 120px; color: var(--muted); text-align: center; }
.details-empty svg { width: 28px; }
.contact-card { display: grid; justify-items: center; padding: 22px 0; border-bottom: 1px solid var(--line); text-align: center; }
.avatar-large { width: 68px; height: 68px; margin-bottom: 10px; font-size: 20px; }
.contact-card p { max-width: 210px; overflow: hidden; text-overflow: ellipsis; margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.details-list { margin: 0; }
.details-list div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.details-list dt { color: var(--muted); }
.details-list dd { max-width: 130px; margin: 0; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.notice { display: flex; gap: 9px; margin-top: 18px; padding: 10px; border-radius: 6px; background: var(--green-soft); color: var(--green-dark); }
.notice svg { width: 18px; flex: 0 0 auto; }
.notice p { margin: 0; font-size: 11px; line-height: 1.4; }

.content-view { min-height: 0; height: var(--app-height, 100dvh); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding: 28px clamp(20px, 4vw, 52px); }
.content-header { margin-bottom: 26px; }
.content-header p:not(.eyebrow) { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.status-list { display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.status-item { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; background: var(--surface); }
.status-item > svg { width: 20px; color: var(--green); }
.status-item span { flex: 1; }
.status-item span strong, .status-item span small { display: block; }
.status-item span small { margin-top: 3px; color: var(--muted); }
.status-pill { padding: 4px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); font-size: 10px; font-weight: 700; }
.status-pill.off { background: #3a1816; color: var(--danger); }

.studio-model { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 700; }
.studio-model svg { width: 14px; }
.studio-layout { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 22px; align-items: start; }
.studio-editor { position: relative; z-index: 2; display: grid; gap: 18px; }
.studio-section { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.studio-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.studio-section-heading > span { display: flex; align-items: center; gap: 10px; min-width: 0; }
.studio-section-heading > span > b { display: grid; place-items: center; width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); font-size: 11px; }
.studio-section-heading > span > span { display: flex; min-width: 0; flex-direction: column; }
.studio-section-heading strong { font-size: 13px; }
.studio-section-heading small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.studio-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.studio-fields label, .studio-contact-picker { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 650; }
.field-label { display: block; }
.studio-fields select, .studio-fields input { width: 100%; min-width: 0; height: 40px; padding: 0 34px 0 10px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: var(--bg); color: var(--ink); font-size: 12px; }
.studio-fields input { margin-bottom: 6px; }
.studio-fields select:focus, .studio-fields input:focus, #studio-text:focus { border-color: #6aaa86; box-shadow: 0 0 0 3px rgb(24 121 78 / 10%); }
.studio-contact-results { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; margin: -2px 0 6px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 12px 30px rgb(15 23 42 / 12%); }
.studio-contact-result { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 9px; width: 100%; min-height: 48px; padding: 7px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); text-align: left; }
.studio-contact-result:hover, .studio-contact-result:focus { background: var(--green-soft); outline: 0; }
.studio-contact-result .avatar { width: 34px; height: 34px; font-size: 11px; }
.studio-contact-result span { min-width: 0; }
.studio-contact-result strong, .studio-contact-result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-contact-result strong { font-size: 12px; }
.studio-contact-result small { margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }
.studio-contact-result em { color: var(--green-dark); font-size: 9px; font-style: normal; font-weight: 800; text-transform: uppercase; }
.studio-contact-result.disabled { opacity: .55; cursor: not-allowed; }
.studio-contact-empty { padding: 12px; color: var(--muted); font-size: 11px; text-align: center; }
.studio-note { margin: 9px 0 0; color: var(--muted); font-size: 9px; }
.studio-note.closed { color: var(--danger); }
.upload-sound-button { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 10px; font-weight: 650; }
.upload-sound-button:hover { background: var(--surface-2); }
.upload-sound-button svg { width: 14px; }
.upload-sound-button input { display: none; }
.sound-controls { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.2fr) 36px; align-items: end; gap: 12px; }
.sound-controls > label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 650; }
.sound-controls select { width: 100%; height: 38px; padding: 0 32px 0 9px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: var(--bg); color: var(--ink); font-size: 11px; }
.volume-control > span { display: flex; justify-content: space-between; }
.volume-control input { width: 100%; height: 38px; accent-color: var(--green); }
.sound-delete { width: 36px; height: 38px; border: 1px solid #6f2b25; background: #2d1513; color: var(--danger); }
.sound-preview-control { display: grid; grid-template-columns: auto minmax(180px, 1fr); align-items: center; gap: 10px; margin-top: 10px; }
.sound-preview-control audio { width: 100%; height: 38px; }
.sound-preview-control button:disabled { opacity: .5; cursor: not-allowed; }
.studio-editor-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.studio-editor-actions .primary-button, .studio-editor-actions .secondary-button { min-height: 34px; font-size: 11px; }
.studio-categories { display: flex; gap: 5px; margin-bottom: 8px; overflow-x: auto; padding-bottom: 2px; }
.studio-categories button { flex: 0 0 auto; min-height: 29px; padding: 0 10px; border: 0; border-radius: 5px; background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 650; }
.studio-categories button.active { background: var(--green-soft); color: var(--green-dark); }
.studio-tags { display: flex; flex-wrap: wrap; gap: 5px; min-height: 31px; margin-bottom: 10px; }
.studio-tags button { min-height: 27px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 9px; }
.studio-tags button:hover { border-color: #91bca2; color: var(--green-dark); }
#studio-text { position: relative; z-index: 3; display: block; width: 100%; resize: vertical; min-height: 190px; max-height: 420px; padding: 13px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: var(--bg); color: var(--ink); font-size: 13px; line-height: 1.5; }
.studio-text-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; color: var(--muted); font-size: 9px; }
.studio-preview { position: sticky; top: 0; z-index: 1; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.preview-stage { display: grid; justify-items: center; min-height: 270px; align-content: center; padding: 18px 0; text-align: center; }
.preview-stage-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 14px; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.preview-stage-icon svg { width: 23px; }
.preview-stage h2 { font-size: 16px; }
.preview-stage > p:not(.eyebrow) { max-width: 230px; margin: 7px 0 14px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.preview-stage audio { width: 100%; height: 38px; margin-top: 10px; }
.generation-status { width: 100%; margin-top: 14px; }
.generation-status > span { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--green-dark); font-size: 10px; }
.generation-status svg { width: 14px; animation: spin 1s linear infinite; }
.generation-status > div { height: 4px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.generation-status > div span { display: block; width: 75%; height: 100%; border-radius: inherit; background: var(--green); animation: progress-pulse 1.4s ease-in-out infinite; }
.studio-primary-action, .studio-send-action, .studio-download-action { width: 100%; margin-top: 8px; }
.studio-send-action:disabled { opacity: .5; cursor: not-allowed; }
.studio-safety { display: flex; align-items: flex-start; gap: 6px; margin: 12px 0 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.studio-safety svg { width: 14px; flex: 0 0 auto; color: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes progress-pulse { 0% { transform: translateX(-80%); } 100% { transform: translateX(120%); } }

.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 6px; font-weight: 650; }
.primary-button { border: 0; background: var(--green); color: #ffffff; }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.primary-button svg, .secondary-button svg { width: 16px; }
.secondary-button:hover { background: var(--surface-2); }

.login-shell { display: grid; width: 100%; min-height: var(--app-height, 100dvh); place-items: center; padding: 20px; background: #111713; }
.login-panel { width: min(400px, 100%); padding: 28px; border-radius: 8px; background: var(--surface); box-shadow: 0 24px 80px rgb(0 0 0 / 25%); }
.brand-login { padding: 0 0 30px; color: var(--ink); }
.brand-login small { color: var(--muted); }
.login-panel h1 { font-size: 26px; }
.login-panel .muted { margin: 6px 0 0; font-size: 13px; }
.login-form { display: grid; gap: 14px; margin-top: 24px; }
.login-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.login-form input { height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: var(--bg); color: var(--ink); }
.login-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgb(24 121 78 / 10%); }
.remember-login { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 8px !important; cursor: pointer; }
.remember-login input { width: 16px; height: 16px; padding: 0; accent-color: var(--green); }
.form-error { min-height: 16px; margin: 0; color: var(--danger); font-size: 11px; }

dialog { width: min(390px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 90px rgb(0 0 0 / 30%); }
dialog::backdrop { background: rgb(8 13 10 / 60%); backdrop-filter: blur(2px); }
dialog form { padding: 24px; text-align: center; }
.dialog-icon { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 auto 12px; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.dialog-icon svg { width: 19px; }
dialog h2 { font-size: 18px; }
dialog p { margin: 8px 0 20px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toast { position: fixed; z-index: 100; right: 18px; bottom: 18px; max-width: min(380px, calc(100vw - 36px)); transform: translateY(20px); padding: 11px 14px; border-radius: 6px; background: #172019; color: #ffffff; opacity: 0; pointer-events: none; transition: .2s ease; font-size: 12px; box-shadow: 0 8px 30px rgb(0 0 0 / 20%); }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #7a271a; }
.list-empty { padding: 30px 18px; color: var(--muted); font-size: 12px; text-align: center; }
.loading { opacity: .55; pointer-events: none; }

@media (max-width: 1240px) {
  .workspace { grid-template-columns: 300px minmax(0, 1fr); }
  .details-panel { display: none; }
  .studio-layout { grid-template-columns: 1fr; }
  .studio-preview { position: static; }
}

@media (max-width: 900px) {
  body { overflow: hidden; }
  input, textarea, select { font-size: 16px !important; }
  input, select { min-height: 44px; }
  textarea { line-height: 1.4; }
  button, a, label { touch-action: manipulation; }
  .mobile-only { display: grid !important; }
  .app-shell { display: block; height: var(--app-height, 100dvh); padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(62px + env(safe-area-inset-bottom)); flex-direction: row; align-items: center; padding: 6px max(10px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); box-shadow: 0 -1px 0 var(--line); }
  .sidebar .brand, .sidebar-footer { display: none; }
  .main-nav { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
  .theme-toggle { display: grid; }
  .nav-button { grid-template-columns: 1fr; justify-items: center; gap: 2px; min-height: 48px; padding: 3px; font-size: 10px; }
  .nav-button b { position: absolute; top: 1px; right: calc(50% - 24px); min-width: 16px; padding: 1px 4px; font-size: 9px; }
  .workspace, .content-view { height: 100%; min-height: 0; }
  .workspace { grid-template-columns: 1fr; }
  .conversation-panel, .chat-panel { height: 100%; min-height: 0; overflow: hidden; }
  .workspace.chat-open .conversation-panel { display: none; }
  .workspace:not(.chat-open) .chat-panel { display: none; }
  .panel-header { padding-top: calc(14px + env(safe-area-inset-top)); height: calc(76px + env(safe-area-inset-top)); }
  .mobile-page-select { display: block; }
  .chat-header { padding-top: calc(10px + env(safe-area-inset-top)); min-height: calc(68px + env(safe-area-inset-top)); }
  .message-list { padding: 16px 12px; }
  .message-bubble { max-width: 84%; }
  .voice-preview { align-items: stretch; flex-direction: column; }
  .preview-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .content-view { padding: calc(20px + env(safe-area-inset-top)) 14px 20px; }
  .content-header { align-items: flex-start; gap: 12px; }
  .login-panel { padding: 22px; }
  body.typing-focus .app-shell { height: var(--app-height, 100dvh); padding-bottom: 0; }
  body.typing-focus .sidebar { display: none; }
  body.typing-focus .workspace, body.typing-focus .content-view { height: var(--app-height, 100dvh); }
  body.typing-focus .active-chat { height: var(--app-height, 100dvh); }
  body.typing-focus .chat-header { flex: 0 0 auto; }
  body.typing-focus .composer { flex: 0 0 auto; }
  body.typing-focus .composer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  body.typing-focus .message-list { padding-bottom: 18px; }
  body.typing-focus .content-view { padding-bottom: max(18px, env(safe-area-inset-bottom)); background: var(--bg); }
}

@media (max-width: 460px) {
  .studio-fields { grid-template-columns: 1fr; }
  .sound-controls { grid-template-columns: 1fr 36px; }
  .sound-preview-control { grid-template-columns: 1fr; }
  .volume-control { grid-column: 1 / -1; grid-row: 2; }
  .studio-section { padding: 14px; }
  .studio-section-heading { align-items: flex-start; flex-direction: column; }
  .studio-editor-actions { width: 100%; }
  .studio-editor-actions button { flex: 1; }
  .studio-text-meta { align-items: flex-start; flex-direction: column; }
  .voice-picker-row { grid-template-columns: auto minmax(90px, 1fr) 30px; }
  .model-badge { display: none; }
}

@media (max-width: 380px) {
  .sidebar { padding-left: 5px; padding-right: 5px; }
  .nav-button { font-size: 9px; }
  .nav-button svg { width: 17px; }
  .panel-header { padding-left: 12px; padding-right: 12px; }
  .chat-header { padding-left: 8px; padding-right: 8px; }
  .composer { padding-left: 9px; padding-right: 9px; }
  .voice-tools-heading { align-items: flex-start; flex-direction: column; }
  .voice-tool-actions { width: 100%; }
  .voice-tool-actions button { flex: 1; }
  .message-bubble { max-width: 90%; }
  dialog form { padding: 20px; }
}

/* Whisper Wave-inspired Voice Studio */
.voice-studio-view {
  --wave-blue: #007aff;
  --wave-blue-soft: rgb(0 122 255 / 10%);
  --wave-card: rgb(255 255 255 / 88%);
  background:
    radial-gradient(circle at 88% 5%, rgb(0 122 255 / 10%), transparent 30%),
    radial-gradient(circle at 12% 92%, rgb(94 92 230 / 8%), transparent 30%),
    var(--bg);
}
:root[data-theme="dark"] .voice-studio-view {
  --wave-card: rgb(28 28 30 / 90%);
  background:
    radial-gradient(circle at 88% 5%, rgb(0 122 255 / 18%), transparent 32%),
    radial-gradient(circle at 12% 92%, rgb(94 92 230 / 14%), transparent 34%),
    #000;
}
.voice-studio-view .content-header {
  padding: 4px 2px 10px;
}
.voice-studio-view .content-header h1 {
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 720;
  letter-spacing: -.035em;
}
.voice-studio-view .content-header .eyebrow {
  color: var(--wave-blue);
  letter-spacing: .12em;
}
.voice-studio-view .studio-model {
  border: 1px solid rgb(0 122 255 / 24%);
  border-radius: 999px;
  background: var(--wave-blue-soft);
  color: var(--wave-blue);
  box-shadow: 0 8px 24px rgb(0 122 255 / 10%);
}
.voice-studio-view .studio-layout {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 18px;
}
.voice-studio-view .studio-editor {
  gap: 12px;
}
.voice-studio-view .studio-section,
.voice-studio-view .studio-preview {
  border: 1px solid rgb(120 120 128 / 20%);
  border-radius: 14px;
  background: var(--wave-card);
  box-shadow: 0 10px 35px rgb(15 23 42 / 7%);
  backdrop-filter: blur(18px);
}
.voice-studio-view .studio-section {
  padding: 16px;
}
.voice-studio-view .studio-section-heading > span > b {
  width: 28px;
  height: 28px;
  background: var(--wave-blue);
  color: #fff;
  box-shadow: 0 5px 14px rgb(0 122 255 / 25%);
}
.voice-studio-view select,
.voice-studio-view input[type="search"],
.voice-studio-view textarea {
  border-color: rgb(120 120 128 / 24%);
  border-radius: 10px;
  background: var(--surface-2);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.voice-studio-view select:focus,
.voice-studio-view input:focus,
.voice-studio-view textarea:focus {
  border-color: var(--wave-blue);
  box-shadow: 0 0 0 3px rgb(0 122 255 / 14%);
  outline: none;
}
.voice-studio-view .enhancement-controls {
  margin: -2px 0 14px;
  padding: 10px;
  border-radius: 11px;
  background: var(--wave-blue-soft);
}
.voice-studio-view .studio-categories {
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
}
.voice-studio-view .studio-categories button,
.voice-studio-view .studio-tags button {
  border-radius: 9px;
}
.voice-studio-view .studio-categories button.active,
.voice-studio-view .studio-tags button:hover {
  border-color: var(--wave-blue);
  background: var(--wave-blue-soft);
  color: var(--wave-blue);
}
.voice-studio-view .primary-button {
  border-radius: 10px;
  background: var(--wave-blue);
  box-shadow: 0 7px 20px rgb(0 122 255 / 20%);
}
.voice-studio-view .primary-button:hover {
  background: #006ee6;
}
.voice-studio-view .secondary-button,
.voice-studio-view .upload-sound-button {
  border-radius: 10px;
}
.voice-studio-view .preview-stage {
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgb(0 122 255 / 12%), rgb(94 92 230 / 8%)),
    var(--surface-2);
}
.voice-studio-view .preview-stage-icon {
  background: var(--wave-blue);
  color: #fff;
  box-shadow: 0 8px 24px rgb(0 122 255 / 28%);
}
.voice-studio-view audio {
  border-radius: 10px;
}
@media (max-width: 860px) {
  .voice-studio-view .studio-layout { grid-template-columns: 1fr; }
}
