:root {
  --font-ui: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-display: "Manrope", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --text-2xs: 0.75rem;
  --text-xs: 0.8rem;
  --text-sm: 0.94rem;
  --text-md: 1rem;
  --text-lg: 1.08rem;
  --text-xl: 1.28rem;
  --text-2xl: 1.66rem;
  --text-3xl: clamp(1.94rem, 2.6vw, 2.72rem);
  --bg: #edf1f5;
  --bg-soft: #f8fafc;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: rgba(255, 255, 255, 0.985);
  --surface-muted: rgba(245, 247, 250, 0.96);
  --ink: #0f172a;
  --ink-soft: #1e293b;
  --muted: #607089;
  --muted-strong: #334155;
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(100, 116, 139, 0.28);
  --line-dark: rgba(255, 255, 255, 0.1);
  --shadow-xl: 0 24px 70px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.07);
  --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.055);
  --shadow-sm: 0 5px 16px rgba(15, 23, 42, 0.04);
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --sidebar-bg: #0c1527;
  --sidebar-surface: rgba(255, 255, 255, 0.04);
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-text: #f8fbff;
  --sidebar-muted: rgba(248, 251, 255, 0.62);
  --success: #0f8d6d;
  --success-soft: rgba(15, 141, 109, 0.14);
  --danger: #be4b42;
  --danger-soft: rgba(190, 75, 66, 0.14);
  --warning: #c57a10;
  --warning-soft: rgba(197, 122, 16, 0.16);
  --accent-rgb: 36, 99, 235;
  --accent-2-rgb: 13, 148, 136;
  --accent: rgb(var(--accent-rgb));
  --accent-strong: #164fc7;
  --accent-soft: rgba(var(--accent-rgb), 0.12);
  --accent-soft-strong: rgba(var(--accent-rgb), 0.18);
  --accent-ring: rgba(var(--accent-rgb), 0.18);
  --accent-shadow: rgba(var(--accent-rgb), 0.18);
  --focus-ring: 0 0 0 4px rgba(var(--accent-rgb), 0.18), 0 0 0 1px rgba(var(--accent-rgb), 0.34);
  --surface-glow: rgba(255, 255, 255, 0.72);
}

body[data-page="videos"] {
  --accent-rgb: 37, 99, 235;
  --accent-2-rgb: 14, 165, 160;
  --accent-strong: #1850c6;
}

body[data-page="whisper"] {
  --accent-rgb: 191, 107, 24;
  --accent-2-rgb: 14, 155, 136;
  --accent-strong: #99540c;
}

body[data-page="torrents"] {
  --accent-rgb: 18, 139, 122;
  --accent-2-rgb: 34, 98, 198;
  --accent-strong: #0c7668;
}

body[data-page="encode"] {
  --accent-rgb: 208, 92, 36;
  --accent-2-rgb: 181, 46, 93;
  --accent-strong: #b24e16;
}

body[data-page="chat"] {
  --accent-rgb: 42, 106, 224;
  --accent-2-rgb: 22, 150, 120;
  --accent-strong: #1b58c7;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  min-height: 100%;
}

body.webui-shell {
  margin: 0;
  color: var(--ink);
  accent-color: var(--accent);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  background:
    radial-gradient(circle at 10% 0%, rgba(var(--accent-rgb), 0.09), transparent 26%),
    radial-gradient(circle at 88% 0%, rgba(var(--accent-2-rgb), 0.08), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.75), transparent 36%),
    linear-gradient(180deg, #f7fafc, var(--bg));
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.webui-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)),
    linear-gradient(90deg, rgba(15, 23, 42, 0.012) 1px, transparent 1px),
    linear-gradient(rgba(15, 23, 42, 0.012) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent 76%);
  opacity: 0.34;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

h1,
h2,
h3,
strong {
  color: var(--ink);
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
span,
small {
  text-wrap: pretty;
}

::selection {
  background: rgba(var(--accent-rgb), 0.22);
}

.hidden,
.is-hidden {
  display: none !important;
}

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

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  gap: 16px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 16px;
  display: grid;
  gap: 14px;
  grid-template-rows: auto auto 1fr auto;
  align-content: start;
  background:
    radial-gradient(circle at 20% 0%, rgba(var(--accent-rgb), 0.16), transparent 24%),
    radial-gradient(circle at 100% 100%, rgba(var(--accent-2-rgb), 0.08), transparent 32%),
    linear-gradient(180deg, rgba(9, 16, 29, 0.988), rgba(10, 18, 33, 0.982));
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-line);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02), 10px 0 28px rgba(2, 6, 23, 0.1);
  overflow: auto;
  z-index: 30;
}

