/* ─────────────────────────────────────────────────────────────────────────── */
/* DHARTE ERP AI — Enterprise Dark Theme                                        */
/* ─────────────────────────────────────────────────────────────────────────── */

:root {
  --bg-base:      #060f1e;
  --bg-panel:     #091524;
  --bg-surface:   #0d1e38;
  --bg-elevated:  #0f2d4a;
  --border:       rgba(14, 165, 233, 0.12);
  --border-mid:   rgba(14, 165, 233, 0.25);
  --border-hi:    rgba(14, 165, 233, 0.5);
  --accent:       #0ea5e9;
  --accent-light: #38bdf8;
  --accent-dim:   rgba(14, 165, 233, 0.08);
  --accent-glow:  rgba(14, 165, 233, 0.20);
  --text:         #dbeafe;
  --text-mid:     #93c5fd;
  --text-muted:   #4a7a9b;
  --error:        #f87171;
  --error-bg:     rgba(248, 113, 113, 0.10);
  --success:      #34d399;
  --radius:       10px;
  --radius-lg:    16px;
  --sidebar-w:    60px;
  --header-h:     60px;
  --font:         'Inter', 'Segoe UI', system-ui, sans-serif;
  --mono:         'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%; overflow: hidden;
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Screens ────────────────────────────────────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}

/* ─── Grid Background ────────────────────────────────────────────────────── */
.grid-bg {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(14, 165, 233, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 165, 233, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ─── Auth Screen ────────────────────────────────────────────────────────── */
#auth-screen { background: var(--bg-base); z-index: 20; }

.auth-panel {
  position: relative; z-index: 1;
  width: min(460px, calc(100vw - 40px));
  background: var(--bg-panel);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  box-shadow: 0 0 60px rgba(14, 165, 233, 0.07), 0 24px 80px rgba(0,0,0,0.6);
  animation: panel-enter 0.6s cubic-bezier(0.2, 0, 0, 1) forwards;
}

@keyframes panel-enter {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Brand ──────────────────────────────────────────────────────────────── */
.auth-brand {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 28px;
}

.auth-robot-icon {
  flex-shrink: 0;
  animation: robot-glow 3.5s ease-in-out infinite;
}

@keyframes robot-glow {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(14, 165, 233, 0.4)); }
  50%       { filter: drop-shadow(0 0 22px rgba(14, 165, 233, 0.75)); }
}

.auth-brand-text { display: flex; flex-direction: column; gap: 4px; }

.auth-title {
  font-size: 20px; font-weight: 700; letter-spacing: 0.15em;
  color: var(--text); line-height: 1;
}

.auth-subtitle {
  font-size: 11px; color: var(--text-muted);
  letter-spacing: 0.08em; text-transform: uppercase;
}

.auth-badges { display: flex; gap: 6px; margin-top: 6px; }

.badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
  padding: 2px 8px; border-radius: 100px; text-transform: uppercase;
}

.badge-secure {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #34d399;
}

.badge-version {
  background: var(--accent-dim);
  border: 1px solid var(--border-mid);
  color: var(--accent-light);
}

/* ─── Terminal ────────────────────────────────────────────────────────────── */
.terminal {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 11.5px; line-height: 1.75;
  color: var(--accent-light);
  max-height: 178px; overflow-y: auto;
  margin-bottom: 24px;
  scroll-behavior: smooth;
}

.terminal::-webkit-scrollbar { width: 3px; }
.terminal::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

.terminal-prefix { color: var(--accent); }

.terminal-line {
  animation: term-in 0.25s ease-out forwards;
  opacity: 0;
}

.terminal-line.done { color: #4ade80; font-weight: 600; }

@keyframes term-in {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Auth Form ──────────────────────────────────────────────────────────── */
.auth-form-wrapper {
  animation: form-in 0.4s cubic-bezier(0.2, 0, 0, 1) forwards;
}

@keyframes form-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.form-field { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  color: var(--text-muted); text-transform: uppercase;
}

.input-icon-wrap { position: relative; }

.input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-muted);
  pointer-events: none;
}

