/* ==========================================================================
   Manga Video Studio — modern professional dark UI (vanilla CSS, no build).
   Layout: left sidebar + top bar + <main id="view">. Sidebar collapses
   into an off-canvas drawer under 900px (toggled by #nav-toggle).
   ========================================================================== */

:root {
  --bg: #0e1320;
  --bg-soft: #131a2b;
  --panel: #17203630;
  --card: #182134;
  --card-border: #28334d;
  --text: #e9eef7;
  --muted: #94a2ba;
  --accent: #4f8cff;
  --accent-hover: #3b76e6;
  --success: #22c55e;
  --danger: #ef4444;
  --danger-hover: #d63a3a;
  --warn: #f59e0b;
  --info: #38bdf8;
  --radius: 10px;
  --sidebar-w: 280px;
  --topbar-h: 52px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Consolas, Menlo, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  scroll-behavior: smooth;
}

/* Modern sleek dark scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #090e1a;
}
::-webkit-scrollbar-thumb {
  background: #23304d;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #364975;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  overflow: hidden;
}

/* ------------------------------------------------------------------ layout */
.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

.main-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

#view {
  flex: 1;
  padding: 22px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

#view.view-wide,
body.route-editor #view {
  max-width: 100%;
  padding: 10px 16px;
}

body.route-panels #view > h1 {
  display: none !important;
}

body.route-panels .footer {
  display: none !important;
}

body.route-panels #view {
  max-width: 100%;
  padding: 0 !important;
  margin: 0 !important;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.route-panels .view-body {
  flex: 1;
  height: 100%;
  padding: 0 !important;
  margin: 0 !important;
  gap: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.footer {
  padding: 6px 18px;
  color: var(--muted);
  flex-shrink: 0;
  background: #0a0a0a;
  border-top: 1px solid #1f2937;
  font-size: 11.5px;
}

/* ----------------------------------------------------------------- sidebar (slide bar & tabs) */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #0a0a0a;
  border-right: 1px solid rgba(38, 38, 38, 0.85);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(23, 23, 23, 0.5);
  border-bottom: 1px solid rgba(38, 38, 38, 0.8);
}

.brand-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #10b981 0%, #6366f1 100%);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-text {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 11px;
  color: #34d399;
  font-weight: 500;
  margin-top: 3px;
  line-height: 1;
}

.sidebar-close-btn {
  display: none;
  background: #171717;
  border: 1px solid rgba(64, 64, 64, 0.8);
  color: #a3a3a3;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  font-size: 13px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.16s ease;
}
.sidebar-close-btn:hover, .sidebar-close-btn:active {
  color: #fff;
  border-color: #525252;
  background: #262626;
}

.sidebar-section-bar {
  padding: 8px 14px;
  background: rgba(23, 23, 23, 0.8);
  border-bottom: 1px solid rgba(38, 38, 38, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-section-title {
  font-size: 11px;
  color: #a3a3a3;
  font-weight: 500;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 10px 14px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.nav::-webkit-scrollbar {
  width: 4px;
}
.nav::-webkit-scrollbar-track {
  background: transparent;
}
.nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}
.nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: #a3a3a3;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 10px 4px;
  user-select: none;
}

.nav-section-label-mgmt {
  padding-top: 14px;
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  color: #d4d4d4;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-link:hover {
  color: #ffffff;
  background: #171717;
  border-color: transparent;
}

.nav-link-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.nav-icon {
  font-size: 15px;
  flex-shrink: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #94a3b8;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-link:hover .nav-icon,
.nav-link.is-active .nav-icon {
  color: #38bdf8;
}

.nav-arrow svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-text-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.nav-title {
  display: block;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.25;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-desc {
  display: block;
  font-size: 10px;
  color: #737373;
  line-height: 1.2;
  margin-top: 1.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}

.nav-link:hover .nav-desc {
  color: #a3a3a3;
}

.nav-arrow {
  color: #525252;
  font-size: 11px;
  flex-shrink: 0;
  margin-left: 6px;
  transition: color 0.15s ease, transform 0.15s ease;
}

.nav-link:hover .nav-arrow {
  color: #a3a3a3;
  transform: translateX(2px);
}

.nav-badge-active {
  display: none;
  font-size: 9.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: 6px;
  line-height: 1.2;
}

.nav-link.active {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.nav-link.active .nav-title {
  color: #a7f3d0;
}

.nav-link.active .nav-desc {
  color: #6ee7b7;
  opacity: 0.85;
}

.nav-link.active .nav-arrow {
  display: none;
}

.nav-link.active .nav-badge-active {
  display: inline-block;
}

.sidebar-foot {
  padding: 12px 14px;
  border-top: 1px solid rgba(38, 38, 38, 0.8);
  background: rgba(23, 23, 23, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.sidebar-foot-note {
  color: #a3a3a3;
  font-size: 11px;
}

.sidebar-foot-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 6px;
  background: #059669;
  color: #ffffff;
  font-weight: 600;
  font-size: 11.5px;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: background 0.15s ease;
}

.sidebar-foot-btn:hover {
  background: #10b981;
}

/* ------------------------------------------------------------------ topbar */
.topbar {
  min-height: 52px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  background: #0a0a0a;
  border-bottom: 1px solid #262626;
  position: sticky;
  top: 0;
  z-index: 50;
  box-sizing: border-box;
  flex-shrink: 0;
  flex-wrap: wrap;
  min-width: 0;
  white-space: nowrap;
}

#nav-toggle {
  display: none;
  background: #171717;
  border: 1px solid #262626;
  color: #d4d4d4;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#nav-toggle:hover {
  background: #262626;
  border-color: #404040;
  color: #ffffff;
}

/* Status Badges */
.health {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #171717;
  border: 1px solid #262626;
  color: #d4d4d4;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.3;
  user-select: none;
  height: 26px;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.health:hover {
  background: #202020;
  border-color: #404040;
  color: #ffffff;
}

#sub-pill-btn { text-decoration: none; }

.health:active {
  background: #141414;
}

/* Active Render Badge */
#render-pill {
  background: #171717;
  border: 1px solid #3b82f6;
  color: #93c5fd;
  flex-shrink: 0;
}

#render-pill:hover {
  background: #1e293b;
  border-color: #60a5fa;
  color: #ffffff;
}

/* Status Indicators */
.health-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #737373;
}

.health-dot.is-ok {
  background: #10b981;
}

.health-dot.is-bad {
  background: #ef4444;
}

.health-dot.is-checking {
  background: #f59e0b;
}

/* Manga & Chapter Picker Toolbar - Fixed & Never Scrollable */
.picker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  background: #171717;
  border: 1px solid #262626;
  border-radius: 6px;
  padding: 3px 6px;
  flex: 1 1 390px;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
}

.picker-label {
  font-size: 10.5px;
  font-weight: 600;
  color: #737373;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 1px;
  user-select: none;
  flex-shrink: 0;
}

.picker .select {
  background: #0a0a0a;
  color: #f5f5f5;
  border: 1px solid #262626;
  border-radius: 4px;
  padding: 2px 20px 2px 6px;
  font-size: 11.5px;
  font-weight: 500;
  height: 26px;
  line-height: 1.3;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23a3a3a3' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 8px 8px;
  width: 115px;
  max-width: 125px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  flex: 1 1 115px;
  min-width: 0;
  transition: border-color 0.15s ease;
}

.picker .select:hover {
  border-color: #404040;
}

.picker .select:focus {
  outline: none;
  border-color: #10b981;
}

.picker .select option {
  background-color: #171717;
  color: #f5f5f5;
}

#reload-library {
  background: #262626;
  border: 1px solid #404040;
  color: #d4d4d4;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  height: 26px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#reload-library:hover {
  background: #333333;
  border-color: #525252;
  color: #ffffff;
}