.sidebar > * {
  min-width: 0;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04)),
    radial-gradient(circle at 100% 0%, rgba(var(--accent-rgb), 0.16), transparent 38%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  background: linear-gradient(135deg, rgb(var(--accent-rgb)), rgb(var(--accent-2-rgb)));
  box-shadow: none;
}

.brand-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.brand-copy strong {
  color: var(--sidebar-text);
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.brand-copy span {
  color: var(--sidebar-muted);
  font-size: var(--text-xs);
  letter-spacing: -0.01em;
}

.sidebar-panel,
.sidebar-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--sidebar-surface);
  border: 1px solid var(--sidebar-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.sidebar-nav,
.sidebar-stack,
.conversation-tools,
.conversation-list,
.sidebar-actions,
.sidebar-foot {
  display: grid;
  gap: 12px;
}

.sidebar-nav {
  gap: 18px;
  align-content: start;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.sidebar small,
.nav-label,
.field-label,
.metric-label,
.section-label,
.meta-label,
.eyebrow,
.surface-copy small,
.panel-head small,
.metric small,
.hero-side-card small,
.meta-card small {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--muted-strong);
}

.sidebar small,
.nav-label,
.meta-label {
  color: rgba(247, 251, 255, 0.56);
}

.eyebrow,
.surface-copy small,
.panel-head small,
.metric small,
.hero-side-card small,
.meta-card small,
.section-label {
  color: rgb(var(--accent-rgb));
}

.sidebar-note,
.meta-value,
.conversation-empty,
.conversation-open span,
.sidebar-foot {
  color: var(--sidebar-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.nav-link {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.nav-link strong {
  color: var(--sidebar-text);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.nav-link span {
  color: var(--sidebar-muted);
  font-size: var(--text-xs);
  line-height: 1.55;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.065);
  border-color: rgba(255, 255, 255, 0.12);
}

.nav-link.active {
  box-shadow: inset 3px 0 0 rgb(var(--accent-rgb));
}

.foot-chip,
.pill,
.tag,
.mini-pill,
.surface-note,
.panel-count,
.status-pill,
.state-pill,
.status-chip,
.job-status,
.probe-status,
.who {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-ui);
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.foot-chip {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(247, 251, 255, 0.82);
}

.pill,
.tag,
.surface-note,
.panel-count,
.status-pill,
.state-pill,
.status-chip,
.job-status,
.probe-status,
.mini-pill {
  background: var(--surface-muted);
  border-color: var(--line);
  color: var(--muted-strong);
}

.status-pill,
.state-pill,
.status-chip,
.job-status {
  background: rgba(var(--accent-rgb), 0.1);
  border-color: rgba(var(--accent-rgb), 0.18);
  color: var(--accent);
}

.probe-status[data-state="ready"] {
  background: var(--success-soft);
  border-color: rgba(15, 141, 109, 0.22);
  color: var(--success);
}

.probe-status[data-state="error"] {
  background: var(--danger-soft);
  border-color: rgba(190, 75, 66, 0.24);
  color: var(--danger);
}

.probe-status[data-state="loading"] {
  background: var(--accent-soft);
  border-color: rgba(var(--accent-rgb), 0.2);
  color: var(--accent);
}

.main {
  width: min(100%, 1560px);
  padding: 18px 22px 40px 0;
  display: grid;
  gap: 18px;
}

.topbar {
  position: sticky;
  top: 14px;
  overflow: hidden;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 251, 255, 0.84)),
    radial-gradient(circle at 100% 0%, rgba(var(--accent-rgb), 0.1), transparent 40%);
  backdrop-filter: blur(16px) saturate(1.08);
  border: 1px solid rgba(203, 213, 225, 0.78);
  box-shadow: var(--shadow-lg);
}

.topbar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  width: 54px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgb(var(--accent-rgb)), rgb(var(--accent-2-rgb)));
  opacity: 0.9;
}

