/* =====================================================================
   JINXAI STUDIO DESIGN SYSTEM  (WebUI · LoRA Studio · RF Lab)
   - Fluid obsidian-glass surfaces, crisp luminance hierarchy, hairline
     borders, tactile micro-interactions, responsive clamp typography.
   - Simple by default: `.cfg` controls stay invisible until Settings is on.
   - Integrated Pro Tier visual grammar (amber/gold badges & modal).
   ===================================================================== */
:root {
  --jx-bg: #070b14;
  --jx-surface: rgba(13, 21, 38, .82);
  --jx-surface-hi: rgba(19, 31, 56, .90);
  --jx-glass: linear-gradient(180deg, rgba(16, 26, 48, .86), rgba(9, 15, 29, .88));
  --jx-r: 20px;
  --jx-r-md: 14px;
  --jx-r-sm: 11px;
  --jx-ease: cubic-bezier(.22, .8, .24, 1);
  --jx-line: rgba(148, 197, 255, .14);
  --jx-line-hi: rgba(56, 224, 255, .52);
  --jx-accent: #38e0ff;
  --jx-accent2: #a78bfa;
  --jx-pro: #f59e0b;
  --jx-pro2: #fde68a;
  --jx-ok: #34d399;
  --jx-text: #eef4ff;
  --jx-mute: #94a3b8;
  --jx-shadow: 0 14px 40px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255, 255, 255, .05);
}

html { scroll-behavior: smooth; }
body {
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--jx-text);
  background-image:
    radial-gradient(900px 520px at 14% -8%, rgba(56, 224, 255, .09), transparent 60%),
    radial-gradient(760px 460px at 88% 4%, rgba(167, 139, 250, .09), transparent 60%) !important;
}

/* ---------- SIMPLE-BY-DEFAULT GATE ---------- */
body:not(.cfg-on) .cfg { display: none !important; }

/* ---------- TOPBAR CONTROLS (PRO PILL + SETTINGS SWITCH) ---------- */
.jx-pro-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, .20), rgba(251, 191, 36, .10));
  border: 1px solid rgba(245, 158, 11, .45);
  color: var(--jx-pro2); font-size: 12px; font-weight: 700; letter-spacing: .2px;
  cursor: pointer; user-select: none;
  transition: transform .18s var(--jx-ease), box-shadow .22s var(--jx-ease), border-color .22s;
}
.jx-pro-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(253, 230, 138, .85);
  box-shadow: 0 0 22px rgba(245, 158, 11, .24);
}
.jx-pro-btn.active {
  background: linear-gradient(135deg, rgba(52, 211, 153, .22), rgba(56, 224, 255, .14));
  border-color: rgba(52, 211, 153, .55);
  color: #a7f3d0;
}