.form-input {
  width: 100%; padding: 11px 12px 11px 38px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  color: var(--text); font-size: 13.5px; font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder { color: var(--text-muted); }

.form-textarea {
  padding: 10px 12px !important;
  resize: vertical; min-height: 80px;
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
}

.form-hint { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

/* ─── Mode Toggle ────────────────────────────────────────────────────────── */
.auth-mode-toggle { text-align: center; margin-top: -4px; }

.link-btn {
  background: none; border: none;
  color: var(--accent-light); font-size: 12px;
  cursor: pointer; padding: 4px 0; opacity: 0.75;
  transition: opacity 0.15s; font-family: var(--font);
}

.link-btn:hover { opacity: 1; }

/* ─── Submit Button ──────────────────────────────────────────────────────── */
.btn-auth {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  border: none; border-radius: var(--radius);
  color: white; font-size: 13px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; margin-top: 4px;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.3);
}

.btn-auth:hover:not(:disabled) {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  box-shadow: 0 4px 28px rgba(14, 165, 233, 0.45);
  transform: translateY(-1px);
}

.btn-auth:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.btn-spinner {
  width: 17px; height: 17px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Auth Error ─────────────────────────────────────────────────────────── */
.auth-error {
  margin-top: 12px; padding: 11px 14px;
  background: var(--error-bg);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius);
  color: var(--error); font-size: 12.5px; line-height: 1.5;
}

.error-shake { animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.fade-out { animation: fade-out 0.4s ease forwards; }

@keyframes fade-out { to { opacity: 0; transform: scale(0.98); } }

/* ─── Chat App Layout ────────────────────────────────────────────────────── */
#chat-app {
  display: grid !important;
  grid-template-columns: var(--sidebar-w) 1fr;
  align-items: stretch;
  background: var(--bg-base);
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  width: var(--sidebar-w); height: 100vh;
  padding: 12px 0; position: relative; z-index: 5;
}

.sidebar-brand {
  padding: 8px 0 16px; width: 100%;
  display: flex; justify-content: center;
  border-bottom: 1px solid var(--border); margin-bottom: 12px;
}

.sidebar-nav {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px; width: 100%; padding: 0 6px;
}

.nav-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px;
  background: transparent; border: none;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}

.nav-btn svg { width: 20px; height: 20px; }

.nav-btn:hover:not(:disabled) { background: var(--accent-dim); color: var(--accent-light); }

.nav-btn.active {
  background: rgba(14, 165, 233, 0.12);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--border-mid);
}

.nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.sidebar-footer { width: 100%; padding: 0 6px; }

.nav-logout:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.08) !important;
  color: var(--error) !important;
}

/* ─── Chat Main ──────────────────────────────────────────────────────────── */
.chat-main {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden; position: relative;
}

/* ─── Chat Header ────────────────────────────────────────────────────────── */
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h); padding: 0 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; z-index: 4;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 10px; }

.ai-avatar-header {
  width: 38px; height: 38px;
  background: var(--bg-surface);
  border: 1px solid var(--border-mid); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.header-ai-info { display: flex; flex-direction: column; gap: 2px; }
.ai-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.ai-status-line { display: flex; align-items: center; gap: 5px; }

.status-pulse {
  width: 7px; height: 7px; background: var(--success);
  border-radius: 50%; animation: status-pulse 2.5s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  50%       { opacity: 0.8; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0); }
}

.status-label { font-size: 11px; color: var(--success); }

/* ─── Module Chips ────────────────────────────────────────────────────────── */
.modules-chips { display: flex; gap: 5px; flex-wrap: wrap; }

.module-chip {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 100px;
  background: var(--accent-dim); border: 1px solid var(--border-mid);
  color: var(--accent-light); text-transform: uppercase;
}

/* ─── User Chip ──────────────────────────────────────────────────────────── */
.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 100px; padding: 4px 12px 4px 4px;
}

.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #0369a1, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: white; flex-shrink: 0;
}