.topbar-meta,
.hero-pills,
.tag-row,
.action-links,
.actions,
.checks,
.progress-meta,
.status-strip,
.inspector-actions,
.toolbar,
.settings-actions,
.composer-bar,
.conversation-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.page-title {
  display: grid;
  gap: 6px;
}

.page-title h1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.page-title p {
  max-width: 72ch;
  font-size: 0.9rem;
  line-height: 1.72;
}

.page-title p,
.surface-copy p,
.panel-head p,
.panel-note,
.meta,
.job-meta,
.viewer-meta,
.surface-note,
.drop-hint,
.subtle,
.hint,
.empty,
.empty-state p,
.card p,
.translation-box p {
  color: var(--muted);
  line-height: 1.7;
}

.hero,
.panel,
.metric,
.upload-card,
.status-card,
.command-card,
.client-card,
.inspector-panel,
.history-card,
.intake-card,
.source-card,
.job,
.preset-card,
.guide-card,
.meta-card,
.hero-side-card,
.item,
.transcript-item,
.viewer,
.detail-box,
.card,
.translation-box,
.chat-panel,
.settings-panel,
.artifact {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(249, 251, 254, 0.94)),
    radial-gradient(circle at 100% 0%, rgba(var(--accent-rgb), 0.06), transparent 36%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.hero::before,
.panel::before,
.metric::before,
.upload-card::before,
.status-card::before,
.command-card::before,
.client-card::before,
.inspector-panel::before,
.history-card::before,
.intake-card::before,
.source-card::before,
.job::before,
.preset-card::before,
.guide-card::before,
.meta-card::before,
.hero-side-card::before,
.item::before,
.transcript-item::before,
.viewer::before,
.detail-box::before,
.card::before,
.translation-box::before,
.chat-panel::before,
.settings-panel::before,
.artifact::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  width: 40px;
  height: 2px;
  border-radius: 0 0 999px 999px;
  pointer-events: none;
  background: linear-gradient(90deg, rgb(var(--accent-rgb)), rgb(var(--accent-2-rgb)));
  opacity: 0.85;
}

.metric::before,
.upload-card::before,
.command-card::before,
.intake-card::before,
.source-card::before,
.job::before,
.preset-card::before,
.guide-card::before,
.meta-card::before,
.hero-side-card::before,
.item::before,
.transcript-item::before,
.detail-box::before,
.history-card::before,
.card::before,
.translation-box::before,
.inspector-panel::before,
.artifact::before {
  display: none;
}

.hero,
.panel,
.chat-panel,
.settings-panel,
.viewer,
.status-card,
.client-card {
  border-radius: var(--radius-xl);
}

.metric,
.upload-card,
.command-card,
.intake-card,
.source-card,
.job,
.preset-card,
.guide-card,
.meta-card,
.hero-side-card,
.item,
.transcript-item,
.detail-box,
.history-card,
.card,
.translation-box,
.inspector-panel,
.artifact {
  border-radius: var(--radius-lg);
}

.hero,
.panel,
.chat-panel,
.settings-panel,
.viewer,
.status-card,
.client-card {
  padding: 20px;
}

.metric,
.upload-card,
.command-card,
.intake-card,
.source-card,
.job,
.preset-card,
.guide-card,
.meta-card,
.hero-side-card,
.item,
.transcript-item,
.detail-box,
.history-card,
.card,
.translation-box,
.inspector-panel,
.artifact {
  padding: 16px;
}

.surface-head,
.panel-head,
.viewer-head,
.viewer-top,
.jobs-head,
.history-head,
.artifact-head,
.status-head,
.inspector-top,
.conversation-head {
  position: relative;
  z-index: 1;
}

.surface-head,
.panel-head,
.viewer-head,
.jobs-head,
.status-head,
.inspector-top,
.history-head,
.artifact-head,
.client-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.surface-head,
.panel-head,
.viewer-head,
.jobs-head,
.status-head,
.inspector-top,
.history-head,
.artifact-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.surface-copy,
.hero-copy,
.stack,
.field,
.options,
.details-body,
.source-section,
.viewer-top,
.viewer-head,
.viewer-meta,
.translation-box,
.card,
.stat-block,
.bubble,
.message,
.torrent-title,
.status-head {
  display: grid;
  gap: 10px;
}