#reload-library:active {
  background: #202020;
}

/* Keep the Renderer target visible while its long settings form scrolls. */
.renderer-context-bar {
  position: static;
  padding: 8px 10px;
  margin: -4px -4px 10px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--card-border);
}

/* -------------------------------------------------------------------- cards */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.card h2, .card h3 { margin: 0 0 10px; }
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.spacer { flex: 1; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }

.empty-state {
  text-align: center;
  padding: 36px 20px;
}

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: #222d47;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { border-color: var(--accent); background: #273453; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible, .select:focus-visible, .input:focus-visible,
.nav-link:focus-visible, .health:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: #3a1f28; border-color: #7a2e3a; color: #ffb4b4; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon { padding: 8px 11px; font-size: 16px; }

/* ------------------------------------------------------------------- inputs */
.input, .select, textarea.input {
  background: #101828;
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  max-width: 100%;
}

.select { cursor: pointer; }
.input::placeholder { color: #5d6b86; }

textarea.input {
  width: 100%;
  min-height: 90px;
  resize: vertical;
}

.form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row > label { font-size: 13px; color: var(--muted); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ------------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border-radius: 8px; }

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th, .table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--card-border);
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tr:hover td { background: #1c2740; }

/* ------------------------------------------------------------- progress bar */
.progress {
  height: 10px;
  background: #0d1322;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  overflow: hidden;
  min-width: 120px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--info));
  border-radius: 999px;
  transition: width 0.25s ease;
}

.progress-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* -------------------------------------------------------------- status pill */
.pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: capitalize;
  border: 1px solid transparent;
  white-space: nowrap;
}

