/* VoxSail-inspired Obsidian & Emerald Studio Theme */
:root {
  --bg: #090b0c;
  --panel: #111416;
  --panel-2: #181c1f;
  --border: #22282c;
  --text: #f3f6f8;
  --muted: #8a959e;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-soft: rgba(16, 185, 129, 0.14);
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; }
.emerald-text { color: #34d399; }
.emerald-link { color: #10b981; cursor: pointer; font-weight: 600; }
.emerald-link:hover { text-decoration: underline; }

/* Login Overlay */
.login-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6, 8, 9, 0.92); backdrop-filter: blur(8px);
  display: grid; place-items: center;
}
.login-card {
  width: 380px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }

/* Shell */
.app-shell {
  display: grid;
  grid-template-columns: 224px 1fr;
  height: 100vh;
}

.sidebar {
  background: #0c0e10;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 6px 16px;
}
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #10b981, #047857);
  color: #fff; display: grid; place-items: center; font-weight: 700;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.nav-group-label {
  font-size: 11px; color: #5e6a73; padding: 8px 10px 4px; font-weight: 600;
}
.nav-divider { height: 1px; background: var(--border); margin: 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  background: transparent; border: none; color: #b4bec6;
  cursor: pointer; text-align: left; font-size: 13.5px; transition: .15s;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active {
  background: var(--primary-soft); color: #34d399; font-weight: 600;
  box-shadow: inset 2px 0 0 #10b981;
}
.nav-icon { font-size: 14px; width: 18px; text-align: center; }

.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.status-chip {
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
  font-size: 12px; color: var(--muted); margin-bottom: 6px; width: 100%;
}
.version-text { font-size: 11px; color: #525d66; }

/* Topbar + Main */
.content-col { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar {
  height: 54px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: #0c0e10;
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-pill {
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
  background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399; font-family: ui-monospace, Consolas, monospace;
}
.avatar-chip { display: flex; align-items: center; gap: 8px; }
.avatar-circle {
  width: 28px; height: 28px; border-radius: 50%;
  background: #1d4ed8; color: #fff; font-weight: 700; font-size: 12px;
  display: grid; place-items: center;
}

.main { flex: 1; overflow-y: auto; padding: 20px 24px; }
.view { display: none; max-width: 1280px; margin: 0 auto; }
.view.active { display: block; }

/* VoxSail 3-column Studio Grid */
.studio-grid {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 18px;
  align-items: start;
}
.panel-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

/* Upload Panel */
.upload-panel { padding: 20px; }
.dropzone-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0d1012;
  padding: 36px 20px 28px;
  text-align: center;
  transition: .15s;
}
.dropzone-box.dragover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.06);
}
.upload-inner-box {
  width: 148px; height: 112px; margin: 0 auto 16px;
  border: 1.5px dashed #323a40; border-radius: 12px;
  background: #14181b;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer; transition: .15s;
}
.upload-inner-box:hover { border-color: var(--primary); }
.upload-arrow { font-size: 24px; color: #e2e8f0; }
.upload-box-label { font-size: 13px; color: #cbd5e1; font-weight: 500; }
.dropzone-title { font-size: 14px; font-weight: 500; }
.dropzone-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

.upload-footer-bar {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.tag-pill {
  font-size: 11px; padding: 2px 8px; border-radius: 5px;
  background: #1f2529; color: #cbd5e1; border: 1px solid #2d353b;
}

.batch-wrap { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.batch-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.probe-name { font-weight: 600; font-size: 14px; }
.batch-list { display: flex; flex-direction: column; gap: 6px; }
.batch-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font-size: 13px;
}

/* Workflow Strip */
.workflow-strip { margin-top: 18px; }
.workflow-title { font-size: 13px; font-weight: 600; color: #cbd5e1; margin-bottom: 12px; }
.workflow-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.wf-step {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 12px; text-align: center;
}
.wf-icon { font-size: 22px; margin-bottom: 6px; }
.wf-label { font-size: 12.5px; color: #cbd5e1; }

/* Right Panel */
.studio-right {
  position: sticky; top: 0;
  display: flex; flex-direction: column; min-height: 490px;
}
.right-panel-body { flex: 1; }
.rp-section-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.rp-field { margin-bottom: 14px; }
.rp-field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.select-full {
  width: 100%; background: #0d1012; border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.rp-toggle-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--border);
}
.rp-toggle-title { font-size: 13px; font-weight: 500; }
.rp-toggle-sub { font-size: 11px; color: var(--muted); }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 38px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #2b3238; border-radius: 999px; transition: .2s;
}
.slider:before {
  content: ""; position: absolute; height: 14px; width: 14px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(18px); }

.right-panel-footer {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border);
}
.cost-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }

/* Buttons */
.btn {
  border: 1px solid transparent; border-radius: 8px; padding: 8px 14px;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s;
  color: var(--text); background: var(--panel-2);
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #04130d; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-danger { background: rgba(239,68,68,0.16); color: #fca5a5; border-color: rgba(239,68,68,0.4); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }

.pill {
  margin-left: auto; font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: var(--primary-soft); color: #34d399;
}

/* Headers & Lists */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px; gap: 12px;
}
.page-header h1 { font-size: 20px; margin-bottom: 4px; }
.header-actions { display: flex; gap: 8px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin: 20px 0 10px; }
.section-header h2 { font-size: 15px; }

.jobs-list, .queue-list { display: flex; flex-direction: column; gap: 8px; }
.job-item {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 13px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.job-title { font-weight: 600; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.job-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.job-actions { display: flex; gap: 8px; }

.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.badge-done { background: rgba(16,185,129,0.16); color: #34d399; }
.badge-running { background: rgba(16,185,129,0.22); color: #6ee7b7; }
.badge-warn { background: rgba(245,158,11,0.18); color: #fcd34d; }
.badge-err { background: rgba(239,68,68,0.18); color: #fca5a5; }

/* Queue & Stepper */
.queue-control-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px; padding: 12px 16px;
}
.queue-controls-left { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.ctrl-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.queue-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; cursor: pointer; transition: .15s;
}
.queue-card:hover, .queue-card.selected { border-color: var(--primary); background: rgba(16,185,129,0.06); }
.queue-card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.queue-card-bar { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.queue-card-bar > div { height: 100%; background: linear-gradient(90deg, #10b981, #34d399); transition: width .25s; }

.stepper { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 16px; }
.step-box {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; text-align: center;
}
.step-box.running { border-color: var(--primary); background: rgba(16,185,129,0.12); }
.step-box.done { border-color: rgba(16,185,129,0.45); background: rgba(16,185,129,0.08); }
.step-num { font-size: 11px; color: var(--muted); }
.step-name { font-size: 13px; font-weight: 600; margin-top: 2px; }
.step-state { font-size: 11px; margin-top: 4px; color: var(--muted); }

.progress-bar-wrap { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #10b981, #34d399); transition: width .25s; }
.progress-meta-row { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.kpi { background: var(--panel-2); border-radius: 8px; padding: 12px; }
.kpi-label { font-size: 11px; color: var(--muted); }
.kpi-value { font-size: 15px; font-weight: 700; margin-top: 4px; }

.log-box {
  background: #07090a; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; height: 220px; overflow-y: auto;
  font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: #cbd5e1;
  white-space: pre-wrap;
}

/* Review Workbench */
.player-card { margin-bottom: 14px; }
.player-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.track-switch { display: flex; gap: 6px; }
.audio-el { width: 100%; height: 38px; }
.live-sub-bar {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  background: #0a0d0e; border: 1px solid var(--border); min-height: 54px;
}
.live-zh { font-size: 13px; color: #cbd5e1; }
.live-en { font-size: 14px; color: #34d399; font-weight: 600; margin-top: 2px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.filter-group { display: flex; gap: 6px; }
.filter-btn {
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  padding: 5px 10px; border-radius: 8px; cursor: pointer; font-size: 12px;
}
.filter-btn.active { border-color: var(--primary); color: #34d399; background: var(--primary-soft); }
.toolbar-right { display: flex; gap: 8px; align-items: center; }

.banner {
  background: var(--primary-soft); border: 1px solid rgba(16,185,129,0.4);
  color: #a7f3d0; padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; font-size: 13px;
}

.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sub-table { width: 100%; border-collapse: collapse; }
.sub-table th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 10px 12px; background: var(--panel-2); border-bottom: 1px solid var(--border);
}
.sub-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.sub-table tr.playing { background: rgba(16,185,129,0.1); }
.sub-table tr.dirty { background: rgba(245,158,11,0.08); }

.time-btn {
  background: transparent; border: none; color: #34d399; cursor: pointer;
  font-family: ui-monospace, Consolas, monospace; font-size: 12px; padding: 0; text-align: left;
}
.time-btn:hover { text-decoration: underline; }
.spk-tag {
  display: inline-block; margin-top: 4px; font-size: 11px; padding: 1px 6px;
  border-radius: 6px; background: var(--panel-2); color: var(--muted);
}
.cell-edit {
  width: 100%; background: #0a0d0e; color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px; font-size: 13px; resize: vertical; min-height: 52px; font-family: inherit;
}
.cell-edit:focus { outline: none; border-color: var(--primary); }

/* Forms */
.form-card { max-width: 760px; }
.form-group { margin-bottom: 14px; }
.form-group > label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.input-row { display: flex; gap: 8px; }
.inline-picker { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.code-tag { background: var(--panel-2); padding: 4px 8px; border-radius: 6px; font-size: 12px; }
.input, .input-sm, .select-sm {
  background: #0a0d0e; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; width: 100%;
}
.input-sm { width: 200px; padding: 5px 10px; font-size: 12px; }
.select-sm { width: auto; padding: 4px 8px; font-size: 12px; }
.concurrency-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.actions-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }

.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 99;
  background: #14191c; border: 1px solid var(--primary); color: #f8fafc;
  padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  font-size: 13px;
}

@media (max-width: 980px) {
  .studio-grid { grid-template-columns: 1fr; }
}