.surface-copy h3,
.panel-head h3,
.viewer-head h3,
.jobs-head h3,
.history-head h3,
.artifact-head h3,
.job-title h3,
.viewer-top h3,
.status-head h3,
.conversation-head strong {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.38;
  letter-spacing: -0.03em;
}

.job-title h3,
.history-head h3 {
  font-size: 1rem;
}

.surface-copy p,
.panel-head p,
.viewer-head p,
.jobs-head p,
.history-head p,
.artifact-head p,
.job-meta,
.viewer-meta,
.meta,
.panel-note,
.drop-hint,
.subtle,
.hint,
.empty,
.empty-state p,
.card p,
.translation-box p {
  font-size: var(--text-xs);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 16px;
  align-items: start;
  min-height: unset;
  box-shadow: var(--shadow-lg);
}

.hero-copy {
  align-content: start;
  gap: 10px;
}

.hero-copy h2 {
  font-family: var(--font-display);
  font-size: clamp(1.46rem, 1.95vw, 1.98rem);
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -0.04em;
}

.hero-copy > p {
  max-width: 58ch;
  font-size: var(--text-md);
}

.hero-pills {
  margin-top: 2px;
}

.hero-pills span,
.quality-chips span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.05);
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  color: var(--muted-strong);
  font-size: 0.75rem;
  font-weight: 600;
}

.hero-side,
.guide-list,
.artifact-grid,
.pending-attachments,
.bubble-attachments {
  display: grid;
  gap: 12px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric strong,
.status-count {
  position: relative;
  z-index: 1;
  font-family: var(--font-ui);
  font-size: clamp(1.34rem, 1.55vw, 1.72rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.hero-side-card strong,
.meta-card strong,
.source-card strong,
.item strong,
.artifact strong,
.viewer-meta #viewer-name,
.panel-count {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.metric p,
.hero-side-card p {
  position: relative;
  z-index: 1;
  font-size: var(--text-xs);
}

.summary-card strong {
  font-family: var(--font-display);
  font-size: clamp(1.24rem, 1.75vw, 1.56rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.summary-card span {
  color: var(--muted);
  font-size: var(--text-xs);
}

.workspace,
.live-layout,
.commands-grid,
.intake-grid {
  display: grid;
  gap: 16px;
  align-items: start;
}

.workspace {
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.92fr);
}

.launcher-strip {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.99), rgba(244, 248, 252, 0.92)),
    radial-gradient(circle at 100% 0%, rgba(var(--accent-rgb), 0.1), transparent 38%),
    radial-gradient(circle at 0% 100%, rgba(var(--accent-2-rgb), 0.08), transparent 38%);
  box-shadow: var(--shadow-lg);
}

.launcher-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.launcher-copy {
  display: grid;
  gap: 6px;
}

.launcher-copy h2 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.launcher-head p {
  max-width: 48ch;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.7;
}

.launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.launcher-card {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15, 23, 42, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.985), rgba(247, 250, 252, 0.95)),
    radial-gradient(circle at 100% 0%, rgba(var(--accent-rgb), 0.1), transparent 40%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), var(--shadow-sm);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.launcher-card:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--accent-rgb), 0.24);
  box-shadow: var(--shadow-lg);
}

.launcher-card.active {
  border-color: rgba(var(--accent-rgb), 0.3);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.08), rgba(255, 255, 255, 0.96)),
    radial-gradient(circle at 100% 0%, rgba(var(--accent-2-rgb), 0.12), transparent 44%);
  box-shadow: 0 16px 30px rgba(var(--accent-rgb), 0.08);
}