.pill-waiting    { background: #2a2f3d; color: #c3cad7; border-color: #454c60; }
.pill-preparing  { background: #12324a; color: #7dd3fc; border-color: #1e5a86; }
.pill-rendering,
.pill-muxing,
.pill-running    { background: #10294f; color: #7db4ff; border-color: #2b5cb8; animation: pulse 1.6s infinite; }
.pill-completed,
.pill-connected,
.pill-done       { background: #0e3a24; color: #4ade80; border-color: #1c7a45; }
.pill-failed,
.pill-error      { background: #451a1e; color: #fca5a5; border-color: #8c2f36; }
.pill-cancelled,
.pill-skipped    { background: #3d2f10; color: #fcd34d; border-color: #8a6a1f; }
.pill-disconnected,
.pill-unknown    { background: #2a2f3d; color: var(--muted); border-color: #454c60; }

/* --------------------------------------------------------------- log viewer */
.log-viewer {
  background: #0a0f1c;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.log-line-error { color: #fca5a5; }
.log-line-warn { color: #fcd34d; }

/* ------------------------------------------------------------ thumbnails */
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.thumb {
  border: 1px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
  background: #0d1322;
}

.thumb img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.thumb-caption {
  padding: 6px 9px;
  font-size: 12px;
  color: var(--muted);
}

/* ------------------------------------------------------------------- modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}

.modal {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}

.modal h2 { margin-top: 0; }

/* ------------------------------------------------------------------ toasts */
#toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  background: #1f2a44;
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--info);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--info); }

.sidebar-backdrop {
  display: none;
}

/* --------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  }

  body.nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 16px 0 48px rgba(0, 0, 0, 0.85);
    z-index: 100;
  }

  body.nav-open .sidebar { transform: translateX(0); }

  .sidebar-close-btn { display: inline-flex; }

  #nav-toggle { display: inline-flex; position: relative; z-index: 101; }

  #view { padding: 12px 10px 76px; }

  .topbar {
    height: auto;
    min-height: 52px;
    padding: 6px 12px;
    gap: 6px;
    flex-wrap: wrap;
  }

  .picker {
    margin-left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #171717;
    border: 1px solid #262626;
    padding: 4px 6px;
    border-radius: 6px;
  }
  .picker-label { font-size: 10.5px; }
  .picker .select { flex: 1; min-width: 0; font-size: 12px; padding: 4px 20px 4px 8px; max-width: none; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .thumb img { height: 120px; }
}

@media (max-width: 600px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  #view { padding: 10px 8px 80px; }
  .topbar { gap: 6px; padding: 6px 10px; }
  .health { padding: 4px 8px; font-size: 11px; gap: 5px; border-radius: 6px; }
  .picker {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
    flex-basis: 100%;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 6px;
  }
  .picker-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .picker .select { width: 100%; font-size: 12px; padding: 4px 18px 4px 6px; height: 44px; max-width: none; }
  #reload-library { padding: 4px 8px; font-size: 12px; height: 44px; }
  .topbar .health, #nav-toggle { min-height: 44px; }
  #nav-toggle { min-width: 44px; align-items: center; justify-content: center; }
  .btn { min-height: 44px; padding: 9px 12px; font-size: 13px; touch-action: manipulation; }
  .btn-sm { min-height: 40px; padding: 8px 11px; }
  input, select, textarea, .select, .input { min-height: 44px; font-size: 16px; }
  .vp-row { gap: 8px; }
  .vp-table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
  .vp-table th, .vp-table td { padding: 10px 11px; white-space: nowrap; }
  .vp-card { max-width: 100%; overflow: hidden; }
  .vp-modal-overlay, .modal-overlay { align-items: flex-end; padding: 0; }
  .vp-modal, .modal { width: 100% !important; max-width: none !important; max-height: 90dvh; max-height: 90vh; border-radius: 16px 16px 0 0; padding-bottom: max(18px, env(safe-area-inset-bottom, 18px)); }
}


@media (prefers-reduced-motion: reduce) {
  .health-dot.is-checking, .pill-rendering, .pill-muxing, .pill-running {
    animation: none;
  }
  .progress-fill { transition: none; }
  .sidebar { transition: none; }
}

/* ------------------------------------------------- view (vp-*) aliases ---
   Pipeline/processing views use vp-* class names. They map 1:1 onto the
   shell tokens above so every view renders styled with no unstyled DOM. */
.view-body { display: flex; flex-direction: column; gap: 16px; }
.vp-sub, .vp-small { color: var(--muted); font-size: 12.5px; }
.vp-sub { margin: 0 0 10px; }
.vp-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vp-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.vp-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.vp-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.vp-pair { display: flex; gap: 8px; align-items: center; }
.vp-pair input[type="range"] { flex: 1; }
.vp-context { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.vp-context-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.vp-context input { background: #101828; border: 1px solid var(--card-border); color: var(--text); border-radius: 8px; padding: 9px 11px; font-size: 14px; }
.vp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 12px; }
.vp-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 18px; }
.vp-card h3 { margin: 0 0 10px; }
.vp-links { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.vp-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.vp-toolbar input { background: #101828; border: 1px solid var(--card-border); color: var(--text); border-radius: 8px; padding: 9px 11px; font-size: 14px; }
.vp-table-wrap { overflow-x: auto; border-radius: 8px; margin-bottom: 12px; }
table.vp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.vp-table th, .vp-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--card-border); }
.vp-table th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.vp-detail { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.vp-detail-imgs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.vp-detail-imgs img { border-radius: 8px; border: 1px solid var(--card-border); }
.vp-upload { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.vp-task { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.vp-task-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vp-task-label { font-size: 13px; color: var(--text); }
.vp-log, .vp-loglist { background: #0a0f1c; border: 1px solid var(--card-border); border-radius: 8px; padding: 12px 14px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; max-height: 220px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }
.vp-log-title { font-size: 12px; color: var(--muted); }
.vp-logline { padding: 2px 0; border-bottom: 1px solid #111827; }
.vp-log-src { color: var(--info); }
.vp-bar { height: 10px; background: #0d1322; border: 1px solid var(--card-border); border-radius: 999px; overflow: hidden; min-width: 120px; }
.vp-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--info)); border-radius: 999px; transition: width 0.25s ease; }
.vp-checklist { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.vp-check { display: flex; gap: 6px; align-items: center; font-size: 13px; background: #0d1322; border: 1px solid var(--card-border); border-radius: 8px; padding: 6px 9px; }
.vp-check img { border-radius: 6px; }
.vp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 10px; }
.vp-thumb { border: 1px solid var(--card-border); border-radius: 8px; overflow: hidden; background: #0d1322; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.vp-thumb.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.vp-thumb img { display: block; width: 100%; height: 150px; object-fit: cover; border-radius: 6px; cursor: pointer; }
.vp-badge { display: inline-block; font-size: 11px; color: var(--muted); }
.vp-preview-frame { border: 1px solid var(--card-border); border-radius: 8px; overflow: hidden; background: #0d1322; padding: 8px; }
.vp-preview-frame img { display: block; max-width: 100%; border-radius: 6px; }
.vp-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 10px 0; }
.vp-bbox-overlay { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 6px; }
.vp-preview-info { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.vp-modal-overlay { position: fixed; inset: 0; background: rgba(4, 8, 16, 0.7); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 100; }
.vp-modal { background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 20px; }
.vp-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.vp-ops, .vp-files { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.vp-op { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 12px; }
.vp-op-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.vp-op-params { display: flex; flex-direction: column; gap: 10px; }
.vp-file { display: flex; gap: 10px; align-items: center; background: #0d1322; border: 1px solid var(--card-border); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.vp-img-missing { font-size: 12px; color: var(--warn); background: #0d1322; border: 1px dashed var(--card-border); border-radius: 8px; padding: 10px; }

/* Lightbox modal & Preview enhancements */
.vp-modal-lightbox {
  max-width: 92vw;
  width: 920px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
}
.vp-modal-lightbox .vp-lightbox-viewport {
  overflow: auto;
  max-height: 72vh;
  background: #070b14;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
}
.vp-modal-lightbox img.vp-lightbox-img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  cursor: zoom-in;
  transition: max-width 0.2s ease;
  image-rendering: -webkit-optimize-contrast;
}
.vp-modal-lightbox img.vp-lightbox-img.zoomed {
  max-width: none;
  cursor: zoom-out;
}
.vp-modal-lightbox .vp-lightbox-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.vp-preview-card {
  border: 1px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
  background: #0d1322;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.vp-preview-card:hover {
  border-color: var(--accent);
}
.vp-preview-card img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
}
.vp-preview-card-strip img {
  height: 220px;
  object-fit: contain;
  background: #050811;
  image-rendering: -webkit-optimize-contrast;
}
.vp-preview-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vp-preview-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.vp-preview-card-actions button,
.vp-preview-card-actions a {
  font-size: 11px;
  padding: 3px 8px;
}
.vp-detail-imgs img {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease;
}
.vp-detail-imgs img:hover {
  transform: scale(1.04);
  border-color: var(--accent);
}



/* Full-resolution coordinates over independently decoded long-strip tiles. */
.vp-crop-modal { width: min(1000px, 96vw); max-width: 1000px; }
.vp-crop-scroll { max-height: 58vh; overflow: auto; background: #181818; margin-top: 12px; }
.vp-crop-surface { position: relative; width: 100%; max-width: 800px; margin: auto; cursor: crosshair; touch-action: pan-y; }
.vp-crop-surface > img { display: block; width: 100%; height: auto; max-height: none; object-fit: contain; user-select: none; image-rendering: -webkit-optimize-contrast; }
.vp-crop-selection { position: absolute; box-sizing: border-box; border: 2px solid #f6c94c; background: #f6c94c22; pointer-events: none; }
.vp-crop-fields input { width: 90px; }

.vp-prompt { margin: 16px 0; }
.vp-prompt summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.vp-prompt textarea { width: 100%; box-sizing: border-box; line-height: 1.5; resize: vertical; }
.vp-panel-extractor .vp-thumb img { object-fit: contain; height: 240px; background: #080b12; }
.vp-panel-extractor .vp-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.vp-all-crops { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.vp-all-crops figure { margin: 0; min-width: 0; }
.vp-all-crops img { display: block; width: 100%; height: auto; max-height: none; }
.vp-all-crops figcaption { margin: 8px 0; }

.vp-source-scroll { max-height: 480px; overflow-y: auto; background: #080b12; }
.vp-panel-extractor .vp-source-scroll img { display: block; width: 100%; height: auto; max-height: none; border-radius: 0; cursor: default; font-size: 0; line-height: 0; color: transparent; background: #0b0f19; }

/* Source Section & 1-Page Continuous Preview */
.vp-source-section {
  background: var(--card-bg, #111827);
  border: 1px solid var(--card-border, #1f2937);
  border-radius: 10px;
  padding: 16px;
  margin: 18px 0 24px 0;
}
.vp-source-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.vp-source-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.vp-source-title-row h3 {
  margin: 0;
  font-size: 1.15rem;
}
.vp-source-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.vp-mode-btn-group {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color, #374151);
}
.vp-mode-btn-group .btn {
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border-color, #374151);
  font-size: 0.82rem;
  padding: 6px 12px;
  background: #1f2937;
  color: #9ca3af;
  cursor: pointer;
}
.vp-mode-btn-group .btn:last-child {
  border-right: none;
}
.vp-mode-btn-group .btn.active {
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
}

/* Continuous 1-Page Viewer */
.vp-continuous-container {
  display: flex;
  flex-direction: column;
  background: #060911;
  border: 1px solid #1f2937;
  border-radius: 8px;
  overflow: hidden;
}
.vp-continuous-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 15, 25, 0.95);
  backdrop-filter: blur(8px);
  padding: 8px 14px;
  border-bottom: 1px solid #1f2937;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.vp-continuous-scroll {
  max-height: 680px;
  overflow-y: auto;
  position: relative;
  background: #03060a;
  scroll-behavior: smooth;
}
.vp-continuous-inner {
  max-width: 820px;
  margin: 0 auto;
  background: #080c16;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  position: relative;
}
.vp-continuous-strip-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #0f172a;
  border-top: 2px solid #3b82f6;
  border-bottom: 1px solid #1e293b;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.vp-strip-divider-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.vp-strip-divider-title {
  font-weight: 700;
  color: #60a5fa;
  font-size: 0.88rem;
}
.vp-strip-divider-meta {
  color: #94a3b8;
  font-size: 0.8rem;
}
.vp-strip-divider-actions {
  display: flex;
  gap: 6px;
}
.vp-continuous-strip-chunk {
  width: 100%;
  font-size: 0;
  line-height: 0;
}
.vp-continuous-strip-chunk img,
.vp-continuous-slice {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  margin: 0 auto;
  font-size: 0;
  line-height: 0;
  color: transparent;
  background: #0b0f19;
  border-radius: 0;
}

/* Single Strip Viewer */
.vp-single-container {
  display: flex;
  flex-direction: column;
  background: #060911;
  border: 1px solid #1f2937;
  border-radius: 8px;
  overflow: hidden;
}
.vp-single-nav {
  padding: 10px 14px;
  background: #0f172a;
  border-bottom: 1px solid #1f2937;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.vp-single-scroll {
  max-height: 680px;
  overflow-y: auto;
  background: #03060a;
}
.vp-single-inner {
  max-width: 820px;
  margin: 0 auto;
  background: #080c16;
}

/* Fullscreen Reader Modal */
.vp-reader-modal {
  width: min(1200px, 98vw);
  max-width: 1200px;
  height: 94vh;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
}
.vp-reader-modal .vp-continuous-scroll {
  max-height: calc(94vh - 120px);
  flex: 1;
}

/* Strip vs Panels Manual Comparison Tool */
.vp-compare-modal {
  width: min(1400px, 98vw);
  max-width: 1400px;
  height: 94vh;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
}
.vp-compare-split {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
  margin-top: 12px;
}
.vp-compare-strip-col {
  flex: 1.25;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background: #060911;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
}
.vp-compare-strip-scroll {
  flex: 1;
  overflow-y: auto;
  position: relative;
  background: #03060a;
}
.vp-compare-strip-surface {
  position: relative;
  margin: 0 auto;
  user-select: none;
}
.vp-compare-strip-surface > img {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  user-select: none;
  image-rendering: -webkit-optimize-contrast;
}
.vp-compare-panels-col {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  background: #080d1a;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
}
.vp-compare-panels-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.vp-compare-panel-item {
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: #0d1322;
  padding: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: all 0.15s ease;
  cursor: pointer;
}
.vp-compare-panel-item:hover, .vp-compare-panel-item.active {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}
.vp-compare-panel-item.active {
  border-color: #60a5fa;
  box-shadow: 0 0 16px rgba(96, 165, 250, 0.4);
}
.vp-compare-overlay-box {
  position: absolute;
  box-sizing: border-box;
  transition: all 0.15s ease;
  cursor: pointer;
  z-index: 2;
}
.vp-compare-overlay-box.box-art {
  border: 2px solid #10b981;
  background: rgba(16, 185, 129, 0.18);
}
.vp-compare-overlay-box.box-dia {
  border: 2px solid #8b5cf6;
  background: rgba(139, 92, 246, 0.22);
}
.vp-compare-overlay-box.active {
  border: 3px solid #fbbf24 !important;
  background: rgba(251, 191, 36, 0.3) !important;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.7);
  z-index: 10;
}
.vp-compare-overlay-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
  pointer-events: none;
  white-space: nowrap;
}
.vp-compare-gap-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px dashed #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  z-index: 1;
}
.vp-compare-gap-box:hover {
  background: rgba(245, 158, 11, 0.28);
  border-color: #fbbf24;
}

/* ==========================================================================
   Manga Video Studio — Studio & Photo Editor (Desktop & Mobile Ergonomics)
   ========================================================================== */

.studio-topbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
}

.studio-workspace {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
  min-height: 520px;
  position: relative;
  width: 100%;
}

.studio-sidebar {
  background: #0f172a;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
  transition: all 0.25s ease;
}

.studio-sidebar-left {
  width: 340px;
  min-width: 320px;
  max-width: 390px;
}

.studio-sidebar-right {
  width: 370px;
  min-width: 340px;
  max-width: 430px;
  overflow-y: auto;
  max-height: 680px;
}

.studio-center-pane {
  flex: 1 1 500px;
  min-width: 360px;
  background: #070a13;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  box-sizing: border-box;
}

.studio-monitor-viewport {
  position: relative;
  background: #030712;
  border: 1px solid #1f2937;
  border-radius: 8px;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 200px;
  max-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.85);
}

.studio-monitor-viewport img.monitor-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  user-select: none;
  pointer-events: none;
  object-fit: contain;
  filter: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.85));
  transition: filter 0.2s ease;
}

.studio-monitor-viewport img.monitor-img.no-shadow {
  filter: none !important;
}

.studio-caption-bar {
  position: absolute;
  bottom: 8px;
  left: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 5px 10px;
  color: #f3f4f6;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  line-height: 1.3;
}

.studio-transport-bar {
  background: #0f172a;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Touch-friendly high-precision scrubber */
input[type="range"].studio-scrubber,
.studio-scrubber {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #1e293b;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  touch-action: pan-x;
  margin: 6px 0;
  border: 1px solid #334155;
}
input[type="range"].studio-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.85);
  cursor: grab;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
input[type="range"].studio-scrubber::-webkit-slider-thumb:active {
  transform: scale(1.22);
  cursor: grabbing;
  box-shadow: 0 0 16px rgba(59, 130, 246, 1);
}
input[type="range"].studio-scrubber::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.85);
  cursor: grab;
}

.studio-play-btn {
  min-height: 38px;
  min-width: 82px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  touch-action: manipulation;
  transition: transform 0.1s ease;
}
.studio-play-btn:active {
  transform: scale(0.96);
}

.studio-step-btn {
  background: #1f2937;
  border: 1px solid #374151;
  color: #e5e7eb;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 11px;
  cursor: pointer;
  touch-action: manipulation;
  font-weight: 600;
  min-height: 28px;
}
.studio-step-btn:active {
  transform: scale(0.95);
  background: #374151;
}

.studio-timeline-panel {
  background: #0f172a;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.25s ease;
  margin-bottom: 12px;
}

.studio-drawer-backdrop {
  display: none;
}

.studio-mobile-bar {
  display: none;
}

/* Mobile & Tablet Adaptations (Android / Touchscreens <= 900px) */
@media (max-width: 900px) {
  .studio-workspace {
    flex-direction: column;
    min-height: auto;
    gap: 8px;
  }

  .studio-edge-btn {
    display: none !important;
  }

  .studio-center-pane {
    width: 100%;
    min-width: 0;
    padding: 8px;
    flex: none;
  }

  .studio-monitor-viewport {
    max-height: 38vh;
    min-height: 180px;
    border-radius: 6px;
  }

  .studio-sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
    z-index: 400 !important;
    width: min(390px, 92vw) !important;
    max-width: 92vw !important;
    background: #0f172a !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.85) !important;
    display: flex !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .studio-sidebar-left {
    left: 0 !important;
    border-right: 1px solid #374151 !important;
    border-left: none !important;
    transform: translateX(-100%) !important;
  }

  .studio-sidebar-left.is-open {
    transform: translateX(0) !important;
  }

  .studio-sidebar-right {
    right: 0 !important;
    left: auto !important;
    border-left: 1px solid #374151 !important;
    border-right: none !important;
    transform: translateX(100%) !important;
  }

  .studio-sidebar-right.is-open {
    transform: translateX(0) !important;
  }

  .studio-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 16, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 380;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .studio-drawer-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Floating Bottom Thumb Navigation Bar on Mobile */
  .studio-mobile-bar {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid #374151;
    padding: 5px 6px max(6px, env(safe-area-inset-bottom, 6px));
    z-index: 250;
    gap: 4px;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
  }

  .studio-mob-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 2px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    white-space: nowrap;
    transition: all 0.12s ease;
  }

  .studio-mob-btn:active {
    background: #1e293b;
    transform: scale(0.95);
  }

  .studio-mob-btn.active {
    color: #fff;
    background: #1e293b;
    border-color: #3b82f6;
  }

  .studio-mob-btn-icon {
    font-size: 15px;
    line-height: 1;
  }

  .studio-mob-btn-split {
    color: #c7d2fe;
    background: #312e81;
    border-color: #4f46e5;
  }

  .studio-mob-btn-play {
    color: #bbf7d0;
    background: #064e3b;
    border-color: #059669;
  }
}

/* ------------------------------------------------ Android Native Agent View UX */

body.route-agent .footer {
  display: none !important;
}

@media (max-width: 768px) {
  body.route-agent .topbar {
    display: none !important;
  }
  body.route-agent #view {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100vw !important;
    overflow: hidden !important;
  }
  body.route-agent #view > h1 {
    display: none !important;
  }
  body.route-agent .view-body {
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    height: 100dvh !important;
    height: 100vh !important;
    max-height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  body.route-agent .agent-view-root {
    height: 100% !important;
    max-height: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  body.route-agent .agent-input-bar {
    position: sticky !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100 !important;
    background: #090d16 !important;
    border-top: 1.5px solid rgba(56, 189, 248, 0.4) !important;
    padding: 10px 12px max(12px, env(safe-area-inset-bottom, 12px)) !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.85) !important;
  }
}

/* Typing Dots Animation */
@keyframes typing-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
.typing-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 2px;
  background: #38bdf8;
  border-radius: 50%;
  animation: typing-pulse 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* ------------------------------------------------ Source Protection & Armor --- */
body, .app, .sidebar, .topbar, .card, .btn, .nav-link, pre, code, span, div, p, h1, h2, h3, table {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -khtml-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

input, textarea, [contenteditable="true"] {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

img {
  -webkit-user-drag: none !important;
  user-drag: none !important;
  pointer-events: auto;
}

/* --------------------------------------------------------- Admin Dashboard --- */
.admin-dashboard-container {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* ----------------------------------- Android UI/UX: Subscription & Checkout --- */
@keyframes mvsAndroidSheetUp {
  0% {
    transform: translateY(100%);
    opacity: 0.7;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes mvsAndroidPop {
  0% {
    transform: scale(0.92) translateY(20px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* ============================================================================
   ENTERPRISE CHECKOUT & BILLING SYSTEM (Stripe / Linear / Vercel Grade)
   ============================================================================ */

.mvs-android-sheet-overlay,
.mvs-checkout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: mvsFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes mvsFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 820px) {
  .mvs-android-sheet-overlay,
  .mvs-checkout-overlay {
    align-items: center;
    padding: 24px 16px;
  }
}

.mvs-android-sheet,
.mvs-checkout-modal {
  width: 100%;
  max-height: 94vh;
  max-height: 94dvh;
  border-radius: 20px 20px 0 0;
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: none;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  animation: mvsSheetSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes mvsSheetSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (min-width: 820px) {
  .mvs-android-sheet,
  .mvs-checkout-modal {
    max-width: 920px;
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.06);
    animation: mvsModalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
}

@keyframes mvsModalPop {
  from { transform: scale(0.97) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.mvs-checkout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #0d121c;
  flex-shrink: 0;
}

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

.mvs-checkout-brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.2px;
}

.mvs-checkout-secure-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mvs-checkout-close-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}

.mvs-checkout-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.16);
}

.mvs-android-sheet-body,
.mvs-checkout-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
}

/* 2-Column Desktop Grid */
.mvs-checkout-grid {
  display: flex;
  flex-direction: column;
}

@media (min-width: 820px) {
  .mvs-checkout-grid {
    display: grid;
    grid-template-columns: 370px 1fr;
    min-height: 520px;
  }
}

/* Left Pane: Order Summary */
.mvs-checkout-pane-summary {
  background: #0c111a;
  padding: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 820px) {
  .mvs-checkout-pane-summary {
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    padding: 24px;
  }
}

/* Right Pane: Payment Form */
.mvs-checkout-pane-payment {
  background: #090d16;
  padding: 22px 22px 40px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@media (min-width: 820px) {
  .mvs-checkout-pane-payment {
    padding: 24px 28px;
    overflow-y: auto;
  }
}

.mvs-checkout-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
}

/* Plan Badge Card in Summary */
.mvs-order-plan-card {
  background: #111724;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mvs-order-plan-name {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mvs-order-plan-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

/* Duration Selectors */
.mvs-cadence-toggle {
  display: flex;
  background: #080c14;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mvs-cadence-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: #94a3b8;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mvs-cadence-btn.active {
  background: #1e293b;
  color: #f8fafc;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.mvs-duration-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mvs-chip-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0c121e;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mvs-chip-btn:hover {
  border-color: rgba(255, 255, 255, 0.18);
  color: #f1f5f9;
}

.mvs-chip-btn.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: #3b82f6;
  color: #60a5fa;
  box-shadow: 0 0 0 1px #3b82f6 inset;
}

/* Itemized Invoice Table */
.mvs-invoice-table {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 13px;
  margin-top: 4px;
}

.mvs-invoice-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #94a3b8;
}

.mvs-invoice-row.accent {
  color: #34d399;
}

.mvs-invoice-row span:last-child {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.mvs-invoice-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.mvs-invoice-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 4px;
}

.mvs-invoice-total-label {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
}

.mvs-invoice-total-num {
  font-size: 26px;
  font-weight: 800;
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: -0.5px;
}

/* Guarantee & Security Badges */
.mvs-security-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11.5px;
  color: #64748b;
}

.mvs-security-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Payment Methods Selector in Right Pane */
.mvs-payment-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.mvs-tab-btn {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #0f1523;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mvs-tab-btn:hover {
  background: #141b2c;
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.18);
}

.mvs-tab-btn.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: #3b82f6;
  color: #60a5fa;
  box-shadow: 0 0 0 1px #3b82f6 inset;
}

/* Form Groups & Inputs */
.mvs-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mvs-field-label {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
}

.mvs-field-input {
  width: 100%;
  background: #0c121d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: #f8fafc;
  outline: none;
  transition: all 0.15s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.mvs-field-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
  background: #0f1624;
}

.mvs-field-input::placeholder {
  color: #475569;
}

.mvs-input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.mvs-input-with-icon .mvs-field-input {
  padding-right: 48px;
}

.mvs-input-icon-right {
  position: absolute;
  right: 12px;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.mvs-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Promo Code Box */
.mvs-promo-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #0c121d;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 6px 10px;
}

.mvs-promo-input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 12.5px;
  color: #f8fafc;
  outline: none;
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.mvs-promo-btn {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mvs-promo-btn:hover {
  background: #334155;
  color: #fff;
}

/* Action CTA Button */
.mvs-submit-pay-btn {
  width: 100%;
  padding: 13px 20px;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
  transition: all 0.15s ease;
  user-select: none;
}

.mvs-submit-pay-btn:hover:not(:disabled) {
  background: #1d4ed8;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45);
}

.mvs-submit-pay-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.mvs-legal-notice {
  font-size: 11px;
  color: #64748b;
  text-align: center;
  line-height: 1.4;
  margin: 0;
}

/* Success Receipt Screen */
.mvs-success-screen {
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  max-width: 480px;
  margin: 0 auto;
}

.mvs-success-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mvs-receipt-card {
  width: 100%;
  background: #0f1523;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  font-size: 13px;
  margin: 8px 0;
}

.mvs-android-welcome-banner {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(59, 130, 246, 0.15));
  border: 1.5px solid rgba(168, 85, 247, 0.45);
  border-radius: 22px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
  animation: mvsAndroidPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Mobile responsive enhancements for Subscription & Plans */
@media (max-width: 768px) {
  .subscription-page-container {
    padding: 0 12px 40px 12px !important;
  }
  .mvs-desktop-only {
    display: none !important;
  }
  .mvs-mobile-only {
    display: block !important;
  }
}

@media (min-width: 769px) {
  .mvs-mobile-only {
    display: none !important;
  }
}



/* Administration: a dedicated, compact operations workspace. */
.route-admin { background: #111418; }
.route-admin > .app > .sidebar, .route-admin .topbar, .route-admin .sidebar-backdrop { display: none; }
.route-admin #view { max-width: 1600px; padding: 0 30px; }
.route-admin .footer { background: #111418; border-color: #292f37; }
.admin-dashboard-container { --accent: #4b87d5; --card-border: #303741; display: flex; flex-direction: column; gap: 24px; padding: 0 0 28px; color: #e4e7ec; }
.admin-hero { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; padding: 24px 0; border-bottom: 1px solid #303741; }
.admin-eyebrow { color: #9da5b1; font-size: 12px; font-weight: 500; margin: 0 0 7px; }
.admin-hero h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.5px; line-height: 1.2; }
.admin-hero p.muted { margin: 8px 0 0; font-size: 12px; color: #8d96a3; }
.admin-hero-actions, .admin-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-signed-in { color: #a1a9b5; font-size: 12px; margin-right: 12px; }
.admin-workspace { display: grid; grid-template-columns: 195px minmax(0, 1fr); gap: 28px; align-items: start; }
.admin-nav { display: flex; flex-direction: column; gap: 3px; position: sticky; top: 20px; }
.admin-nav-group { color: #7f8997; letter-spacing: .8px; font-size: 9px; font-weight: 600; padding: 12px 10px 4px; margin: 12px 0 0; }
.admin-nav-group:first-child { margin-top: 0; padding-top: 0; }
.admin-nav-link { padding: 9px 10px; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 4px; color: #a0a9b7; font: inherit; font-size: 12px; cursor: pointer; }
.admin-nav-link:hover { background: #1c222a; color: #e6e9ed; }
.admin-nav-link.is-active { background: #202b3a; border-color: #33445b; color: #c9ddf8; font-weight: 500; }
.admin-refresh { align-self: start; margin: 22px 0 0; }
.admin-content { min-width: 0; }
.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 0 0 22px; margin-bottom: 24px; border-bottom: 1px solid #303741; }
.admin-stat { display: flex; flex-direction: column; gap: 7px; padding: 0 22px; border-right: 1px solid #303741; }
.admin-stat:first-child { padding-left: 0; }
.admin-stat:last-child { border-right: 0; }
.admin-stat > span { font-size: 11px; color: #a1a9b5; }
.admin-stat strong { font-size: 25px; font-weight: 550; line-height: 1.2; font-variant-numeric: tabular-nums; }
.admin-stat small { color: #7f8997; font-size: 10px; }
.admin-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-section-heading h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.2px; }
.admin-section-heading p { font-size: 12px; margin: 7px 0 0; color: #8d96a3; }
.admin-users-card { border: 1px solid #303741; border-radius: 6px; overflow: hidden; background: #151a20; }
.admin-toolbar { display: flex; gap: 8px; padding: 14px; flex-wrap: wrap; border-bottom: 1px solid #303741; }
.admin-toolbar .input { flex: 1 1 200px; min-width: 160px; width: auto; }
.admin-dashboard-container :is(.input, .select) { background: #12171d; border-color: #343c48; color: #d2d8e1; border-radius: 4px; }
.admin-toolbar .select { width: auto; font-size: 12px; }
.admin-table-scroll { overflow-x: auto; }
.admin-users-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; white-space: nowrap; }
.admin-users-table th { background: #1c222a; color: #a7b0bf; font-size: 11px; font-weight: 500; padding: 11px 14px; }
.admin-users-table td { padding: 13px 14px; border-top: 1px solid #2a313b; color: #c6cdd8; }
.admin-users-table tr:hover td { background: #1c232c; }
.admin-identity { display: flex; align-items: center; gap: 10px; }
.admin-avatar { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #3b4553; background: #252e39; color: #bfc9d7; border-radius: 4px; font-size: 10px; font-weight: 500; flex-shrink: 0; }
.admin-identity strong { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; color: #e2e6ed; font-weight: 500; }
.admin-identity small { display: block; font-size: 10px; color: #8691a2; margin-top: 4px; }
.admin-badge { display: inline-flex; align-items: center; padding: 3px 6px; font-size: 10px; font-weight: 500; border-radius: 4px; border: 1px solid #3b4553; background: #242d39; color: #bcc8d8; white-space: nowrap; }
.admin-badge-admin { background: #262b39; border-color: #434b63; color: #c5cce1; }
.admin-badge-active { background: #1d302b; border-color: #355247; color: #a2cdbd; }
.admin-badge-disabled { background: #342d27; border-color: #5b4c3e; color: #ccb9a5; }
.admin-row-actions { display: flex; gap: 6px; align-items: center; }
.admin-more { width: 81px; font-size: 11px; padding: 6px; }
.admin-table-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 14px; border-top: 1px solid #303741; font-size: 11px; color: #929daa; }
.admin-users-table .admin-empty { padding: 45px 20px; text-align: center; white-space: normal; }
.admin-empty h3 { color: #e2e6ed; }
.admin-footnote { font-size: 11px; line-height: 1.8; color: #8995a5; margin-top: 14px; }
.admin-dashboard-container :is(button, input, select, a):focus-visible { outline: 2px solid #81b6ff; outline-offset: 3px; }
.admin-dashboard-container .btn { border-radius: 4px; box-shadow: none; }
.admin-dashboard-container .btn-ghost { border-color: #343c48; background: transparent; color: #c2ccd9; }
.admin-dashboard-container .btn-primary { background: #3265a5; border-color: #4779ba; }
.admin-content .card { max-width: 100%; overflow-x: auto; }
@media (max-width: 900px) {
  .admin-workspace { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .admin-nav { position: static; flex-direction: row; overflow-x: auto; padding: 0 0 8px; }
  .admin-nav-group { display: none; }
  .admin-refresh { margin: 0; flex-shrink: 0; }
  .admin-nav-link { white-space: nowrap; flex-shrink: 0; }
}
@media (max-width: 640px) {
  .route-admin #view { padding: 0 14px; }
  .admin-hero { padding: 20px 0; gap: 16px; }
  .admin-hero-actions { width: 100%; }
  .admin-signed-in { width: 100%; }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; padding-bottom: 20px; }
  .admin-stat { padding: 0 12px; }
  .admin-stat:nth-child(3) { padding-left: 0; }
  .admin-stat:nth-child(2) { border-right: 0; }
  .admin-toolbar { padding: 10px; }
  .admin-toolbar .input { flex-basis: 100%; }
  .admin-toolbar .select { flex: 1 1 100px; min-width: 0; }
  .admin-section-heading > .admin-actions { width: 100%; justify-content: flex-end; }
}

/* Subscription plans and manual-review checkout */
.subscription-page-container { width: 100%; min-width: 0; max-width: 1080px !important; gap: 24px !important; }
.mvs-plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 24px; align-items: stretch; min-width: 0; }
.subscription-page-container > div:first-of-type { border-radius: 8px !important; }
.mvs-plan-card {
  padding: 24px !important; border: 1px solid #303a48 !important; border-radius: 10px !important;
  background: #111820 !important; box-shadow: none !important; gap: 18px;
  display: flex; flex-direction: column; min-width: 0; margin-bottom: 0;
}
.mvs-plan-card.is-current { border-color: #52759d !important; }
.mvs-plan-card h2 { margin: 14px 0 6px; color: #edf2f8; font-size: 20px; font-weight: 650; letter-spacing: -.2px; }
.mvs-plan-card p { margin: 0; color: #9daaba; line-height: 1.5; font-size: 13px; min-height: 38px; }
.mvs-plan-badge { display: inline-flex; width: fit-content; padding: 4px 8px; border: 1px solid #354253; border-radius: 5px; color: #b6c4d5; background: #18212b; font-size: 11px; font-weight: 600; }
.mvs-plan-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; padding: 16px 0; border-bottom: 1px solid #293440; }
.mvs-plan-price strong { color: #f2f5f8; font-size: 30px; font-weight: 650; letter-spacing: -.6px; }
.mvs-plan-price span, .mvs-plan-note { color: #9daaba; font-size: 12px !important; }
.mvs-plan-note { min-height: 0 !important; margin-top: 10px !important; }
.mvs-plan-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; color: #c3ccd7; font-size: 13px; }
.mvs-plan-features li::before { content: '✓'; margin-right: 9px; color: #7fa8d5; }
.mvs-plan-button { width: 100%; min-height: 42px; margin-top: auto; border: 1px solid #4779b3; border-radius: 6px; background: #3265a5; color: white; font-size: 13px; font-weight: 600; cursor: pointer; }
.mvs-plan-button:disabled { background: #202a35; border-color: #36414f; color: #9aa6b5; cursor: default; }
.mvs-review-note { padding: 18px 20px; border: 1px solid #303a48; border-radius: 8px; background: #111820; }
.mvs-review-note-title { margin-bottom: 5px; color: #e7edf4; font-size: 14px; font-weight: 650; }
.mvs-review-note p { max-width: 760px; margin: 0; color: #9daaba; font-size: 13px; line-height: 1.6; }
.mvs-checkout-professional { max-width: 880px !important; background: #111820 !important; border: 1px solid #354253 !important; border-radius: 10px !important; }
.mvs-checkout-professional .mvs-checkout-header { padding: 20px 24px; background: #111820; border-color: #2c3744; }
.mvs-checkout-professional .mvs-checkout-header h2 { margin: 5px 0 0; color: #f0f3f7; font-size: 20px; font-weight: 650; }
.mvs-checkout-professional .mvs-checkout-brand-badge { color: #9fbce0; font-size: 12px; font-weight: 600; }
.mvs-checkout-professional .mvs-checkout-body { padding: 22px 24px 26px; overflow-y: auto; }
.mvs-checkout-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 28px; }
.mvs-checkout-layout > div { min-width: 0; }
.mvs-checkout-layout h3 { margin: 0 0 16px; color: #e8edf3; font-size: 14px; font-weight: 650; }
.mvs-checkout-plan { display: flex; justify-content: space-between; gap: 10px; padding: 14px 0; border-top: 1px solid #2a3541; border-bottom: 1px solid #2a3541; color: #dce3eb; font-size: 13px; }
.mvs-checkout-field { display: grid; gap: 7px; margin: 17px 0; }
.mvs-checkout-field label { color: #b8c2cf; font-size: 12px; font-weight: 600; }
.mvs-checkout-field input, .mvs-checkout-field select { min-height: 40px; width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid #354253; border-radius: 5px; outline: none; background: #0d141b; color: #e9eef4; font: inherit; font-size: 13px; }
.mvs-checkout-field input:focus, .mvs-checkout-field select:focus { border-color: #5a8bc1; box-shadow: 0 0 0 2px #31557b55; }
.mvs-checkout-field small { color: #8996a5; font-size: 11px; line-height: 1.45; }
.mvs-choice-row, .mvs-promo-row { display: flex; gap: 8px; }
.mvs-choice-row button, .mvs-promo-row button { min-height: 38px; padding: 0 12px; border: 1px solid #354253; border-radius: 5px; background: #151e28; color: #b9c5d2; cursor: pointer; font-size: 12px; }
.mvs-choice-row button.selected { border-color: #5b83b0; background: #1b3047; color: #e4effc; }
.mvs-promo-row input { flex: 1; min-width: 0; }
#mvs-promo-feedback, #mvs-submit-feedback { min-height: 16px; color: #e0ae77; font-size: 11px; }
.mvs-checkout-totals { display: grid; gap: 11px; padding-top: 14px; border-top: 1px solid #2a3541; color: #aab5c2; font-size: 12px; }
.mvs-checkout-totals > div { display: flex; justify-content: space-between; gap: 12px; }
.mvs-checkout-totals .total { padding-top: 12px; border-top: 1px solid #2a3541; color: #f1f4f7; font-size: 14px; }
.mvs-upi-id { display: flex; justify-content: space-between; align-items: center; padding: 12px; border: 1px solid #354253; border-radius: 6px; background: #0d141b; color: #edf2f7; font: 600 14px ui-monospace, monospace; }
.mvs-upi-id button { border: 0; background: none; color: #8db8e6; cursor: pointer; font: 600 12px inherit; }
.mvs-checkout-payment > p { color: #9daaba; font-size: 12px; line-height: 1.55; }
.mvs-review-disclosure { margin: 18px 0; padding: 12px; border-left: 2px solid #678db5; background: #17212b; color: #aeb9c6; font-size: 12px; line-height: 1.5; }
.mvs-checkout-professional .mvs-submit-pay-btn { width: 100%; min-height: 42px; border: 1px solid #4779b3; border-radius: 6px; background: #3265a5; box-shadow: none; color: white; font-weight: 600; cursor: pointer; }
.mvs-checkout-professional .mvs-submit-pay-btn:disabled { opacity: .65; cursor: wait; }
.mvs-request-result { max-width: 480px; margin: 30px auto; text-align: center; }
.mvs-request-result h3 { color: #e9eff6; }
.mvs-request-result p { margin: 12px 0 24px; color: #a2afbd; font-size: 13px; line-height: 1.6; }
@media (max-width: 720px) { .mvs-checkout-layout { grid-template-columns: 1fr; gap: 20px; } .mvs-checkout-professional .mvs-checkout-body { padding: 18px; } }
.subscription-page-container .btn-sm { border-radius: 6px !important; box-shadow: none !important; }
.subscription-page-container .btn-sm[style*="background:#3b82f6"],
.subscription-page-container .btn-sm[style*="background:linear-gradient"] { background: #3265a5 !important; color: #fff !important; }
.subscription-page-container .btn-sm[style*="background:#131c2e"] { color: #aeb8c5; }

/* Android admin controls and readable payment review cards. */
.admin-workspace, .admin-content, .admin-content > * { min-width: 0; }
.admin-payment-queue { overflow-x: auto !important; }
.admin-payment-table td[data-label="Payment reference"] { overflow-wrap: anywhere; }
.mvs-pending-payment { padding: 18px 20px; overflow-wrap: anywhere; }
.mvs-pending-payment p { margin: 10px 0; font-size: 13px; }
@media (max-width: 760px) {
  .admin-section-heading { flex-wrap: wrap; gap: 12px; }
  .admin-payment-table, .admin-payment-table tbody { display: block; width: 100%; }
  .admin-payment-table thead { display: none; }
  .admin-payment-table tr { display: block; padding: 10px 14px; border-bottom: 1px solid #354253 !important; }
  .admin-payment-table td {
    display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 12px;
    padding: 8px 0 !important; border: 0; text-align: left !important;
    font-size: 13px !important; white-space: normal; overflow-wrap: anywhere;
  }
  .admin-payment-table td::before { content: attr(data-label); color: #95a3b4; font-size: 12px; font-weight: 500; line-height: 1.5; }
  .admin-payment-table td:last-child { display: block; padding-top: 14px !important; }
  .admin-payment-table td:last-child::before { display: none; }
  .admin-payment-actions { flex-wrap: wrap; justify-content: stretch !important; }
  .admin-payment-actions .btn { flex: 1 1 130px; min-height: 44px; font-size: 12px !important; }
  .route-admin .btn, .admin-nav-link { min-height: 44px; }
  .route-admin .admin-toolbar { flex-wrap: wrap; }
  .route-admin .admin-row-actions { flex-wrap: wrap; }
  .route-admin .input:not([type="checkbox"]), .route-admin .select { min-height: 44px; font-size: 16px; }
  .route-admin #modal-root .modal { max-height: 88dvh; overflow-y: auto; }
  .admin-stat { min-width: 0; }
}

/* Studio workspace: clear hierarchy, compact panels, and touch-friendly controls. */
.studio-editor { --studio-border: #293448; min-width: 0; padding-bottom: 24px; }
.studio-editor .studio-topbar { gap: 12px; padding: 12px; border-color: var(--studio-border); background: #101827; border-radius: 12px; }
.studio-editor .studio-actions { flex-wrap: wrap; margin-left: auto; }
.studio-editor button { min-height: 32px; border-radius: 7px !important; transition: background-color .15s, border-color .15s; }
.studio-editor button:focus-visible, .studio-editor summary:focus-visible, .studio-editor input:focus-visible, .studio-editor select:focus-visible, .studio-editor textarea:focus-visible { outline: 2px solid #93c5fd; outline-offset: 3px; }
.studio-editor button:disabled { opacity: .5; cursor: not-allowed; }
.studio-editor .studio-workspace { gap: 8px; min-height: 440px; height: min(680px, 68vh); }
.studio-editor .studio-sidebar { border-color: var(--studio-border); border-radius: 12px; padding: 12px; min-width: 0; overflow-y: auto; overscroll-behavior: contain; }
.studio-editor .studio-sidebar-left { flex: 0 0 220px; width: 220px; }
.studio-editor .studio-sidebar-right { flex: 0 0 290px; width: 290px; max-height: none; }
.studio-editor .studio-center-pane { flex: 1 1 0; min-width: 0; border-radius: 12px; padding: 14px; border-color: var(--studio-border); overflow-y: auto; }
.studio-editor .studio-monitor-viewport { min-height: 0; flex-shrink: 0; border-radius: 8px; }
.studio-editor .studio-inspector-tabs { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6px !important; }
.studio-editor .studio-inspector-tabs button { margin: 0; font-size: 12px !important; }
.studio-editor .studio-timeline-panel { border-color: var(--studio-border); border-radius: 12px; padding: 14px; min-width: 0; overflow: hidden; }
.studio-editor .studio-timeline-heading { gap: 10px; flex-wrap: wrap; padding-bottom: 12px !important; }
.studio-editor .studio-timeline-heading > div { flex-wrap: wrap; }
.studio-editor .studio-more-actions { position: relative; }
.studio-editor .studio-more-actions summary { list-style: none; cursor: pointer; padding: 8px 12px; border: 1px solid #475569; border-radius: 7px; font-size: 12px; color: #e2e8f0; }
.studio-editor .studio-more-actions summary::-webkit-details-marker { display: none; }
.studio-editor .studio-more-actions summary::after { content: ' ▾'; }
.studio-editor .studio-more-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 225px; z-index: 60; background: #111b2c; border: 1px solid #475569; box-shadow: 0 12px 32px #0008; padding: 8px; border-radius: 10px; display: flex; flex-direction: column; gap: 6px; }
.studio-editor .studio-more-menu button { width: 100%; text-align: left; background: #1e293b !important; border-color: #334155 !important; font-weight: 500 !important; }
@media (min-width: 901px) and (max-width: 1200px) {
  .studio-editor .studio-sidebar-left { flex-basis: 175px; width: 175px; }
  .studio-editor .studio-sidebar-right { flex-basis: 245px; width: 245px; }
}
@media (max-width: 900px) {
  .studio-editor { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .studio-editor .studio-workspace { height: auto; min-height: 0; }
  .studio-editor .studio-center-pane { flex: none; padding: 10px; }
  .studio-editor .studio-sidebar { min-width: 0; height: 100dvh !important; max-height: 100dvh !important; padding: max(16px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom)); }
  .studio-editor .studio-topbar { padding: 10px; }
  .studio-editor .studio-topbar > div:first-child { display: none !important; }
  .studio-editor .studio-actions { width: 100%; margin-left: 0; }
  .studio-editor .studio-actions > button { flex: 1; }
  .studio-editor button { min-height: 40px; }
  .studio-editor .studio-mobile-bar { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .studio-editor .studio-mob-btn { min-width: 0; font-size: 11px; }
  .studio-editor .studio-timeline-heading > div { width: 100%; }
  .studio-editor .studio-monitor-viewport { max-height: none; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .studio-editor *, .studio-editor *::before, .studio-editor *::after { transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 900px) {
  .studio-editor .studio-transport-bar > div > div { flex-wrap: wrap !important; min-width: 0; max-width: 100%; }
  .studio-editor .studio-transport-bar > div > div > span { overflow-wrap: anywhere; }
}

/* Keep the audio transport compact; generic mobile input sizing must not
   turn the seek bar into a full-height form field. */
.studio-editor .studio-transport-bar { padding: 8px; gap: 4px; }
.studio-editor input[type="range"].studio-scrubber {
  min-height: 0;
  height: 6px;
  padding: 0;
  margin: 10px 0;
}
.studio-editor .studio-transport-bar .studio-play-btn {
  min-width: 68px;
  min-height: 34px;
  padding: 5px 10px !important;
  font-size: 12px;
}
.studio-editor .studio-transport-bar input[type="checkbox"] { min-height: 0; width: 16px; height: 16px; }
@media (max-width: 900px) {
  .studio-editor .studio-transport-bar button { min-height: 36px; padding: 5px 8px; }
  .studio-editor .studio-transport-bar .studio-play-btn { min-height: 36px; }
  .studio-editor .studio-transport-bar select { min-height: 32px; }
}
.studio-editor .studio-preview-content { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.studio-editor .studio-native-audio { flex-shrink: 0; width: 100%; }
.studio-editor .studio-native-audio[hidden] { display: none; }
.studio-editor #studio-audio-player { display: block; width: 100%; height: 36px; color-scheme: dark; }