.jx-switch {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 12px; border-radius: 999px;
  background: rgba(9, 17, 33, .82); border: 1px solid var(--jx-line);
  color: var(--jx-mute); font-size: 12px; font-weight: 600; letter-spacing: .2px;
  cursor: pointer; user-select: none; position: relative;
  transition: border-color .25s var(--jx-ease), color .25s var(--jx-ease), box-shadow .25s var(--jx-ease);
}
.jx-switch:hover { border-color: var(--jx-line-hi); color: #fff; }
.jx-switch input { position: absolute; opacity: 0; pointer-events: none; }
.jx-switch .jx-gear { font-size: 14px; transition: transform .5s var(--jx-ease); }
.jx-switch .jx-track {
  width: 34px; height: 19px; border-radius: 999px; position: relative;
  background: rgba(148, 163, 184, .28); transition: background .25s var(--jx-ease);
}
.jx-switch .jx-thumb {
  position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%;
  background: #e2e8f0; transition: transform .28s var(--jx-ease), background .25s;
}
.jx-switch input:checked ~ .jx-track { background: linear-gradient(90deg, var(--jx-accent), var(--jx-accent2)); }
.jx-switch input:checked ~ .jx-track .jx-thumb { transform: translateX(15px); background: #fff; }
body.cfg-on .jx-switch { color: #fff; border-color: var(--jx-line-hi); box-shadow: 0 0 18px rgba(56, 224, 255, .18); }
body.cfg-on .jx-switch .jx-gear { transform: rotate(90deg); }
.jx-switch.jx-floating { position: fixed; top: 12px; right: 16px; z-index: 10000; }

/* ---------- CLI + MCP + SKILLS INSTALL PROMO BANNER ---------- */
.jx-install-promo {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; margin: 10px auto 16px; padding: 14px 18px; max-width: 680px; width: 100%;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(56, 224, 255, .10), rgba(167, 139, 250, .10), rgba(245, 158, 11, .08));
  border: 1px solid rgba(56, 224, 255, .34);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.jx-install-badge {
  font-size: 10.5px; font-weight: 800; letter-spacing: .7px; color: var(--jx-pro2);
  text-transform: uppercase;
}
.jx-install-cmd {
  display: block; padding: 8px 16px; border-radius: 11px;
  background: rgba(6, 12, 24, .88); border: 1px solid var(--jx-line);
  color: #7dd3fc; font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 13px; user-select: all; word-break: break-all;
}
.jx-install-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }

/* ---------- CONTEXTUAL SUB-OPTIONS BAR (CENTERED GROUPS & BREATHING ROOM) ---------- */
.basic-intent-bar {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 10px 12px !important;
  padding: 10px 12px 6px !important;
  width: 100%;
}
.jx-intent-grp {
  display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 8px;
  padding: 6px 12px 6px 14px; border-radius: 999px;
  background: rgba(10, 18, 34, .64); border: 1px solid rgba(148, 197, 255, .13);
}
.jx-grp-tag {
  font-size: 10px; font-weight: 750; letter-spacing: .65px;
  text-transform: uppercase; color: rgba(148, 163, 184, .82);
  padding: 0 6px 0 2px; user-select: none;
}
.jx-subbar {
  display: flex; align-items: center; justify-content: center;
  gap: 10px 12px; flex-wrap: wrap;
  padding: 6px 12px 10px; margin-bottom: 6px; width: 100%;
  animation: jxFade .24s var(--jx-ease);
}
.jx-subgrp {
  display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 7px;
  padding: 6px 12px 6px 13px; border-radius: 16px;
  background: rgba(11, 20, 38, .66); border: 1px solid rgba(148, 197, 255, .13);
}
.jx-sublbl {
  font-size: 10px; font-weight: 750; letter-spacing: .6px;
  text-transform: uppercase; color: rgba(56, 224, 255, .82);
  padding: 0 4px 0 2px; user-select: none;
}
.jx-subchip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(15, 26, 48, .82); border: 1px solid var(--jx-line);
  color: var(--jx-mute); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .18s var(--jx-ease);
}
.intent-pill {
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  gap: 6px !important;
  padding: 8px 16px !important;
  font-size: 12.5px !important; font-weight: 620 !important;
}
.jx-subchip:hover { color: #fff; border-color: var(--jx-line-hi); transform: translateY(-1px); }
.jx-subchip.active {
  color: #fff; border-color: var(--jx-line-hi);
  background: linear-gradient(135deg, rgba(56, 224, 255, .20), rgba(167, 139, 250, .18));
  box-shadow: 0 0 16px rgba(56, 224, 255, .15);
}
.jx-subchip.pro {
  border-color: rgba(245, 158, 11, .42);
  color: var(--jx-pro2);
  background: linear-gradient(135deg, rgba(245, 158, 11, .14), rgba(167, 139, 250, .10));
}
.jx-subchip.pro.active {
  border-color: rgba(253, 230, 138, .85);
  background: linear-gradient(135deg, rgba(245, 158, 11, .30), rgba(251, 191, 36, .18));
  color: #fff;
}
.jx-pro-tag {
  font-size: 9.5px; font-weight: 800; letter-spacing: .5px;
  padding: 1px 5px; border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  color: #090d16; text-transform: uppercase;
}

/* ---------- PRO TIER MODAL ---------- */
.jx-modal-backdrop {
  position: fixed; inset: 0; z-index: 10050;
  background: rgba(4, 8, 18, .74); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: jxFade .22s var(--jx-ease);
}
.jx-modal {
  width: min(580px, 96vw); max-height: 88vh; overflow-y: auto;
  border-radius: 22px; padding: 22px 24px;
  background: linear-gradient(180deg, rgba(16, 26, 48, .97), rgba(9, 15, 30, .98));
  border: 1px solid rgba(245, 158, 11, .36);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .68), 0 0 40px rgba(245, 158, 11, .12);
  color: var(--jx-text);
}
.jx-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.jx-modal-title { font-size: 18px; font-weight: 750; letter-spacing: -.2px; color: #fff; }
.jx-modal-close {
  width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--jx-line);
  background: rgba(255, 255, 255, .05); color: var(--jx-mute); cursor: pointer; font-size: 16px;
}
.jx-modal-close:hover { color: #fff; border-color: var(--jx-line-hi); }
.jx-pro-grid { display: grid; gap: 9px; margin: 14px 0 16px; }
.jx-pro-item {
  padding: 11px 13px; border-radius: 14px;
  background: rgba(255, 255, 255, .035); border: 1px solid var(--jx-line);
}
.jx-pro-item strong { display: flex; align-items: center; gap: 7px; font-size: 13px; color: #fff; margin-bottom: 3px; }
.jx-pro-item p { margin: 0; font-size: 12px; color: var(--jx-mute); line-height: 1.45; }
.jx-modal-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: center; margin-top: 16px; }
.jx-btn-pro {
  padding: 11px 22px; border-radius: 999px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #090d16;
  font-weight: 750; font-size: 13px; transition: transform .18s var(--jx-ease), box-shadow .2s;
}
.jx-btn-pro:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(245, 158, 11, .35); }
.jx-btn-ghost {
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--jx-line);
  background: rgba(255, 255, 255, .04); color: var(--jx-text); cursor: pointer;
  font-weight: 600; font-size: 12.5px;
}
.jx-btn-ghost:hover { border-color: var(--jx-line-hi); }