.launcher-card strong {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.launcher-card p,
.launcher-foot {
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.65;
}

.launcher-badge,
.launcher-foot {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
}

.launcher-badge {
  min-height: 26px;
  padding: 0 9px;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.launcher-foot {
  color: var(--muted-strong);
  font-weight: 600;
}

.commands-grid,
.intake-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.live-layout {
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
}

.stack {
  align-content: start;
  gap: 16px;
}

.jobs,
.history,
.source-list,
.library,
.list,
.transcript-list {
  display: grid;
  gap: 12px;
}

.job,
.history-card,
.artifact,
.source-card,
.item,
.transcript-item,
.list-item,
.torrent-row {
  position: relative;
  z-index: 1;
}

.field-grid,
.inline-grid,
.settings-grid,
.grid-2,
.detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dropzone-shell,
.dropzone,
.composer {
  display: grid;
  gap: 14px;
}

.dropzone-shell,
.dropzone {
  position: relative;
  z-index: 1;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(var(--accent-rgb), 0.18);
  background: rgba(var(--accent-rgb), 0.02);
}

.dropzone-shell.is-dragover,
.dropzone.active,
.dropzone.is-dragover {
  border-color: rgba(var(--accent-rgb), 0.32);
  background: rgba(var(--accent-rgb), 0.055);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.08);
}

.field {
  position: relative;
  z-index: 1;
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="search"],
input[type="file"],
select,
textarea,
.search-input {
  width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: 1.45;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  min-height: 132px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #8a95a9;
}

input:focus,
select:focus,
textarea:focus,
.search-input:focus {
  outline: none;
  border-color: rgba(var(--accent-rgb), 0.42);
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-ring);
}

a:focus-visible,
button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.action-link:focus-visible,
.download-link:focus-visible,
.inline-upload:focus-visible,
.nav-link:focus-visible,
.launcher-card:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.search-input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

button,
.primary-button,
.secondary-button,
.action-link,
.download-link,
.inline-upload,
.sidebar-actions a,
.sidebar-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, rgb(var(--accent-rgb)), rgb(var(--accent-2-rgb)));
  color: #fff;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(var(--accent-rgb), 0.13);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

button:hover,
.primary-button:hover,
.secondary-button:hover,
.action-link:hover,
.download-link:hover,
.inline-upload:hover,
.sidebar-actions a:hover,
.sidebar-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(var(--accent-rgb), 0.16);
}

button.alt,
button.ghost,
.secondary-button,
.action-link.action-button,
.inline-upload,
.download-link.disabled,
.sidebar-actions a,
.sidebar-actions button {
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.035);
}

button.ghost,
.download-link.disabled {
  background: transparent;
  color: var(--muted-strong);
}

.danger-button {
  background: rgba(190, 75, 66, 0.08);
  color: var(--danger);
  border-color: rgba(190, 75, 66, 0.18);
  box-shadow: none;
}

button:disabled,
.download-link.disabled,
.action-link.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.check input {
  margin: 0;
}

.toggle-check {
  align-items: flex-start;
}

.toggle-copy {
  display: grid;
  gap: 4px;
}

.toggle-title {
  font-weight: 700;
  color: var(--ink);
}

.toggle-desc {
  color: var(--muted);
  font-size: 0.88rem;
}

.whisper-toggle-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(var(--accent-rgb), 0.05);
  border: 1px solid rgba(var(--accent-rgb), 0.14);
}

.source-list,
.library,
.transcript-list {
  position: relative;
  z-index: 1;
}

.status-card,
.viewer,
.inspector,
.client-card {
  display: grid;
  gap: 14px;
  align-content: start;
}

.status-card .meta,
.viewer-meta,
.progress-meta,
.job-meta,
.conversation-meta-row,
.meta,
.panel-note {
  font-size: var(--text-xs);
  line-height: 1.65;
}

.bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgb(var(--accent-rgb)), rgb(var(--accent-2-rgb)));
}

.probe-frame {
  display: grid;
  gap: 14px;
}

.thumb-frame {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.08), rgba(var(--accent-2-rgb), 0.05)),
    rgba(241, 245, 251, 0.94);
  display: grid;
  place-items: center;
}

.thumb-frame img,
.bubble-attachments img,
.pending-attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-empty {
  color: var(--muted);
  font-weight: 600;
}

.bubble-attachments,
.pending-attachments {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.bubble-attachments a,
.pending-attachment {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(247, 250, 255, 0.92);
  border: 1px solid var(--line);
}

.bubble-attachments img,
.pending-attachment img {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
}

.pending-attachment {
  position: relative;
}

.pending-attachment button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 0;
  box-shadow: none;
}

.attachment-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted-strong);
  word-break: break-word;
}

.filter-input {
  min-width: min(280px, 100%);
}