.user-name { font-size: 12px; color: var(--text-mid); white-space: nowrap; }

.btn-icon-header {
  width: 32px; height: 32px;
  background: transparent; border: none; border-radius: 8px;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s;
}

.btn-icon-header:hover { background: var(--error-bg); color: var(--error); }

/* ─── Chat Messages ──────────────────────────────────────────────────────── */
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 24px 20px;
  display: flex; flex-direction: column; gap: 20px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 4px; }

/* ─── Message Row ────────────────────────────────────────────────────────── */
.message {
  display: flex; gap: 12px; align-items: flex-start;
  animation: msg-in 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
  opacity: 0; max-width: 100%;
}

.message-user { flex-direction: row-reverse; }

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Avatars ────────────────────────────────────────────────────────────── */
.msg-avatar {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

.message-ai .msg-avatar {
  background: var(--bg-surface); border: 1px solid var(--border-mid);
  color: var(--accent);
}

.message-user .msg-avatar {
  background: linear-gradient(135deg, #0369a1, #0ea5e9);
  color: white;
}

/* ─── Bubbles ────────────────────────────────────────────────────────────── */
.msg-bubble {
  padding: 12px 16px; border-radius: 12px;
  max-width: calc(100% - 100px);
  font-size: 13.5px; line-height: 1.65; word-wrap: break-word;
}

.message-ai .msg-bubble {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: 4px 12px 12px 12px; color: var(--text);
}

.message-user .msg-bubble {
  background: rgba(14, 165, 233, 0.10); border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 12px 4px 12px 12px; color: var(--text);
}

/* ─── Markdown ───────────────────────────────────────────────────────────── */
.msg-bubble p { margin: 0 0 8px; }
.msg-bubble p:last-child { margin: 0; }
.msg-bubble strong { color: var(--text); font-weight: 600; }
.msg-bubble em { color: var(--text-mid); font-style: italic; }

.msg-bubble code {
  font-family: var(--mono); font-size: 12px;
  background: rgba(14, 165, 233, 0.1); border: 1px solid var(--border-mid);
  padding: 1px 5px; border-radius: 4px; color: var(--accent-light);
}

.msg-bubble pre {
  background: rgba(0,0,0,0.4); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
  overflow-x: auto; margin: 10px 0;
}

.msg-bubble pre code {
  background: none; border: none; padding: 0;
  font-size: 12px; line-height: 1.6; color: var(--accent-light);
}

.msg-bubble ul, .msg-bubble ol { padding-left: 18px; margin: 8px 0; }
.msg-bubble li { margin: 3px 0; }
.msg-bubble h2 { font-size: 15px; font-weight: 600; margin: 12px 0 6px; }
.msg-bubble h3 { font-size: 14px; font-weight: 600; margin: 10px 0 5px; }
.msg-bubble h4 { font-size: 13px; font-weight: 600; margin: 8px 0 4px; }
.msg-bubble hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ─── Typing Indicator ───────────────────────────────────────────────────── */
.typing-bubble {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px !important; min-height: 40px;
}

.typing-label { font-size: 12px; color: var(--text-muted); font-style: italic; }

.typing-dots { display: flex; gap: 4px; align-items: center; }

.typing-dots span {
  width: 5px; height: 5px; background: var(--accent);
  border-radius: 50%; animation: dot-bounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%            { transform: translateY(-6px); opacity: 1; }
}

/* ─── Chat Input ─────────────────────────────────────────────────────────── */
.chat-input-area {
  padding: 16px 20px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border); flex-shrink: 0;
}

.input-wrapper {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--bg-surface); border: 1px solid var(--border-mid);
  border-radius: 12px; padding: 8px 10px 8px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--border-hi);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-ai-icon { flex-shrink: 0; opacity: 0.5; padding-bottom: 4px; }

.chat-textarea {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 13.5px; font-family: var(--font);
  line-height: 1.5; resize: none;
  max-height: 160px; min-height: 22px; padding: 4px 0;
}

.chat-textarea::placeholder { color: var(--text-muted); }