/* ---------- CARDS / SURFACES ---------- */
.card, .holo-card {
  border-radius: var(--jx-r) !important;
  border: 1px solid var(--jx-line) !important;
  background: var(--jx-glass) !important;
  box-shadow: var(--jx-shadow) !important;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  transition: border-color .28s var(--jx-ease), box-shadow .28s var(--jx-ease), transform .28s var(--jx-ease);
}
.card:hover, .holo-card:hover { border-color: rgba(148, 197, 255, .28) !important; }
.card h2, .card-head h2, .card-hdr h2, .card-title {
  text-transform: none !important; letter-spacing: -.1px !important;
  font-size: clamp(14.5px, 1.2vw, 16.5px) !important; font-weight: 680 !important; color: var(--jx-text);
}
.cyber-corner, .corner-notch { display: none !important; }

/* ---------- BUTTONS & PILLS ---------- */
.btn, .mini-btn, .nav-tab, .mode-pill, .macro-chip, .hud-tag-btn, .card button, .lens-btn, .transmit-btn, .intent-pill {
  border-radius: 999px !important;
  transition: transform .18s var(--jx-ease), background .2s, border-color .2s, box-shadow .2s, color .2s;
  font-family: inherit;
}
.btn:hover, .mini-btn:hover, .card button:hover, .transmit-btn:hover, .intent-pill:hover { transform: translateY(-1px); }
.btn:active, .mini-btn:active, .card button:active, .transmit-btn:active, .intent-pill:active { transform: translateY(0) scale(.98); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; box-shadow: 0 0 0 3px rgba(56, 224, 255, .28) !important;
}
button:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- INPUTS ---------- */
input[type="text"], input[type="number"], input[type="password"], select, textarea {
  border-radius: var(--jx-r-md) !important;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
  border-color: var(--jx-line-hi) !important;
}

/* ---------- AUDIO PLAYER & SUPERAGENT TRACE ---------- */
.jx-audio-card {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; margin-top: 8px;
  border-radius: 14px; background: rgba(11, 20, 38, .84); border: 1px solid var(--jx-line);
}
.jx-audio-card audio { width: 100%; height: 36px; border-radius: 999px; }
.jx-trace-list { display: grid; gap: 6px; margin-top: 8px; }
.jx-trace-step {
  padding: 8px 11px; border-radius: 11px; font-size: 12px; line-height: 1.45;
  background: rgba(255, 255, 255, .035); border: 1px solid rgba(148, 197, 255, .12);
}
.jx-trace-step b { color: var(--jx-accent); font-size: 11px; letter-spacing: .3px; }

/* ---------- MOTION ---------- */
@keyframes jxFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes jxRise { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.pane.active { animation: jxFade .34s var(--jx-ease); }
.log-packet { animation: jxRise .34s var(--jx-ease); border-radius: 18px !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- LORA STUDIO, RF LAB & WEBUI FLUID LAYOUT ---------- */
.addon-shell { max-width: min(1180px, 96vw) !important; margin-left: auto !important; margin-right: auto !important; }
.nav-tabs { display: flex; justify-content: center; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 6px 4px; }
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab { white-space: nowrap; font-size: 13px !important; font-weight: 600 !important; padding: 9px 20px !important; text-transform: none !important; letter-spacing: 0 !important; }
.nav-tab.active { background: linear-gradient(90deg, rgba(56, 224, 255, .22), rgba(167, 139, 250, .22)) !important; border-color: var(--jx-line-hi) !important; color: #fff !important; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)) !important; gap: 14px; }
.dropzone { border-radius: var(--jx-r) !important; padding: clamp(22px, 4vw, 40px) 18px !important; transition: all .24s var(--jx-ease); }
.dropzone:hover, .dropzone.dragover { transform: translateY(-2px); border-color: var(--jx-line-hi) !important; background: rgba(56, 224, 255, .06) !important; }
.gallery img { border-radius: 12px; transition: transform .24s var(--jx-ease); }
.gallery img:hover { transform: scale(1.03); }
.topbar { gap: 10px; flex-wrap: wrap; }
.prog-track { border-radius: 999px !important; overflow: hidden; height: 10px; }
.prog-fill { border-radius: 999px; background: linear-gradient(90deg, var(--jx-accent), var(--jx-accent2)) !important; transition: width .6s var(--jx-ease); }
.grid { gap: clamp(10px, 1.4vw, 18px); }
@media (max-width: 900px) { .grid > .card { grid-column: 1 / -1 !important; } }
.pred-banner { border-radius: var(--jx-r); }
.command-lens { transition: box-shadow .24s var(--jx-ease), border-color .24s var(--jx-ease); }
.xeno-header { backdrop-filter: blur(14px); }
.header-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.packet-images img { border-radius: 14px; }
@media (max-width: 640px) {
  .brand-meta h1 { font-size: 14px !important; }
  .jx-switch .jx-switch-label { display: none; }
}