.empty,
.empty-state,
.inspector-empty {
  display: grid;
  place-items: center;
  min-height: 88px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--line-strong);
  background:
    linear-gradient(180deg, rgba(247, 250, 255, 0.9), rgba(244, 248, 252, 0.86)),
    radial-gradient(circle at 100% 0%, rgba(var(--accent-rgb), 0.06), transparent 36%);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
}

.torrent-list,
.conversation-list {
  min-height: 0;
  overflow: auto;
}

.client-head-row {
  padding: 0 4px;
  color: var(--muted-strong);
  font-family: var(--font-display);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: none;
  grid-template-columns: minmax(320px, 1.8fr) repeat(5, minmax(80px, 1fr));
}

.client-head-row span {
  display: block;
}

.client-head-row,
.torrent-main {
  display: grid;
  gap: 12px;
  align-items: start;
}

.torrent-main {
  grid-template-columns: minmax(320px, 1.8fr) repeat(5, minmax(80px, 1fr));
}

.torrent-row {
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.torrent-row:hover,
.torrent-row.is-selected {
  transform: translateY(-1px);
  border-color: rgba(var(--accent-rgb), 0.24);
  box-shadow: var(--shadow-sm);
}

.toolbar {
  justify-content: space-between;
}

.segmented {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--line);
}

.segmented button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-strong);
  border-color: transparent;
  box-shadow: none;
}

.segmented button.is-active {
  background: linear-gradient(135deg, rgb(var(--accent-rgb)), var(--accent-strong));
  color: #fff;
}

.list-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(247, 250, 255, 0.8);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.chat-stream {
  min-height: 0;
  overflow: auto;
  padding: 16px;
  display: grid;
  gap: 16px;
  align-content: start;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(248, 250, 253, 0.98), rgba(244, 247, 252, 0.96)),
    radial-gradient(circle at 0% 0%, rgba(var(--accent-rgb), 0.04), transparent 28%);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--surface-glow);
}

.message.user {
  justify-self: end;
}

.who {
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.14);
}

.bubble {
  max-width: min(860px, 100%);
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.035);
}

.message.user .bubble {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.98), rgba(var(--accent-2-rgb), 0.92));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 24px rgba(var(--accent-rgb), 0.18);
}

.sidebar-actions a,
.sidebar-actions button,
.search-input,
.conversation-item {
  width: 100%;
}

.search-input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--sidebar-text);
  min-height: 42px;
}

.search-input::placeholder {
  color: rgba(247, 251, 255, 0.4);
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.14);
}

.conversation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.02);
  background: rgba(255, 255, 255, 0.025);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.conversation-item:hover,
.conversation-item.active {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.conversation-open,
.conversation-delete {
  background: transparent;
  border: 0;
  color: inherit;
  box-shadow: none;
}

.conversation-open {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  align-items: stretch;
  padding: 8px 10px;
  min-height: unset;
}

.conversation-open strong {
  color: var(--sidebar-text);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.conversation-open span:last-child {
  color: rgba(247, 251, 255, 0.72);
  font-size: var(--text-xs);
  line-height: 1.55;
}

.conversation-delete {
  width: 38px;
  min-height: unset;
  padding: 0;
  color: rgba(247, 251, 255, 0.58);
}

.conversation-delete:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.translation-box ul {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--muted-strong);
}

.viewer-body,
.translation-box,
.card,
.composer,
.settings-panel,
.conversation-open,
.job-copy,
.job-title,
.artifact-head,
.status-card,
.inspector-panel {
  position: relative;
  z-index: 1;
}

.viewer-body {
  min-height: 280px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(248, 250, 253, 0.96);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  overflow: auto;
}

.composer {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.card,
.translation-box {
  background: rgba(249, 251, 254, 0.88);
}

body[data-page="videos"] .workspace {
  grid-template-columns: minmax(0, 1.06fr) 390px;
}

body[data-page="whisper"] .workspace {
  grid-template-columns: minmax(0, 1.02fr) 410px;
}

body[data-page="torrents"] .live-layout.is-single {
  grid-template-columns: minmax(0, 1fr);
}

body[data-page="torrents"] .live-layout.is-single .inspector {
  display: none;
}

body[data-page="chat"] .workspace {
  grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.82fr);
}

body[data-page="chat"] .settings-panel {
  gap: 14px;
}

body[data-page="chat"] .status-strip {
  justify-content: flex-end;
}

body[data-page="chat"] .topbar {
  align-items: center;
}

body[data-page="chat"] .topbar .page-title p {
  max-width: 60ch;
}

body[data-page="chat"] .card .field label,
body[data-page="chat"] .grid-2 .field label {
  color: var(--muted-strong);
  font-size: var(--text-xs);
  font-weight: 600;
}

body[data-page="videos"] .hero-side-card strong,
body[data-page="whisper"] .metric strong,
body[data-page="whisper"] .hero-side-card strong,
body[data-page="torrents"] .hero-side-card strong,
body[data-page="encode"] .hero-side-card strong {
  font-size: 0.88rem;
}

body[data-page="whisper"] .metric strong {
  font-family: var(--font-mono);
  line-height: 1.45;
}

body[data-page="videos"] .probe-meta,
body[data-page="torrents"] .detail-grid {
  display: grid;
  gap: 10px;
}

@media (min-width: 1381px) {
  body[data-page="videos"] .workspace > .stack:last-child,
  body[data-page="whisper"] .viewer,
  body[data-page="torrents"] .inspector,
  body[data-page="chat"] .settings-panel {
    position: sticky;
    top: 106px;
    align-self: start;
  }
}

.download-link {
  text-decoration: none;
}

.sidebar-toggle,
.sidebar-close,
.sidebar-backdrop {
  display: none;
}

.sidebar-toggle,
.sidebar-close {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
}

.sidebar-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  padding: 0;
}