.send-btn {
  flex-shrink: 0; width: 34px; height: 34px;
  background: var(--accent); border: none; border-radius: 8px;
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}

.send-btn svg { width: 16px; height: 16px; }
.send-btn:hover { background: var(--accent-light); transform: scale(1.05); }
.send-btn:active { transform: scale(0.95); }

.input-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 8px;
}

.input-hint, .powered-by {
  font-size: 10.5px; color: var(--text-muted); letter-spacing: 0.03em;
}

/* ─── Scrollbar Global ───────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border-mid) transparent; }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* AI PROCESSING CENTER — OCR · Audio · History                                 */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* View switching — each view fills the area under the shared header */
.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; flex-direction: column; }
.view-chat.active { flex-direction: column; }

/* Scroll container for proc/history views */
.proc-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 30px 40px; position: relative; z-index: 1; }

.proc-head { margin-bottom: 22px; }
.proc-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.proc-title { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.proc-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Two-column layout: upload | result */
.proc-grid { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 22px; align-items: start; }
@media (max-width: 980px) { .proc-grid { grid-template-columns: 1fr; } }
.proc-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* Dropzone */
.dropzone {
  border: 1.5px dashed var(--border-mid); border-radius: var(--radius-lg);
  background: var(--accent-dim); padding: 34px 20px; text-align: center;
  cursor: pointer; transition: all 0.18s; outline: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--border-hi); background: var(--accent-glow); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-glow); transform: scale(1.01); }
.dz-svg { width: 40px; height: 40px; color: var(--accent); opacity: 0.85; }
.dz-title { font-size: 15px; font-weight: 600; color: var(--text); margin-top: 12px; }
.dz-or { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.dz-link { color: var(--accent-light); text-decoration: underline; }
.dz-hint { font-size: 11px; color: var(--text-muted); margin-top: 10px; letter-spacing: 0.02em; }

/* Selected file card */
.file-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-surface); border: 1px solid var(--border-mid);
  border-radius: var(--radius); padding: 12px 14px;
}
.file-card .fc-name { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-all; }
.file-card .fc-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.file-card .fc-clear { margin-left: auto; cursor: pointer; color: var(--text-muted); background: none; border: none; font-size: 18px; line-height: 1; }
.file-card .fc-clear:hover { color: var(--error); }

/* Options */
.opt-row { display: flex; flex-direction: column; gap: 6px; }
.opt-label { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-mid); }
.proc-select {
  background: var(--bg-surface); color: var(--text);
  border: 1px solid var(--border-mid); border-radius: var(--radius);
  padding: 9px 12px; font-size: 13px; font-family: var(--font); cursor: pointer; outline: none;
}
.proc-select:focus { border-color: var(--border-hi); }

/* Process button */
.btn-proc {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--accent); color: #04111f; font-weight: 700; font-size: 14px;
  border: none; border-radius: var(--radius); padding: 12px 16px; cursor: pointer;
  transition: all 0.15s; letter-spacing: 0.01em;
}
.btn-proc:hover:not(:disabled) { background: var(--accent-light); }
.btn-proc:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-proc-spin {
  width: 15px; height: 15px; border: 2px solid rgba(4,17,31,0.35);
  border-top-color: #04111f; border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Status panel */
.proc-status {
  border: 1px solid var(--border-mid); border-radius: var(--radius);
  background: var(--bg-surface); padding: 12px 14px; font-size: 12.5px; color: var(--text-mid);
}
.proc-status.is-error { border-color: rgba(248,113,113,0.4); background: var(--error-bg); color: var(--error); }
.proc-status.is-success { border-color: rgba(52,211,153,0.4); color: var(--success); }
.proc-status .ps-row { display: flex; align-items: center; gap: 8px; }
.proc-bar { height: 6px; border-radius: 3px; background: var(--bg-elevated); margin-top: 10px; overflow: hidden; }
.proc-bar > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.2s; }

/* Result card */
.result-card { display: flex; flex-direction: column; background: var(--bg-panel); border: 1px solid var(--border-mid); border-radius: var(--radius-lg); overflow: hidden; min-height: 320px; }
.result-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-surface); }
.result-title { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-mid); }
.result-actions { display: flex; gap: 8px; }
.btn-mini {
  background: var(--bg-elevated); color: var(--text-mid); border: 1px solid var(--border-mid);
  border-radius: 7px; padding: 5px 11px; font-size: 11.5px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.btn-mini:hover:not(:disabled) { color: var(--accent-light); border-color: var(--border-hi); }
.btn-mini:disabled { opacity: 0.4; cursor: not-allowed; }
.result-pre {
  flex: 1; margin: 0; padding: 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  color: var(--text); white-space: pre-wrap; word-break: break-word; overflow-y: auto; max-height: 60vh;
}
.aud-player { width: 100%; }

/* History table */
.hist-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn-refresh { padding: 8px 12px; }
.hist-wrap { border: 1px solid var(--border-mid); border-radius: var(--radius-lg); overflow: hidden; }
.hist-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hist-table thead th {
  text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-mid); background: var(--bg-surface); border-bottom: 1px solid var(--border-mid);
}
.hist-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.hist-table tbody tr:hover { background: var(--accent-dim); }
.hist-table tbody tr:last-child td { border-bottom: none; }
.hist-empty { text-align: center; color: var(--text-muted); padding: 28px 16px !important; }
.hist-file { font-weight: 600; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-actions { display: flex; gap: 6px; }

/* Status badge */
.badge-status { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; }
.st-completed { background: rgba(52,211,153,0.15); color: var(--success); }
.st-failed { background: rgba(248,113,113,0.15); color: var(--error); }
.st-processing, .st-queued, .st-uploaded, .st-pending { background: rgba(14,165,233,0.15); color: var(--accent-light); }
.st-cancelled { background: rgba(148,163,184,0.15); color: var(--text-muted); }

/* Result modal */
.proc-modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(2,8,18,0.7); backdrop-filter: blur(3px); padding: 24px; }
.proc-modal-card { width: min(820px, 100%); max-height: 84vh; display: flex; flex-direction: column; background: var(--bg-panel); border: 1px solid var(--border-mid); border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 24px 80px rgba(0,0,0,0.6); }
.proc-modal-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--bg-surface); }
.proc-modal-title { font-size: 13px; font-weight: 700; color: var(--text); }

/* ─── In-browser recording (Audio view) ─────────────────────────────────────── */
.rec-divider {
  display: flex; align-items: center; gap: 12px; margin: 14px 0 10px;
  color: var(--text-mid); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
}
.rec-divider::before, .rec-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border-mid);
}
.btn-rec {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--bg-surface); color: var(--text-mid);
  font-weight: 600; font-size: 13.5px; letter-spacing: 0.01em;
  border: 1px solid var(--border-mid); border-radius: var(--radius);
  padding: 12px 16px; cursor: pointer; transition: all 0.18s ease;
}
.btn-rec:hover { border-color: var(--accent); color: var(--accent-light); box-shadow: 0 0 0 3px var(--accent-dim); }
.btn-rec:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rec-ic {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  transition: all 0.18s ease;
}
.rec-ic svg { width: 18px; height: 18px; }
.rec-label { flex: 1; text-align: left; }
.rec-timer {
  font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700;
  color: var(--error); letter-spacing: 0.04em;
}
/* Recording state: red identity + breathing halo on the mic disc */
.btn-rec.recording {
  border-color: rgba(248, 113, 113, 0.55); background: var(--error-bg); color: var(--error);
}
.btn-rec.recording:hover { box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12); color: var(--error); }
.btn-rec.recording .rec-ic {
  background: rgba(248, 113, 113, 0.15); color: var(--error);
  animation: rec-halo 1.6s ease-out infinite;
}
@keyframes rec-halo {
  0%   { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.45); }
  70%  { box-shadow: 0 0 0 10px rgba(248, 113, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0); }
}
@media (prefers-reduced-motion: reduce) { .btn-rec.recording .rec-ic { animation: none; } }