@media (max-width: 1380px) {
  .workspace,
  .live-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="videos"] .workspace,
  body[data-page="whisper"] .workspace,
  body[data-page="chat"] .workspace,
  body[data-page="torrents"] .live-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .launcher-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  body.webui-shell {
    overflow-x: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(360px, 90vw);
    transform: translateX(-100%);
    transition: transform 180ms ease;
    box-shadow: 24px 0 60px rgba(2, 6, 23, 0.34);
  }

  body[data-nav-open="true"] .sidebar {
    transform: translateX(0);
  }

  body[data-nav-open="true"] {
    overflow: hidden;
  }

  .sidebar-toggle,
  .sidebar-close {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
    z-index: 25;
  }

  body[data-nav-open="true"] .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    padding: 18px;
    width: 100%;
  }

  .topbar {
    top: 12px;
    padding: 18px;
  }

  .hero,
  .commands-grid,
  .intake-grid {
    grid-template-columns: 1fr;
  }

  body[data-page="videos"] .workspace,
  body[data-page="whisper"] .workspace,
  body[data-page="chat"] .workspace,
  body[data-page="torrents"] .live-layout {
    grid-template-columns: 1fr;
  }

  .launcher-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .main {
    padding: 14px;
  }

  .topbar,
  .hero,
  .panel,
  .chat-panel,
  .settings-panel,
  .viewer,
  .status-card,
  .client-card {
    padding: 18px;
  }

  button,
  .primary-button,
  .secondary-button,
  .action-link,
  .download-link,
  .inline-upload,
  .sidebar-actions a,
  .sidebar-actions button {
    min-height: 44px;
  }

  .metric,
  .upload-card,
  .command-card,
  .intake-card,
  .source-card,
  .job,
  .preset-card,
  .guide-card,
  .meta-card,
  .hero-side-card,
  .item,
  .transcript-item,
  .detail-box,
  .history-card,
  .card,
  .translation-box,
  .inspector-panel {
    padding: 16px;
  }

  .metrics,
  .field-grid,
  .inline-grid,
  .settings-grid,
  .grid-2,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
  }

  .filter-input {
    min-width: 100%;
  }

  .client-head-row {
    display: none;
  }

  .torrent-main {
    grid-template-columns: 1fr;
  }

  .page-title h1 {
    font-size: clamp(1.9rem, 11vw, 2.8rem);
  }

  .hero-copy h2 {
    font-size: clamp(1.5rem, 8vw, 2rem);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .topbar,
  .hero,
  .panel,
  .chat-panel,
  .settings-panel,
  .viewer,
  .status-card,
  .client-card,
  .launcher-strip {
    animation: surface-rise 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .launcher-card {
    animation: surface-rise 360ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .launcher-card:nth-child(2) {
    animation-delay: 45ms;
  }

  .launcher-card:nth-child(3) {
    animation-delay: 90ms;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
